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-26 20:42:22
|
Revision: 8010 http://gridarta.svn.sourceforge.net/gridarta/?rev=8010&view=rev Author: akirschbaum Date: 2010-05-26 20:42:15 +0000 (Wed, 26 May 2010) Log Message: ----------- Remve outdated TODO comments. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/GameObject.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/gameobject/GameObject.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/gameobject/GameObject.java trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java trunk/src/app/net/sf/gridarta/gui/mapuserlistener/MapUserListener.java trunk/src/app/net/sf/gridarta/mapmanager/DefaultFileControl.java trunk/src/app/net/sf/gridarta/model/baseobject/BaseObject.java trunk/src/app/net/sf/gridarta/model/baseobject/GameObjectContainer.java trunk/src/app/net/sf/gridarta/model/map/maparchobject/MapArchObject.java trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java trunk/src/app/net/sf/gridarta/model/spells/Spells.java trunk/src/app/net/sf/gridarta/script/Script.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/GameObject.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/GameObject.java 2010-05-26 20:24:23 UTC (rev 8009) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/GameObject.java 2010-05-26 20:42:15 UTC (rev 8010) @@ -35,11 +35,6 @@ * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - * @todo the archobject should be directly asked for a face, and eventually it - * should cache faces itself; that would speed up painting maps - * @todo this class maybe could be split into 3 classes: AbstractArchObject as - * abstract base class, DefArchObject for default arches and GameObject for - * normal arches. * @todo this class is not always the best place for multipart object handling, * see also {@link net.sf.gridarta.model.baseobject.GameObjectContainer} for * issues about this Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/gameobject/GameObject.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/gameobject/GameObject.java 2010-05-26 20:24:23 UTC (rev 8009) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/gameobject/GameObject.java 2010-05-26 20:42:15 UTC (rev 8010) @@ -36,11 +36,6 @@ * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - * @todo the archobject should be directly asked for a face, and eventually it - * should cache faces itself; that would speed up painting maps - * @todo this class maybe could be split into 3 classes: AbstractArchObject as - * abstract base class, DefArchObject for default arches and GameObject for - * normal arches. * @todo this class is not always the best place for multipart object handling, * see also {@link net.sf.gridarta.model.baseobject.GameObjectContainer} for * issues about this Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/gameobject/GameObject.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/gameobject/GameObject.java 2010-05-26 20:24:23 UTC (rev 8009) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/gameobject/GameObject.java 2010-05-26 20:42:15 UTC (rev 8010) @@ -35,11 +35,6 @@ * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - * @todo the archobject should be directly asked for a face, and eventually it - * should cache faces itself; that would speed up painting maps - * @todo this class maybe could be split into 3 classes: AbstractArchObject as - * abstract base class, DefArchObject for default arches and GameObject for - * normal arches. * @todo this class is not always the best place for multipart object handling, * see also {@link net.sf.gridarta.model.baseobject.GameObjectContainer} for * issues about this Modified: trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java 2010-05-26 20:24:23 UTC (rev 8009) +++ trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java 2010-05-26 20:42:15 UTC (rev 8010) @@ -147,7 +147,7 @@ @Override public R getSelection() { final ArchetypeChooserPanel<G, A, R> selectedPanel = archetypeChooserModel.getSelectedPanel(); - return selectedPanel != null ? selectedPanel.getSelectedFolder().getSelectedArchetype() : null; // XXX: should not cast Archetype -> GameObject + return selectedPanel != null ? selectedPanel.getSelectedFolder().getSelectedArchetype() : null; } /** @@ -155,7 +155,7 @@ */ @NotNull @Override - public List<R> getSelections() { // XXX: should return List<Archetype<G, A, R>> + public List<R> getSelections() { final R archObject = getSelection(); if (archObject == null) { return Collections.emptyList(); Modified: trunk/src/app/net/sf/gridarta/gui/mapuserlistener/MapUserListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mapuserlistener/MapUserListener.java 2010-05-26 20:24:23 UTC (rev 8009) +++ trunk/src/app/net/sf/gridarta/gui/mapuserlistener/MapUserListener.java 2010-05-26 20:42:15 UTC (rev 8010) @@ -35,7 +35,6 @@ import org.jetbrains.annotations.Nullable; /** - * TODO Description. * @author <a href="mailto:dlv...@gm...">Daniel Viegas</a> */ public class MapUserListener<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements MouseListener, MouseMotionListener { Modified: trunk/src/app/net/sf/gridarta/mapmanager/DefaultFileControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/mapmanager/DefaultFileControl.java 2010-05-26 20:24:23 UTC (rev 8009) +++ trunk/src/app/net/sf/gridarta/mapmanager/DefaultFileControl.java 2010-05-26 20:42:15 UTC (rev 8010) @@ -229,8 +229,7 @@ } } else if (!file.exists()) { if (isScriptFile) { - // TODO: pass filename - scriptEditControl.newScript(); + scriptEditControl.newScript(); // TODO: pass filename } else { newMapDialogFactory.newMap(); // XXX: pass file } Modified: trunk/src/app/net/sf/gridarta/model/baseobject/BaseObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/baseobject/BaseObject.java 2010-05-26 20:24:23 UTC (rev 8009) +++ trunk/src/app/net/sf/gridarta/model/baseobject/BaseObject.java 2010-05-26 20:42:15 UTC (rev 8010) @@ -319,7 +319,6 @@ * @return next of this multipart object or <code>null</code> if this isn't * a multipart object or this is the last part of a multipart * object. - * @todo check whether this should return G or Archetype<G> */ @Nullable T getMultiNext(); Modified: trunk/src/app/net/sf/gridarta/model/baseobject/GameObjectContainer.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/baseobject/GameObjectContainer.java 2010-05-26 20:24:23 UTC (rev 8009) +++ trunk/src/app/net/sf/gridarta/model/baseobject/GameObjectContainer.java 2010-05-26 20:42:15 UTC (rev 8010) @@ -589,8 +589,6 @@ /** * {@inheritDoc} - * @todo either this class should be Cloneable or the catch clause needs to - * be changed. */ @NotNull @Override Modified: trunk/src/app/net/sf/gridarta/model/map/maparchobject/MapArchObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/maparchobject/MapArchObject.java 2010-05-26 20:24:23 UTC (rev 8009) +++ trunk/src/app/net/sf/gridarta/model/map/maparchobject/MapArchObject.java 2010-05-26 20:42:15 UTC (rev 8010) @@ -270,8 +270,6 @@ /** * Returns the message text. * @return The message text. - * @todo original comment said returns map text, so what does it? return map - * text or message text? */ @NotNull String getText(); Modified: trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-05-26 20:24:23 UTC (rev 8009) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-05-26 20:42:15 UTC (rev 8010) @@ -725,9 +725,6 @@ * @retval <code>true</code> if the multi-square arch would still fit on * this map * @retval <code>false</code> otherwise - * @todo discuss whether this method really belongs to the interface of - * MapModel as it is only used by MapModel implementations and heavily - * depends on how arches, especially multi-square arches are implemented. */ private boolean isMultiArchFittingToMap(@NotNull final Archetype<G, A, R> archetype, @NotNull final Point pos, final boolean allowDouble) { for (Archetype<G, A, R> part = archetype; part != null; part = part.getMultiNext()) { Modified: trunk/src/app/net/sf/gridarta/model/spells/Spells.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/spells/Spells.java 2010-05-26 20:24:23 UTC (rev 8009) +++ trunk/src/app/net/sf/gridarta/model/spells/Spells.java 2010-05-26 20:42:15 UTC (rev 8010) @@ -29,7 +29,6 @@ /** * Common base class for spells and spell lists. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - * @todo move spell related stuff from CFArchTypeList to this class. */ public class Spells<S extends Spell> implements Iterable<S> { Modified: trunk/src/app/net/sf/gridarta/script/Script.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/Script.java 2010-05-26 20:24:23 UTC (rev 8009) +++ trunk/src/app/net/sf/gridarta/script/Script.java 2010-05-26 20:42:15 UTC (rev 8010) @@ -104,10 +104,8 @@ } /** - * Returns the code of this ScriptModel. - * @return The code of this ScriptModel. - * @todo Improve name - what code is it? Source code? A special coded - * String? + * Returns the source code of this script model. + * @return the source code of this script model */ public String getCode() { return code; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-26 20:24:29
|
Revision: 8009 http://gridarta.svn.sourceforge.net/gridarta/?rev=8009&view=rev Author: akirschbaum Date: 2010-05-26 20:24:23 +0000 (Wed, 26 May 2010) Log Message: ----------- Remove unused code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/commands/CreateThumbsCommand.java Deleted: trunk/src/app/net/sf/gridarta/commands/CreateThumbsCommand.java =================================================================== --- trunk/src/app/net/sf/gridarta/commands/CreateThumbsCommand.java 2010-05-26 20:19:58 UTC (rev 8008) +++ trunk/src/app/net/sf/gridarta/commands/CreateThumbsCommand.java 2010-05-26 20:24:23 UTC (rev 8009) @@ -1,48 +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.commands; - -import java.util.List; -import org.jetbrains.annotations.NotNull; - -/** - * Run in collect arches mode. - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - * @author Andreas Kirschbaum - */ -public class CreateThumbsCommand implements Command { - - /** - * Creates a new instance. - * @param args the arguments - */ - public CreateThumbsCommand(@NotNull final List<String> args) { - } - - /** - * {@inheritDoc} - */ - @Override - public int execute() { - System.err.println("Not yet implemented."); // XXX: implement command - return 1; - } - -} // class CreateThumbsCommand Modified: trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2010-05-26 20:19:58 UTC (rev 8008) +++ trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2010-05-26 20:24:23 UTC (rev 8009) @@ -35,7 +35,6 @@ import net.sf.gridarta.commands.BatchPngCommand; import net.sf.gridarta.commands.CollectArchesCommand; import net.sf.gridarta.commands.Command; -import net.sf.gridarta.commands.CreateThumbsCommand; import net.sf.gridarta.commands.ScriptCommand; import net.sf.gridarta.commands.SinglePngCommand; import net.sf.gridarta.gui.errorview.ConsoleErrorView; @@ -308,10 +307,6 @@ returnCode = new SinglePngCommand(new File(args2.get(0)), new File(args2.get(1)), new ImageCreatorFactory<G, A, R>(systemIcons).newImageCreator(editorFactory)).execute(); break; - case CREATE_THUMBS: - returnCode = new CreateThumbsCommand(args2).execute(); - break; - case COLLECT_ARCHES: returnCode = new CollectArchesCommand(resources, globalSettings).execute(); break; @@ -579,14 +574,9 @@ /** * Collect archetypes. */ - COLLECT_ARCHES(true), + COLLECT_ARCHES(true); /** - * Create Thumbnails. - */ - CREATE_THUMBS(false); - - /** * Whether this mode uses console-mode. */ private final boolean consoleMode; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-26 20:20:04
|
Revision: 8008 http://gridarta.svn.sourceforge.net/gridarta/?rev=8008&view=rev Author: akirschbaum Date: 2010-05-26 20:19:58 +0000 (Wed, 26 May 2010) Log Message: ----------- Make sure the updater dialogs are displayed in front of the main window. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-05-26 20:15:56 UTC (rev 8007) +++ trunk/atrinik/ChangeLog 2010-05-26 20:19:58 UTC (rev 8008) @@ -1,5 +1,8 @@ 2010-05-26 Andreas Kirschbaum + * Make sure the updater dialogs are displayed in front of the main + window. + * Implement #2093373 (Ability to import more than one type). Now types.xml is "<!ELEMENT type (import_type*..." rather than "...import_type?...". Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2010-05-26 20:15:56 UTC (rev 8007) +++ trunk/crossfire/ChangeLog 2010-05-26 20:19:58 UTC (rev 8008) @@ -1,5 +1,8 @@ 2010-05-26 Andreas Kirschbaum + * Make sure the updater dialogs are displayed in front of the main + window. + * Implement #2093373 (Ability to import more than one type). Now types.xml is "<!ELEMENT type (import_type*..." rather than "...import_type?...". Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-05-26 20:15:56 UTC (rev 8007) +++ trunk/daimonin/ChangeLog 2010-05-26 20:19:58 UTC (rev 8008) @@ -1,5 +1,8 @@ 2010-05-26 Andreas Kirschbaum + * Make sure the updater dialogs are displayed in front of the main + window. + * Implement #2093373 (Ability to import more than one type). Now types.xml is "<!ELEMENT type (import_type*..." rather than "...import_type?...". Modified: trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-05-26 20:15:56 UTC (rev 8007) +++ trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-05-26 20:19:58 UTC (rev 8008) @@ -339,6 +339,12 @@ private final ShortcutsManager shortcutsManager; /** + * The {@link UpdaterManager} instance. + */ + @NotNull + private final UpdaterManager updaterManager; + + /** * Creates a new instance. * @param createDirectionPane whether the direction panel should be created * @param mapManager the map manager @@ -459,8 +465,7 @@ final ToolPalette<G, A, R> toolPalette = new ToolPalette<G, A, R>(mapViewSettings, selectedSquareView, selectedSquareModel, objectChooser, pickmapChooserControl, floorMatcher, wallMatcher, monsterMatcher, insertionModeSet); new FindArchetypesDialogManager<G, A, R>(mainViewFrame, archetypeChooserControl, objectChooser, archetypeTypeSet); new UndoControl<G, A, R>(mapManager, gameObjectFactory, gameObjectMatchers); - final UpdaterManager updaterManager = new UpdaterManager(exiter, mapManager, mainViewFrame, gridartaJarFilename); - updaterManager.startup(); + updaterManager = new UpdaterManager(exiter, mapManager, mainViewFrame, gridartaJarFilename); final GameObjectAttributesTab<G, A, R> textEditorTab = new TextEditorTab<G, A, R>(gameObjectAttributesModel, archetypeTypeSet); final GameObjectTab<G, A, R> gameObjectTab = new GameObjectTab<G, A, R>("gameObject", gameObjectAttributesControl, Location.BOTTOM, 0, true); @@ -812,6 +817,7 @@ public void run(@NotNull final Iterable<String> args) { mainViewFrame.setVisible(true); TipOfTheDayManager.showAtStartup(mainViewFrame); + updaterManager.startup(); openFiles(args); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-26 20:16:03
|
Revision: 8007 http://gridarta.svn.sourceforge.net/gridarta/?rev=8007&view=rev Author: akirschbaum Date: 2010-05-26 20:15:56 +0000 (Wed, 26 May 2010) Log Message: ----------- Remove outdated error dialog. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java trunk/src/app/net/sf/gridarta/messages.properties trunk/src/app/net/sf/gridarta/messages_de.properties trunk/src/app/net/sf/gridarta/messages_fr.properties trunk/src/app/net/sf/gridarta/messages_sv.properties trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2010-05-26 20:12:24 UTC (rev 8006) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2010-05-26 20:15:56 UTC (rev 8007) @@ -211,12 +211,6 @@ * @param gameObject the GameObject to be displayed by this dialog */ public void showAttributeDialog(@NotNull final G gameObject) { - if (archetypeTypeSet.isEmpty()) { - // types.xml is missing! - ACTION_BUILDER.showMessageDialog(parent, "openAttrDialogNoTypes"); - return; - } - final G head = gameObject.getHead(); if (head.hasUndefinedArchetype()) { Modified: trunk/src/app/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages.properties 2010-05-26 20:12:24 UTC (rev 8006) +++ trunk/src/app/net/sf/gridarta/messages.properties 2010-05-26 20:15:56 UTC (rev 8007) @@ -390,8 +390,6 @@ deletePickmapFolderNotEmpty.title=Pickmap folder not empty deletePickmapFolderNotEmpty.message=The pickmap folder ''{0}'' contains sub-folders.\nPlease delete these first. -openAttrDialogNoTypes.title=File missing -openAttrDialogNoTypes.message=The definitions-file \"types.xml\" is missing! The\nattribute interface doesn''t work without that file. openAttrDialogNoDefaultArch.title=No default arch openAttrDialogNoDefaultArch.message=Changing attributes of arches without archetype is not supported. Modified: trunk/src/app/net/sf/gridarta/messages_de.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_de.properties 2010-05-26 20:12:24 UTC (rev 8006) +++ trunk/src/app/net/sf/gridarta/messages_de.properties 2010-05-26 20:15:56 UTC (rev 8007) @@ -372,8 +372,6 @@ deletePickmapFolderNotEmpty.title=Pickmap-Gruppe nicht leer deletePickmapFolderNotEmpty.message=Die Pickmap-Gruppe ''{0}'' besitzt Untergruppen.\nBitte l\xF6schen Sie diese zuerst. -openAttrDialogNoTypes.title=Datei fehlt -openAttrDialogNoTypes.message=Die Konfigurationsdatei \"types.xml\" fehlt. Der Dialog zum \xC4ndern von Objekt-Attributen funktioniert nicht ohne diese Datei. openAttrDialogNoDefaultArch.title=Attribute \xE4ndern openAttrDialogNoDefaultArch.message=Attribute von Objekten ohne Archetyp k\xF6nnen nicht ge\xE4ndert werden. Modified: trunk/src/app/net/sf/gridarta/messages_fr.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_fr.properties 2010-05-26 20:12:24 UTC (rev 8006) +++ trunk/src/app/net/sf/gridarta/messages_fr.properties 2010-05-26 20:15:56 UTC (rev 8007) @@ -366,8 +366,6 @@ #deletePickmapFolderNotEmpty.title= #deletePickmapFolderNotEmpty.message= -#openAttrDialogNoTypes.title= -#openAttrDialogNoTypes.message= #openAttrDialogNoDefaultArch.title= #openAttrDialogNoDefaultArch.message= Modified: trunk/src/app/net/sf/gridarta/messages_sv.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_sv.properties 2010-05-26 20:12:24 UTC (rev 8006) +++ trunk/src/app/net/sf/gridarta/messages_sv.properties 2010-05-26 20:15:56 UTC (rev 8007) @@ -369,8 +369,6 @@ #deletePickmapFolderNotEmpty.title= #deletePickmapFolderNotEmpty.message= -openAttrDialogNoTypes.title=Fil saknas -openAttrDialogNoTypes.message=Defintionsfilen \"types.xml\" saknas!\nAttribut-gr\xE4nssnittet fungerar inte utan den filen. openAttrDialogNoDefaultArch.title=Ingen standardarketyp openAttrDialogNoDefaultArch.message=\xC4ndring av objektattribut utan tillg\xE5ng till standardarketyp \xE4r inte m\xF6jligt. Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java 2010-05-26 20:12:24 UTC (rev 8006) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java 2010-05-26 20:15:56 UTC (rev 8007) @@ -182,15 +182,6 @@ } /** - * Returns whether this archetype type set contains no data. - * @return <code>true</code> if this archetype type set contains no data, - * otherwise <code>false</code>. - */ - public boolean isEmpty() { - return archetypeTypeList.isEmpty(); - } - - /** * Find and return the type-structure (<code>ArchetypeType</code>) that * matches the given 'typeName'. These type-names are "artificial" names, * defined in "types.xml". They appear in the type selection box in the This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-26 20:12:30
|
Revision: 8006 http://gridarta.svn.sourceforge.net/gridarta/?rev=8006&view=rev Author: akirschbaum Date: 2010-05-26 20:12:24 +0000 (Wed, 26 May 2010) Log Message: ----------- Rename function names. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java trunk/src/app/net/sf/gridarta/gui/map/cursor/MapCursorActions.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java Modified: trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java 2010-05-26 20:08:23 UTC (rev 8005) +++ trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java 2010-05-26 20:12:24 UTC (rev 8006) @@ -256,7 +256,7 @@ /** * Sets the currently selected archetype in the list. Makes sure the * archetype is visible. - * @param archetype the selected archetype or <code>null</code> to unselect + * @param archetype the selected archetype or <code>null</code> to deselect * all */ private void setSelectedArchetype(@Nullable final R archetype) { @@ -331,7 +331,7 @@ */ @ActionMethod public void editPopup() { - //XXX: gameObjectAttributesDialogFactory.showAttribDialog(getSelectedArchetype()); + //XXX: gameObjectAttributesDialogFactory.showAttributeDialog(getSelectedArchetype()); } /** Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2010-05-26 20:08:23 UTC (rev 8005) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2010-05-26 20:12:24 UTC (rev 8006) @@ -863,7 +863,7 @@ public void setValue(@NotNull final Object newValue) { super.setValue(newValue); if (newValue != UNINITIALIZED_VALUE) { - gameObjectAttributesDialogFactory.hideAttribDialog(gameObject); + gameObjectAttributesDialogFactory.hideAttributeDialog(gameObject); mapModel.removeMapModelListener(mapModelListener); mapManager.removeMapManagerListener(mapManagerListener); } Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2010-05-26 20:08:23 UTC (rev 8005) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2010-05-26 20:12:24 UTC (rev 8006) @@ -210,7 +210,7 @@ * instance. * @param gameObject the GameObject to be displayed by this dialog */ - public void showAttribDialog(@NotNull final G gameObject) { + public void showAttributeDialog(@NotNull final G gameObject) { if (archetypeTypeSet.isEmpty()) { // types.xml is missing! ACTION_BUILDER.showMessageDialog(parent, "openAttrDialogNoTypes"); @@ -241,7 +241,7 @@ * instance. * @param gameObject the GameObject to be displayed by this dialog */ - public void hideAttribDialog(@NotNull final G gameObject) { + public void hideAttributeDialog(@NotNull final G gameObject) { final Window dialog = dialogs.remove(gameObject); if (dialog != null) { dialog.dispose(); Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java 2010-05-26 20:08:23 UTC (rev 8005) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java 2010-05-26 20:12:24 UTC (rev 8006) @@ -560,7 +560,7 @@ @ActionMethod public void mapArchAttrib() { if (selectedGameObject != null) { - gameObjectAttributesDialogFactory.showAttribDialog(selectedGameObject); + gameObjectAttributesDialogFactory.showAttributeDialog(selectedGameObject); } } Modified: trunk/src/app/net/sf/gridarta/gui/map/cursor/MapCursorActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/cursor/MapCursorActions.java 2010-05-26 20:08:23 UTC (rev 8005) +++ trunk/src/app/net/sf/gridarta/gui/map/cursor/MapCursorActions.java 2010-05-26 20:12:24 UTC (rev 8006) @@ -651,7 +651,7 @@ } if (performAction) { - gameObjectAttributesDialogFactory.showAttribDialog(gameObject); + gameObjectAttributesDialogFactory.showAttributeDialog(gameObject); } return true; Modified: trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java 2010-05-26 20:08:23 UTC (rev 8005) +++ trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java 2010-05-26 20:12:24 UTC (rev 8006) @@ -143,7 +143,7 @@ public void mousePressed(final MouseEvent e) { if (isSelect(e)) { if (e.getClickCount() > 1) { // LMB Double click - gameObjectAttributesDialogFactory.showAttribDialog(selectedSquareModel.getSelectedGameObject()); + gameObjectAttributesDialogFactory.showAttributeDialog(selectedSquareModel.getSelectedGameObject()); } } else if (isInsert(e)) { insertGameObjectFromObjectChooser(selectedSquareView.getListIndex(e)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-26 20:10:20
|
Revision: 8004 http://gridarta.svn.sourceforge.net/gridarta/?rev=8004&view=rev Author: akirschbaum Date: 2010-05-26 20:03:10 +0000 (Wed, 26 May 2010) Log Message: ----------- Fix typos. Modified Paths: -------------- trunk/src/test/net/sf/gridarta/model/archetypetype/TestArchetypeAttributeFactory.java Modified: trunk/src/test/net/sf/gridarta/model/archetypetype/TestArchetypeAttributeFactory.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/archetypetype/TestArchetypeAttributeFactory.java 2010-05-26 19:58:27 UTC (rev 8003) +++ trunk/src/test/net/sf/gridarta/model/archetypetype/TestArchetypeAttributeFactory.java 2010-05-26 20:03:10 UTC (rev 8004) @@ -34,7 +34,7 @@ @NotNull @Override public ArchetypeAttribute newArchetypeAttributeAnimname(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { - return new TestArchetypeAttribute("anim_name", archetypeAttributeName, attributeName, description, inputLength, sectionName); + return new TestArchetypeAttribute("animname", archetypeAttributeName, attributeName, description, inputLength, sectionName); } /** @@ -196,7 +196,7 @@ @NotNull @Override public ArchetypeAttribute newArchetypeAttributeZSpell(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { - return new TestArchetypeAttribute("zspell", archetypeAttributeName, attributeName, description, inputLength, sectionName); + return new TestArchetypeAttribute("nz_spell", archetypeAttributeName, attributeName, description, inputLength, sectionName); } } // class TestArchetypeAttributeFactory This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-26 20:08:29
|
Revision: 8005 http://gridarta.svn.sourceforge.net/gridarta/?rev=8005&view=rev Author: akirschbaum Date: 2010-05-26 20:08:23 +0000 (Wed, 26 May 2010) Log Message: ----------- Rename variable name. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java Modified: trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java 2010-05-26 20:03:10 UTC (rev 8004) +++ trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java 2010-05-26 20:08:23 UTC (rev 8005) @@ -339,11 +339,11 @@ * @param archetype the archetype to select */ public void selectArchetype(@NotNull final R archetype) { - final List<ArchetypeChooserFolder<G, A, R>> folders = archetypeChooserPanel.getFolders(); - for (int index = 1; index < folders.size(); index++) { - final ArchetypeChooserFolder<G, A, R> folder = folders.get(index); + final List<ArchetypeChooserFolder<G, A, R>> archetypeChooserFolders = archetypeChooserPanel.getFolders(); + for (int index = 1; index < archetypeChooserFolders.size(); index++) { + final ArchetypeChooserFolder<G, A, R> folder = archetypeChooserFolders.get(index); if (folder.containsArcheype(archetype)) { - this.folders.setSelectedIndex(index); + folders.setSelectedIndex(index); setSelectedArchetype(archetype); return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-26 19:58:33
|
Revision: 8003 http://gridarta.svn.sourceforge.net/gridarta/?rev=8003&view=rev Author: akirschbaum Date: 2010-05-26 19:58:27 +0000 (Wed, 26 May 2010) Log Message: ----------- Move ArchetypeTypeSetParserTest.TestArchetypeAttributeFactory to top-level class. Modified Paths: -------------- trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java Added Paths: ----------- trunk/src/test/net/sf/gridarta/model/archetypetype/TestArchetypeAttributeFactory.java Modified: trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java 2010-05-26 19:57:21 UTC (rev 8002) +++ trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java 2010-05-26 19:58:27 UTC (rev 8003) @@ -28,7 +28,6 @@ import net.sf.gridarta.model.errorview.TestErrorView; import net.sf.gridarta.utils.XmlHelper; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import org.junit.Assert; import org.junit.Test; import org.xml.sax.InputSource; @@ -546,183 +545,4 @@ return inputSource; } - /** - * An {@link ArchetypeAttributeFactory} suitable for unit tests. - * @author Andreas Kirschbaum - */ - private static class TestArchetypeAttributeFactory implements ArchetypeAttributeFactory { - - /** - * {@inheritDoc} - */ - @NotNull - @Override - public ArchetypeAttribute newArchetypeAttributeAnimname(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { - return new TestArchetypeAttribute("anim_name", archetypeAttributeName, attributeName, description, inputLength, sectionName); - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override - public ArchetypeAttribute newArchetypeAttributeBitmask(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName, @NotNull final String bitmaskName) { - return new TestArchetypeAttribute("bitmask", archetypeAttributeName, attributeName, description, inputLength, sectionName); - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override - public ArchetypeAttribute newArchetypeAttributeBool(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { - return new TestArchetypeAttribute("bool", archetypeAttributeName, attributeName, description, inputLength, sectionName); - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override - public ArchetypeAttribute newArchetypeAttributeBoolSpec(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName, @NotNull final String trueValue, @NotNull final String falseValue) { - return new TestArchetypeAttribute("bool_spec", archetypeAttributeName, attributeName, description, inputLength, sectionName); - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override - public ArchetypeAttribute newArchetypeAttributeFacename(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { - return new TestArchetypeAttribute("face_name", archetypeAttributeName, attributeName, description, inputLength, sectionName); - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override - public ArchetypeAttribute newArchetypeAttributeFixed(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { - return new TestArchetypeAttribute("fixed", archetypeAttributeName, attributeName, description, inputLength, sectionName); - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override - public ArchetypeAttribute newArchetypeAttributeFloat(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { - return new TestArchetypeAttribute("float", archetypeAttributeName, attributeName, description, inputLength, sectionName); - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override - public ArchetypeAttribute newArchetypeAttributeInt(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName, final int minValue, final int maxValue, final int minCheckValue, final int maxCheckValue) { - return new TestArchetypeAttribute("int", archetypeAttributeName, attributeName, description, inputLength, sectionName); - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override - public ArchetypeAttribute newArchetypeAttributeInvSpell(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { - return new TestArchetypeAttribute("inv_spell", archetypeAttributeName, attributeName, description, inputLength, sectionName); - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override - public ArchetypeAttribute newArchetypeAttributeInvSpellOptional(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { - return new TestArchetypeAttribute("inv_spell_optional", archetypeAttributeName, attributeName, description, inputLength, sectionName); - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override - public ArchetypeAttribute newArchetypeAttributeList(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName, @NotNull final String listName) { - return new TestArchetypeAttribute("list", archetypeAttributeName, attributeName, description, inputLength, sectionName); - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override - public ArchetypeAttribute newArchetypeAttributeLong(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { - return new TestArchetypeAttribute("long", archetypeAttributeName, attributeName, description, inputLength, sectionName); - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override - public ArchetypeAttribute newArchetypeAttributeMapPath(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { - return new TestArchetypeAttribute("map_path", archetypeAttributeName, attributeName, description, inputLength, sectionName); - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override - public ArchetypeAttribute newArchetypeAttributeScriptFile(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { - return new TestArchetypeAttribute("script_file", archetypeAttributeName, attributeName, description, inputLength, sectionName); - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override - public ArchetypeAttribute newArchetypeAttributeSpell(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { - return new TestArchetypeAttribute("spell", archetypeAttributeName, attributeName, description, inputLength, sectionName); - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override - public ArchetypeAttribute newArchetypeAttributeString(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { - return new TestArchetypeAttribute("string", archetypeAttributeName, attributeName, description, inputLength, sectionName); - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override - public ArchetypeAttribute newArchetypeAttributeText(@NotNull final String archetypeAttributeName, @NotNull final String endingOld, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @Nullable final String fileExtension) { - return new TestArchetypeAttribute("text", archetypeAttributeName, attributeName, description, inputLength, attributeName); - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override - public ArchetypeAttribute newArchetypeAttributeTreasure(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { - return new TestArchetypeAttribute("treasure", archetypeAttributeName, attributeName, description, inputLength, sectionName); - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override - public ArchetypeAttribute newArchetypeAttributeZSpell(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { - return new TestArchetypeAttribute("zspell", archetypeAttributeName, attributeName, description, inputLength, sectionName); - } - - } // class TestArchetypeAttributeFactory - } // class ArchetypeTypeSetParserTest Added: trunk/src/test/net/sf/gridarta/model/archetypetype/TestArchetypeAttributeFactory.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/archetypetype/TestArchetypeAttributeFactory.java (rev 0) +++ trunk/src/test/net/sf/gridarta/model/archetypetype/TestArchetypeAttributeFactory.java 2010-05-26 19:58:27 UTC (rev 8003) @@ -0,0 +1,202 @@ +/* + * 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.archetypetype; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * An {@link ArchetypeAttributeFactory} suitable for unit tests. + * @author Andreas Kirschbaum + */ +public class TestArchetypeAttributeFactory implements ArchetypeAttributeFactory { + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public ArchetypeAttribute newArchetypeAttributeAnimname(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { + return new TestArchetypeAttribute("anim_name", archetypeAttributeName, attributeName, description, inputLength, sectionName); + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public ArchetypeAttribute newArchetypeAttributeBitmask(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName, @NotNull final String bitmaskName) { + return new TestArchetypeAttribute("bitmask", archetypeAttributeName, attributeName, description, inputLength, sectionName); + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public ArchetypeAttribute newArchetypeAttributeBool(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { + return new TestArchetypeAttribute("bool", archetypeAttributeName, attributeName, description, inputLength, sectionName); + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public ArchetypeAttribute newArchetypeAttributeBoolSpec(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName, @NotNull final String trueValue, @NotNull final String falseValue) { + return new TestArchetypeAttribute("bool_spec", archetypeAttributeName, attributeName, description, inputLength, sectionName); + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public ArchetypeAttribute newArchetypeAttributeFacename(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { + return new TestArchetypeAttribute("face_name", archetypeAttributeName, attributeName, description, inputLength, sectionName); + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public ArchetypeAttribute newArchetypeAttributeFixed(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { + return new TestArchetypeAttribute("fixed", archetypeAttributeName, attributeName, description, inputLength, sectionName); + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public ArchetypeAttribute newArchetypeAttributeFloat(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { + return new TestArchetypeAttribute("float", archetypeAttributeName, attributeName, description, inputLength, sectionName); + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public ArchetypeAttribute newArchetypeAttributeInt(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName, final int minValue, final int maxValue, final int minCheckValue, final int maxCheckValue) { + return new TestArchetypeAttribute("int", archetypeAttributeName, attributeName, description, inputLength, sectionName); + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public ArchetypeAttribute newArchetypeAttributeInvSpell(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { + return new TestArchetypeAttribute("inv_spell", archetypeAttributeName, attributeName, description, inputLength, sectionName); + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public ArchetypeAttribute newArchetypeAttributeInvSpellOptional(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { + return new TestArchetypeAttribute("inv_spell_optional", archetypeAttributeName, attributeName, description, inputLength, sectionName); + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public ArchetypeAttribute newArchetypeAttributeList(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName, @NotNull final String listName) { + return new TestArchetypeAttribute("list", archetypeAttributeName, attributeName, description, inputLength, sectionName); + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public ArchetypeAttribute newArchetypeAttributeLong(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { + return new TestArchetypeAttribute("long", archetypeAttributeName, attributeName, description, inputLength, sectionName); + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public ArchetypeAttribute newArchetypeAttributeMapPath(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { + return new TestArchetypeAttribute("map_path", archetypeAttributeName, attributeName, description, inputLength, sectionName); + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public ArchetypeAttribute newArchetypeAttributeScriptFile(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { + return new TestArchetypeAttribute("script_file", archetypeAttributeName, attributeName, description, inputLength, sectionName); + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public ArchetypeAttribute newArchetypeAttributeSpell(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { + return new TestArchetypeAttribute("spell", archetypeAttributeName, attributeName, description, inputLength, sectionName); + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public ArchetypeAttribute newArchetypeAttributeString(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { + return new TestArchetypeAttribute("string", archetypeAttributeName, attributeName, description, inputLength, sectionName); + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public ArchetypeAttribute newArchetypeAttributeText(@NotNull final String archetypeAttributeName, @NotNull final String endingOld, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @Nullable final String fileExtension) { + return new TestArchetypeAttribute("text", archetypeAttributeName, attributeName, description, inputLength, attributeName); + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public ArchetypeAttribute newArchetypeAttributeTreasure(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { + return new TestArchetypeAttribute("treasure", archetypeAttributeName, attributeName, description, inputLength, sectionName); + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public ArchetypeAttribute newArchetypeAttributeZSpell(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { + return new TestArchetypeAttribute("zspell", archetypeAttributeName, attributeName, description, inputLength, sectionName); + } + +} // class TestArchetypeAttributeFactory Property changes on: trunk/src/test/net/sf/gridarta/model/archetypetype/TestArchetypeAttributeFactory.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-26 19:57:30
|
Revision: 8002 http://gridarta.svn.sourceforge.net/gridarta/?rev=8002&view=rev Author: akirschbaum Date: 2010-05-26 19:57:21 +0000 (Wed, 26 May 2010) Log Message: ----------- Move ArchetypeTypeSetParserTest.TestArchetypeAttribute to top-level class. Modified Paths: -------------- trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java Added Paths: ----------- trunk/src/test/net/sf/gridarta/model/archetypetype/TestArchetypeAttribute.java Modified: trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java 2010-05-26 18:39:32 UTC (rev 8001) +++ trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java 2010-05-26 19:57:21 UTC (rev 8002) @@ -723,52 +723,6 @@ return new TestArchetypeAttribute("zspell", archetypeAttributeName, attributeName, description, inputLength, sectionName); } - /** - * An {@link ArchetypeAttribute} suitable for unit tests. - * @author Andreas Kirschbaum - */ - private static class TestArchetypeAttribute extends ArchetypeAttribute { - - /** - * The attribute's type. - */ - @NotNull - private final String type; - - /** - * Creates a new instance. - * @param type the attribute's type - * @param archetypeAttributeName the archetype attribute name - * @param attributeName the user interface attribute name - * @param description the attribute's description - * @param inputLength the input length in characters for text input - * fields - * @param sectionName the section name - */ - public TestArchetypeAttribute(@NotNull final String type, @NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { - super(archetypeAttributeName, attributeName, description, inputLength, sectionName); - this.type = type; - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override - public String toString() { - return type + "/" + super.toString(); - } - - /** - * {@inheritDoc} - */ - @Override - public void visit(@NotNull final ArchetypeAttributeVisitor visitor) { - throw new AssertionError(); - } - - } // class TestArchetypeAttribute - } // class TestArchetypeAttributeFactory } // class ArchetypeTypeSetParserTest Added: trunk/src/test/net/sf/gridarta/model/archetypetype/TestArchetypeAttribute.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/archetypetype/TestArchetypeAttribute.java (rev 0) +++ trunk/src/test/net/sf/gridarta/model/archetypetype/TestArchetypeAttribute.java 2010-05-26 19:57:21 UTC (rev 8002) @@ -0,0 +1,67 @@ +/* + * 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.archetypetype; + +import org.jetbrains.annotations.NotNull; + +/** + * An {@link ArchetypeAttribute} suitable for unit tests. + * @author Andreas Kirschbaum + */ +public class TestArchetypeAttribute extends ArchetypeAttribute { + + /** + * The attribute's type. + */ + @NotNull + private final String type; + + /** + * Creates a new instance. + * @param type the attribute's type + * @param archetypeAttributeName the archetype attribute name + * @param attributeName the user interface attribute name + * @param description the attribute's description + * @param inputLength the input length in characters for text input fields + * @param sectionName the section name + */ + public TestArchetypeAttribute(@NotNull final String type, @NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { + super(archetypeAttributeName, attributeName, description, inputLength, sectionName); + this.type = type; + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public String toString() { + return type + "/" + super.toString(); + } + + /** + * {@inheritDoc} + */ + @Override + public void visit(@NotNull final ArchetypeAttributeVisitor visitor) { + throw new AssertionError(); + } + +} // class TestArchetypeAttribute Property changes on: trunk/src/test/net/sf/gridarta/model/archetypetype/TestArchetypeAttribute.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-26 18:39:38
|
Revision: 8001 http://gridarta.svn.sourceforge.net/gridarta/?rev=8001&view=rev Author: akirschbaum Date: 2010-05-26 18:39:32 +0000 (Wed, 26 May 2010) Log Message: ----------- Implement #2093373 (Ability to import more than one type). Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/resource/system/dtd/types.dtd trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-05-26 18:19:27 UTC (rev 8000) +++ trunk/atrinik/ChangeLog 2010-05-26 18:39:32 UTC (rev 8001) @@ -1,3 +1,9 @@ +2010-05-26 Andreas Kirschbaum + + * Implement #2093373 (Ability to import more than one type). Now + types.xml is "<!ELEMENT type (import_type*..." rather than + "...import_type?...". + 2010-05-24 Andreas Kirschbaum * Fix edit operations involving multi-square game objects. Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2010-05-26 18:19:27 UTC (rev 8000) +++ trunk/crossfire/ChangeLog 2010-05-26 18:39:32 UTC (rev 8001) @@ -1,3 +1,9 @@ +2010-05-26 Andreas Kirschbaum + + * Implement #2093373 (Ability to import more than one type). Now + types.xml is "<!ELEMENT type (import_type*..." rather than + "...import_type?...". + 2010-05-24 Andreas Kirschbaum * Fix edit operations involving multi-square game objects. Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-05-26 18:19:27 UTC (rev 8000) +++ trunk/daimonin/ChangeLog 2010-05-26 18:39:32 UTC (rev 8001) @@ -1,3 +1,9 @@ +2010-05-26 Andreas Kirschbaum + + * Implement #2093373 (Ability to import more than one type). Now + types.xml is "<!ELEMENT type (import_type*..." rather than + "...import_type?...". + 2010-05-24 Andreas Kirschbaum * Fix edit operations involving multi-square game objects. Modified: trunk/resource/system/dtd/types.dtd =================================================================== --- trunk/resource/system/dtd/types.dtd 2010-05-26 18:19:27 UTC (rev 8000) +++ trunk/resource/system/dtd/types.dtd 2010-05-26 18:39:32 UTC (rev 8001) @@ -88,9 +88,12 @@ xml:base CDATA #IMPLIED > +<!-- import_type: imports are applied in the given order; attributes defined in + the type or in a preceding import_type are not imported; the default_type + is implicitly imported at the end. --> <!-- available: the type is ignored when set to "no"; can be used to temporarily disable type definitions. --> -<!ELEMENT type (import_type?,required?,ignore?,description?,use?,(section | attribute)*)> +<!ELEMENT type (import_type*,required?,ignore?,description?,use?,(section | attribute)*)> <!ATTLIST type xml:base CDATA #IMPLIED name CDATA #REQUIRED Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java 2010-05-26 18:19:27 UTC (rev 8000) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java 2010-05-26 18:39:32 UTC (rev 8001) @@ -22,6 +22,7 @@ import java.util.Collection; import java.util.HashSet; import java.util.Iterator; +import java.util.LinkedHashSet; import net.sf.gridarta.model.errorview.ErrorViewCategory; import net.sf.gridarta.model.errorview.ErrorViewCollector; import net.sf.japi.xml.NodeListIterator; @@ -150,8 +151,15 @@ final Collection<String> ignoreTable = new HashSet<String>(); final ArchetypeAttributesDefinition typeAttributes = isDefaultType ? new ArchetypeAttributesDefinition() : parseTypeAttributes(typeElement, typeName, errorViewCollector, ignoreTable, ignorelistsDefinition); - final Element importTypeElement = NodeListIterator.getFirstChild(typeElement, XML_ELEMENT_IMPORT_TYPE); - final String importType = importTypeElement == null ? null : parseImportType(importTypeElement, typeName, errorViewCollector); + final Collection<String> importTypes = new LinkedHashSet<String>(); + final Iterator<Element> importTypeIterator = new NodeListIterator<Element>(typeElement, XML_ELEMENT_IMPORT_TYPE); + while (importTypeIterator.hasNext()) { + final Element importTypeElement = importTypeIterator.next(); + final String importType = parseImportType(importTypeElement, typeName, errorViewCollector); + if (importType != null && !importTypes.add(importType)) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + " has duplicate import for '" + importType + "'."); + } + } final ArchetypeAttributes attributes = new ArchetypeAttributes(); final SectionNames sectionNames = new SectionNames(); @@ -162,10 +170,13 @@ autoIgnoreTable.add(attribute.getArchetypeAttributeName()); } + if (archetypeType.hasAttribute()) { + for (final String importType : importTypes) { + addImportList(importType, attributes, errorViewCollector, typeName, archetypeTypeSet, autoIgnoreTable); + } + } + addDefaultList(archetypeType, attributes, autoIgnoreTable, ignoreTable); - if (importType != null && archetypeType.hasAttribute()) { - addImportList(importType, attributes, errorViewCollector, typeName, archetypeTypeSet, autoIgnoreTable); - } } attributes.setSectionNames(sectionNames); @@ -196,7 +207,8 @@ * @param errorViewCollector the error view collector for reporting errors * @param typeName the type name for error messages * @param archetypeTypeSet the archetype type set - * @param autoIgnoreTable the attributes to ignore + * @param autoIgnoreTable the attributes to ignore; imported attributes are + * added */ private static void addImportList(@NotNull final String importName, @NotNull final ArchetypeAttributes attributes, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final String typeName, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final Collection<String> autoIgnoreTable) { final Iterable<ArchetypeAttribute> importType = archetypeTypeSet.getArchetypeType(importName); @@ -206,7 +218,8 @@ } for (final ArchetypeAttribute archetypeAttribute : importType) { - if (autoIgnoreTable.contains(archetypeAttribute.getArchetypeAttributeName())) { + final String attributeName = archetypeAttribute.getArchetypeAttributeName(); + if (autoIgnoreTable.contains(attributeName)) { continue; } @@ -215,6 +228,7 @@ } attributes.add(archetypeAttribute.clone()); + autoIgnoreTable.add(attributeName); } } Modified: trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java 2010-05-26 18:19:27 UTC (rev 8000) +++ trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java 2010-05-26 18:39:32 UTC (rev 8001) @@ -130,10 +130,144 @@ + "string/name2_attr1[name2] section=1/Special\n" + "string/name1_attr2[name2] section=1/Special\n" + "string/default_attr2[name2] section=1/Special\n" + /* imports */ + + "string/name1_attr1[name1] section=1/Special\n" /* defaults */ + "string/default_attr1[default] section=0/General\n" + + "\n"); + } + + /** + * Checks that multi-imports do work. + * @throws ParserConfigurationException if the test fails + * @throws UnsupportedEncodingException if the test fails + */ + @Test + public void testImport2() throws ParserConfigurationException, UnsupportedEncodingException { + check("<bitmasks/>\n" + + "<lists/>\n" + + "<ignorelists/>\n" + + "<default_type>\n" + + "<attribute arch=\"attr1\" editor=\"default\" type=\"string\">description</attribute>\n" + + "<attribute arch=\"attr3\" editor=\"default\" type=\"string\">description</attribute>\n" + + "<attribute arch=\"attr5\" editor=\"default\" type=\"string\">description</attribute>\n" + + "<attribute arch=\"attr7\" editor=\"default\" type=\"string\">description</attribute>\n" + + "<attribute arch=\"attr9\" editor=\"default\" type=\"string\">description</attribute>\n" + + "<attribute arch=\"attrB\" editor=\"default\" type=\"string\">description</attribute>\n" + + "<attribute arch=\"attrD\" editor=\"default\" type=\"string\">description</attribute>\n" + + "<attribute arch=\"attrF\" editor=\"default\" type=\"string\">description</attribute>\n" + + "</default_type>\n" + + "<type number=\"1\" name=\"name1\">\n" + + "<description>description1</description>\n" + + "<attribute arch=\"attr2\" editor=\"name1\" type=\"string\">description</attribute>\n" + + "<attribute arch=\"attr3\" editor=\"name1\" type=\"string\">description</attribute>\n" + + "<attribute arch=\"attr6\" editor=\"name1\" type=\"string\">description</attribute>\n" + + "<attribute arch=\"attr7\" editor=\"name1\" type=\"string\">description</attribute>\n" + + "<attribute arch=\"attrA\" editor=\"name1\" type=\"string\">description</attribute>\n" + + "<attribute arch=\"attrB\" editor=\"name1\" type=\"string\">description</attribute>\n" + + "<attribute arch=\"attrE\" editor=\"name1\" type=\"string\">description</attribute>\n" + + "<attribute arch=\"attrF\" editor=\"name1\" type=\"string\">description</attribute>\n" + + "</type>\n" + + "<type number=\"2\" name=\"name2\">\n" + + "<description>description2</description>\n" + + "<attribute arch=\"attr4\" editor=\"name2\" type=\"string\">description</attribute>\n" + + "<attribute arch=\"attr5\" editor=\"name2\" type=\"string\">description</attribute>\n" + + "<attribute arch=\"attr6\" editor=\"name2\" type=\"string\">description</attribute>\n" + + "<attribute arch=\"attr7\" editor=\"name2\" type=\"string\">description</attribute>\n" + + "<attribute arch=\"attrC\" editor=\"name2\" type=\"string\">description</attribute>\n" + + "<attribute arch=\"attrD\" editor=\"name2\" type=\"string\">description</attribute>\n" + + "<attribute arch=\"attrE\" editor=\"name2\" type=\"string\">description</attribute>\n" + + "<attribute arch=\"attrF\" editor=\"name2\" type=\"string\">description</attribute>\n" + + "</type>\n" + + "<type number=\"3\" name=\"name3\">\n" + + "<import_type name=\"name1\"/>\n" + + "<import_type name=\"name2\"/>\n" + + "<description>description3</description>\n" + + "<attribute arch=\"attr8\" editor=\"name3\" type=\"string\">description</attribute>\n" + + "<attribute arch=\"attr9\" editor=\"name3\" type=\"string\">description</attribute>\n" + + "<attribute arch=\"attrA\" editor=\"name3\" type=\"string\">description</attribute>\n" + + "<attribute arch=\"attrB\" editor=\"name3\" type=\"string\">description</attribute>\n" + + "<attribute arch=\"attrC\" editor=\"name3\" type=\"string\">description</attribute>\n" + + "<attribute arch=\"attrD\" editor=\"name3\" type=\"string\">description</attribute>\n" + + "<attribute arch=\"attrE\" editor=\"name3\" type=\"string\">description</attribute>\n" + + "<attribute arch=\"attrF\" editor=\"name3\" type=\"string\">description</attribute>\n" + + "</type>\n" + + "", + false, + "default_type:-1,default\n" + + ":\n" + + ":\n" + /* attributes */ + + "string/attr1[default] section=0/General\n" + + "string/attr3[default] section=0/General\n" + + "string/attr5[default] section=0/General\n" + + "string/attr7[default] section=0/General\n" + + "string/attr9[default] section=0/General\n" + + "string/attrB[default] section=0/General\n" + + "string/attrD[default] section=0/General\n" + + "string/attrF[default] section=0/General\n" + /* defaults */ /* imports */ - + "string/name1_attr1[name1] section=1/Special\n" + + "\n" + + "type:1,name1\n" + + ":\n" + + ":\n" + /* attributes */ + + "string/attr2[name1] section=1/Special\n" + + "string/attr3[name1] section=1/Special\n" + + "string/attr6[name1] section=1/Special\n" + + "string/attr7[name1] section=1/Special\n" + + "string/attrA[name1] section=1/Special\n" + + "string/attrB[name1] section=1/Special\n" + + "string/attrE[name1] section=1/Special\n" + + "string/attrF[name1] section=1/Special\n" + /* defaults */ + + "string/attr1[default] section=0/General\n" + + "string/attr5[default] section=0/General\n" + + "string/attr9[default] section=0/General\n" + + "string/attrD[default] section=0/General\n" + /* imports */ + + "\n" + + "type:2,name2\n" + + ":\n" + + ":\n" + /* attributes */ + + "string/attr4[name2] section=1/Special\n" + + "string/attr5[name2] section=1/Special\n" + + "string/attr6[name2] section=1/Special\n" + + "string/attr7[name2] section=1/Special\n" + + "string/attrC[name2] section=1/Special\n" + + "string/attrD[name2] section=1/Special\n" + + "string/attrE[name2] section=1/Special\n" + + "string/attrF[name2] section=1/Special\n" + /* defaults */ + + "string/attr1[default] section=0/General\n" + + "string/attr3[default] section=0/General\n" + + "string/attr9[default] section=0/General\n" + + "string/attrB[default] section=0/General\n" + /* attributes */ + /* imports */ + + "\n" + + "type:3,name3\n" + + ":\n" + + ":\n" + + "string/attr8[name3] section=1/Special\n" + + "string/attr9[name3] section=1/Special\n" + + "string/attrA[name3] section=1/Special\n" + + "string/attrB[name3] section=1/Special\n" + + "string/attrC[name3] section=1/Special\n" + + "string/attrD[name3] section=1/Special\n" + + "string/attrE[name3] section=1/Special\n" + + "string/attrF[name3] section=1/Special\n" + /* imports */ + + "string/attr2[name1] section=1/Special\n" + + "string/attr3[name1] section=1/Special\n" + + "string/attr6[name1] section=1/Special\n" + + "string/attr7[name1] section=1/Special\n" + + "string/attr4[name2] section=1/Special\n" + + "string/attr5[name2] section=1/Special\n" + /* defaults */ + + "string/attr1[default] section=0/General\n" + "\n"); } @@ -168,10 +302,10 @@ + "type:1,name1\n" + ":\n" + ":\n" + /* attributes */ + /* imports */ /* defaults */ + "string/default_attr2[default] section=0/General\n" - /* attributes */ - /* imports */ + "\n"); } @@ -218,11 +352,11 @@ + ":\n" + ":\n" /* attributes */ - /* defaults */ - + "string/default_attr1[default] section=0/General\n" /* imports */ + "string/name1_attr1[name1] section=1/Special\n" // imported attributes are not affected by ignores + "string/name1_attr2[name1] section=1/Special\n" + /* defaults */ + + "string/default_attr1[default] section=0/General\n" + "\n"); } @@ -257,8 +391,8 @@ /* attributes */ + "string/name1_attr1[name1] section=1/Special\n" // defined attributes are not affected by ignores + "string/name1_attr2[name1] section=1/Special\n" + /* imports */ /* defaults */ - /* imports */ + "\n"); } @@ -288,9 +422,9 @@ + ":\n" + ":\n" /* attributes */ + /* imports */ /* defaults */ + "text/msg[default] section=2/default\n" - /* imports */ + "\n"); } @@ -323,8 +457,8 @@ + ":\n" /* attributes */ + "text/msg[name1] section=2/name1\n" + /* imports */ /* defaults */ - /* imports */ + "\n"); } @@ -357,8 +491,8 @@ + ":\n" + ":\n" /* attributes */ + /* imports */ /* defaults */ - /* imports */ + "\n"); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-26 18:19:34
|
Revision: 8000 http://gridarta.svn.sourceforge.net/gridarta/?rev=8000&view=rev Author: akirschbaum Date: 2010-05-26 18:19:27 +0000 (Wed, 26 May 2010) Log Message: ----------- Cleanup parser for types.xml. Modified Paths: -------------- trunk/resource/system/dtd/types.dtd trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.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/AttributeBitmask.java trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java Modified: trunk/resource/system/dtd/types.dtd =================================================================== --- trunk/resource/system/dtd/types.dtd 2010-05-25 16:30:00 UTC (rev 7999) +++ trunk/resource/system/dtd/types.dtd 2010-05-26 18:19:27 UTC (rev 8000) @@ -38,6 +38,9 @@ xml:base CDATA #IMPLIED > +<!-- name: the name of the bitmask; must be unique --> +<!-- is_named: whether values are to be encoded as strings in external + representation --> <!ELEMENT bitmask (bmentry+)> <!ATTLIST bitmask name CDATA #REQUIRED Modified: trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2010-05-25 16:30:00 UTC (rev 7999) +++ trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2010-05-26 18:19:27 UTC (rev 8000) @@ -239,7 +239,7 @@ final ArchetypeAttributeFactory archetypeAttributeFactory = new DefaultArchetypeAttributeFactory(); final ArchetypeAttributeParser archetypeAttributeParser = new ArchetypeAttributeParser(archetypeAttributeFactory); final ArchetypeTypeParser archetypeTypeParser = new ArchetypeTypeParser(archetypeAttributeParser); - final ArchetypeTypeSetParser archetypeTypeSetParser = new ArchetypeTypeSetParser(xmlHelper.getDocumentBuilder(), xmlHelper.getXPath(), archetypeTypeSet, archetypeTypeParser); + final ArchetypeTypeSetParser archetypeTypeSetParser = new ArchetypeTypeSetParser(xmlHelper.getDocumentBuilder(), archetypeTypeSet, archetypeTypeParser); ArchetypeTypeList eventTypeSet = null; try { final URL url = IOUtils.getResource(globalSettings.getConfigurationDirectory(), CommonConstants.TYPEDEF_FILE); Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeParser.java 2010-05-25 16:30:00 UTC (rev 7999) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeParser.java 2010-05-26 18:19:27 UTC (rev 8000) @@ -34,42 +34,110 @@ public class ArchetypeAttributeParser { /** - * XML attribute name for arch. + * The name of the "attribute" element. */ @NotNull - public static final String XML_KEY_ARCH = "arch"; + public static final String XML_ELEMENT_ATTRIBUTE = "attribute"; /** - * XML attribute name for begin of arch. + * The name of the "arch" attribute within {@link #XML_ELEMENT_ATTRIBUTE} + * elements. */ @NotNull - private static final String XML_KEY_ARCH_BEGIN = "arch_begin"; + public static final String XML_ATTRIBUTE_ARCH = "arch"; /** - * XML attribute name for end of arch. + * The name of the "editor" attribute within {@link #XML_ELEMENT_ATTRIBUTE} + * elements. */ @NotNull - private static final String XML_KEY_ARCH_END = "arch_end"; + public static final String XML_ATTRIBUTE_EDITOR = "editor"; /** - * XML attribute name for editor specific information. + * The name of the "value" attribute within {@link #XML_ELEMENT_ATTRIBUTE} + * elements. */ @NotNull - private static final String XML_KEY_EDITOR = "editor"; + public static final String XML_ATTRIBUTE_VALUE = "value"; /** - * XML attribute name for type definitions. + * The name of the "min" attribute within {@link #XML_ELEMENT_ATTRIBUTE} + * elements. */ @NotNull - private static final String XML_ATTRIBUTE_TYPE = "type"; + public static final String XML_ATTRIBUTE_MIN = "min"; /** - * XML attribute name for length information. + * The name of the "max" attribute within {@link #XML_ELEMENT_ATTRIBUTE} + * elements. */ @NotNull - private static final String XML_INPUT_LENGTH = "length"; + public static final String XML_ATTRIBUTE_MAX = "max"; /** + * The name of the "check_min" attribute within {@link + * #XML_ELEMENT_ATTRIBUTE} elements. + */ + @NotNull + public static final String XML_ATTRIBUTE_CHECK_MIN = "check_min"; + + /** + * The name of the "check_max" attribute within {@link + * #XML_ELEMENT_ATTRIBUTE} elements. + */ + @NotNull + public static final String XML_ATTRIBUTE_CHECK_MAX = "check_max"; + + /** + * The name of the "type" attribute within {@link #XML_ELEMENT_ATTRIBUTE} + * elements. + */ + @NotNull + public static final String XML_ATTRIBUTE_TYPE = "type"; + + /** + * The name of the "arch_begin" attribute within {@link + * #XML_ELEMENT_ATTRIBUTE} elements. + */ + @NotNull + public static final String XML_ATTRIBUTE_ARCH_BEGIN = "arch_begin"; + + /** + * The name of the "arch_end" attribute within {@link + * #XML_ELEMENT_ATTRIBUTE} elements. + */ + @NotNull + public static final String XML_ATTRIBUTE_ARCH_END = "arch_end"; + + /** + * The name of the "length" attribute within {@link #XML_ELEMENT_ATTRIBUTE} + * elements. + */ + @NotNull + public static final String XML_ATTRIBUTE_LENGTH = "length"; + + /** + * The name of the "true" attribute within {@link #XML_ELEMENT_ATTRIBUTE} + * elements. + */ + @NotNull + public static final String XML_ATTRIBUTE_TRUE = "true"; + + /** + * The name of the "false" attribute within {@link #XML_ELEMENT_ATTRIBUTE} + * elements. + */ + @NotNull + public static final String XML_ATTRIBUTE_FALSE = "false"; + + /** + * The name of the "marker" attribute within {@link #XML_ELEMENT_ATTRIBUTE} + * elements. + */ + @NotNull + public static final String XML_ATTRIBUTE_MARKER = "marker"; + + /** * The {@link ArchetypeAttributeFactory} for creating {@link * ArchetypeAttribute}s. */ @@ -86,8 +154,8 @@ /** * Loading the data from an xml element into this object. + * @param attributeElement the xml 'attribute' element * @param errorViewCollector the error view collector for reporting errors - * @param root the xml 'attribute' element * @param archetypeTypeSet the archetype type list * @param typeName (descriptive) name of the type this attribute belongs to * (e.g. "Weapon") @@ -97,67 +165,67 @@ */ @Nullable @SuppressWarnings({ "FeatureEnvy" }) - public ArchetypeAttribute load(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final Element root, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final String typeName, @NotNull final String sectionName) throws MissingAttributeException { - final String description = parseText(root); - final int inputLength = getAttributeIntValue(root, XML_INPUT_LENGTH, 0, typeName, errorViewCollector); - final String attributeType = getAttributeValue(root, XML_ATTRIBUTE_TYPE); + public ArchetypeAttribute load(@NotNull final Element attributeElement, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final String typeName, @NotNull final String sectionName) throws MissingAttributeException { + final String description = parseText(attributeElement); + final int inputLength = getAttributeIntValue(attributeElement, XML_ATTRIBUTE_LENGTH, 0, typeName, errorViewCollector); + final String attributeType = getAttributeValue(attributeElement, XML_ATTRIBUTE_TYPE); if (attributeType.equals("bool")) { - return archetypeAttributeFactory.newArchetypeAttributeBool(getAttributeValue(root, XML_KEY_ARCH), getAttributeValue(root, XML_KEY_EDITOR), description, inputLength, sectionName); + return archetypeAttributeFactory.newArchetypeAttributeBool(getAttributeValue(attributeElement, XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, XML_ATTRIBUTE_EDITOR), description, inputLength, sectionName); } else if (attributeType.equals("bool_special")) { - return archetypeAttributeFactory.newArchetypeAttributeBoolSpec(getAttributeValue(root, XML_KEY_ARCH), getAttributeValue(root, XML_KEY_EDITOR), description, inputLength, sectionName, getAttributeValue(root, "true"), getAttributeValue(root, "false")); + return archetypeAttributeFactory.newArchetypeAttributeBoolSpec(getAttributeValue(attributeElement, XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, XML_ATTRIBUTE_EDITOR), description, inputLength, sectionName, getAttributeValue(attributeElement, XML_ATTRIBUTE_TRUE), getAttributeValue(attributeElement, XML_ATTRIBUTE_FALSE)); } else if (attributeType.equals("int")) { - final int minValue = getAttributeIntValue(root, "min", Integer.MIN_VALUE, typeName, errorViewCollector); - final int maxValue = getAttributeIntValue(root, "max", Integer.MAX_VALUE, typeName, errorViewCollector); - final int minCheckValue = getAttributeIntValue(root, "check_min", minValue, typeName, errorViewCollector); - final int maxCheckValue = getAttributeIntValue(root, "check_max", maxValue, typeName, errorViewCollector); + final int minValue = getAttributeIntValue(attributeElement, XML_ATTRIBUTE_MIN, Integer.MIN_VALUE, typeName, errorViewCollector); + final int maxValue = getAttributeIntValue(attributeElement, XML_ATTRIBUTE_MAX, Integer.MAX_VALUE, typeName, errorViewCollector); + final int minCheckValue = getAttributeIntValue(attributeElement, XML_ATTRIBUTE_CHECK_MIN, minValue, typeName, errorViewCollector); + final int maxCheckValue = getAttributeIntValue(attributeElement, XML_ATTRIBUTE_CHECK_MAX, maxValue, typeName, errorViewCollector); if (minValue > maxValue) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + " has invalid min..max range: " + minValue + ".." + maxValue + "."); + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + " has invalid " + XML_ATTRIBUTE_MIN + ".." + XML_ATTRIBUTE_MAX + " range: " + minValue + ".." + maxValue + "."); return null; } if (minCheckValue > maxCheckValue) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + " has invalid check_min..check_max range: " + minCheckValue + ".." + maxCheckValue + "."); + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + " has invalid " + XML_ATTRIBUTE_CHECK_MIN + ".." + XML_ATTRIBUTE_CHECK_MAX + " range: " + minCheckValue + ".." + maxCheckValue + "."); return null; } if (minCheckValue < minValue) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + " has invalid check_min value: " + minCheckValue + " < min = " + minValue + "."); + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + " has invalid " + XML_ATTRIBUTE_CHECK_MIN + " value: " + minCheckValue + " < " + XML_ATTRIBUTE_MIN + " = " + minValue + "."); return null; } if (maxCheckValue > maxValue) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + " has invalid check_max value: " + maxCheckValue + " > max = " + maxValue + "."); + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + " has invalid " + XML_ATTRIBUTE_CHECK_MAX + " value: " + maxCheckValue + " > " + XML_ATTRIBUTE_MAX + " = " + maxValue + "."); return null; } - return archetypeAttributeFactory.newArchetypeAttributeInt(getAttributeValue(root, XML_KEY_ARCH), getAttributeValue(root, XML_KEY_EDITOR), description, inputLength, sectionName, minValue, maxValue, minCheckValue, maxCheckValue); + return archetypeAttributeFactory.newArchetypeAttributeInt(getAttributeValue(attributeElement, XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, XML_ATTRIBUTE_EDITOR), description, inputLength, sectionName, minValue, maxValue, minCheckValue, maxCheckValue); } else if (attributeType.equals("long")) { - return archetypeAttributeFactory.newArchetypeAttributeLong(getAttributeValue(root, XML_KEY_ARCH), getAttributeValue(root, XML_KEY_EDITOR), description, inputLength, sectionName); + return archetypeAttributeFactory.newArchetypeAttributeLong(getAttributeValue(attributeElement, XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, XML_ATTRIBUTE_EDITOR), description, inputLength, sectionName); } else if (attributeType.equals("float")) { - return archetypeAttributeFactory.newArchetypeAttributeFloat(getAttributeValue(root, XML_KEY_ARCH), getAttributeValue(root, XML_KEY_EDITOR), description, inputLength, sectionName); + return archetypeAttributeFactory.newArchetypeAttributeFloat(getAttributeValue(attributeElement, XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, XML_ATTRIBUTE_EDITOR), description, inputLength, sectionName); } else if (attributeType.equals("string")) { - return archetypeAttributeFactory.newArchetypeAttributeString(getAttributeValue(root, XML_KEY_ARCH), getAttributeValue(root, XML_KEY_EDITOR), description, inputLength, sectionName); + return archetypeAttributeFactory.newArchetypeAttributeString(getAttributeValue(attributeElement, XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, XML_ATTRIBUTE_EDITOR), description, inputLength, sectionName); } else if (attributeType.equals("map_path")) { - return archetypeAttributeFactory.newArchetypeAttributeMapPath(getAttributeValue(root, XML_KEY_ARCH), getAttributeValue(root, XML_KEY_EDITOR), description, inputLength, sectionName); + return archetypeAttributeFactory.newArchetypeAttributeMapPath(getAttributeValue(attributeElement, XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, XML_ATTRIBUTE_EDITOR), description, inputLength, sectionName); } else if (attributeType.equals("script_file")) { - return archetypeAttributeFactory.newArchetypeAttributeScriptFile(getAttributeValue(root, XML_KEY_ARCH), getAttributeValue(root, XML_KEY_EDITOR), description, inputLength, sectionName); + return archetypeAttributeFactory.newArchetypeAttributeScriptFile(getAttributeValue(attributeElement, XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, XML_ATTRIBUTE_EDITOR), description, inputLength, sectionName); } else if (attributeType.equals("facename")) { - return archetypeAttributeFactory.newArchetypeAttributeFacename(getAttributeValue(root, XML_KEY_ARCH), getAttributeValue(root, XML_KEY_EDITOR), description, inputLength, sectionName); + return archetypeAttributeFactory.newArchetypeAttributeFacename(getAttributeValue(attributeElement, XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, XML_ATTRIBUTE_EDITOR), description, inputLength, sectionName); } else if (attributeType.equals("animname")) { - return archetypeAttributeFactory.newArchetypeAttributeAnimname(getAttributeValue(root, XML_KEY_ARCH), getAttributeValue(root, XML_KEY_EDITOR), description, inputLength, sectionName); + return archetypeAttributeFactory.newArchetypeAttributeAnimname(getAttributeValue(attributeElement, XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, XML_ATTRIBUTE_EDITOR), description, inputLength, sectionName); } else if (attributeType.equals("text")) { - return archetypeAttributeFactory.newArchetypeAttributeText(getAttributeValue(root, XML_KEY_ARCH_BEGIN), getAttributeValue(root, XML_KEY_ARCH_END), getAttributeValue(root, XML_KEY_EDITOR), description, inputLength, getAttributeValueOptional(root, "marker")); + return archetypeAttributeFactory.newArchetypeAttributeText(getAttributeValue(attributeElement, XML_ATTRIBUTE_ARCH_BEGIN), getAttributeValue(attributeElement, XML_ATTRIBUTE_ARCH_END), getAttributeValue(attributeElement, XML_ATTRIBUTE_EDITOR), description, inputLength, getAttributeValueOptional(attributeElement, XML_ATTRIBUTE_MARKER)); } else if (attributeType.equals("fixed")) { - return archetypeAttributeFactory.newArchetypeAttributeFixed(getAttributeValue(root, XML_KEY_ARCH), getAttributeValue(root, "value"), description, inputLength, sectionName); + return archetypeAttributeFactory.newArchetypeAttributeFixed(getAttributeValue(attributeElement, XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, XML_ATTRIBUTE_VALUE), description, inputLength, sectionName); } else if (attributeType.equals("spell")) { - return archetypeAttributeFactory.newArchetypeAttributeSpell(getAttributeValue(root, XML_KEY_ARCH), getAttributeValue(root, XML_KEY_EDITOR), description, inputLength, sectionName); + return archetypeAttributeFactory.newArchetypeAttributeSpell(getAttributeValue(attributeElement, XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, XML_ATTRIBUTE_EDITOR), description, inputLength, sectionName); } else if (attributeType.equals("nz_spell")) { - return archetypeAttributeFactory.newArchetypeAttributeZSpell(getAttributeValue(root, XML_KEY_ARCH), getAttributeValue(root, XML_KEY_EDITOR), description, inputLength, sectionName); + return archetypeAttributeFactory.newArchetypeAttributeZSpell(getAttributeValue(attributeElement, XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, XML_ATTRIBUTE_EDITOR), description, inputLength, sectionName); } else if (attributeType.equals("inv_spell")) { - return archetypeAttributeFactory.newArchetypeAttributeInvSpell(getAttributeValue(root, XML_KEY_ARCH), getAttributeValue(root, XML_KEY_EDITOR), description, inputLength, sectionName); + return archetypeAttributeFactory.newArchetypeAttributeInvSpell(getAttributeValue(attributeElement, XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, XML_ATTRIBUTE_EDITOR), description, inputLength, sectionName); } else if (attributeType.equals("inv_spell_optional")) { - return archetypeAttributeFactory.newArchetypeAttributeInvSpellOptional(getAttributeValue(root, XML_KEY_ARCH), getAttributeValue(root, XML_KEY_EDITOR), description, inputLength, sectionName); + return archetypeAttributeFactory.newArchetypeAttributeInvSpellOptional(getAttributeValue(attributeElement, XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, XML_ATTRIBUTE_EDITOR), description, inputLength, sectionName); } else if (attributeType.startsWith("bitmask")) { // got a bitmask attribute final String bitmaskName = attributeType.substring(8).trim(); @@ -165,7 +233,7 @@ errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + ": Bitmask \"" + bitmaskName + "\" is undefined."); return null; } - return archetypeAttributeFactory.newArchetypeAttributeBitmask(getAttributeValue(root, XML_KEY_ARCH), getAttributeValue(root, XML_KEY_EDITOR), description, inputLength, sectionName, bitmaskName); + return archetypeAttributeFactory.newArchetypeAttributeBitmask(getAttributeValue(attributeElement, XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, XML_ATTRIBUTE_EDITOR), description, inputLength, sectionName, bitmaskName); } else if (attributeType.startsWith("list_")) { // got a bitmask attribute final String listName = attributeType.substring(5).trim(); @@ -173,9 +241,9 @@ errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + ": List \"" + listName + "\" is undefined."); return null; } - return archetypeAttributeFactory.newArchetypeAttributeList(getAttributeValue(root, XML_KEY_ARCH), getAttributeValue(root, XML_KEY_EDITOR), description, inputLength, sectionName, listName); + return archetypeAttributeFactory.newArchetypeAttributeList(getAttributeValue(attributeElement, XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, XML_ATTRIBUTE_EDITOR), description, inputLength, sectionName, listName); } else if (attributeType.equals("treasurelist")) { - return archetypeAttributeFactory.newArchetypeAttributeTreasure(getAttributeValue(root, XML_KEY_ARCH), getAttributeValue(root, XML_KEY_EDITOR), description, inputLength, sectionName); + return archetypeAttributeFactory.newArchetypeAttributeTreasure(getAttributeValue(attributeElement, XML_ATTRIBUTE_ARCH), getAttributeValue(attributeElement, XML_ATTRIBUTE_EDITOR), description, inputLength, sectionName); } else { // unknown type errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + " has an attribute with unknown type: '" + attributeType + "'."); @@ -187,12 +255,12 @@ * This method reads the text out of the element's "body" and cuts off white * spaces at front/end of lines. Probably a more correct approach would be * to display the info text in an html context. - * @param root xml attribute element + * @param attributeElement xml attribute element * @return the body's text */ @NotNull - private static String parseText(@NotNull final Node root) { - final String tmp = root.getTextContent().trim(); + private static String parseText(@NotNull final Node attributeElement) { + final String tmp = attributeElement.getTextContent().trim(); if (tmp.startsWith("<html>")) { return tmp.replaceAll("\\s*\n\\s*", " "); } else { Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java 2010-05-25 16:30:00 UTC (rev 7999) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java 2010-05-26 18:19:27 UTC (rev 8000) @@ -132,101 +132,104 @@ } /** - * Parses an element which contains a list of <attribute> elements - * from a types.xml file. + * Parses an element which contains a list of {@link + * ArchetypeAttributeParser#XML_ELEMENT_ATTRIBUTE} elements from a types.xml + * file. * @param typeElement the xml 'type' element which is going to be parsed * @param errorViewCollector the error view collector for reporting errors - * @param parent the parent archetype type + * @param archetypeType the parent archetype type * @param archetypeTypeSet archetype type list * @param ignorelistsDefinition the ignore_lists contents * @param isDefaultType whether this element is the "default_type" * @return the archetype type or <code>null</code> - * @todo I'm sucking slow, improve me */ @NotNull - public ArchetypeType loadAttributeList(@NotNull final Element typeElement, @NotNull final ErrorViewCollector errorViewCollector, @Nullable final ArchetypeType parent, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final IgnorelistsDefinition ignorelistsDefinition, final boolean isDefaultType) { + public ArchetypeType loadAttributeList(@NotNull final Element typeElement, @NotNull final ErrorViewCollector errorViewCollector, @Nullable final ArchetypeType archetypeType, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final IgnorelistsDefinition ignorelistsDefinition, final boolean isDefaultType) { final String typeName = parseTypeName(typeElement, isDefaultType); final int typeNo = parseTypeNo(typeElement, isDefaultType, typeName, errorViewCollector); final Collection<String> ignoreTable = new HashSet<String>(); final ArchetypeAttributesDefinition typeAttributes = isDefaultType ? new ArchetypeAttributesDefinition() : parseTypeAttributes(typeElement, typeName, errorViewCollector, ignoreTable, ignorelistsDefinition); - final String importType = parseImportType(typeElement, typeName, errorViewCollector); + + final Element importTypeElement = NodeListIterator.getFirstChild(typeElement, XML_ELEMENT_IMPORT_TYPE); + final String importType = importTypeElement == null ? null : parseImportType(importTypeElement, typeName, errorViewCollector); + final ArchetypeAttributes attributes = new ArchetypeAttributes(); final SectionNames sectionNames = new SectionNames(); - final Collection<String> autoIgnoreTable = new HashSet<String>(); - attributes.addAll(parseAttributeList(typeElement, errorViewCollector, typeName, typeNo, sectionNames, autoIgnoreTable, archetypeTypeSet)); - if (parent != null) { - attributes.addAll(getDefaultList(parent, autoIgnoreTable, ignoreTable)); - if (parent.hasAttribute()) { - attributes.addAll(importName(importType, errorViewCollector, typeName, archetypeTypeSet, autoIgnoreTable)); + addAttributeList(typeElement, attributes, errorViewCollector, typeName, typeNo, sectionNames, archetypeTypeSet); + if (archetypeType != null) { + final Collection<String> autoIgnoreTable = new HashSet<String>(); + for (final ArchetypeAttribute attribute : attributes) { + autoIgnoreTable.add(attribute.getArchetypeAttributeName()); } + + addDefaultList(archetypeType, attributes, autoIgnoreTable, ignoreTable); + if (importType != null && archetypeType.hasAttribute()) { + addImportList(importType, attributes, errorViewCollector, typeName, archetypeTypeSet, autoIgnoreTable); + } } attributes.setSectionNames(sectionNames); return new ArchetypeType(typeName, typeNo, parseDescription(typeElement), parseUse(typeElement), sectionNames.getSectionNames(), attributes, typeAttributes); } - @NotNull - private ArchetypeAttributes getDefaultList(@NotNull final Iterable<ArchetypeAttribute> archetypeType, @NotNull final Collection<String> autoIgnoreTable, @NotNull final Collection<String> ignoreTable) { - final ArchetypeAttributes defaultList = new ArchetypeAttributes(); - + /** + * Adds all attributes of am {@link ArchetypeType} to an {@link + * ArchetypeAttributes} that are not ignored. + * @param archetypeType the archetype type + * @param attributes the archetype attributes to add to + * @param autoIgnoreTable the attributes to ignore + * @param ignoreTable the attributes to ignore + */ + private static void addDefaultList(@NotNull final Iterable<ArchetypeAttribute> archetypeType, @NotNull final ArchetypeAttributes attributes, @NotNull final Collection<String> autoIgnoreTable, @NotNull final Collection<String> ignoreTable) { for (final ArchetypeAttribute archetypeAttribute : archetypeType) { // add all attributes from the default_type which are not in the ignoreTable if (!ignoreTable.contains(archetypeAttribute.getArchetypeAttributeName()) && !autoIgnoreTable.contains(archetypeAttribute.getArchetypeAttributeName())) { - defaultList.add(archetypeAttribute.clone()); + attributes.add(archetypeAttribute.clone()); } } - - return defaultList; } - @NotNull - private ArchetypeAttributes importName(@Nullable final String importName, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final String typeName, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final Collection<String> autoIgnoreTable) { - if (importName == null) { - return new ArchetypeAttributes(); - } - - final Iterable<ArchetypeAttribute> impType = archetypeTypeSet.getArchetypeType(importName); - if (impType == null) { + /** + * Adds all imported attributes to an {@link ArchetypeAttributes}. + * @param importName the name of the import list to import + * @param attributes the archetype attributes to add to + * @param errorViewCollector the error view collector for reporting errors + * @param typeName the type name for error messages + * @param archetypeTypeSet the archetype type set + * @param autoIgnoreTable the attributes to ignore + */ + private static void addImportList(@NotNull final String importName, @NotNull final ArchetypeAttributes attributes, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final String typeName, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final Collection<String> autoIgnoreTable) { + final Iterable<ArchetypeAttribute> importType = archetypeTypeSet.getArchetypeType(importName); + if (importType == null) { errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, typeName + ": import type \"" + importName + "\" not found!"); - return new ArchetypeAttributes(); + return; } - return importAttributes(impType, autoIgnoreTable); - } - - @NotNull - private ArchetypeAttributes importAttributes(@NotNull final Iterable<ArchetypeAttribute> impType, @NotNull final Collection<String> autoIgnoreTable) { - final ArchetypeAttributes importList = new ArchetypeAttributes(); - - for (final ArchetypeAttribute archetypeAttribute : impType) { + for (final ArchetypeAttribute archetypeAttribute : importType) { if (autoIgnoreTable.contains(archetypeAttribute.getArchetypeAttributeName())) { continue; } - if (!archetypeAttribute.getSectionName().equals(SectionNames.GENERAL_SECTION)) { - importList.add(archetypeAttribute.clone()); + if (archetypeAttribute.getSectionName().equals(SectionNames.GENERAL_SECTION)) { + continue; } + + attributes.add(archetypeAttribute.clone()); } - - return importList; } /** - * Parses the {@link #XML_ELEMENT_IMPORT_TYPE} of a "type" or "default_type" - * {@link Element}. - * @param typeElement the element + * Parses the {@link #XML_ELEMENT_IMPORT_TYPE} of an {@link + * ArchetypeTypeSetParser#XML_ELEMENT_TYPE} or {@link + * ArchetypeTypeSetParser#XML_ELEMENT_DEFAULT_TYPE} {@link Element}. + * @param importTypeElement the element * @param typeName the type name for error messages * @param errorViewCollector the error view collector for error messages * @return the import type name or <code>null</code> if no import_type is - * present or an error occurs + * present or an error occurs */ @Nullable - private static String parseImportType(@NotNull final Element typeElement, @NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector) { - final Element importTypeElement = NodeListIterator.getFirstChild(typeElement, XML_ELEMENT_IMPORT_TYPE); - if (importTypeElement == null) { - return null; - } - + private static String parseImportType(@NotNull final Element importTypeElement, @NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector) { final Attr nameAttribute = importTypeElement.getAttributeNode(XML_IMPORT_TYPE_NAME); if (nameAttribute == null) { errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + " has " + XML_ELEMENT_IMPORT_TYPE + " element without '" + XML_IMPORT_TYPE_NAME + "'."); @@ -243,14 +246,16 @@ } /** - * Parses the type name of a "type" or "default_type" {@link Element}. + * Parses the type name of an {@link ArchetypeTypeSetParser#XML_ELEMENT_TYPE} + * or {@link ArchetypeTypeSetParser#XML_ELEMENT_DEFAULT_TYPE} {@link + * Element}. * @param typeElement the element * @param isDefaultType whether the element is a "default_type" * @return the type name */ @NotNull private static String parseTypeName(@NotNull final Element typeElement, final boolean isDefaultType) { - return isDefaultType ? "default" : typeElement.getAttribute("name").trim(); + return isDefaultType ? "default" : typeElement.getAttribute(ArchetypeTypeSetParser.XML_TYPE_NAME); } /** @@ -266,7 +271,7 @@ return -1; } - final String number = typeElement.getAttribute("number"); + final String number = typeElement.getAttribute(ArchetypeTypeSetParser.XML_TYPE_NUMBER); try { return Integer.parseInt(number); } catch (final NumberFormatException ignored) { @@ -310,9 +315,10 @@ final ArchetypeAttributesDefinition attributes = new ArchetypeAttributesDefinition(); final Element requiredElement = NodeListIterator.getFirstChild(typeElement, XML_ELEMENT_REQUIRED); if (requiredElement != null) { - final Iterator<Element> it = new NodeListIterator<Element>(requiredElement, XML_ELEMENT_ATTRIBUTE); - while (it.hasNext()) { - final Element attributeElement = it.next(); + final Iterator<Element> attributeIterator = new NodeListIterator<Element>(requiredElement, XML_ELEMENT_ATTRIBUTE); + while (attributeIterator.hasNext()) { + final Element attributeElement = attributeIterator.next(); + final Attr archAttribute = attributeElement.getAttributeNode(XML_ATTRIBUTE_ARCH); if (archAttribute == null) { errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, XML_ELEMENT_REQUIRED + ": element of type " + typeName + ": " + XML_ELEMENT_ATTRIBUTE + " missing '" + XML_ATTRIBUTE_ARCH + "'."); @@ -349,14 +355,16 @@ * @param ignoreTable the ignore table to add to */ private static void parseAttributeAttributes(@NotNull final Element ignoreElement, @NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final Collection<String> ignoreTable) { - final Iterator<Element> it = new NodeListIterator<Element>(ignoreElement, XML_ELEMENT_ATTRIBUTE); - while (it.hasNext()) { - final Element elem = it.next(); - final Attr archAttribute = elem.getAttributeNode(XML_ATTRIBUTE_ARCH); + final Iterator<Element> attributeIterator = new NodeListIterator<Element>(ignoreElement, XML_ELEMENT_ATTRIBUTE); + while (attributeIterator.hasNext()) { + final Element attributeElement = attributeIterator.next(); + + final Attr archAttribute = attributeElement.getAttributeNode(XML_ATTRIBUTE_ARCH); if (archAttribute == null) { errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, XML_ELEMENT_IGNORE + ": section of type " + typeName + ": " + XML_ELEMENT_ATTRIBUTE + " missing '" + XML_ATTRIBUTE_ARCH + "'."); continue; } + final String arch = archAttribute.getValue(); if (arch.isEmpty()) { errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, XML_ELEMENT_IGNORE + ": section of type " + typeName + ": " + XML_ELEMENT_ATTRIBUTE + " empty '" + XML_ATTRIBUTE_ARCH + "'."); @@ -376,19 +384,20 @@ * @param ignorelistsDefinition the ignore lists to use */ private static void parseIgnoreListAttribute(@NotNull final Element ignoreElement, @NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final Collection<String> ignoreTable, @NotNull final IgnorelistsDefinition ignorelistsDefinition) { - final Iterator<Element> it2 = new NodeListIterator<Element>(ignoreElement, XML_ELEMENT_IGNORE_LIST); - while (it2.hasNext()) { - final Element elem = it2.next(); - final Attr nameAttribute = elem.getAttributeNode(XML_IGNORE_LIST_NAME); + final Iterator<Element> ignoreListIterator = new NodeListIterator<Element>(ignoreElement, XML_ELEMENT_IGNORE_LIST); + while (ignoreListIterator.hasNext()) { + final Element ignoreListElement = ignoreListIterator.next(); + + final Attr nameAttribute = ignoreListElement.getAttributeNode(XML_IGNORE_LIST_NAME); if (nameAttribute == null) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, XML_ELEMENT_IGNORE + ": section of type " + typeName + ": ignore_list missing '" + XML_IGNORE_LIST_NAME + "'."); + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, XML_ELEMENT_IGNORE + ": section of type " + typeName + ": "+ XML_ELEMENT_IGNORE_LIST + " missing '" + XML_IGNORE_LIST_NAME + "'."); continue; } final String name = nameAttribute.getValue(); final Iterable<String> ignoreList = ignorelistsDefinition.get(name); if (ignoreList == null) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, XML_ELEMENT_IGNORE + ": section of type " + typeName + ": ignore_list with name \"" + name + "\" is undefined."); + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, XML_ELEMENT_IGNORE + ": section of type " + typeName + ": " + XML_ELEMENT_IGNORE_LIST + " with "+ XML_IGNORE_LIST_NAME + " \"" + name + "\" is undefined."); continue; } @@ -423,30 +432,26 @@ /** * Parses the {@link #XML_ELEMENT_ATTRIBUTE} and {@link - * #XML_ELEMENT_SECTION} children of a "type" or "default_type" element. + * #XML_ELEMENT_SECTION} children of a "type" or "default_type" element and + * adds all found attributes to an {@link ArchetypeAttribute}. * @param typeElement the type element to parse + * @param attributes the archetype attributes to add to * @param errorViewCollector the error view collector for reporting errors * @param typeName the type name of the element being parsed * @param typeNo the type number of the element being parsed * @param sectionNames the defined section names * @param archetypeTypeSet archetype type list - * @return the archetype type or <code>null</code> */ - @NotNull - private ArchetypeAttributes parseAttributeList(@NotNull final Element typeElement, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final String typeName, final int typeNo, @NotNull final SectionNames sectionNames, @NotNull final Collection<String> autoIgnoreTable, @NotNull final ArchetypeTypeSet archetypeTypeSet) { - final ArchetypeAttributes archetypeAttributes = new ArchetypeAttributes(); + private void addAttributeList(@NotNull final Element typeElement, @NotNull final ArchetypeAttributes attributes, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final String typeName, final int typeNo, @NotNull final SectionNames sectionNames, @NotNull final ArchetypeTypeSet archetypeTypeSet) { + final Iterator<Element> childIterator = new NodeListIterator<Element>(typeElement, Node.ELEMENT_NODE); + while (childIterator.hasNext()) { + final Element childElement = childIterator.next(); + final String childName = childElement.getNodeName(); - final Iterator<Element> it = new NodeListIterator<Element>(typeElement, Node.ELEMENT_NODE); - while (it.hasNext()) { - final Element node = it.next(); - final String nodeName = node.getNodeName(); - - if (nodeName.equals(XML_ELEMENT_ATTRIBUTE)) { - parseAttribute(node, errorViewCollector, typeName, typeNo, sectionNames, null, archetypeTypeSet, archetypeAttributes, autoIgnoreTable); - } - - if (nodeName.equals(XML_ELEMENT_SECTION) && node.hasChildNodes()) { - final Attr nameAttribute = node.getAttributeNode(XML_SECTION_NAME); + if (childName.equals(XML_ELEMENT_ATTRIBUTE)) { + parseAttribute(childElement, errorViewCollector, typeName, typeNo, sectionNames, null, archetypeTypeSet, attributes); + } else if (childName.equals(XML_ELEMENT_SECTION) && childElement.hasChildNodes()) { + final Attr nameAttribute = childElement.getAttributeNode(XML_SECTION_NAME); if (nameAttribute == null) { errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + " contains a " + XML_ELEMENT_SECTION + " missing '" + XML_SECTION_NAME + "'."); continue; @@ -460,14 +465,12 @@ sectionNames.defineSectionName(sectionName); - final Iterator<Element> it2 = new NodeListIterator<Element>(node, XML_ELEMENT_ATTRIBUTE); - while (it2.hasNext()) { - parseAttribute(it2.next(), errorViewCollector, typeName, typeNo, sectionNames, sectionName, archetypeTypeSet, archetypeAttributes, autoIgnoreTable); + final Iterator<Element> attributeIterator = new NodeListIterator<Element>(childElement, XML_ELEMENT_ATTRIBUTE); + while (attributeIterator.hasNext()) { + parseAttribute(attributeIterator.next(), errorViewCollector, typeName, typeNo, sectionNames, sectionName, archetypeTypeSet, attributes); } } } - - return archetypeAttributes; } /** @@ -480,14 +483,16 @@ * @param sectionName the section name or <code>null</code> for top-level * attributes * @param archetypeTypeSet archetype type list + * @param attributes the attribute will be added to this */ - private void parseAttribute(@NotNull final Element attributeElement, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final String typeName, final int typeNo, @NotNull final SectionNames sectionNames, @Nullable final String sectionName, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeAttributes archetypeAttributes, @NotNull final Collection<String> autoIgnoreTable) { + private void parseAttribute(@NotNull final Element attributeElement, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final String typeName, final int typeNo, @NotNull final SectionNames sectionNames, @Nullable final String sectionName, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeAttributes attributes) { final ArchetypeAttribute archetypeAttribute = parseAttribute(attributeElement, errorViewCollector, typeName, typeNo, sectionName, archetypeTypeSet); - if (archetypeAttribute != null) { - sectionNames.defineSectionName(archetypeAttribute.getSectionName()); - archetypeAttributes.add(archetypeAttribute); - autoIgnoreTable.add(archetypeAttribute.getArchetypeAttributeName()); + if (archetypeAttribute == null) { + return; } + + sectionNames.defineSectionName(archetypeAttribute.getSectionName()); + attributes.add(archetypeAttribute); } /** @@ -516,7 +521,7 @@ } try { - return archetypeAttributeParser.load(errorViewCollector, attributeElement, archetypeTypeSet, typeName, effectiveSectionName); + return archetypeAttributeParser.load(attributeElement, errorViewCollector, archetypeTypeSet, typeName, effectiveSectionName); } catch (final MissingAttributeException ex) { errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + ": " + ex.getMessage()); return null; Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2010-05-25 16:30:00 UTC (rev 7999) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2010-05-26 18:19:27 UTC (rev 8000) @@ -22,8 +22,6 @@ import java.io.IOException; import java.util.Iterator; import javax.xml.parsers.DocumentBuilder; -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathExpressionException; import net.sf.gridarta.model.errorview.ErrorViewCategory; import net.sf.gridarta.model.errorview.ErrorViewCollector; import net.sf.gridarta.utils.SyntaxErrorException; @@ -52,6 +50,105 @@ private static final String XML_ELEMENT_DEFAULT_TYPE = "default_type"; /** + * The name of the "bitmasks" element. + */ + @NotNull + private static final String XML_ELEMENT_BITMASKS = "bitmasks"; + + /** + * The name of the "bitmask" element. + */ + @NotNull + private static final String XML_ELEMENT_BITMASK = "bitmask"; + + /** + * The name of the "name" attribute within {@link #XML_ELEMENT_BITMASK} + * elements. + */ + @NotNull + private static final String XML_BITMASK_NAME = "name"; + + /** + * The name of the "is_named" attribute within {@link #XML_ELEMENT_BITMASK} + * elements. + */ + @NotNull + private static final String XML_BITMASK_IS_NAMED = "is_named"; + + /** + * The name of the "bmentry" element. + */ + @NotNull + private static final String XML_ELEMENT_BMENTRY = "bmentry"; + + /** + * The name of the "bit" attribute within {@link #XML_ELEMENT_BMENTRY} + * elements. + */ + @NotNull + private static final String XML_BMENTRY_BIT = "bit"; + + /** + * The name of the "name" attribute within {@link #XML_ELEMENT_BMENTRY} + * elements. + */ + @NotNull + private static final String XML_BMENTRY_NAME = "name"; + + /** + * The name of the "value" attribute within {@link #XML_ELEMENT_BMENTRY} + * elements. + */ + @NotNull + private static final String XML_BMENTRY_VALUE = "value"; + + /** + * The name of the "encoding" attribute within {@link #XML_ELEMENT_BMENTRY} + * elements. + */ + @NotNull + private static final String XML_BMENTRY_ENCODING = "encoding"; + + /** + * The name of the "lists" element. + */ + @NotNull + private static final String XML_ELEMENT_LISTS = "lists"; + + /** + * The name of the "list" element. + */ + @NotNull + private static final String XML_ELEMENT_LIST = "list"; + + /** + * The name of the "name" attribute within {@link #XML_ELEMENT_LIST} + * elements. + */ + @NotNull + private static final String XML_LIST_NAME = "name"; + + /** + * The name of the "listentry" element. + */ + @NotNull + private static final String XML_ELEMENT_LISTENTRY = "listentry"; + + /** + * The name of the "name" attribute within {@link #XML_ELEMENT_LISTENTRY} + * elements. + */ + @NotNull + private static final String XML_LISTENTRY_NAME = "name"; + + /** + * The name of the "value" attribute within {@link #XML_ELEMENT_LISTENTRY} + * elements. + */ + @NotNull + private static final String XML_LISTENTRY_VALUE = "value"; + + /** * The name of the "type" element. */ @NotNull @@ -65,6 +162,39 @@ private static final String XML_TYPE_AVAILABLE = "available"; /** + * The name of the "name" attribute within {@link #XML_ELEMENT_TYPE} or + * {@link #XML_ELEMENT_DEFAULT_TYPE} elements. + */ + @NotNull + public static final String XML_TYPE_NAME = "name"; + + /** + * The name of the "number" attribute within {@link #XML_ELEMENT_TYPE} + * elements. + */ + @NotNull + public static final String XML_TYPE_NUMBER = "number"; + + /** + * The name of the "ignorelists" element. + */ + @NotNull + private static final String XML_ELEMENT_IGNORELISTS = "ignorelists"; + + /** + * The name of the "ignore_list" element. + */ + @NotNull + private static final String XML_ELEMENT_IGNORE_LIST = "ignore_list"; + + /** + * The name of the "name" attribute within {@link #XML_ELEMENT_IGNORE_LIST} + * elements. + */ + @NotNull + private static final String XML_IGNORE_LIST_NAME = "name"; + + /** * The logger for printing log messages. */ @NotNull @@ -77,12 +207,6 @@ private final DocumentBuilder documentBuilder; /** - * The {@link }XPath} for using XPath. - */ - @NotNull - private final XPath xpath; - - /** * The {@link ArchetypeTypeSet} to update. */ @NotNull @@ -97,14 +221,11 @@ /** * Creates a new instance. * @param documentBuilder the document builder to use - * @param xpath the XPath instance to use for applying for XPath - * expressions * @param archetypeTypeSet the archetype type set to update * @param archetypeTypeParser the archetype type parser to use */ - public ArchetypeTypeSetParser(@NotNull final DocumentBuilder documentBuilder, @NotNull final XPath xpath, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeTypeParser archetypeTypeParser) { + public ArchetypeTypeSetParser(@NotNull final DocumentBuilder documentBuilder, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeTypeParser archetypeTypeParser) { this.documentBuilder = documentBuilder; - this.xpath = xpath; this.archetypeTypeSet = archetypeTypeSet; this.archetypeTypeParser = archetypeTypeParser; } @@ -137,68 +258,77 @@ * file */ public void loadTypesFromXML(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final String filename, @NotNull final Document document) { - try { - final Element rootElement = document.getDocumentElement(); - parseBitmasks(errorViewCollector, rootElement); - parseLists(errorViewCollector, rootElement); - final IgnorelistsDefinition ignorelistsDefinition = parseIgnoreLists(errorViewCollector, rootElement); + final Element rootElement = document.getDocumentElement(); + parseBitmasks(getChild(rootElement, XML_ELEMENT_BITMASKS), errorViewCollector); + parseLists(getChild(rootElement, XML_ELEMENT_LISTS), errorViewCollector); + final IgnorelistsDefinition ignorelistsDefinition = parseIgnoreLists(getChild(rootElement, XML_ELEMENT_IGNORELISTS), errorViewCollector); + parseDefaultType(getChild(rootElement, XML_ELEMENT_DEFAULT_TYPE), errorViewCollector, ignorelistsDefinition); - final Element defaultTypeElement = NodeListIterator.getFirstChild(rootElement, XML_ELEMENT_DEFAULT_TYPE); - assert defaultTypeElement != null; // types.xml makes sure this holds - parseDefaultType(errorViewCollector, defaultTypeElement, ignorelistsDefinition); + final Iterator<Element> typeElements = new NodeListIterator<Element>(rootElement, XML_ELEMENT_TYPE); + while (typeElements.hasNext()) { + parseTypes(typeElements.next(), errorViewCollector, ignorelistsDefinition); + } - final Iterator<Element> typeElements = new NodeListIterator<Element>(rootElement, XML_ELEMENT_TYPE); - while (typeElements.hasNext()) { - parseTypes(typeElements.next(), errorViewCollector, ignorelistsDefinition); - } - - if (log.isInfoEnabled()) { - log.info("Loaded " + archetypeTypeSet.getLength() + " types from '" + filename + "\'"); - } - } catch (final XPathExpressionException e) { - errorViewCollector.addWarning(ErrorViewCategory.INTERNAL_ERROR, "XPath error: " + e.getMessage()); + if (log.isInfoEnabled()) { + log.info("Loaded " + archetypeTypeSet.getLength() + " types from '" + filename + "\'"); } archetypeTypeSet.defineFallbackArchetypeType(); } /** - * Parses the "bitmasks" section of a types.xml file. + * Returns a child {@link Element} of a parent element. The child element + * must exist. + * @param parentElement the parent element + * @param childName the name of the child element + * @return the child element + */ + @NotNull + private static Element getChild(@NotNull final Element parentElement, @NotNull final String childName) { + final Element element = NodeListIterator.getFirstChild(parentElement, childName); + if (element == null) { + throw new IllegalArgumentException("child element '" + childName + "' does not exist"); + } + return element; + } + + /** + * Parses the {@link #XML_ELEMENT_BITMASKS} section of a types.xml file. + * @param bitmasksElement the element to parse * @param errorViewCollector the error view collector for reporting errors - * @param element the element to parse - * @throws XPathExpressionException if an internal error occurs */ - private void parseBitmasks(@NotNull final ErrorViewCollector errorViewCollector, final Element element) throws XPathExpressionException { - final Iterator<Element> it = new NodeListIterator<Element>(xpath, element, "bitmasks/bitmask"); - while (it.hasNext()) { - final Element elem = it.next(); - final AttributeBitmask attributeBitmask = parseBitmask(errorViewCollector, elem); + private void parseBitmasks(@NotNull final Element bitmasksElement, @NotNull final ErrorViewCollector errorViewCollector) { + final Iterator<Element> bitmaskIterator = new NodeListIterator<Element>(bitmasksElement, XML_ELEMENT_BITMASK); + while (bitmaskIterator.hasNext()) { + final Element bitmaskElement = bitmaskIterator.next(); + + final String name = bitmaskElement.getAttribute(XML_BITMASK_NAME); + final AttributeBitmask attributeBitmask = parseBitmask(bitmaskElement, name, errorViewCollector); if (attributeBitmask != null) { - archetypeTypeSet.addBitmask(elem.getAttribute("name"), attributeBitmask); + archetypeTypeSet.addBitmask(name, attributeBitmask); } } } /** - * Parses a "bitmasks/bitmask" section of a types.xml file. + * Parses a {@link #XML_ELEMENT_BITMASK} section of a types.xml file. + * @param bitmaskElement the element to parse + * @param name the name of the bitmask element * @param errorViewCollector the error view collector for reporting errors - * @param element the element to parse or <code>null</code> if the entry is - * invalid - * @return the parsed bitmask attribute - * @throws XPathExpressionException if an internal error occurs + * @return the parsed bitmask attribute or <code>null</code> if the entry is + * invalid */ @Nullable - private AttributeBitmask parseBitmask(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final Element element) throws XPathExpressionException { - final String name = element.getAttribute("name"); - final boolean isNamed = element.getAttribute("is_named").equals("yes"); + private static AttributeBitmask parseBitmask(@NotNull final Element bitmaskElement, @NotNull final String name, @NotNull final ErrorViewCollector errorViewCollector) { + final boolean isNamed = bitmaskElement.getAttribute(XML_BITMASK_IS_NAMED).equals("yes"); final AttributeBitmask attributeBitmask = new AttributeBitmask(isNamed); - final NodeListIterator<Element> entries = new NodeListIterator<Element>(xpath, element, "bmentry"); + final NodeListIterator<Element> entries = new NodeListIterator<Element>(bitmaskElement, XML_ELEMENT_BMENTRY); while (entries.hasNext()) { - parseBmentry(errorViewCollector, entries.next(), name, isNamed, attributeBitmask); + parseBmentry(entries.next(), errorViewCollector, name, isNamed, attributeBitmask); } if (attributeBitmask.getNumber() <= 0) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, name + ": no 'bit' entries"); + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, name + ": no '" + XML_BMENTRY_BIT + "' entries"); return null; } @@ -215,35 +345,35 @@ } /** - * Parses a "bmentry" section of a types.xml file. + * Parses a {@link #XML_ELEMENT_BMENTRY} section of a types.xml file. * @param errorViewCollector the error view collector for reporting errors - * @param element the "bmentry" section to parse + * @param bmentryElement the "bmentry" section to parse * @param bitmaskName the name of the parent's "bitmask" section for error * messages * @param isNamed whether the bitmask attribute is named * @param attributeBitmask the bitmask attribute to update */ - private static void parseBmentry(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final Element element, @NotNull final String bitmaskName, final boolean isNamed, @NotNull final AttributeBitmask attributeBitmask) { - final String bitAttribute = element.getAttribute("bit"); + private static void parseBmentry(@NotNull final Element bmentryElement, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final String bitmaskName, final boolean isNamed, @NotNull final AttributeBitmask attributeBitmask) { + final String bitAttribute = bmentryElement.getAttribute(XML_BMENTRY_BIT); - final String valueAttribute = element.getAttribute("value"); + final String valueAttribute = bmentryElement.getAttribute(XML_BMENTRY_VALUE); if (bitAttribute.length() != 0 && valueAttribute.length() != 0) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, bitmaskName + ": element contains both 'bit' and 'value' attributes"); + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, bitmaskName + ": element contains both '" + XML_BMENTRY_BIT + "' and '" + XML_BMENTRY_VALUE + "' attributes"); return; } - final String name = element.getAttribute("name"); + final String name = bmentryElement.getAttribute(XML_BMENTRY_NAME); final int value; if (bitAttribute.length() == 0) { if (!isNamed) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, bitmaskName + ": 'value' attribute allowed only in named bitmasks"); + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, bitmaskName + ": '" + XML_BMENTRY_VALUE + "' attribute allowed only in named bitmasks"); return; } try { value = Integer.parseInt(valueAttribute); } catch (final NumberFormatException ignored) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, bitmaskName + ": invalid 'value' value: " + valueAttribute); + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, bitmaskName + ": invalid '" + XML_BMENTRY_VALUE + "' value: " + valueAttribute); return; } } else { @@ -251,15 +381,15 @@ try { bitValue = Integer.parseInt(bitAttribute); } catch (final NumberFormatException ignored) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, bitmaskName + ": invalid 'bit' value: " + bitAttribute); + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, bitmaskName + ": invalid '" + ... [truncated message content] |
From: <aki...@us...> - 2010-05-25 16:30:08
|
Revision: 7999 http://gridarta.svn.sourceforge.net/gridarta/?rev=7999&view=rev Author: akirschbaum Date: 2010-05-25 16:30:00 +0000 (Tue, 25 May 2010) Log Message: ----------- Cleanup parser for/document <type> and <default_type> elements within types.xml. Modified Paths: -------------- trunk/resource/system/dtd/types.dtd 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 Modified: trunk/resource/system/dtd/types.dtd =================================================================== --- trunk/resource/system/dtd/types.dtd 2010-05-25 07:40:59 UTC (rev 7998) +++ trunk/resource/system/dtd/types.dtd 2010-05-25 16:30:00 UTC (rev 7999) @@ -85,6 +85,8 @@ xml:base CDATA #IMPLIED > +<!-- available: the type is ignored when set to "no"; can be used to + temporarily disable type definitions. --> <!ELEMENT type (import_type?,required?,ignore?,description?,use?,(section | attribute)*)> <!ATTLIST type xml:base CDATA #IMPLIED @@ -109,6 +111,8 @@ name CDATA #REQUIRED > +<!-- type: type number; integer value --> +<!-- name: name for the type --> <!-- arch: section name to be ignored (within <ignore_list>) --> <!-- min/max: absolute allowed range; editor rejects --> <!-- check_min/check_max: recommended range; editor warns --> Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeParser.java 2010-05-25 07:40:59 UTC (rev 7998) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeParser.java 2010-05-25 16:30:00 UTC (rev 7999) @@ -92,7 +92,7 @@ * @param typeName (descriptive) name of the type this attribute belongs to * (e.g. "Weapon") * @param sectionName the section name for the new attribute - * @return the archetype attribute + * @return the archetype attribute or <code>null</code> if an error occurs * @throws MissingAttributeException if the element cannot be parsed */ @Nullable Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java 2010-05-25 07:40:59 UTC (rev 7998) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java 2010-05-25 16:30:00 UTC (rev 7999) @@ -22,7 +22,6 @@ import java.util.Collection; import java.util.HashSet; import java.util.Iterator; -import java.util.Set; import net.sf.gridarta.model.errorview.ErrorViewCategory; import net.sf.gridarta.model.errorview.ErrorViewCollector; import net.sf.japi.xml.NodeListIterator; @@ -44,33 +43,69 @@ * Attribute Element Name. */ @NotNull - public static final String XML_ATTRIBUTE = "attribute"; + public static final String XML_ELEMENT_ATTRIBUTE = "attribute"; /** * Required Element Name. */ @NotNull - private static final String XML_REQUIRED = "required"; + private static final String XML_ELEMENT_REQUIRED = "required"; /** * Ignore Element Name. */ @NotNull - private static final String XML_IGNORE = "ignore"; + private static final String XML_ELEMENT_IGNORE = "ignore"; /** + * Ignore List Element Name. + */ + @NotNull + private static final String XML_ELEMENT_IGNORE_LIST = "ignore_list"; + + /** * Import Type Element Name. */ @NotNull - private static final String XML_IMPORT_TYPE = "import_type"; + private static final String XML_ELEMENT_IMPORT_TYPE = "import_type"; /** - * Value Element Name. + * Section Element Name. */ @NotNull - private static final String XML_VALUE = "value"; + private static final String XML_ELEMENT_SECTION = "section"; /** + * The "arch" attribute name of a {@link #XML_ELEMENT_ATTRIBUTE} element. + */ + @NotNull + public static final String XML_ATTRIBUTE_ARCH = "arch"; + + /** + * The "value" attribute name of a {@link #XML_ELEMENT_ATTRIBUTE} element. + */ + @NotNull + private static final String XML_ATTRIBUTE_VALUE = "value"; + + /** + * The "name" attribute name of a {@link #XML_ELEMENT_IGNORE_LIST} element. + */ + @NotNull + private static final String XML_IGNORE_LIST_NAME = "name"; + + /** + * The "name" attribute name of a {@link #XML_ELEMENT_IMPORT_TYPE} element. + */ + @NotNull + private static final String XML_IMPORT_TYPE_NAME = "name"; + + /** + * The "name" attribute name of a {@link #XML_ELEMENT_SECTION} element. + */ + @NotNull + private static final String XML_SECTION_NAME = "name"; + + /** * Description Element Name. */ @NotNull @@ -83,12 +118,6 @@ private static final String XML_USE = "use"; /** - * Section Element Name. - */ - @NotNull - private static final String XML_SECTION = "section"; - - /** * The parser to use. */ @NotNull @@ -103,42 +132,41 @@ } /** - * Loading the data from an xml type element into this instance. Since users - * are expected to edit the type definitions, I have tried to design the - * parser to be somewhat robust and provide error feedback. + * Parses an element which contains a list of <attribute> elements + * from a types.xml file. + * @param typeElement the xml 'type' element which is going to be parsed * @param errorViewCollector the error view collector for reporting errors * @param parent the parent archetype type - * @param root the xml 'type' element which is going to be parsed * @param archetypeTypeSet archetype type list * @param ignorelistsDefinition the ignore_lists contents + * @param isDefaultType whether this element is the "default_type" * @return the archetype type or <code>null</code> * @todo I'm sucking slow, improve me */ @NotNull - public ArchetypeType load(@NotNull final ErrorViewCollector errorViewCollector, @Nullable final ArchetypeType parent, @NotNull final Element root, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final IgnorelistsDefinition ignorelistsDefinition) { - final boolean isDefaultType = root.getNodeName().equals("default_type"); - final String typeName = parseTypeName(root, isDefaultType); - final Set<String> ignoreTable = new HashSet<String>(); - final int typeNo = parseTypeNo(root, isDefaultType, typeName, errorViewCollector); - final ArchetypeAttributesDefinition typeAttributes = parseTypeAttributes(root, isDefaultType, typeName, typeNo, errorViewCollector, ignoreTable, ignorelistsDefinition); - final String importName = parseImportName(root, typeName, errorViewCollector); + public ArchetypeType loadAttributeList(@NotNull final Element typeElement, @NotNull final ErrorViewCollector errorViewCollector, @Nullable final ArchetypeType parent, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final IgnorelistsDefinition ignorelistsDefinition, final boolean isDefaultType) { + final String typeName = parseTypeName(typeElement, isDefaultType); + final int typeNo = parseTypeNo(typeElement, isDefaultType, typeName, errorViewCollector); + final Collection<String> ignoreTable = new HashSet<String>(); + final ArchetypeAttributesDefinition typeAttributes = isDefaultType ? new ArchetypeAttributesDefinition() : parseTypeAttributes(typeElement, typeName, errorViewCollector, ignoreTable, ignorelistsDefinition); + final String importType = parseImportType(typeElement, typeName, errorViewCollector); final ArchetypeAttributes attributes = new ArchetypeAttributes(); final SectionNames sectionNames = new SectionNames(); final Collection<String> autoIgnoreTable = new HashSet<String>(); - attributes.addAll(parseAttrList(root, errorViewCollector, typeName, typeNo, sectionNames, autoIgnoreTable, archetypeTypeSet)); + attributes.addAll(parseAttributeList(typeElement, errorViewCollector, typeName, typeNo, sectionNames, autoIgnoreTable, archetypeTypeSet)); if (parent != null) { attributes.addAll(getDefaultList(parent, autoIgnoreTable, ignoreTable)); if (parent.hasAttribute()) { - attributes.addAll(importName(importName, errorViewCollector, typeName, archetypeTypeSet, autoIgnoreTable)); + attributes.addAll(importName(importType, errorViewCollector, typeName, archetypeTypeSet, autoIgnoreTable)); } } attributes.setSectionNames(sectionNames); - return new ArchetypeType(typeName, typeNo, parseDescription(root), parseUse(root), sectionNames.getSectionNames(), attributes, typeAttributes); + return new ArchetypeType(typeName, typeNo, parseDescription(typeElement), parseUse(typeElement), sectionNames.getSectionNames(), attributes, typeAttributes); } @NotNull - private ArchetypeAttributes getDefaultList(@NotNull final Iterable<ArchetypeAttribute> archetypeType, @NotNull final Collection<String> autoIgnoreTable, @NotNull final Set<String> ignoreTable) { + private ArchetypeAttributes getDefaultList(@NotNull final Iterable<ArchetypeAttribute> archetypeType, @NotNull final Collection<String> autoIgnoreTable, @NotNull final Collection<String> ignoreTable) { final ArchetypeAttributes defaultList = new ArchetypeAttributes(); for (final ArchetypeAttribute archetypeAttribute : archetypeType) { @@ -183,50 +211,66 @@ return importList; } + /** + * Parses the {@link #XML_ELEMENT_IMPORT_TYPE} of a "type" or "default_type" + * {@link Element}. + * @param typeElement the element + * @param typeName the type name for error messages + * @param errorViewCollector the error view collector for error messages + * @return the import type name or <code>null</code> if no import_type is + * present or an error occurs + */ @Nullable - private static String parseImportName(@NotNull final Element root, @NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector) { - final Element elem = NodeListIterator.getFirstChild(root, XML_IMPORT_TYPE); - if (elem == null) { + private static String parseImportType(@NotNull final Element typeElement, @NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector) { + final Element importTypeElement = NodeListIterator.getFirstChild(typeElement, XML_ELEMENT_IMPORT_TYPE); + if (importTypeElement == null) { return null; } - final Attr a1 = elem.getAttributeNode("name"); - if (a1 == null) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + " has " + XML_IMPORT_TYPE + " element without 'name'."); + final Attr nameAttribute = importTypeElement.getAttributeNode(XML_IMPORT_TYPE_NAME); + if (nameAttribute == null) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + " has " + XML_ELEMENT_IMPORT_TYPE + " element without '" + XML_IMPORT_TYPE_NAME + "'."); return null; } - return a1.getValue().trim(); + final String name = nameAttribute.getValue(); + if (name.isEmpty()) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + " has " + XML_ELEMENT_IMPORT_TYPE + " element with empty '" + XML_IMPORT_TYPE_NAME + "'."); + return null; + } + + return name; } /** * Parses the type name of a "type" or "default_type" {@link Element}. - * @param root the element + * @param typeElement the element * @param isDefaultType whether the element is a "default_type" * @return the type name */ @NotNull - private static String parseTypeName(@NotNull final Element root, final boolean isDefaultType) { - return isDefaultType ? "default" : root.getAttribute("name").trim(); + private static String parseTypeName(@NotNull final Element typeElement, final boolean isDefaultType) { + return isDefaultType ? "default" : typeElement.getAttribute("name").trim(); } /** * Parses the type number of a "type" or "default_type" {@link Element}. - * @param root the element + * @param typeElement the element * @param isDefaultType whether the element is a "default_type" * @param typeName the type name for error messages * @param errorViewCollector the error view collector for error messages * @return the type number */ - private static int parseTypeNo(@NotNull final Element root, final boolean isDefaultType, @NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector) { + private static int parseTypeNo(@NotNull final Element typeElement, final boolean isDefaultType, @NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector) { if (isDefaultType) { return -1; } + final String number = typeElement.getAttribute("number"); try { - return Integer.parseInt(root.getAttribute("number").trim()); + return Integer.parseInt(number); } catch (final NumberFormatException ignored) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + " has invalid type number '" + root.getAttribute("number") + "'."); + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + " has invalid type number '" + number + "'."); return -1; } } @@ -234,111 +278,123 @@ /** * Parses the type attributes of a "type" or "default_type" {@link * Element}. - * @param root the element - * @param isDefaultType whether the element is a "default_type" + * @param typeElement the element * @param typeName the type name for error messages - * @param typeNo the type number for error messages * @param errorViewCollector the error view collector for error messages * @param ignoreTable returns the "ignore" attributes * @param ignorelistsDefinition the defined ignore lists * @return the type attributes */ @NotNull - private static ArchetypeAttributesDefinition parseTypeAttributes(@NotNull final Element root, final boolean isDefaultType, @NotNull final String typeName, final int typeNo, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final Set<String> ignoreTable, @NotNull final IgnorelistsDefinition ignorelistsDefinition) { - if (isDefaultType) { - // special case: default type (this one contains the default attributes) - return new ArchetypeAttributesDefinition(); - } + private static ArchetypeAttributesDefinition parseTypeAttributes(@NotNull final Element typeElement, @NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final Collection<String> ignoreTable, @NotNull final IgnorelistsDefinition ignorelistsDefinition) { + final ArchetypeAttributesDefinition typeAttributes = parseRequiredAttribute(typeElement, typeName, errorViewCollector); - final ArchetypeAttributesDefinition typeAttributes = parseRequiredAttribute(root, typeName, errorViewCollector); - - // parse 'ignore' elements - final Element ignoreElement = NodeListIterator.getFirstChild(root, XML_IGNORE); + final Element ignoreElement = NodeListIterator.getFirstChild(typeElement, XML_ELEMENT_IGNORE); if (ignoreElement != null) { - // load all attributes in the ignore section - parseAttributeAttributes(typeName, errorViewCollector, ignoreTable, ignoreElement); - - // load attributes from ignore lists - parseIgnoreListAttribute(typeName, errorViewCollector, ignoreTable, ignorelistsDefinition, ignoreElement); + parseAttributeAttributes(ignoreElement, typeName, errorViewCollector, ignoreTable); + parseIgnoreListAttribute(ignoreElement, typeName, errorViewCollector, ignoreTable, ignorelistsDefinition); } return typeAttributes; } /** - * Parses the {@link #XML_REQUIRED} child. - * @param root the root element + * Parses the {@link #XML_ELEMENT_REQUIRED} child. + * @param typeElement the root element * @param typeName the type name * @param errorViewCollector the error view collector for error messages * @return the type definitions */ @NotNull - private static ArchetypeAttributesDefinition parseRequiredAttribute(@NotNull final Element root, @NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector) { + private static ArchetypeAttributesDefinition parseRequiredAttribute(@NotNull final Element typeElement, @NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector) { final ArchetypeAttributesDefinition attributes = new ArchetypeAttributesDefinition(); - final Element required = NodeListIterator.getFirstChild(root, XML_REQUIRED); - if (required != null) { - final Iterator<Element> it = new NodeListIterator<Element>(required, XML_ATTRIBUTE); + final Element requiredElement = NodeListIterator.getFirstChild(typeElement, XML_ELEMENT_REQUIRED); + if (requiredElement != null) { + final Iterator<Element> it = new NodeListIterator<Element>(requiredElement, XML_ELEMENT_ATTRIBUTE); while (it.hasNext()) { - final Element elem = it.next(); - final Attr a1 = elem.getAttributeNode(ArchetypeAttributeParser.XML_KEY_ARCH); - final Attr a2 = elem.getAttributeNode(XML_VALUE); - if (a1 == null || a2 == null) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, XML_REQUIRED + ": element of type " + typeName + ": " + XML_ATTRIBUTE + " missing '" + ArchetypeAttributeParser.XML_KEY_ARCH + "' or '" + XML_VALUE + "'."); - } else { - attributes.add(new ArchetypeAttributeDefinition(a1.getValue().trim(), a2.getValue().trim())); + final Element attributeElement = it.next(); + final Attr archAttribute = attributeElement.getAttributeNode(XML_ATTRIBUTE_ARCH); + if (archAttribute == null) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, XML_ELEMENT_REQUIRED + ": element of type " + typeName + ": " + XML_ELEMENT_ATTRIBUTE + " missing '" + XML_ATTRIBUTE_ARCH + "'."); + continue; } + final String arch = archAttribute.getValue(); + if (arch.isEmpty()) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, XML_ELEMENT_REQUIRED + ": element of type " + typeName + ": " + XML_ELEMENT_ATTRIBUTE + " empty '" + XML_ATTRIBUTE_ARCH + "'."); + continue; + } + + final Attr valueAttribute = attributeElement.getAttributeNode(XML_ATTRIBUTE_VALUE); + if (valueAttribute == null) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, XML_ELEMENT_REQUIRED + ": element of type " + typeName + ": " + XML_ELEMENT_ATTRIBUTE + " missing '" + XML_ATTRIBUTE_VALUE + "'."); + continue; + } + final String value = valueAttribute.getValue(); + if (value.isEmpty()) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, XML_ELEMENT_REQUIRED + ": element of type " + typeName + ": " + XML_ELEMENT_ATTRIBUTE + " empty '" + XML_ATTRIBUTE_VALUE + "'."); + continue; + } + + attributes.add(new ArchetypeAttributeDefinition(arch, value)); } } return attributes; } /** - * Parses the {@link #XML_ATTRIBUTE} child. + * Parses the {@link #XML_ELEMENT_ATTRIBUTE} child. + * @param ignoreElement the ignore element to parse * @param typeName the type name for error messages * @param errorViewCollector the error view collector for error messages * @param ignoreTable the ignore table to add to - * @param ignoreElement the ignore element to parse */ - private static void parseAttributeAttributes(@NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final Set<String> ignoreTable, @NotNull final Element ignoreElement) { - final Iterator<Element> it = new NodeListIterator<Element>(ignoreElement, XML_ATTRIBUTE); + private static void parseAttributeAttributes(@NotNull final Element ignoreElement, @NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final Collection<String> ignoreTable) { + final Iterator<Element> it = new NodeListIterator<Element>(ignoreElement, XML_ELEMENT_ATTRIBUTE); while (it.hasNext()) { final Element elem = it.next(); - final Attr a1 = elem.getAttributeNode(ArchetypeAttributeParser.XML_KEY_ARCH); - if (a1 == null) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, XML_IGNORE + ": section of type " + typeName + ": " + XML_ATTRIBUTE + " missing '" + ArchetypeAttributeParser.XML_KEY_ARCH + "'."); - } else { - ignoreTable.add(a1.getValue().trim()); + final Attr archAttribute = elem.getAttributeNode(XML_ATTRIBUTE_ARCH); + if (archAttribute == null) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, XML_ELEMENT_IGNORE + ": section of type " + typeName + ": " + XML_ELEMENT_ATTRIBUTE + " missing '" + XML_ATTRIBUTE_ARCH + "'."); + continue; } + final String arch = archAttribute.getValue(); + if (arch.isEmpty()) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, XML_ELEMENT_IGNORE + ": section of type " + typeName + ": " + XML_ELEMENT_ATTRIBUTE + " empty '" + XML_ATTRIBUTE_ARCH + "'."); + continue; + } + + ignoreTable.add(arch); } } /** * Parses the "ignore_list" children. + * @param ignoreElement the ignore element to parse * @param typeName the type name for error messages * @param errorViewCollector the error view collector for error messages * @param ignoreTable the ignore table to add to * @param ignorelistsDefinition the ignore lists to use - * @param ignoreElement the ignore element to parse */ - private static void parseIgnoreListAttribute(@NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final Set<String> ignoreTable, @NotNull final IgnorelistsDefinition ignorelistsDefinition, @NotNull final Element ignoreElement) { - final Iterator<Element> it2 = new NodeListIterator<Element>(ignoreElement, "ignore_list"); + private static void parseIgnoreListAttribute(@NotNull final Element ignoreElement, @NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final Collection<String> ignoreTable, @NotNull final IgnorelistsDefinition ignorelistsDefinition) { + final Iterator<Element> it2 = new NodeListIterator<Element>(ignoreElement, XML_ELEMENT_IGNORE_LIST); while (it2.hasNext()) { final Element elem = it2.next(); - final Attr a1 = elem.getAttributeNode("name"); - if (a1 == null) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, XML_IGNORE + ": section of type " + typeName + ": ignore_list missing 'name'."); - } else { - final String name = a1.getValue().trim(); - final Iterable<String> ignoreList = ignorelistsDefinition.get(name); - if (ignoreList != null) { - // just copy everything from ignore list to this ignore section - for (final String ignItem : ignoreList) { - ignoreTable.add(ignItem); - } - } else { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, XML_IGNORE + ": section of type " + typeName + ": ignore_list with name \"" + a1.getValue() + "\" is undefined."); - } + final Attr nameAttribute = elem.getAttributeNode(XML_IGNORE_LIST_NAME); + if (nameAttribute == null) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, XML_ELEMENT_IGNORE + ": section of type " + typeName + ": ignore_list missing '" + XML_IGNORE_LIST_NAME + "'."); + continue; } + + final String name = nameAttribute.getValue(); + final Iterable<String> ignoreList = ignorelistsDefinition.get(name); + if (ignoreList == null) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, XML_ELEMENT_IGNORE + ": section of type " + typeName + ": ignore_list with name \"" + name + "\" is undefined."); + continue; + } + + for (final String ignoreItem : ignoreList) { + ignoreTable.add(ignoreItem); + } } } @@ -366,80 +422,105 @@ } /** - * Parses an XML attribute element. If parsing succeeds, the new {@link - * ArchetypeAttribute} is added to the temporary linked list provided by the - * parameters (see below). Assignment of sections to attributes also happens - * in this method. + * Parses the {@link #XML_ELEMENT_ATTRIBUTE} and {@link + * #XML_ELEMENT_SECTION} children of a "type" or "default_type" element. + * @param typeElement the type element to parse * @param errorViewCollector the error view collector for reporting errors - * @param typeName the archetype type's name - * @param typeNo the archetype type's type number - * @param elem the XML attribute element + * @param typeName the type name of the element being parsed + * @param typeNo the type number of the element being parsed * @param sectionNames the defined section names - * @param inSection true if this attribute belongs to a (custom-defined) - * section - * @param section name of the section (only relevant if 'inSection'==true) - * @param archetypeTypeSet arch type list - * @return the parsed attribute or <code>null</code> if an error occurs + * @param archetypeTypeSet archetype type list + * @return the archetype type or <code>null</code> */ - @Nullable - private ArchetypeAttribute parseAttribute(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final String typeName, final int typeNo, final Element elem, final SectionNames sectionNames, final boolean inSection, final String section, final ArchetypeTypeSet archetypeTypeSet) { - final ArchetypeAttribute archetypeAttribute; - try { - archetypeAttribute = archetypeAttributeParser.load(errorViewCollector, elem, archetypeTypeSet, typeName, inSection ? section : typeNo == -1 ? SectionNames.GENERAL_SECTION : SectionNames.SPECIAL_SECTION); - } catch (final MissingAttributeException ex) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + ": " + ex.getMessage()); - return null; - } - - if (archetypeAttribute != null) { - sectionNames.defineSectionName(archetypeAttribute.getSectionName()); - } - return archetypeAttribute; - } - @NotNull - private ArchetypeAttributes parseAttrList(@NotNull final Element root, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final String typeName, final int typeNo, @NotNull final SectionNames sectionNames, @NotNull final Collection<String> autoIgnoreTable, @NotNull final ArchetypeTypeSet archetypeTypeSet) { - final ArchetypeAttributes attributeList = new ArchetypeAttributes(); + private ArchetypeAttributes parseAttributeList(@NotNull final Element typeElement, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final String typeName, final int typeNo, @NotNull final SectionNames sectionNames, @NotNull final Collection<String> autoIgnoreTable, @NotNull final ArchetypeTypeSet archetypeTypeSet) { + final ArchetypeAttributes archetypeAttributes = new ArchetypeAttributes(); - // now get all children and process them in order: - final Iterator<Element> it = new NodeListIterator<Element>(root, Node.ELEMENT_NODE); + final Iterator<Element> it = new NodeListIterator<Element>(typeElement, Node.ELEMENT_NODE); while (it.hasNext()) { - final Element elem = it.next(); - // attribute directly in type element - if (elem.getNodeName().equals(XML_ATTRIBUTE)) { - parseAttr(errorViewCollector, typeName, typeNo, elem, sectionNames, null, archetypeTypeSet, attributeList, autoIgnoreTable); + final Element node = it.next(); + final String nodeName = node.getNodeName(); + + if (nodeName.equals(XML_ELEMENT_ATTRIBUTE)) { + parseAttribute(node, errorViewCollector, typeName, typeNo, sectionNames, null, archetypeTypeSet, archetypeAttributes, autoIgnoreTable); } - // attributes in a section - if (elem.getNodeName().equals(XML_SECTION) && elem.hasChildNodes()) { - final Attr a1 = elem.getAttributeNode("name"); - if (a1 == null) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + " contains a " + XML_SECTION + " missing 'name'."); + if (nodeName.equals(XML_ELEMENT_SECTION) && node.hasChildNodes()) { + final Attr nameAttribute = node.getAttributeNode(XML_SECTION_NAME); + if (nameAttribute == null) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + " contains a " + XML_ELEMENT_SECTION + " missing '" + XML_SECTION_NAME + "'."); continue; } - final String sectionName = a1.getValue().trim(); + final String sectionName = nameAttribute.getValue(); + if (sectionName.isEmpty()) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + " contains a " + XML_ELEMENT_SECTION + " with empty '" + XML_SECTION_NAME + "'."); + continue; + } + sectionNames.defineSectionName(sectionName); - // parse all attributes in the section - final Iterator<Element> it2 = new NodeListIterator<Element>(elem, XML_ATTRIBUTE); + final Iterator<Element> it2 = new NodeListIterator<Element>(node, XML_ELEMENT_ATTRIBUTE); while (it2.hasNext()) { - final Element elem2 = it2.next(); - // got an attribute element possibly in a section - parseAttr(errorViewCollector, typeName, typeNo, elem2, sectionNames, sectionName, archetypeTypeSet, attributeList, autoIgnoreTable); + parseAttribute(it2.next(), errorViewCollector, typeName, typeNo, sectionNames, sectionName, archetypeTypeSet, archetypeAttributes, autoIgnoreTable); } } } - return attributeList; + return archetypeAttributes; } - private void parseAttr(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final String typeName, final int typeNo, @NotNull final Element elem, @NotNull final SectionNames sectionNames, @Nullable final String section, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeAttributes attrList, @NotNull final Collection<String> autoIgnoreTable) { - final ArchetypeAttribute archetypeAttribute = parseAttribute(errorViewCollector, typeName, typeNo, elem, sectionNames, section != null, section, archetypeTypeSet); + /** + * Parses an {@link #XML_ELEMENT_ATTRIBUTE} element. + * @param attributeElement the attribute element to parse + * @param errorViewCollector the error view collector for reporting errors + * @param typeName the type name of the element being parsed + * @param typeNo the type number of the element being parsed + * @param sectionNames the defined section names + * @param sectionName the section name or <code>null</code> for top-level + * attributes + * @param archetypeTypeSet archetype type list + */ + private void parseAttribute(@NotNull final Element attributeElement, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final String typeName, final int typeNo, @NotNull final SectionNames sectionNames, @Nullable final String sectionName, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeAttributes archetypeAttributes, @NotNull final Collection<String> autoIgnoreTable) { + final ArchetypeAttribute archetypeAttribute = parseAttribute(attributeElement, errorViewCollector, typeName, typeNo, sectionName, archetypeTypeSet); if (archetypeAttribute != null) { - attrList.add(archetypeAttribute); + sectionNames.defineSectionName(archetypeAttribute.getSectionName()); + archetypeAttributes.add(archetypeAttribute); autoIgnoreTable.add(archetypeAttribute.getArchetypeAttributeName()); } } + /** + * Parses an XML attribute element. If parsing succeeds, the new {@link + * ArchetypeAttribute} is added to the temporary linked list provided by the + * parameters (see below). Assignment of sections to attributes also happens + * in this method. + * @param attributeElement the XML attribute element + * @param errorViewCollector the error view collector for reporting errors + * @param typeName the archetype type's name + * @param typeNo the archetype type's type number + * @param sectionName name of the section or <code>null</code> for top-level + * attribute definitions + * @param archetypeTypeSet arch type list + * @return the parsed attribute or <code>null</code> if an error occurs + */ + @Nullable + private ArchetypeAttribute parseAttribute(@NotNull final Element attributeElement, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final String typeName, final int typeNo, @Nullable final String sectionName, @NotNull final ArchetypeTypeSet archetypeTypeSet) { + final String effectiveSectionName; + if (sectionName != null) { + effectiveSectionName = sectionName; + } else if (typeNo == -1) { + effectiveSectionName = SectionNames.GENERAL_SECTION; + } else { + effectiveSectionName = SectionNames.SPECIAL_SECTION; + } + + try { + return archetypeAttributeParser.load(errorViewCollector, attributeElement, archetypeTypeSet, typeName, effectiveSectionName); + } catch (final MissingAttributeException ex) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "type " + typeName + ": " + ex.getMessage()); + return null; + } + } + } // class ArchetypeTypeParser Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2010-05-25 07:40:59 UTC (rev 7998) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2010-05-25 16:30:00 UTC (rev 7999) @@ -46,6 +46,25 @@ public class ArchetypeTypeSetParser { /** + * The name of the "default_type" element. + */ + @NotNull + private static final String XML_ELEMENT_DEFAULT_TYPE = "default_type"; + + /** + * The name of the "type" element. + */ + @NotNull + private static final String XML_ELEMENT_TYPE = "type"; + + /** + * The name of the "available" attribute within {@link #XML_ELEMENT_TYPE} + * elements. + */ + @NotNull + private static final String XML_TYPE_AVAILABLE = "available"; + + /** * The logger for printing log messages. */ @NotNull @@ -119,13 +138,20 @@ */ public void loadTypesFromXML(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final String filename, @NotNull final Document document) { try { - final Element root = document.getDocumentElement(); - parseBitmasks(errorViewCollector, root); - parseLists(errorViewCollector, root); - final IgnorelistsDefinition ignorelistsDefinition = parseIgnoreLists(errorViewCollector, root); - parseDefaultType(errorViewCollector, root, ignorelistsDefinition); - parseTypes(errorViewCollector, root, ignorelistsDefinition); + final Element rootElement = document.getDocumentElement(); + parseBitmasks(errorViewCollector, rootElement); + parseLists(errorViewCollector, rootElement); + final IgnorelistsDefinition ignorelistsDefinition = parseIgnoreLists(errorViewCollector, rootElement); + final Element defaultTypeElement = NodeListIterator.getFirstChild(rootElement, XML_ELEMENT_DEFAULT_TYPE); + assert defaultTypeElement != null; // types.xml makes sure this holds + parseDefaultType(errorViewCollector, defaultTypeElement, ignorelistsDefinition); + + final Iterator<Element> typeElements = new NodeListIterator<Element>(rootElement, XML_ELEMENT_TYPE); + while (typeElements.hasNext()) { + parseTypes(typeElements.next(), errorViewCollector, ignorelistsDefinition); + } + if (log.isInfoEnabled()) { log.info("Loaded " + archetypeTypeSet.getLength() + " types from '" + filename + "\'"); } @@ -350,33 +376,23 @@ /** * Parses the "default_type" section of a types.xml file. * @param errorViewCollector the error view collector for reporting errors - * @param element the element to parse + * @param defaultTypeElement the element to parse * @param ignorelistsDefinition the contents of the "ignorelists" section */ - private void parseDefaultType(@NotNull final ErrorViewCollector errorViewCollector, final Element element, @NotNull final IgnorelistsDefinition ignorelistsDefinition) { - final Element el = NodeListIterator.getFirstChild(element, "default_type"); - if (el == null) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "default_type element is missing!"); - return; - } - - final ArchetypeType defaultType = archetypeTypeParser.load(errorViewCollector, null, el, archetypeTypeSet, ignorelistsDefinition); + private void parseDefaultType(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final Element defaultTypeElement, @NotNull final IgnorelistsDefinition ignorelistsDefinition) { + final ArchetypeType defaultType = archetypeTypeParser.loadAttributeList(defaultTypeElement, errorViewCollector, null, archetypeTypeSet, ignorelistsDefinition, true); archetypeTypeSet.setDefaultArchetypeType(defaultType); } /** - * Parses the "type" section of a types.xml file. + * Parses a "type" element of a types.xml file. + * @param typeElement the type element to parse * @param errorViewCollector the error view collector for reporting errors - * @param element the element to parse * @param ignorelistsDefinition the contents of the "ignorelists" section */ - private void parseTypes(@NotNull final ErrorViewCollector errorViewCollector, final Element element, @NotNull final IgnorelistsDefinition ignorelistsDefinition) { - final Iterator<Element> it = new NodeListIterator<Element>(element, "type"); - while (it.hasNext()) { - final Element elem = it.next(); - if (!elem.getAttribute("available").equals("no")) { - archetypeTypeSet.add(archetypeTypeParser.load(errorViewCollector, archetypeTypeSet.getDefaultArchetypeType(), elem, archetypeTypeSet, ignorelistsDefinition)); - } + private void parseTypes(@NotNull final Element typeElement, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final IgnorelistsDefinition ignorelistsDefinition) { + if (!typeElement.getAttribute(XML_TYPE_AVAILABLE).equals("no")) { + archetypeTypeSet.add(archetypeTypeParser.loadAttributeList(typeElement, errorViewCollector, archetypeTypeSet.getDefaultArchetypeType(), archetypeTypeSet, ignorelistsDefinition, false)); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-25 07:41:09
|
Revision: 7998 http://gridarta.svn.sourceforge.net/gridarta/?rev=7998&view=rev Author: akirschbaum Date: 2010-05-25 07:40:59 +0000 (Tue, 25 May 2010) Log Message: ----------- Simplify code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java 2010-05-24 22:01:25 UTC (rev 7997) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java 2010-05-25 07:40:59 UTC (rev 7998) @@ -20,10 +20,9 @@ package net.sf.gridarta.model.archetypetype; import java.util.Collection; -import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; -import java.util.Map; +import java.util.Set; import net.sf.gridarta.model.errorview.ErrorViewCategory; import net.sf.gridarta.model.errorview.ErrorViewCollector; import net.sf.japi.xml.NodeListIterator; @@ -119,7 +118,7 @@ public ArchetypeType load(@NotNull final ErrorViewCollector errorViewCollector, @Nullable final ArchetypeType parent, @NotNull final Element root, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final IgnorelistsDefinition ignorelistsDefinition) { final boolean isDefaultType = root.getNodeName().equals("default_type"); final String typeName = parseTypeName(root, isDefaultType); - final Map<String, String> ignoreTable = new HashMap<String, String>(); + final Set<String> ignoreTable = new HashSet<String>(); final int typeNo = parseTypeNo(root, isDefaultType, typeName, errorViewCollector); final ArchetypeAttributesDefinition typeAttributes = parseTypeAttributes(root, isDefaultType, typeName, typeNo, errorViewCollector, ignoreTable, ignorelistsDefinition); final String importName = parseImportName(root, typeName, errorViewCollector); @@ -139,12 +138,12 @@ } @NotNull - private ArchetypeAttributes getDefaultList(@NotNull final Iterable<ArchetypeAttribute> archetypeType, @NotNull final Collection<String> autoIgnoreTable, @NotNull final Map<String, String> ignoreTable) { + private ArchetypeAttributes getDefaultList(@NotNull final Iterable<ArchetypeAttribute> archetypeType, @NotNull final Collection<String> autoIgnoreTable, @NotNull final Set<String> ignoreTable) { final ArchetypeAttributes defaultList = new ArchetypeAttributes(); for (final ArchetypeAttribute archetypeAttribute : archetypeType) { // add all attributes from the default_type which are not in the ignoreTable - if (!ignoreTable.containsKey(archetypeAttribute.getArchetypeAttributeName()) && !autoIgnoreTable.contains(archetypeAttribute.getArchetypeAttributeName())) { + if (!ignoreTable.contains(archetypeAttribute.getArchetypeAttributeName()) && !autoIgnoreTable.contains(archetypeAttribute.getArchetypeAttributeName())) { defaultList.add(archetypeAttribute.clone()); } } @@ -245,7 +244,7 @@ * @return the type attributes */ @NotNull - private static ArchetypeAttributesDefinition parseTypeAttributes(@NotNull final Element root, final boolean isDefaultType, @NotNull final String typeName, final int typeNo, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final Map<String, String> ignoreTable, @NotNull final IgnorelistsDefinition ignorelistsDefinition) { + private static ArchetypeAttributesDefinition parseTypeAttributes(@NotNull final Element root, final boolean isDefaultType, @NotNull final String typeName, final int typeNo, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final Set<String> ignoreTable, @NotNull final IgnorelistsDefinition ignorelistsDefinition) { if (isDefaultType) { // special case: default type (this one contains the default attributes) return new ArchetypeAttributesDefinition(); @@ -300,7 +299,7 @@ * @param ignoreTable the ignore table to add to * @param ignoreElement the ignore element to parse */ - private static void parseAttributeAttributes(@NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final Map<String, String> ignoreTable, @NotNull final Element ignoreElement) { + private static void parseAttributeAttributes(@NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final Set<String> ignoreTable, @NotNull final Element ignoreElement) { final Iterator<Element> it = new NodeListIterator<Element>(ignoreElement, XML_ATTRIBUTE); while (it.hasNext()) { final Element elem = it.next(); @@ -308,7 +307,7 @@ if (a1 == null) { errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, XML_IGNORE + ": section of type " + typeName + ": " + XML_ATTRIBUTE + " missing '" + ArchetypeAttributeParser.XML_KEY_ARCH + "'."); } else { - ignoreTable.put(a1.getValue().trim(), ""); + ignoreTable.add(a1.getValue().trim()); } } } @@ -321,7 +320,7 @@ * @param ignorelistsDefinition the ignore lists to use * @param ignoreElement the ignore element to parse */ - private static void parseIgnoreListAttribute(@NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final Map<String, String> ignoreTable, @NotNull final IgnorelistsDefinition ignorelistsDefinition, @NotNull final Element ignoreElement) { + private static void parseIgnoreListAttribute(@NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final Set<String> ignoreTable, @NotNull final IgnorelistsDefinition ignorelistsDefinition, @NotNull final Element ignoreElement) { final Iterator<Element> it2 = new NodeListIterator<Element>(ignoreElement, "ignore_list"); while (it2.hasNext()) { final Element elem = it2.next(); @@ -334,7 +333,7 @@ if (ignoreList != null) { // just copy everything from ignore list to this ignore section for (final String ignItem : ignoreList) { - ignoreTable.put(ignItem, ""); + ignoreTable.add(ignItem); } } else { errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, XML_IGNORE + ": section of type " + typeName + ": ignore_list with name \"" + a1.getValue() + "\" is undefined."); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-24 22:01:31
|
Revision: 7997 http://gridarta.svn.sourceforge.net/gridarta/?rev=7997&view=rev Author: akirschbaum Date: 2010-05-24 22:01:25 +0000 (Mon, 24 May 2010) Log Message: ----------- Remove some fields from DefaultObjectChooser. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java Modified: trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java 2010-05-24 22:00:15 UTC (rev 7996) +++ trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java 2010-05-24 22:01:25 UTC (rev 7997) @@ -126,84 +126,6 @@ private int selectedIndex = -2; /** - * The {@link ChangeListener} attached to {@link #tabbedPane}. - */ - @NotNull - private final ChangeListener changeListener = new ChangeListener() { - - /** {@inheritDoc} */ - @Override - public void stateChanged(final ChangeEvent e) { - updateSelectedIndex(); - } - - }; - - /** - * The listener used to detect selection changes in the archetype chooser. - */ - @NotNull - private final ArchetypeChooserModelListener<G, A, R> archetypeChooserModelListener = new ArchetypeChooserModelListener<G, A, R>() { - - /** {@inheritDoc} */ - @Override - public void selectedPanelChanged(@NotNull final ArchetypeChooserPanel<G, A, R> selectedPanel) { - // ignore - } - - /** {@inheritDoc} */ - @Override - public void selectedFolderChanged(@NotNull final ArchetypeChooserFolder<G, A, R> selectedFolder) { - // ignore - } - - /** {@inheritDoc} */ - @Override - public void selectedArchetypeChanged(@Nullable final R selectedArchetype) { - if (!isPickmapActive()) { - fireSelectionChanged(selectedArchetype); - } - } - - /** {@inheritDoc} */ - @Override - public void directionChanged(@Nullable final Integer direction) { - // ignore - } - - }; - - /** - * The listener used to detect changed active pickmaps. - */ - @NotNull - private final PickmapChooserModelListener<G, A, R> pickmapChooserModelListener = new PickmapChooserModelListener<G, A, R>() { - - /** {@inheritDoc} */ - @Override - public void activePickmapChanged(@Nullable final MapFile<G, A, R> mapFile) { - if (activeMapFile != mapFile) { // ignore non-changes - updateActivePickmap(mapFile); - } - } - - /** {@inheritDoc} */ - @Override - public void pickmapReverted(@NotNull final MapFile<G, A, R> mapFile) { - if (activeMapFile == mapFile) { // ignore unless active pickmap was reverted - updateActivePickmap(mapFile); - } - } - - /** {@inheritDoc} */ - @Override - public void pickmapModifiedChanged(final int index, final MapFile<G, A, R> mapFile) { - // ignore - } - - }; - - /** * The map cursor listener attached to {@link #activePickmapView}. */ @NotNull @@ -241,12 +163,78 @@ addTab(archetypeChooserControl); addTab(pickmapChooserControl); + + final ChangeListener changeListener = new ChangeListener() { + + /** {@inheritDoc} */ + @Override + public void stateChanged(final ChangeEvent e) { + updateSelectedIndex(); + } + + }; tabbedPane.addChangeListener(changeListener); + updateSelectedIndex(); add(tabbedPane, BorderLayout.CENTER); add(objectChoiceDisplay, BorderLayout.SOUTH); + final ArchetypeChooserModelListener<G, A, R> archetypeChooserModelListener = new ArchetypeChooserModelListener<G, A, R>() { + + /** {@inheritDoc} */ + @Override + public void selectedPanelChanged(@NotNull final ArchetypeChooserPanel<G, A, R> selectedPanel) { + // ignore + } + + /** {@inheritDoc} */ + @Override + public void selectedFolderChanged(@NotNull final ArchetypeChooserFolder<G, A, R> selectedFolder) { + // ignore + } + + /** {@inheritDoc} */ + @Override + public void selectedArchetypeChanged(@Nullable final R selectedArchetype) { + if (!isPickmapActive()) { + fireSelectionChanged(selectedArchetype); + } + } + + /** {@inheritDoc} */ + @Override + public void directionChanged(@Nullable final Integer direction) { + // ignore + } + + }; archetypeChooserModel.addArchetypeChooserModelListener(archetypeChooserModelListener); + + final PickmapChooserModelListener<G, A, R> pickmapChooserModelListener = new PickmapChooserModelListener<G, A, R>() { + + /** {@inheritDoc} */ + @Override + public void activePickmapChanged(@Nullable final MapFile<G, A, R> mapFile) { + if (activeMapFile != mapFile) { // ignore non-changes + updateActivePickmap(mapFile); + } + } + + /** {@inheritDoc} */ + @Override + public void pickmapReverted(@NotNull final MapFile<G, A, R> mapFile) { + if (activeMapFile == mapFile) { // ignore unless active pickmap was reverted + updateActivePickmap(mapFile); + } + } + + /** {@inheritDoc} */ + @Override + public void pickmapModifiedChanged(final int index, final MapFile<G, A, R> mapFile) { + // ignore + } + + }; pickmapChooserModel.addPickmapChooserListener(pickmapChooserModelListener); objectChoiceDisplay.showObjectChooserQuickObject(cursorSelection, isPickmapActive()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-24 22:00:22
|
Revision: 7996 http://gridarta.svn.sourceforge.net/gridarta/?rev=7996&view=rev Author: akirschbaum Date: 2010-05-24 22:00:15 +0000 (Mon, 24 May 2010) Log Message: ----------- Rename variable name. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java Modified: trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java 2010-05-24 21:59:33 UTC (rev 7995) +++ trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java 2010-05-24 22:00:15 UTC (rev 7996) @@ -269,7 +269,7 @@ @Nullable ObjectChooserTab<G, A, R> tab; try { tab = tabs.get(index); - } catch (final IndexOutOfBoundsException ex) { + } catch (final IndexOutOfBoundsException ignored) { tab = null; } if (activeTab == tab) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-24 21:59:40
|
Revision: 7995 http://gridarta.svn.sourceforge.net/gridarta/?rev=7995&view=rev Author: akirschbaum Date: 2010-05-24 21:59:33 +0000 (Mon, 24 May 2010) Log Message: ----------- Add @NotNull annotations; simplify code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/HelpActionListener.java Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/HelpActionListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/HelpActionListener.java 2010-05-24 21:57:16 UTC (rev 7994) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/HelpActionListener.java 2010-05-24 21:59:33 UTC (rev 7995) @@ -24,8 +24,7 @@ import java.awt.event.ActionListener; import javax.swing.JOptionPane; import net.sf.gridarta.model.archetypetype.ArchetypeAttribute; -import org.apache.log4j.Category; -import org.apache.log4j.Logger; +import org.jetbrains.annotations.NotNull; /** * ActionListener for help-buttons. @@ -34,18 +33,15 @@ public class HelpActionListener implements ActionListener { /** - * The Logger for printing log messages. - */ - private static final Category log = Logger.getLogger(HelpActionListener.class); - - /** * The {@link ArchetypeAttribute} which contains help information. */ + @NotNull private final ArchetypeAttribute archetypeAttribute; /** * The component for help dialogs. */ + @NotNull private final Component parent; /** @@ -53,10 +49,7 @@ * @param a the gameObject attribute where this help button belongs to * @param parent the parent component for help dialogs */ - public HelpActionListener(final ArchetypeAttribute a, final Component parent) { - if (a == null) { - throw new IllegalArgumentException("HelpActionListener without context"); - } + public HelpActionListener(@NotNull final ArchetypeAttribute a, @NotNull final Component parent) { archetypeAttribute = a; this.parent = parent; } @@ -65,13 +58,8 @@ * {@inheritDoc} */ @Override - public void actionPerformed(final ActionEvent e) { - if (archetypeAttribute != null) { - popupHelp(archetypeAttribute.getAttributeName(), archetypeAttribute.getDescription()); - } else { - assert false; - log.warn("Help without help context!"); - } + public void actionPerformed(@NotNull final ActionEvent e) { + popupHelp(archetypeAttribute.getAttributeName(), archetypeAttribute.getDescription()); } /** @@ -79,7 +67,7 @@ * @param title name of attribute * @param msg message text */ - private void popupHelp(final String title, final String msg) { + private void popupHelp(@NotNull final String title, @NotNull final String msg) { JOptionPane.showMessageDialog(parent, msg, "Help: " + title, JOptionPane.PLAIN_MESSAGE); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-24 21:57:23
|
Revision: 7994 http://gridarta.svn.sourceforge.net/gridarta/?rev=7994&view=rev Author: akirschbaum Date: 2010-05-24 21:57:16 +0000 (Mon, 24 May 2010) Log Message: ----------- Make function static. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2010-05-24 21:56:48 UTC (rev 7993) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2010-05-24 21:57:16 UTC (rev 7994) @@ -197,7 +197,7 @@ * @param isNamed whether the bitmask attribute is named * @param attributeBitmask the bitmask attribute to update */ - private void parseBmentry(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final Element element, @NotNull final String bitmaskName, final boolean isNamed, @NotNull final AttributeBitmask attributeBitmask) { + private static void parseBmentry(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final Element element, @NotNull final String bitmaskName, final boolean isNamed, @NotNull final AttributeBitmask attributeBitmask) { final String bitAttribute = element.getAttribute("bit"); final String valueAttribute = element.getAttribute("value"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-24 21:56:54
|
Revision: 7993 http://gridarta.svn.sourceforge.net/gridarta/?rev=7993&view=rev Author: akirschbaum Date: 2010-05-24 21:56:48 +0000 (Mon, 24 May 2010) Log Message: ----------- Fix typo. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFactory.java Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFactory.java 2010-05-24 21:56:12 UTC (rev 7992) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFactory.java 2010-05-24 21:56:48 UTC (rev 7993) @@ -29,7 +29,7 @@ public interface ArchetypeAttributeFactory { /** - * Creates a new "anim name" archetype attribute. + * Creates a new "animname" archetype attribute. * @param archetypeAttributeName the archetype attribute name * @param attributeName the user interface attribute name * @param description the attribute's description This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-24 21:56:19
|
Revision: 7992 http://gridarta.svn.sourceforge.net/gridarta/?rev=7992&view=rev Author: akirschbaum Date: 2010-05-24 21:56:12 +0000 (Mon, 24 May 2010) Log Message: ----------- Make function static. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java 2010-05-24 21:55:36 UTC (rev 7991) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java 2010-05-24 21:56:12 UTC (rev 7992) @@ -309,7 +309,7 @@ * @param archetypeType the archetype type * @param title the title to prepend the entry */ - private void format(@NotNull final StringBuilder sb, @NotNull final ArchetypeType archetypeType, @NotNull final String title) { + private static void format(@NotNull final StringBuilder sb, @NotNull final ArchetypeType archetypeType, @NotNull final String title) { sb.append(title); sb.append(':'); archetypeType.toString(sb); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-24 21:55:43
|
Revision: 7991 http://gridarta.svn.sourceforge.net/gridarta/?rev=7991&view=rev Author: akirschbaum Date: 2010-05-24 21:55:36 +0000 (Mon, 24 May 2010) Log Message: ----------- Fix typos. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.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/gridarta.ipr trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/HelpActionListener.java trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java trunk/src/app/net/sf/gridarta/gui/prefs/AppPrefs.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/model/archetypetype/ArchetypeAttributeFactory.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributes.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/gui/prefs/AppPreferencesModel.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/gui/prefs/AppPrefsModel.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-24 21:42:37 UTC (rev 7990) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2010-05-24 21:55:36 UTC (rev 7991) @@ -36,7 +36,7 @@ import net.sf.gridarta.gui.mappropertiesdialog.MapPropertiesDialogFactory; import net.sf.gridarta.gui.newmap.NewMapDialogFactory; import net.sf.gridarta.gui.prefs.AppPrefs; -import net.sf.gridarta.gui.prefs.AppPrefsModel; +import net.sf.gridarta.gui.prefs.AppPreferencesModel; import net.sf.gridarta.gui.prefs.DevPrefs; import net.sf.gridarta.gui.prefs.GUIPrefs; import net.sf.gridarta.gui.prefs.MapValidatorPrefs; @@ -159,27 +159,27 @@ /** * Preferences default for auto validation. */ - private static final boolean PREFS_VALIDATOR_AUTO_DEFAULT = false; + private static final boolean PREFERENCES_VALIDATOR_AUTO_DEFAULT = false; /** * The horizontal size of a map square. */ - private static final int SQUARE_ISO_XLEN = 48; + private static final int SQUARE_ISO_X_LEN = 48; /** * The horizontal center of a map square. */ - private static final int SQUARE_ISO_XLEN2 = 24; + private static final int SQUARE_ISO_X_LEN2 = 24; /** * The vertical size of a map square. */ - private static final int SQUARE_ISO_YLEN = 23; + private static final int SQUARE_ISO_Y_LEN = 23; /** * The vertical center of a map square. */ - private static final int SQUARE_ISO_YLEN2 = 12; + private static final int SQUARE_ISO_Y_LEN2 = 12; /** * The Logger for printing log messages. @@ -195,7 +195,7 @@ * The {@link IsoMapSquareInfo} instance. */ @NotNull - private final IsoMapSquareInfo isoMapSquareInfo = new IsoMapSquareInfo(SQUARE_ISO_XLEN, SQUARE_ISO_XLEN2, SQUARE_ISO_YLEN, SQUARE_ISO_YLEN2); + private final IsoMapSquareInfo isoMapSquareInfo = new IsoMapSquareInfo(SQUARE_ISO_X_LEN, SQUARE_ISO_X_LEN2, SQUARE_ISO_Y_LEN, SQUARE_ISO_Y_LEN2); /** * The {@link MultiPositionData} to query for multi-part objects. @@ -216,7 +216,7 @@ * {@inheritDoc} */ @Override - public int getDoubleFaceOffest() { + public int getDoubleFaceOffset() { return isoMapSquareInfo.getYlen() - 1; } @@ -471,8 +471,8 @@ */ @NotNull @Override - public AppPrefsModel createAppPrefsModel() { - return new AppPrefsModel("../server/atrinik_server", System.getProperty("os.name").toLowerCase().startsWith("win") ? "../client/atrinik.exe" : "../client-0.1/atrinik", "vim"); + public AppPreferencesModel createAppPreferencesModel() { + return new AppPreferencesModel("../server/atrinik_server", System.getProperty("os.name").toLowerCase().startsWith("win") ? "../client/atrinik.exe" : "../client-0.1/atrinik", "vim"); } /** @@ -528,8 +528,8 @@ */ @NotNull @Override - public PreferencesGroup createPreferencesGroup(@NotNull final GlobalSettings globalSettings, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final AppPrefsModel appPrefsModel, @NotNull final ExitConnectorModel exitConnectorModel, @NotNull final ConfigSourceFactory configSourceFactory) { - return new PreferencesGroup("Gridarta for Atrinik", new ResPrefs(globalSettings, configSourceFactory), new AppPrefs(appPrefsModel), new NetPrefs(), new GUIPrefs(globalSettings), new MiscPrefs(exitConnectorModel, globalSettings), new DevPrefs(), new UpdatePrefs(), new MapValidatorPrefs(validators, PREFS_VALIDATOR_AUTO_DEFAULT)); // prefsGroup + public PreferencesGroup createPreferencesGroup(@NotNull final GlobalSettings globalSettings, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final AppPreferencesModel appPreferencesModel, @NotNull final ExitConnectorModel exitConnectorModel, @NotNull final ConfigSourceFactory configSourceFactory) { + return new PreferencesGroup("Gridarta for Atrinik", new ResPrefs(globalSettings, configSourceFactory), new AppPrefs(appPreferencesModel), new NetPrefs(), new GUIPrefs(globalSettings), new MiscPrefs(exitConnectorModel, globalSettings), new DevPrefs(), new UpdatePrefs(), new MapValidatorPrefs(validators, PREFERENCES_VALIDATOR_AUTO_DEFAULT)); } /** @@ -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 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 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, }, resources, gameObjectSpells, numberSpells, attributeRangeChecker, 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, }, PREFERENCES_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, }, resources, gameObjectSpells, numberSpells, attributeRangeChecker, pluginParameterFactory); } /** 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-24 21:42:37 UTC (rev 7990) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2010-05-24 21:55:36 UTC (rev 7991) @@ -30,8 +30,8 @@ import net.sf.gridarta.gui.map.renderer.RendererFactory; import net.sf.gridarta.gui.mappropertiesdialog.MapPropertiesDialogFactory; import net.sf.gridarta.gui.newmap.NewMapDialogFactory; +import net.sf.gridarta.gui.prefs.AppPreferencesModel; import net.sf.gridarta.gui.prefs.AppPrefs; -import net.sf.gridarta.gui.prefs.AppPrefsModel; import net.sf.gridarta.gui.prefs.DevPrefs; import net.sf.gridarta.gui.prefs.GUIPrefs; import net.sf.gridarta.gui.prefs.MapValidatorPrefs; @@ -140,7 +140,7 @@ /** * Preferences default for auto validation. */ - private static final boolean PREFS_VALIDATOR_AUTO_DEFAULT = true; + private static final boolean PREFERENCES_VALIDATOR_AUTO_DEFAULT = true; /** * The {@link Logger} for printing log messages. @@ -166,7 +166,7 @@ * {@inheritDoc} */ @Override - public int getDoubleFaceOffest() { + public int getDoubleFaceOffset() { return 1; } @@ -361,8 +361,8 @@ */ @NotNull @Override - public AppPrefsModel createAppPrefsModel() { - return new AppPrefsModel("crossfire-server", System.getProperty("os.name").toLowerCase().startsWith("win") ? "GTKClient.exe" : "crossfire-client-gtk2", "vim"); + public AppPreferencesModel createAppPreferencesModel() { + return new AppPreferencesModel("crossfire-server", System.getProperty("os.name").toLowerCase().startsWith("win") ? "GTKClient.exe" : "crossfire-client-gtk2", "vim"); } /** @@ -395,8 +395,8 @@ */ @NotNull @Override - public PreferencesGroup createPreferencesGroup(@NotNull final GlobalSettings globalSettings, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final AppPrefsModel appPrefsModel, @NotNull final ExitConnectorModel exitConnectorModel, @NotNull final ConfigSourceFactory configSourceFactory) { - return new PreferencesGroup("Gridarta for Crossfire", new ResPrefs(globalSettings, configSourceFactory), new AppPrefs(appPrefsModel), new NetPrefs(), new GUIPrefs(globalSettings), new MiscPrefs(exitConnectorModel, globalSettings), new DevPrefs(), new UpdatePrefs(), new MapValidatorPrefs(validators, PREFS_VALIDATOR_AUTO_DEFAULT)); // prefsGroup + public PreferencesGroup createPreferencesGroup(@NotNull final GlobalSettings globalSettings, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final AppPreferencesModel appPreferencesModel, @NotNull final ExitConnectorModel exitConnectorModel, @NotNull final ConfigSourceFactory configSourceFactory) { + return new PreferencesGroup("Gridarta for Crossfire", new ResPrefs(globalSettings, configSourceFactory), new AppPrefs(appPreferencesModel), new NetPrefs(), new GUIPrefs(globalSettings), new MiscPrefs(exitConnectorModel, globalSettings), new DevPrefs(), new UpdatePrefs(), new MapValidatorPrefs(validators, PREFERENCES_VALIDATOR_AUTO_DEFAULT)); } /** @@ -405,7 +405,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 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 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, }, resources, gameObjectSpells, numberSpells, attributeRangeChecker, 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, }, PREFERENCES_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, }, 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-24 21:42:37 UTC (rev 7990) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2010-05-24 21:55:36 UTC (rev 7991) @@ -36,7 +36,7 @@ import net.sf.gridarta.gui.mappropertiesdialog.MapPropertiesDialogFactory; import net.sf.gridarta.gui.newmap.NewMapDialogFactory; import net.sf.gridarta.gui.prefs.AppPrefs; -import net.sf.gridarta.gui.prefs.AppPrefsModel; +import net.sf.gridarta.gui.prefs.AppPreferencesModel; import net.sf.gridarta.gui.prefs.DevPrefs; import net.sf.gridarta.gui.prefs.GUIPrefs; import net.sf.gridarta.gui.prefs.MapValidatorPrefs; @@ -160,27 +160,27 @@ /** * Preferences default for auto validation. */ - private static final boolean PREFS_VALIDATOR_AUTO_DEFAULT = false; + private static final boolean PREFERENCES_VALIDATOR_AUTO_DEFAULT = false; /** * The horizontal size of a map square. */ - private static final int SQUARE_ISO_XLEN = 48; + private static final int SQUARE_ISO_X_LEN = 48; /** * The horizontal center of a map square. */ - private static final int SQUARE_ISO_XLEN2 = 24; + private static final int SQUARE_ISO_X_LEN2 = 24; /** * The vertical size of a map square. */ - private static final int SQUARE_ISO_YLEN = 23; + private static final int SQUARE_ISO_Y_LEN = 23; /** * The vertical center of a map square. */ - private static final int SQUARE_ISO_YLEN2 = 12; + private static final int SQUARE_ISO_Y_LEN2 = 12; /** * The Logger for printing log messages. @@ -196,7 +196,7 @@ * The {@link IsoMapSquareInfo} instance. */ @NotNull - private final IsoMapSquareInfo isoMapSquareInfo = new IsoMapSquareInfo(SQUARE_ISO_XLEN, SQUARE_ISO_XLEN2, SQUARE_ISO_YLEN, SQUARE_ISO_YLEN2); + private final IsoMapSquareInfo isoMapSquareInfo = new IsoMapSquareInfo(SQUARE_ISO_X_LEN, SQUARE_ISO_X_LEN2, SQUARE_ISO_Y_LEN, SQUARE_ISO_Y_LEN2); /** * The {@link MultiPositionData} to query for multi-part objects. @@ -217,7 +217,7 @@ * {@inheritDoc} */ @Override - public int getDoubleFaceOffest() { + public int getDoubleFaceOffset() { return isoMapSquareInfo.getYlen() - 1; } @@ -472,8 +472,8 @@ */ @NotNull @Override - public AppPrefsModel createAppPrefsModel() { - return new AppPrefsModel("../server/daimonin_server", System.getProperty("os.name").toLowerCase().startsWith("win") ? "../client/Daimonin.exe" : "../client-BETA3-0.966/daimonin", "vim"); + public AppPreferencesModel createAppPreferencesModel() { + return new AppPreferencesModel("../server/daimonin_server", System.getProperty("os.name").toLowerCase().startsWith("win") ? "../client/Daimonin.exe" : "../client-BETA3-0.966/daimonin", "vim"); } /** @@ -529,8 +529,8 @@ */ @NotNull @Override - public PreferencesGroup createPreferencesGroup(@NotNull final GlobalSettings globalSettings, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final AppPrefsModel appPrefsModel, @NotNull final ExitConnectorModel exitConnectorModel, @NotNull final ConfigSourceFactory configSourceFactory) { - return new PreferencesGroup("Gridarta for Daimonin", new ResPrefs(globalSettings, configSourceFactory), new AppPrefs(appPrefsModel), new NetPrefs(), new GUIPrefs(globalSettings), new MiscPrefs(exitConnectorModel, globalSettings), new DevPrefs(), new UpdatePrefs(), new MapValidatorPrefs(validators, PREFS_VALIDATOR_AUTO_DEFAULT)); // prefsGroup + public PreferencesGroup createPreferencesGroup(@NotNull final GlobalSettings globalSettings, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final AppPreferencesModel appPreferencesModel, @NotNull final ExitConnectorModel exitConnectorModel, @NotNull final ConfigSourceFactory configSourceFactory) { + return new PreferencesGroup("Gridarta for Daimonin", new ResPrefs(globalSettings, configSourceFactory), new AppPrefs(appPreferencesModel), new NetPrefs(), new GUIPrefs(globalSettings), new MiscPrefs(exitConnectorModel, globalSettings), new DevPrefs(), new UpdatePrefs(), new MapValidatorPrefs(validators, PREFERENCES_VALIDATOR_AUTO_DEFAULT)); } /** @@ -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 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 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, }, resources, gameObjectSpells, numberSpells, attributeRangeChecker, 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, }, PREFERENCES_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, }, resources, gameObjectSpells, numberSpells, attributeRangeChecker, pluginParameterFactory); } /** Modified: trunk/gridarta.ipr =================================================================== --- trunk/gridarta.ipr 2010-05-24 21:42:37 UTC (rev 7990) +++ trunk/gridarta.ipr 2010-05-24 21:55:36 UTC (rev 7991) @@ -1150,6 +1150,7 @@ <w>gridarta</w> <w>ignorelists</w> <w>indices</w> + <w>japi</w> <w>javac</w> <w>longdescription</w> <w>matchers</w> Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/HelpActionListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/HelpActionListener.java 2010-05-24 21:42:37 UTC (rev 7990) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/HelpActionListener.java 2010-05-24 21:55:36 UTC (rev 7991) @@ -39,9 +39,9 @@ private static final Category log = Logger.getLogger(HelpActionListener.class); /** - * CFArchAttrib which contains help information. + * The {@link ArchetypeAttribute} which contains help information. */ - private final ArchetypeAttribute attrib; // attribute structure + private final ArchetypeAttribute archetypeAttribute; /** * The component for help dialogs. @@ -57,7 +57,7 @@ if (a == null) { throw new IllegalArgumentException("HelpActionListener without context"); } - attrib = a; + archetypeAttribute = a; this.parent = parent; } @@ -66,8 +66,8 @@ */ @Override public void actionPerformed(final ActionEvent e) { - if (attrib != null) { - popupHelp(attrib.getAttributeName(), attrib.getDescription()); + if (archetypeAttribute != null) { + popupHelp(archetypeAttribute.getAttributeName(), archetypeAttribute.getDescription()); } else { assert false; log.warn("Help without help context!"); Modified: trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java 2010-05-24 21:42:37 UTC (rev 7990) +++ trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java 2010-05-24 21:55:36 UTC (rev 7991) @@ -82,7 +82,7 @@ private final ObjectChoiceDisplay objectChoiceDisplay; /** - * Panel holding both archlist and pickmaps. + * Panel holding both archetype chooser and pickmap chooser. */ private final JTabbedPane tabbedPane = new JTabbedPane(SwingConstants.TOP); @@ -241,7 +241,6 @@ addTab(archetypeChooserControl); addTab(pickmapChooserControl); - // this listener informs the mainview which panel is active: archlist or pickmaps? tabbedPane.addChangeListener(changeListener); updateSelectedIndex(); add(tabbedPane, BorderLayout.CENTER); @@ -263,7 +262,7 @@ } /** - * Records whether the archtype chooser or the pickmap chooser is active. + * Records whether the archetype chooser or the pickmap chooser is active. * @param index the active tab index */ private void setActiveTab(final int index) { Copied: trunk/src/app/net/sf/gridarta/gui/prefs/AppPreferencesModel.java (from rev 7989, trunk/src/app/net/sf/gridarta/gui/prefs/AppPrefsModel.java) =================================================================== --- trunk/src/app/net/sf/gridarta/gui/prefs/AppPreferencesModel.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/prefs/AppPreferencesModel.java 2010-05-24 21:55:36 UTC (rev 7991) @@ -0,0 +1,161 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gui.prefs; + +import java.util.prefs.Preferences; +import net.sf.gridarta.MainControl; +import net.sf.gridarta.model.io.PathManager; +import org.jetbrains.annotations.NotNull; + +/** + * Maintains the application preferences state. + * @author Andreas Kirschbaum + */ +public class AppPreferencesModel { + + /** + * Preferences key for server application. + */ + private static final String PREFERENCES_APP_SERVER = "appServer"; + + /** + * Preferences key for client application. + */ + private static final String PREFERENCES_APP_CLIENT = "appClient"; + + /** + * Preferences key for editor application. + */ + private static final String PREFERENCES_APP_EDITOR = "appEditor"; + + /** + * Preferences. + */ + private static final Preferences PREFERENCES = Preferences.userNodeForPackage(MainControl.class); + + /** + * The default value for the server setting. + */ + @NotNull + private final String serverDefault; + + /** + * The default value for the client setting. + */ + @NotNull + private final String clientDefault; + + /** + * The default value for the editor setting. + */ + @NotNull + private final String editorDefault; + + /** + * Creates a new instance. + * @param serverDefault the default value for the server setting + * @param clientDefault the default value for the client setting + * @param editorDefault the default value for the editor setting + */ + public AppPreferencesModel(@NotNull final String serverDefault, @NotNull final String clientDefault, @NotNull final String editorDefault) { + this.serverDefault = serverDefault; + this.clientDefault = clientDefault; + this.editorDefault = editorDefault; + } + + /** + * Sets the server setting. + * @param server the server setting + */ + public static void setServer(@NotNull final String server) { + PREFERENCES.put(PREFERENCES_APP_SERVER, PathManager.path(server)); + } + + /** + * Sets the client setting. + * @param client the client setting + */ + public static void setClient(@NotNull final String client) { + PREFERENCES.put(PREFERENCES_APP_CLIENT, PathManager.path(client)); + } + + /** + * Sets the editor setting. + * @param editor the editor setting + */ + public static void setEditor(@NotNull final String editor) { + PREFERENCES.put(PREFERENCES_APP_EDITOR, PathManager.path(editor)); + } + + /** + * Returns the server setting. + * @return the server setting + */ + @NotNull + public String getServer() { + return PREFERENCES.get(PREFERENCES_APP_SERVER, serverDefault); + } + + /** + * Returns the client setting. + * @return the client setting + */ + @NotNull + public String getClient() { + return PREFERENCES.get(PREFERENCES_APP_CLIENT, clientDefault); + } + + /** + * Returns the editor setting. + * @return the editor setting + */ + @NotNull + public String getEditor() { + return PREFERENCES.get(PREFERENCES_APP_EDITOR, editorDefault); + } + + /** + * Returns the server setting's default value. + * @return the server setting's default value + */ + @NotNull + public String getServerDefault() { + return serverDefault; + } + + /** + * Returns the client setting's default value. + * @return the client setting's default value + */ + @NotNull + public String getClientDefault() { + return clientDefault; + } + + /** + * Returns the editor setting's default value. + * @return the editor setting's default value + */ + @NotNull + public String getEditorDefault() { + return editorDefault; + } + +} // class AppPreferencesModel Property changes on: trunk/src/app/net/sf/gridarta/gui/prefs/AppPreferencesModel.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/gui/prefs/AppPrefs.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/prefs/AppPrefs.java 2010-05-24 21:42:37 UTC (rev 7990) +++ trunk/src/app/net/sf/gridarta/gui/prefs/AppPrefs.java 2010-05-24 21:55:36 UTC (rev 7991) @@ -56,7 +56,7 @@ * The model. */ @NotNull - private final AppPrefsModel appPrefsModel; + private final AppPreferencesModel appPreferencesModel; /** * TextField for server executable. @@ -75,10 +75,10 @@ /** * Creates a new instance. - * @param appPrefsModel the model + * @param appPreferencesModel the model */ - public AppPrefs(@NotNull final AppPrefsModel appPrefsModel) { - this.appPrefsModel = appPrefsModel; + public AppPrefs(@NotNull final AppPreferencesModel appPreferencesModel) { + this.appPreferencesModel = appPreferencesModel; setListLabelText(ACTION_BUILDER.getString("prefsApp.title")); setListLabelIcon(ACTION_BUILDER.getIcon("prefsApp.icon")); @@ -100,9 +100,9 @@ */ @Override public void apply() { - AppPrefsModel.setServer(serverField.getText()); - AppPrefsModel.setClient(clientField.getText()); - AppPrefsModel.setEditor(editorField.getText()); + AppPreferencesModel.setServer(serverField.getText()); + AppPreferencesModel.setClient(clientField.getText()); + AppPreferencesModel.setEditor(editorField.getText()); } /** @@ -110,9 +110,9 @@ */ @Override public void revert() { - serverField.setText(appPrefsModel.getServer()); - clientField.setText(appPrefsModel.getClient()); - editorField.setText(appPrefsModel.getEditor()); + serverField.setText(appPreferencesModel.getServer()); + clientField.setText(appPreferencesModel.getClient()); + editorField.setText(appPreferencesModel.getEditor()); } /** @@ -120,9 +120,9 @@ */ @Override public void defaults() { - serverField.setText(appPrefsModel.getServerDefault()); - clientField.setText(appPrefsModel.getClientDefault()); - editorField.setText(appPrefsModel.getEditorDefault()); + serverField.setText(appPreferencesModel.getServerDefault()); + clientField.setText(appPreferencesModel.getClientDefault()); + editorField.setText(appPreferencesModel.getEditorDefault()); } /** @@ -130,7 +130,7 @@ */ @Override public boolean isChanged() { - return !(serverField.getText().equals(appPrefsModel.getServer()) && clientField.getText().equals(appPrefsModel.getClient()) && editorField.getText().equals(appPrefsModel.getEditor())); + return !(serverField.getText().equals(appPreferencesModel.getServer()) && clientField.getText().equals(appPreferencesModel.getClient()) && editorField.getText().equals(appPreferencesModel.getEditor())); } /** @@ -142,9 +142,9 @@ final PreferencesHelper preferencesHelper = new PreferencesHelper(panel); panel.setBorder(createTitledBorder("optionsApps")); - serverField = preferencesHelper.createFileField("optionsAppServer", appPrefsModel.getServer(), JFileChooser.FILES_ONLY); - clientField = preferencesHelper.createFileField("optionsAppClient", appPrefsModel.getClient(), JFileChooser.FILES_ONLY); - editorField = preferencesHelper.createFileField("optionsAppEditor", appPrefsModel.getEditor(), JFileChooser.FILES_ONLY); + serverField = preferencesHelper.createFileField("optionsAppServer", appPreferencesModel.getServer(), JFileChooser.FILES_ONLY); + clientField = preferencesHelper.createFileField("optionsAppClient", appPreferencesModel.getClient(), JFileChooser.FILES_ONLY); + editorField = preferencesHelper.createFileField("optionsAppEditor", appPreferencesModel.getEditor(), JFileChooser.FILES_ONLY); return panel; } Deleted: trunk/src/app/net/sf/gridarta/gui/prefs/AppPrefsModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/prefs/AppPrefsModel.java 2010-05-24 21:42:37 UTC (rev 7990) +++ trunk/src/app/net/sf/gridarta/gui/prefs/AppPrefsModel.java 2010-05-24 21:55:36 UTC (rev 7991) @@ -1,161 +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.gui.prefs; - -import java.util.prefs.Preferences; -import net.sf.gridarta.MainControl; -import net.sf.gridarta.model.io.PathManager; -import org.jetbrains.annotations.NotNull; - -/** - * Maintains the application preferences state. - * @author Andreas Kirschbaum - */ -public class AppPrefsModel { - - /** - * Preferences key for server application. - */ - private static final String PREFS_APP_SERVER = "appServer"; - - /** - * Preferences key for client application. - */ - private static final String PREFS_APP_CLIENT = "appClient"; - - /** - * Preferences key for editor application. - */ - private static final String PREFS_APP_EDITOR = "appEditor"; - - /** - * Preferences. - */ - private static final Preferences PREFS = Preferences.userNodeForPackage(MainControl.class); - - /** - * The default value for the server setting. - */ - @NotNull - private final String serverDefault; - - /** - * The default value for the client setting. - */ - @NotNull - private final String clientDefault; - - /** - * The default value for the editor setting. - */ - @NotNull - private final String editorDefault; - - /** - * Creates a new instance. - * @param serverDefault the default value for the server setting - * @param clientDefault the default value for the client setting - * @param editorDefault the default value for the editor setting - */ - public AppPrefsModel(@NotNull final String serverDefault, @NotNull final String clientDefault, @NotNull final String editorDefault) { - this.serverDefault = serverDefault; - this.clientDefault = clientDefault; - this.editorDefault = editorDefault; - } - - /** - * Sets the server setting. - * @param server the server setting - */ - public static void setServer(@NotNull final String server) { - PREFS.put(PREFS_APP_SERVER, PathManager.path(server)); - } - - /** - * Sets the client setting. - * @param client the client setting - */ - public static void setClient(@NotNull final String client) { - PREFS.put(PREFS_APP_CLIENT, PathManager.path(client)); - } - - /** - * Sets the editor setting. - * @param editor the editor setting - */ - public static void setEditor(@NotNull final String editor) { - PREFS.put(PREFS_APP_EDITOR, PathManager.path(editor)); - } - - /** - * Returns the server setting. - * @return the server setting - */ - @NotNull - public String getServer() { - return PREFS.get(PREFS_APP_SERVER, serverDefault); - } - - /** - * Returns the client setting. - * @return the client setting - */ - @NotNull - public String getClient() { - return PREFS.get(PREFS_APP_CLIENT, clientDefault); - } - - /** - * Returns the editor setting. - * @return the editor setting - */ - @NotNull - public String getEditor() { - return PREFS.get(PREFS_APP_EDITOR, editorDefault); - } - - /** - * Returns the server setting's default value. - * @return the server setting's default value - */ - @NotNull - public String getServerDefault() { - return serverDefault; - } - - /** - * Returns the client setting's default value. - * @return the client setting's default value - */ - @NotNull - public String getClientDefault() { - return clientDefault; - } - - /** - * Returns the editor setting's default value. - * @return the editor setting's default value - */ - @NotNull - public String getEditorDefault() { - return editorDefault; - } - -} // class AppPrefsModel Modified: trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java 2010-05-24 21:42:37 UTC (rev 7990) +++ trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java 2010-05-24 21:55:36 UTC (rev 7991) @@ -26,7 +26,7 @@ import net.sf.gridarta.gui.map.renderer.RendererFactory; import net.sf.gridarta.gui.mappropertiesdialog.MapPropertiesDialogFactory; import net.sf.gridarta.gui.newmap.NewMapDialogFactory; -import net.sf.gridarta.gui.prefs.AppPrefsModel; +import net.sf.gridarta.gui.prefs.AppPreferencesModel; import net.sf.gridarta.gui.scripts.ScriptArchDataUtils; import net.sf.gridarta.gui.scripts.ScriptedEventEditor; import net.sf.gridarta.mapmanager.AbstractMapManager; @@ -109,7 +109,7 @@ * @param numberSpells the number spells to use * @param gameObjectSpells the game object spells to use * @param attributeRangeChecker the attribute range checker to use - * @param pluginParameterFactory the plugin parameter factoy to use + * @param pluginParameterFactory the plugin parameter factory to use * @return the new instance */ @NotNull @@ -119,7 +119,7 @@ * Returns the offset for drawing double faces. * @return the offset */ - int getDoubleFaceOffest(); + int getDoubleFaceOffset(); /** * Creates a new {@link MapArchObjectFactory} instance. @@ -219,7 +219,7 @@ * @param mapValidators the map validators that delegates to add to * @param errorViewCollector the error view collector to use * @param globalSettings the global settings instance - * @param gameObjectMatchers the defined game object machers + * @param gameObjectMatchers the defined game object matchers * @param attributeRangeChecker the attribute range checker to use */ void initMapValidators(@NotNull DelegatingMapValidator<G, A, R> mapValidators, @NotNull ErrorViewCollector errorViewCollector, @NotNull GlobalSettings globalSettings, @NotNull GameObjectMatchers gameObjectMatchers, @NotNull AttributeRangeChecker<G, A, R> attributeRangeChecker); @@ -297,11 +297,11 @@ MapViewFactory<G, A, R> newMapViewFactory(@NotNull RendererFactory<G, A, R> rendererFactory, @NotNull PathManager pathManager); /** - * Creates a new {@link AppPrefsModel} instance. + * Creates a new {@link AppPreferencesModel} instance. * @return the new instance */ @NotNull - AppPrefsModel createAppPrefsModel(); + AppPreferencesModel createAppPreferencesModel(); /** * Creates a new {@link MapPropertiesDialogFactory} instance. @@ -333,13 +333,13 @@ * Creates a new {@link PreferencesGroup} instance. * @param globalSettings the global settings to use * @param validators the validators to use - * @param appPrefsModel the app prefs model to use - * @param exitConnectorModel the exit eonnector model to use + * @param appPreferencesModel the app preferences model to use + * @param exitConnectorModel the exit connector model to use * @param configSourceFactory the config source factory to use * @return the new instance */ @NotNull - PreferencesGroup createPreferencesGroup(@NotNull GlobalSettings globalSettings, @NotNull DelegatingMapValidator<G, A, R> validators, @NotNull AppPrefsModel appPrefsModel, @NotNull ExitConnectorModel exitConnectorModel, @NotNull ConfigSourceFactory configSourceFactory); + PreferencesGroup createPreferencesGroup(@NotNull GlobalSettings globalSettings, @NotNull DelegatingMapValidator<G, A, R> validators, @NotNull AppPreferencesModel appPreferencesModel, @NotNull ExitConnectorModel exitConnectorModel, @NotNull ConfigSourceFactory configSourceFactory); /** * Creates a new {@link GUIMainControl} instance. Modified: trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-05-24 21:42:37 UTC (rev 7990) +++ trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-05-24 21:55:36 UTC (rev 7991) @@ -93,7 +93,7 @@ import net.sf.gridarta.gui.objectchooser.DefaultObjectChooser; import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; import net.sf.gridarta.gui.pickmapchooser.PickmapChooserModel; -import net.sf.gridarta.gui.prefs.AppPrefsModel; +import net.sf.gridarta.gui.prefs.AppPreferencesModel; import net.sf.gridarta.gui.replacedialog.ReplaceDialogManager; import net.sf.gridarta.gui.script.ScriptController; import net.sf.gridarta.gui.script.parameter.PluginParameterViewFactory; @@ -296,10 +296,10 @@ private PreferencesGroup prefsGroup = null; /** - * The {@link AppPrefsModel} instance. + * The {@link AppPreferencesModel} instance. */ @NotNull - private final AppPrefsModel appPrefsModel; + private final AppPreferencesModel appPreferencesModel; /** * Client Control Component. @@ -402,7 +402,7 @@ imageCreator = new ImageCreator<G, A, R>(mapManager, rendererFactory); final ImageCreator2<G, A, R> imageCreator2 = new ImageCreator2<G, A, R>(globalSettings, imageCreator); spellUtils = spellFile != null ? new SpellsUtils(spellFile) : null; - appPrefsModel = editorFactory.createAppPrefsModel(); + appPreferencesModel = editorFactory.createAppPreferencesModel(); final MapViewManager<G, A, R> mapViewManager = new MapViewManager<G, A, R>(); statusBar = new StatusBar<G, A, R>(mapManager, mapViewManager, archetypeSet, faceObjects); final MapImageCache<G, A, R> mapImageCache = new MapImageCache<G, A, R>(mapManager, systemIcons.getDefaultIcon(), systemIcons.getDefaultPreview(), rendererFactory, cacheFiles); @@ -616,7 +616,7 @@ @ActionMethod public void options() { if (prefsGroup == null) { - prefsGroup = editorFactory.createPreferencesGroup(globalSettings, validators, appPrefsModel, exitConnectorModel, configSourceFactory); + prefsGroup = editorFactory.createPreferencesGroup(globalSettings, validators, appPreferencesModel, exitConnectorModel, configSourceFactory); } PreferencesPane.showPreferencesDialog(mainViewFrame, prefsGroup, false); } @@ -681,10 +681,10 @@ @ActionMethod public void controlServer() { if (controlServer == null) { - controlServer = new ProcessRunner("controlServer", appPrefsModel.getServer()); + controlServer = new ProcessRunner("controlServer", appPreferencesModel.getServer()); ACTION_BUILDER.showOnetimeMessageDialog(mainViewFrame, JOptionPane.WARNING_MESSAGE, "controlServerWarning"); } else { - controlServer.setCommand(appPrefsModel.getServer()); + controlServer.setCommand(appPreferencesModel.getServer()); } controlServer.showDialog(mainViewFrame); } @@ -695,9 +695,9 @@ @ActionMethod public void controlClient() { if (controlClient == null) { - controlClient = new ProcessRunner("controlClient", appPrefsModel.getClient()); + controlClient = new ProcessRunner("controlClient", appPreferencesModel.getClient()); } else { - controlClient.setCommand(appPrefsModel.getClient()); + controlClient.setCommand(appPreferencesModel.getClient()); } controlClient.showDialog(mainViewFrame); } Modified: trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2010-05-24 21:42:37 UTC (rev 7990) +++ trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2010-05-24 21:55:36 UTC (rev 7991) @@ -227,7 +227,7 @@ final ArchFaceProvider archFaceProvider = new ArchFaceProvider(); final FaceObjects faceObjects = editorFactory.createFaceObjects(archFaceProvider); editorFactory.initSmoothFaces(faceObjects); - final int doubleFaceOffset = editorFactory.getDoubleFaceOffest(); + final int doubleFaceOffset = editorFactory.getDoubleFaceOffset(); final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(doubleFaceOffset, faceObjects, systemIcons); final ArchetypeTypeSet archetypeTypeSet = new ArchetypeTypeSet(); final AnimationObjects animationObjects = editorFactory.newAnimationObjects(); Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFactory.java 2010-05-24 21:42:37 UTC (rev 7990) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFactory.java 2010-05-24 21:55:36 UTC (rev 7991) @@ -254,7 +254,7 @@ ArchetypeAttribute newArchetypeAttributeTreasure(@NotNull String archetypeAttributeName, @NotNull String attributeName, @NotNull String description, int inputLength, @NotNull String sectionName); /** - * Creates a new "zspell" archetype attribute. + * Creates a new "z-spell" archetype attribute. * @param archetypeAttributeName the archetype attribute name * @param attributeName the user interface attribute name * @param description the attribute's description Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributes.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributes.java 2010-05-24 21:42:37 UTC (rev 7990) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributes.java 2010-05-24 21:55:36 UTC (rev 7991) @@ -64,7 +64,7 @@ /** * Returns whether no {@link ArchetypeAttribute ArchetypeAttributes} exist. - * @return wether no archetype attributes exist + * @return whether no archetype attributes exist */ public boolean isEmpty() { return archetypeAttributes.isEmpty(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-24 21:42:46
|
Revision: 7990 http://gridarta.svn.sourceforge.net/gridarta/?rev=7990&view=rev Author: akirschbaum Date: 2010-05-24 21:42:37 +0000 (Mon, 24 May 2010) Log Message: ----------- Remove unneeded type parameters. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/DefaultGameObjectFactory.java trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/GameObject.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/daimonin/src/app/net/sf/gridarta/var/daimonin/model/gameobject/DefaultGameObjectFactory.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/gameobject/GameObject.java trunk/src/app/net/sf/gridarta/gui/archetypetype/ArchetypeTypeChecks.java trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialogManager.java trunk/src/app/net/sf/gridarta/gui/findarchetypes/TableModel.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribute.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeAnimationName.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeBitmask.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeBool.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeBoolSpec.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeFaceName.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeFloat.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeInt.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeInvSpell.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeList.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeLong.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeMapPath.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeScriptFile.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeSpell.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeString.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeText.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeTreasure.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeZSpell.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GuiInfo.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/HelpActionListener.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/MaskChangeAL.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/ArchTab.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/TextEditorTab.java trunk/src/app/net/sf/gridarta/gui/gameobjecttexteditor/GameObjectTextEditor.java trunk/src/app/net/sf/gridarta/gui/objectchoicedisplay/ObjectChoiceDisplay.java trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.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/archetypetype/AbstractArchetypeAttributeInvSpell.java trunk/src/app/net/sf/gridarta/model/archetypetype/AbstractArchetypeAttributeList.java trunk/src/app/net/sf/gridarta/model/archetypetype/AbstractArchetypeAttributeSpell.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttribute.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeAnimationName.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeBitmask.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeBool.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeBoolSpec.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFaceName.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFactory.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFixed.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFloat.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeInt.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeInvSpell.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeList.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeLong.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeMapPath.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeParser.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeScriptFile.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeSpell.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeString.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeText.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeTreasure.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeVisitor.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeZSpell.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributes.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java trunk/src/app/net/sf/gridarta/model/archetypetype/AttributeBitmask.java trunk/src/app/net/sf/gridarta/model/archetypetype/DefaultArchetypeAttributeFactory.java trunk/src/app/net/sf/gridarta/model/gameobject/GameObjectUtils.java trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.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-24 19:56:35 UTC (rev 7989) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2010-05-24 21:42:37 UTC (rev 7990) @@ -208,7 +208,7 @@ */ @NotNull @Override - public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final GlobalSettings globalSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @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 DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final GlobalSettings globalSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @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 new DefaultMainControl<GameObject, MapArchObject, Archetype>(FileFilters.pythonFileFilter, ".py", "Python", 0, IGUIConstants.SPELL_FILE, IGUIConstants.SCRIPTS_DIR, errorView, this, forceReadFromFiles, globalSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, autojoinLists, mapManager, scriptModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, attributeRangeChecker, pluginParameterFactory); } @@ -243,7 +243,7 @@ */ @NotNull @Override - public GameObjectFactory<GameObject, MapArchObject, Archetype> newGameObjectFactory(@NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet) { + public GameObjectFactory<GameObject, MapArchObject, Archetype> newGameObjectFactory(@NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeTypeSet archetypeTypeSet) { return new DefaultGameObjectFactory(faceObjectProviders, animationObjects, archetypeTypeSet); } @@ -537,7 +537,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 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 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 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, }, resources, gameObjectSpells, numberSpells, attributeRangeChecker, pluginParameterFactory); } Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/DefaultGameObjectFactory.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/DefaultGameObjectFactory.java 2010-05-24 19:56:35 UTC (rev 7989) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/DefaultGameObjectFactory.java 2010-05-24 21:42:37 UTC (rev 7990) @@ -52,7 +52,7 @@ * The {@link ArchetypeTypeSet} for looking up archetype types. */ @NotNull - private final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet; + private final ArchetypeTypeSet archetypeTypeSet; /** * Creates a new instance. @@ -61,7 +61,7 @@ * @param archetypeTypeSet the archetype type set for looking up archetype * types */ - public DefaultGameObjectFactory(@NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet) { + public DefaultGameObjectFactory(@NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeTypeSet archetypeTypeSet) { this.faceObjectProviders = faceObjectProviders; this.animationObjects = animationObjects; this.archetypeTypeSet = archetypeTypeSet; Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/GameObject.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/GameObject.java 2010-05-24 19:56:35 UTC (rev 7989) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/GameObject.java 2010-05-24 21:42:37 UTC (rev 7990) @@ -55,7 +55,7 @@ * The {@link ArchetypeTypeSet} for looking up archetype types. */ @NotNull - private final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet; + private final ArchetypeTypeSet archetypeTypeSet; /** * Creates a new instance. @@ -67,7 +67,7 @@ * types */ @Deprecated - public GameObject(@NotNull final String archetypeName, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet) { + public GameObject(@NotNull final String archetypeName, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeTypeSet archetypeTypeSet) { super(archetypeName, faceObjectProviders, animationObjects); this.archetypeTypeSet = archetypeTypeSet; } @@ -81,7 +81,7 @@ * @param archetypeTypeSet the archetype type set for looking up archetype * types */ - public GameObject(@NotNull final Archetype archetype, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet) { + public GameObject(@NotNull final Archetype archetype, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeTypeSet archetypeTypeSet) { super(archetype, faceObjectProviders, animationObjects); this.archetypeTypeSet = archetypeTypeSet; } 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-24 19:56:35 UTC (rev 7989) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2010-05-24 21:42:37 UTC (rev 7990) @@ -158,7 +158,7 @@ */ @NotNull @Override - public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final GlobalSettings globalSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @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 DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final GlobalSettings globalSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @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 new DefaultMainControl<GameObject, MapArchObject, Archetype>(FileFilters.pythonFileFilter, ".py", "Python", Archetype.TYPE_SPELL, null, IGUIConstants.SCRIPTS_DIR, errorView, this, false, globalSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, autojoinLists, mapManager, scriptModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, attributeRangeChecker, pluginParameterFactory); } @@ -193,7 +193,7 @@ */ @NotNull @Override - public GameObjectFactory<GameObject, MapArchObject, Archetype> newGameObjectFactory(@NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet) { + public GameObjectFactory<GameObject, MapArchObject, Archetype> newGameObjectFactory(@NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeTypeSet archetypeTypeSet) { return new DefaultGameObjectFactory(faceObjectProviders, animationObjects); } @@ -404,7 +404,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 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 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 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, }, 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-24 19:56:35 UTC (rev 7989) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2010-05-24 21:42:37 UTC (rev 7990) @@ -209,7 +209,7 @@ */ @NotNull @Override - public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final GlobalSettings globalSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @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 DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final GlobalSettings globalSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @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 new DefaultMainControl<GameObject, MapArchObject, Archetype>(FileFilters.luaFileFilter, ".lua", "Lua", 0, IGUIConstants.SPELL_FILE, IGUIConstants.SCRIPTS_DIR, errorView, this, forceReadFromFiles, globalSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, autojoinLists, mapManager, scriptModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, attributeRangeChecker, pluginParameterFactory); } @@ -244,7 +244,7 @@ */ @NotNull @Override - public GameObjectFactory<GameObject, MapArchObject, Archetype> newGameObjectFactory(@NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet) { + public GameObjectFactory<GameObject, MapArchObject, Archetype> newGameObjectFactory(@NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeTypeSet archetypeTypeSet) { return new DefaultGameObjectFactory(faceObjectProviders, animationObjects, archetypeTypeSet); } @@ -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 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 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 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, }, resources, gameObjectSpells, numberSpells, attributeRangeChecker, pluginParameterFactory); } Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/gameobject/DefaultGameObjectFactory.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/gameobject/DefaultGameObjectFactory.java 2010-05-24 19:56:35 UTC (rev 7989) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/gameobject/DefaultGameObjectFactory.java 2010-05-24 21:42:37 UTC (rev 7990) @@ -52,7 +52,7 @@ * The {@link ArchetypeTypeSet} for looking up archetype types. */ @NotNull - private final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet; + private final ArchetypeTypeSet archetypeTypeSet; /** * Creates a new instance. @@ -61,7 +61,7 @@ * @param archetypeTypeSet the archetype type set for looking up archetype * types */ - public DefaultGameObjectFactory(@NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet) { + public DefaultGameObjectFactory(@NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeTypeSet archetypeTypeSet) { this.faceObjectProviders = faceObjectProviders; this.animationObjects = animationObjects; this.archetypeTypeSet = archetypeTypeSet; Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/gameobject/GameObject.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/gameobject/GameObject.java 2010-05-24 19:56:35 UTC (rev 7989) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/gameobject/GameObject.java 2010-05-24 21:42:37 UTC (rev 7990) @@ -55,7 +55,7 @@ * The {@link ArchetypeTypeSet} for looking up archetype types. */ @NotNull - private final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet; + private final ArchetypeTypeSet archetypeTypeSet; /** * Creates a new instance. @@ -67,7 +67,7 @@ * types */ @Deprecated - public GameObject(@NotNull final String archetypeName, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet) { + public GameObject(@NotNull final String archetypeName, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeTypeSet archetypeTypeSet) { super(archetypeName, faceObjectProviders, animationObjects); this.archetypeTypeSet = archetypeTypeSet; } @@ -81,7 +81,7 @@ * @param archetypeTypeSet the archetype type set for looking up archetype * types */ - public GameObject(@NotNull final Archetype archetype, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet) { + public GameObject(@NotNull final Archetype archetype, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeTypeSet archetypeTypeSet) { super(archetype, faceObjectProviders, animationObjects); this.archetypeTypeSet = archetypeTypeSet; } Modified: trunk/src/app/net/sf/gridarta/gui/archetypetype/ArchetypeTypeChecks.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/archetypetype/ArchetypeTypeChecks.java 2010-05-24 19:56:35 UTC (rev 7989) +++ trunk/src/app/net/sf/gridarta/gui/archetypetype/ArchetypeTypeChecks.java 2010-05-24 21:42:37 UTC (rev 7990) @@ -73,8 +73,8 @@ * @param attributeRangeChecker the attribute range checker to add to * @param archetypeTypeSet the archetype type set to use */ - public static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> void addChecks(@NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker) { - for (final ArchetypeType<G, A, R> archetypeType : archetypeTypeSet) { + public static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> void addChecks(@NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker) { + for (final ArchetypeType archetypeType : archetypeTypeSet) { addChecks(archetypeTypeSet, attributeRangeChecker, archetypeType); } } @@ -86,23 +86,23 @@ * @param archetypeTypeSet the archetype type set to use * @param archetypeType the archetype type */ - private static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> void addChecks(@NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker, @NotNull final ArchetypeType<G, A, R> archetypeType) { + private static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> void addChecks(@NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker, @NotNull final ArchetypeType archetypeType) { if (archetypeType.hasTypeAttributes()) { return; // XXX: make such attributes work } - final ArchetypeAttributeVisitor<G, A, R> archetypeAttributeVisitor = new ArchetypeAttributeVisitor<G, A, R>() { + final ArchetypeAttributeVisitor archetypeAttributeVisitor = new ArchetypeAttributeVisitor() { /** {@inheritDoc} */ @Override - public void visit(@NotNull final ArchetypeAttributeAnimationName<G, A, R> archetypeAttribute) { + public void visit(@NotNull final ArchetypeAttributeAnimationName archetypeAttribute) { // XXX: missing } /** {@inheritDoc} */ @Override - public void visit(@NotNull final ArchetypeAttributeBitmask<G, A, R> archetypeAttribute) { - final AttributeBitmask<G, A, R> bitmask = archetypeTypeSet.getBitmask(archetypeAttribute.getBitmaskName()); + public void visit(@NotNull final ArchetypeAttributeBitmask archetypeAttribute) { + final AttributeBitmask bitmask = archetypeTypeSet.getBitmask(archetypeAttribute.getBitmaskName()); if (bitmask != null) { try { attributeRangeChecker.add(archetypeType.getTypeNo(), archetypeAttribute.getArchetypeAttributeName(), archetypeAttribute.getAttributeName(), 0, bitmask.getMaxValue()); @@ -114,7 +114,7 @@ /** {@inheritDoc} */ @Override - public void visit(@NotNull final ArchetypeAttributeBool<G, A, R> archetypeAttribute) { + public void visit(@NotNull final ArchetypeAttributeBool archetypeAttribute) { try { attributeRangeChecker.add(archetypeType.getTypeNo(), archetypeAttribute.getArchetypeAttributeName(), archetypeAttribute.getAttributeName(), 0, 1); } catch (final InvalidCheckException ex) { @@ -124,31 +124,31 @@ /** {@inheritDoc} */ @Override - public void visit(@NotNull final ArchetypeAttributeBoolSpec<G, A, R> archetypeAttribute) { + public void visit(@NotNull final ArchetypeAttributeBoolSpec archetypeAttribute) { // XXX: missing } /** {@inheritDoc} */ @Override - public void visit(@NotNull final ArchetypeAttributeFaceName<G, A, R> archetypeAttribute) { + public void visit(@NotNull final ArchetypeAttributeFaceName archetypeAttribute) { // XXX: missing } /** {@inheritDoc} */ @Override - public void visit(@NotNull final ArchetypeAttributeFixed<G, A, R> archetypeAttribute) { + public void visit(@NotNull final ArchetypeAttributeFixed archetypeAttribute) { // XXX: missing } /** {@inheritDoc} */ @Override - public void visit(@NotNull final ArchetypeAttributeFloat<G, A, R> archetypeAttribute) { + public void visit(@NotNull final ArchetypeAttributeFloat archetypeAttribute) { // XXX: missing } /** {@inheritDoc} */ @Override - public void visit(@NotNull final ArchetypeAttributeInt<G, A, R> archetypeAttribute) { + public void visit(@NotNull final ArchetypeAttributeInt archetypeAttribute) { try { attributeRangeChecker.add(archetypeType.getTypeNo(), archetypeAttribute.getArchetypeAttributeName(), archetypeAttribute.getAttributeName(), archetypeAttribute.getMinCheckValue(), archetypeAttribute.getMaxCheckValue()); } catch (final InvalidCheckException ex) { @@ -158,67 +158,67 @@ /** {@inheritDoc} */ @Override - public void visit(@NotNull final ArchetypeAttributeInvSpell<G, A, R> archetypeAttribute) { + public void visit(@NotNull final ArchetypeAttributeInvSpell archetypeAttribute) { // XXX: missing } /** {@inheritDoc} */ @Override - public void visit(@NotNull final ArchetypeAttributeList<G, A, R> archetypeAttribute) { + public void visit(@NotNull final ArchetypeAttributeList archetypeAttribute) { // XXX: missing } /** {@inheritDoc} */ @Override - public void visit(@NotNull final ArchetypeAttributeLong<G, A, R> archetypeAttribute) { + public void visit(@NotNull final ArchetypeAttributeLong archetypeAttribute) { // XXX: missing } /** {@inheritDoc} */ @Override - public void visit(@NotNull final ArchetypeAttributeMapPath<G, A, R> archetypeAttribute) { + public void visit(@NotNull final ArchetypeAttributeMapPath archetypeAttribute) { // XXX: missing } /** {@inheritDoc} */ @Override - public void visit(@NotNull final ArchetypeAttributeScriptFile<G, A, R> archetypeAttribute) { + public void visit(@NotNull final ArchetypeAttributeScriptFile archetypeAttribute) { // XXX: missing } /** {@inheritDoc} */ @Override - public void visit(@NotNull final ArchetypeAttributeSpell<G, A, R> archetypeAttribute) { + public void visit(@NotNull final ArchetypeAttributeSpell archetypeAttribute) { // XXX: missing } /** {@inheritDoc} */ @Override - public void visit(@NotNull final ArchetypeAttributeString<G, A, R> archetypeAttribute) { + public void visit(@NotNull final ArchetypeAttributeString archetypeAttribute) { // XXX: missing } /** {@inheritDoc} */ @Override - public void visit(@NotNull final ArchetypeAttributeText<G, A, R> archetypeAttribute) { + public void visit(@NotNull final ArchetypeAttributeText archetypeAttribute) { // XXX: missing } /** {@inheritDoc} */ @Override - public void visit(@NotNull final ArchetypeAttributeTreasure<G, A, R> archetypeAttribute) { + public void visit(@NotNull final ArchetypeAttributeTreasure archetypeAttribute) { // XXX: missing } /** {@inheritDoc} */ @Override - public void visit(@NotNull final ArchetypeAttributeZSpell<G, A, R> archetypeAttribute) { + public void visit(@NotNull final ArchetypeAttributeZSpell archetypeAttribute) { // XXX: missing } }; - for (final ArchetypeAttribute<G, A, R> archetypeAttribute : archetypeType) { + for (final ArchetypeAttribute archetypeAttribute : archetypeType) { archetypeAttribute.visit(archetypeAttributeVisitor); } } Modified: trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java 2010-05-24 19:56:35 UTC (rev 7989) +++ trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java 2010-05-24 21:42:37 UTC (rev 7990) @@ -147,7 +147,7 @@ * search results. * @param archetypeTypeSet the instance for looking up archetype types */ - public FindArchetypesDialog(final Component parent, final ArchetypeChooserControl<G, A, R> archetypeChooserControl, final ObjectChooser<G, A, R> objectChooser, final ArchetypeTypeSet<G, A, R> archetypeTypeSet) { + public FindArchetypesDialog(final Component parent, final ArchetypeChooserControl<G, A, R> archetypeChooserControl, final ObjectChooser<G, A, R> objectChooser, final ArchetypeTypeSet archetypeTypeSet) { this.archetypeChooserControl = archetypeChooserControl; this.objectChooser = objectChooser; Modified: trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialogManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialogManager.java 2010-05-24 19:56:35 UTC (rev 7989) +++ trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialogManager.java 2010-05-24 21:42:37 UTC (rev 7990) @@ -72,7 +72,7 @@ * The {@link ArchetypeTypeSet} for looking up archetype types. */ @NotNull - private final ArchetypeTypeSet<G, A, R> archetypeTypeSet; + private final ArchetypeTypeSet archetypeTypeSet; /** * Creates a new instance. @@ -83,7 +83,7 @@ * @param archetypeTypeSet the archetype type set for looking up archetype * types */ - public FindArchetypesDialogManager(@NotNull final Component parent, @NotNull final ArchetypeChooserControl<G, A, R> archetypeChooserControl, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet) { + public FindArchetypesDialogManager(@NotNull final Component parent, @NotNull final ArchetypeChooserControl<G, A, R> archetypeChooserControl, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final ArchetypeTypeSet archetypeTypeSet) { super("findArchetypes"); this.parent = parent; this.archetypeChooserControl = archetypeChooserControl; Modified: trunk/src/app/net/sf/gridarta/gui/findarchetypes/TableModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/findarchetypes/TableModel.java 2010-05-24 19:56:35 UTC (rev 7989) +++ trunk/src/app/net/sf/gridarta/gui/findarchetypes/TableModel.java 2010-05-24 21:42:37 UTC (rev 7990) @@ -62,7 +62,7 @@ /** * The instance for looking up archetype types. */ - private final ArchetypeTypeSet<G, A, R> archetypeTypeSet; + private final ArchetypeTypeSet archetypeTypeSet; /** * The model's contents. @@ -107,7 +107,7 @@ * Creates a new instance. * @param archetypeTypeSet the instance for looking up archetype types */ - public TableModel(final ArchetypeTypeSet<G, A, R> archetypeTypeSet) { + public TableModel(final ArchetypeTypeSet archetypeTypeSet) { this.archetypeTypeSet = archetypeTypeSet; } @@ -168,7 +168,7 @@ return archetype.getArchetypeName(); case 2: - final ArchetypeType<G, A, R> archetypeType = archetypeTypeSet.getArchetypeType(archetype); + final ArchetypeType archetypeType = archetypeTypeSet.getArchetypeType(archetype); return archetypeType.getTypeName() + " (" + archetypeType.getTypeNo() + ')'; ... [truncated message content] |
From: <aki...@us...> - 2010-05-24 19:56:41
|
Revision: 7989 http://gridarta.svn.sourceforge.net/gridarta/?rev=7989&view=rev Author: akirschbaum Date: 2010-05-24 19:56:35 +0000 (Mon, 24 May 2010) Log Message: ----------- Cleanup parser for/document <ignorelists> elements within types.xml. Modified Paths: -------------- trunk/resource/system/dtd/types.dtd trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/model/archetypetype/IgnorelistsDefinition.java Modified: trunk/resource/system/dtd/types.dtd =================================================================== --- trunk/resource/system/dtd/types.dtd 2010-05-24 19:23:19 UTC (rev 7988) +++ trunk/resource/system/dtd/types.dtd 2010-05-24 19:56:35 UTC (rev 7989) @@ -72,6 +72,9 @@ encoding CDATA #IMPLIED > +<!-- name: name of the ignore list; must be unique --> +<!-- attribute: 'arch' attribute specifies the section name to be ignored; + other attributes are not allowed --> <!ELEMENT ignore_list (attribute*)> <!ATTLIST ignore_list name CDATA #REQUIRED @@ -106,6 +109,7 @@ name CDATA #REQUIRED > +<!-- arch: section name to be ignored (within <ignore_list>) --> <!-- min/max: absolute allowed range; editor rejects --> <!-- check_min/check_max: recommended range; editor warns --> <!ELEMENT attribute (#PCDATA)> Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java 2010-05-24 19:23:19 UTC (rev 7988) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java 2010-05-24 19:56:35 UTC (rev 7989) @@ -23,7 +23,6 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; -import java.util.List; import java.util.Map; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.errorview.ErrorViewCategory; @@ -115,17 +114,17 @@ * @param parent the parent archetype type * @param root the xml 'type' element which is going to be parsed * @param archetypeTypeSet archetype type list - * @param ignoreListTable the ignore_lists contents + * @param ignorelistsDefinition the ignore_lists contents * @return the archetype type or <code>null</code> * @todo I'm sucking slow, improve me */ @NotNull - public ArchetypeType<G, A, R> load(@NotNull final ErrorViewCollector errorViewCollector, @Nullable final ArchetypeType<G, A, R> parent, @NotNull final Element root, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final Map<String, List<String>> ignoreListTable) { + public ArchetypeType<G, A, R> load(@NotNull final ErrorViewCollector errorViewCollector, @Nullable final ArchetypeType<G, A, R> parent, @NotNull final Element root, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final IgnorelistsDefinition ignorelistsDefinition) { final boolean isDefaultType = root.getNodeName().equals("default_type"); final String typeName = parseTypeName(root, isDefaultType); final Map<String, String> ignoreTable = new HashMap<String, String>(); final int typeNo = parseTypeNo(root, isDefaultType, typeName, errorViewCollector); - final ArchetypeAttributesDefinition typeAttributes = parseTypeAttributes(root, isDefaultType, typeName, typeNo, errorViewCollector, ignoreTable, ignoreListTable); + final ArchetypeAttributesDefinition typeAttributes = parseTypeAttributes(root, isDefaultType, typeName, typeNo, errorViewCollector, ignoreTable, ignorelistsDefinition); final String importName = parseImportName(root, typeName, errorViewCollector); final ArchetypeAttributes<G, A, R> attributes = new ArchetypeAttributes<G, A, R>(); final SectionNames sectionNames = new SectionNames(); @@ -245,11 +244,11 @@ * @param typeNo the type number for error messages * @param errorViewCollector the error view collector for error messages * @param ignoreTable returns the "ignore" attributes - * @param ignoreListTable the defined ignore lists + * @param ignorelistsDefinition the defined ignore lists * @return the type attributes */ @NotNull - private static ArchetypeAttributesDefinition parseTypeAttributes(@NotNull final Element root, final boolean isDefaultType, @NotNull final String typeName, final int typeNo, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final Map<String, String> ignoreTable, @NotNull final Map<String, List<String>> ignoreListTable) { + private static ArchetypeAttributesDefinition parseTypeAttributes(@NotNull final Element root, final boolean isDefaultType, @NotNull final String typeName, final int typeNo, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final Map<String, String> ignoreTable, @NotNull final IgnorelistsDefinition ignorelistsDefinition) { if (isDefaultType) { // special case: default type (this one contains the default attributes) return new ArchetypeAttributesDefinition(); @@ -264,7 +263,7 @@ parseAttributeAttributes(typeName, errorViewCollector, ignoreTable, ignoreElement); // load attributes from ignore lists - parseIgnoreListAttribute(typeName, errorViewCollector, ignoreTable, ignoreListTable, ignoreElement); + parseIgnoreListAttribute(typeName, errorViewCollector, ignoreTable, ignorelistsDefinition, ignoreElement); } return typeAttributes; @@ -322,24 +321,27 @@ * @param typeName the type name for error messages * @param errorViewCollector the error view collector for error messages * @param ignoreTable the ignore table to add to - * @param ignoreListTable the ignore lists to use + * @param ignorelistsDefinition the ignore lists to use * @param ignoreElement the ignore element to parse */ - private static void parseIgnoreListAttribute(@NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final Map<String, String> ignoreTable, final Map<String, List<String>> ignoreListTable, @NotNull final Element ignoreElement) { + private static void parseIgnoreListAttribute(@NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final Map<String, String> ignoreTable, @NotNull final IgnorelistsDefinition ignorelistsDefinition, @NotNull final Element ignoreElement) { final Iterator<Element> it2 = new NodeListIterator<Element>(ignoreElement, "ignore_list"); while (it2.hasNext()) { final Element elem = it2.next(); final Attr a1 = elem.getAttributeNode("name"); if (a1 == null) { errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, XML_IGNORE + ": section of type " + typeName + ": ignore_list missing 'name'."); - } else if (ignoreListTable.containsKey(a1.getValue().trim())) { - // just copy everything from ignore list to this ignore section - final Iterable<String> ignoreList = ignoreListTable.get(a1.getValue().trim()); - for (final String ignItem : ignoreList) { - ignoreTable.put(ignItem, ""); + } else { + final String name = a1.getValue().trim(); + final Iterable<String> ignoreList = ignorelistsDefinition.get(name); + if (ignoreList != null) { + // just copy everything from ignore list to this ignore section + for (final String ignItem : ignoreList) { + ignoreTable.put(ignItem, ""); + } + } else { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, XML_IGNORE + ": section of type " + typeName + ": ignore_list with name \"" + a1.getValue() + "\" is undefined."); } - } else { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, XML_IGNORE + ": section of type " + typeName + ": ignore_list with name \"" + a1.getValue() + "\" is undefined."); } } } Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2010-05-24 19:23:19 UTC (rev 7988) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2010-05-24 19:56:35 UTC (rev 7989) @@ -20,11 +20,7 @@ package net.sf.gridarta.model.archetypetype; import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; import java.util.Iterator; -import java.util.List; -import java.util.Map; import javax.xml.parsers.DocumentBuilder; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathExpressionException; @@ -129,9 +125,9 @@ final Element root = document.getDocumentElement(); parseBitmasks(errorViewCollector, root); parseLists(errorViewCollector, root); - final Map<String, List<String>> ignoreListTable = parseIgnoreLists(errorViewCollector, root); - parseDefaultType(errorViewCollector, root, ignoreListTable); - parseTypes(errorViewCollector, root, ignoreListTable); + final IgnorelistsDefinition ignorelistsDefinition = parseIgnoreLists(errorViewCollector, root); + parseDefaultType(errorViewCollector, root, ignorelistsDefinition); + parseTypes(errorViewCollector, root, ignorelistsDefinition); if (log.isInfoEnabled()) { log.info("Loaded " + archetypeTypeSet.getLength() + " types from '" + filename + "\'"); @@ -320,23 +316,26 @@ * @throws XPathExpressionException if an internal error occurs */ @NotNull - private Map<String, List<String>> parseIgnoreLists(@NotNull final ErrorViewCollector errorViewCollector, final Element element) throws XPathExpressionException { - final Map<String, List<String>> ignoreListTable = new HashMap<String, List<String>>(); + private IgnorelistsDefinition parseIgnoreLists(@NotNull final ErrorViewCollector errorViewCollector, final Element element) throws XPathExpressionException { + final IgnorelistsDefinition ignorelistsDefinition = new IgnorelistsDefinition(); final Iterator<Element> it = new NodeListIterator<Element>(xpath, element, "ignore_list|ignorelists/ignore_list"); while (it.hasNext()) { final Element elem = it.next(); final String name = elem.getAttribute("name"); - if (ignoreListTable.containsKey(name)) { + if (ignorelistsDefinition.containsKey(name)) { errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, name + ": duplicate name"); } - final List<String> content = new ArrayList<String>(); final Iterator<Element> it2 = new NodeListIterator<Element>(elem, "attribute"); while (it2.hasNext()) { final Element el2 = it2.next(); final Attr a = el2.getAttributeNode("arch"); if (a != null) { - content.add(a.getValue()); + try { + ignorelistsDefinition.put(name, a.getValue()); + } catch (final IllegalArgumentException ex) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, name + ": " + ex.getMessage() + "."); + } } else { errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, name + ": attribute missing 'arch'."); } @@ -347,25 +346,24 @@ errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, name + ": " + ex.getMessage() + "."); } } - ignoreListTable.put(name, content); } - return ignoreListTable; + return ignorelistsDefinition; } /** * Parses the "default_type" section of a types.xml file. * @param errorViewCollector the error view collector for reporting errors * @param element the element to parse - * @param ignoreListTable the contents of the "ignorelists" section + * @param ignorelistsDefinition the contents of the "ignorelists" section */ - private void parseDefaultType(@NotNull final ErrorViewCollector errorViewCollector, final Element element, @NotNull final Map<String, List<String>> ignoreListTable) { + private void parseDefaultType(@NotNull final ErrorViewCollector errorViewCollector, final Element element, @NotNull final IgnorelistsDefinition ignorelistsDefinition) { final Element el = NodeListIterator.getFirstChild(element, "default_type"); if (el == null) { errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "default_type element is missing!"); return; } - final ArchetypeType<G, A, R> defaultType = archetypeTypeParser.load(errorViewCollector, null, el, archetypeTypeSet, ignoreListTable); + final ArchetypeType<G, A, R> defaultType = archetypeTypeParser.load(errorViewCollector, null, el, archetypeTypeSet, ignorelistsDefinition); archetypeTypeSet.setDefaultArchetypeType(defaultType); } @@ -373,14 +371,14 @@ * Parses the "type" section of a types.xml file. * @param errorViewCollector the error view collector for reporting errors * @param element the element to parse - * @param ignoreListTable the contents of the "ignorelists" section + * @param ignorelistsDefinition the contents of the "ignorelists" section */ - private void parseTypes(@NotNull final ErrorViewCollector errorViewCollector, final Element element, @NotNull final Map<String, List<String>> ignoreListTable) { + private void parseTypes(@NotNull final ErrorViewCollector errorViewCollector, final Element element, @NotNull final IgnorelistsDefinition ignorelistsDefinition) { final Iterator<Element> it = new NodeListIterator<Element>(element, "type"); while (it.hasNext()) { final Element elem = it.next(); if (!elem.getAttribute("available").equals("no")) { - archetypeTypeSet.add(archetypeTypeParser.load(errorViewCollector, archetypeTypeSet.getDefaultArchetypeType(), elem, archetypeTypeSet, ignoreListTable)); + archetypeTypeSet.add(archetypeTypeParser.load(errorViewCollector, archetypeTypeSet.getDefaultArchetypeType(), elem, archetypeTypeSet, ignorelistsDefinition)); } } } Added: trunk/src/app/net/sf/gridarta/model/archetypetype/IgnorelistsDefinition.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/IgnorelistsDefinition.java (rev 0) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/IgnorelistsDefinition.java 2010-05-24 19:56:35 UTC (rev 7989) @@ -0,0 +1,87 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.archetypetype; + +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * The contents of an <ignorelists> element of a types.xml file. + * @author Andreas Kirschbaum + */ +public class IgnorelistsDefinition { + + /** + * The ignore list entries. Maps ignore list name to ignored section names. + */ + @NotNull + private final Map<String, Set<String>> ignoreListTable = new HashMap<String, Set<String>>(); + + /** + * Returns whether an ignore list name exists. + * @param name the ignore list name + * @return whether the name exists + */ + public boolean containsKey(@NotNull final String name) { + return ignoreListTable.containsKey(name); + } + + /** + * Adds a new entry. + * @param name the ignore list name + * @param value the section name to be ignored + * @throws IllegalArgumentException if the parameters are not valid + */ + public void put(@NotNull final String name, @NotNull final String value) { + if (name.isEmpty()) { + throw new IllegalArgumentException("empty name"); + } + + if (value.isEmpty()) { + throw new IllegalArgumentException("empty value for name '" + name + "'"); + } + + Set<String> values = ignoreListTable.get(name); + if (values == null) { + values = new HashSet<String>(); + ignoreListTable.put(name, values); + } + if (!values.add(value)) { + throw new IllegalArgumentException("duplicate value '" + value + "' for name '" + name + "'"); + } + } + + /** + * Returns the ignored section names for a ignore list name. + * @param name the ignore list name + * @return the ignored section names + */ + @Nullable + public Iterable<String> get(@NotNull final String name) { + final Set<String> values = ignoreListTable.get(name); + return values == null ? null : Collections.unmodifiableCollection(values); + } + +} // class IgnorelistsDefinition Property changes on: trunk/src/app/net/sf/gridarta/model/archetypetype/IgnorelistsDefinition.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-24 19:23:25
|
Revision: 7988 http://gridarta.svn.sourceforge.net/gridarta/?rev=7988&view=rev Author: akirschbaum Date: 2010-05-24 19:23:19 +0000 (Mon, 24 May 2010) Log Message: ----------- Cleanup parser for/document <ignorelists> elements within types.xml. Modified Paths: -------------- trunk/resource/system/dtd/types.dtd trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java Modified: trunk/resource/system/dtd/types.dtd =================================================================== --- trunk/resource/system/dtd/types.dtd 2010-05-24 19:08:48 UTC (rev 7987) +++ trunk/resource/system/dtd/types.dtd 2010-05-24 19:23:19 UTC (rev 7988) @@ -72,7 +72,7 @@ encoding CDATA #IMPLIED > -<!ELEMENT ignore_list (attribute* | EMPTY)> +<!ELEMENT ignore_list (attribute*)> <!ATTLIST ignore_list name CDATA #REQUIRED > Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2010-05-24 19:08:48 UTC (rev 7987) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2010-05-24 19:23:19 UTC (rev 7988) @@ -33,6 +33,7 @@ import net.sf.gridarta.model.errorview.ErrorViewCollector; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; +import net.sf.gridarta.utils.SyntaxErrorException; import net.sf.japi.xml.NodeListIterator; import org.apache.log4j.Category; import org.apache.log4j.Logger; @@ -324,25 +325,29 @@ final Iterator<Element> it = new NodeListIterator<Element>(xpath, element, "ignore_list|ignorelists/ignore_list"); while (it.hasNext()) { final Element elem = it.next(); - if (elem.getAttribute("name") == null) { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "cannot load ignore_list element without 'name'."); - } else { - final String name = elem.getAttribute("name").trim(); - final List<String> content = new ArrayList<String>(); - final Iterator<Element> it2 = new NodeListIterator<Element>(elem, ArchetypeTypeParser.XML_ATTRIBUTE); - while (it2.hasNext()) { - final Element el2 = it2.next(); - final Attr a = el2.getAttributeNode(ArchetypeAttributeParser.XML_KEY_ARCH); - if (a != null) { - content.add(a.getValue().trim()); - } else { - errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, name + ": " + ArchetypeTypeParser.XML_ATTRIBUTE + " missing '" + ArchetypeAttributeParser.XML_KEY_ARCH + "'."); - } + final String name = elem.getAttribute("name"); + if (ignoreListTable.containsKey(name)) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, name + ": duplicate name"); + } + + final List<String> content = new ArrayList<String>(); + final Iterator<Element> it2 = new NodeListIterator<Element>(elem, "attribute"); + while (it2.hasNext()) { + final Element el2 = it2.next(); + final Attr a = el2.getAttributeNode("arch"); + if (a != null) { + content.add(a.getValue()); + } else { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, name + ": attribute missing 'arch'."); } - if (!content.isEmpty()) { - ignoreListTable.put(name, content); + + try { + rejectAttributes(el2, "type", "arch_begin", "arch_end", "editor", "value", "min", "max", "check_min", "check_max", "length", "true", "false", "marker"); + } catch (final SyntaxErrorException ex) { + errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, name + ": " + ex.getMessage() + "."); } } + ignoreListTable.put(name, content); } return ignoreListTable; } @@ -380,4 +385,18 @@ } } + /** + * Makes sure an {@link Element} does not define attributes. + * @param element the element to check + * @param attributes the attributes to check for + * @throws SyntaxErrorException if an attribute was found + */ + private static void rejectAttributes(@NotNull final Element element, @NotNull final String... attributes) throws SyntaxErrorException { + for (final String attribute : attributes) { + if (element.hasAttribute(attribute)) { + throw new SyntaxErrorException("unexpected attribute '" + attribute + "'"); + } + } + } + } // class ArchetypeTypeSetParser This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-24 19:08:55
|
Revision: 7987 http://gridarta.svn.sourceforge.net/gridarta/?rev=7987&view=rev Author: akirschbaum Date: 2010-05-24 19:08:48 +0000 (Mon, 24 May 2010) Log Message: ----------- Whitespace changes. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/filter/MenuItemCreator.java trunk/src/doc/copyright.xhtml trunk/src/doc/dev/codeStyle.xhtml trunk/src/doc/hist/MergingEditors.xhtml trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java trunk/src/test/net/sf/gridarta/model/map/grid/MapGridTest.java trunk/src/test/net/sf/gridarta/model/map/mapmodel/DefaultMapModelTest.java Modified: trunk/src/app/net/sf/gridarta/gui/filter/MenuItemCreator.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/filter/MenuItemCreator.java 2010-05-24 18:49:57 UTC (rev 7986) +++ trunk/src/app/net/sf/gridarta/gui/filter/MenuItemCreator.java 2010-05-24 19:08:48 UTC (rev 7987) @@ -31,7 +31,8 @@ import org.jetbrains.annotations.Nullable; /** - * Creates menu items for {@link net.sf.gridarta.model.filter.Filter} instances. + * Creates menu items for {@link net.sf.gridarta.model.filter.Filter} + * instances. * @author tchize * @author Andreas Kirschbaum */ Modified: trunk/src/doc/copyright.xhtml =================================================================== --- trunk/src/doc/copyright.xhtml 2010-05-24 18:49:57 UTC (rev 7986) +++ trunk/src/doc/copyright.xhtml 2010-05-24 19:08:48 UTC (rev 7987) @@ -28,6 +28,6 @@ <body> <p> Gridarta is licensed under GPL version 2 or newer. </p> - <pre><xi:include xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" href="../../COPYING"/></pre> +<pre><xi:include xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" href="../../COPYING"/></pre> </body> </html> Modified: trunk/src/doc/dev/codeStyle.xhtml =================================================================== --- trunk/src/doc/dev/codeStyle.xhtml 2010-05-24 18:49:57 UTC (rev 7986) +++ trunk/src/doc/dev/codeStyle.xhtml 2010-05-24 19:08:48 UTC (rev 7987) @@ -69,7 +69,7 @@ <p> The following example code shows how streams should be opened / closed: </p> - <pre class="listing"><xi:include href="SafeCopy.java.xhtml" xpointer="element(/1/2/1/1)"/></pre> +<pre class="listing"><xi:include href="SafeCopy.java.xhtml" xpointer="element(/1/2/1/1)"/></pre> <p> Rationale: </p> <ul> @@ -115,239 +115,222 @@ developers that do not use IntelliJ IDEA / InspectionGadgets to know what the rules are to be able to perform the same verifications. </p> <ul> - <li> - Inspections - <ul> - <li> - Abstraction issues - <dl> - <dt>'instanceof' check for 'this'</dt> - <dd> - This most likely is a failure to understand object - oriented programming. Such constructs must be replaced - by proper polymorphism. - </dd> - </dl> - </li> - <li> - Assignment issues - <dl> - <dt>Assignment replaceable with operator assignment</dt> - <dd> - Operator assignments should be used wherever applicable - because they are easier to read: It's faster to see and - understand that the new variable value is based on a - modification of the original value, not a completely new - value. - <br/> - Conditional operators are currently ignored because - <code>foo |= bar();</code> is not the same as <code>foo - = foo || bar();</code> because the behavior regarding - side-effects in <code>bar()</code> is changed. - </dd> - <dt>Assignment to catch block parameter</dt> - <dd> - This reports things like <code>catch (FooException e) { - e = ...; }</code> as they are either errors or, if not, - at least very confusing. - </dd> - </dl> - </li> - <li> - Bitwise operation issues - <dl> - <dt>Incompatible bitwise mask operation</dt> - <dd> - Bitwise mask expressions which are guaranteed to always - evaluate to true or false most likely are logical - errors. Example: <code>(var & constant1) == - constant2</code>. - </dd> - <dt>Pointless bitwise expression</dt> - <dd> - Pointless expressions that and with zero, or with zero - or shift with zero most likely are logical errors. - </dd> - <dt>Shift operation by inappropriate constant</dt> - <dd> - Shifts with shift values out of range (0..31 for int, - 0..63 for long) most likely are logical errors. - </dd> - </dl> - </li> - <li> - Class structure - <dl> - <dt>'final' method in 'final' class</dt> - <dd> - This is unnecessary and may be confusing. Methods in - final classes are always implicitly final. A method - should only be explicitly declared final if the context - is "the class might be subclasses, but this method is - not designed to be overridden". Thus if a method in a - final class is explicitly declared final, it may lead to - the conclusion that the class was declared final by - mistake. - </dd> - <dt>Missing @Deprecated annotation</dt> - <dd> - Makes sure that deprecated members that are documented - as deprecated in Javadoc (<code>@deprecated</code> - Javadoc tag) are also annotated as - <code>@Deprecated</code> in the source code. - <br/> - Background: Future compiler versions (JDK 1.6 or JDK - 1.7) might stop to parse Javadoc comments. To get the - deprecation information into the class file, the - annotation must be used then. Also, deprecation - information might only be fully reflective on 1.5 or - later if it was declared with the annotation. - </dd> - <dt>Missing @Override annotation</dt> - <dd> - Makes sure that members that override members from a - class (not implement from an interface) are annotated as - <code>@Override</code> in the source code. - <br/> - Background: A missing <code>@Override</code> isn't an - error by itself. But the opposite situation, an <code>@Override</code> - when nothing is overridden is an error. That is useful - for finding typos when wanting to override a method. - E.g. if you override <code>toString()</code> using - <code>@Override public String tostring()</code> (not the - typo), the compiler will be able to report this as an - error. - </dd> - <dt>'private' method declared 'final'</dt> - <dd> - Private methods are implicitly final. Explicitly - declaring them final looks like the method should be - public or protected instead. - </dd> - <dt>'protected' member in 'final' class</dt> - <dd> - Final classes cannot be sub-classed. Protected members - are explicitly visible for subclasses. Because of that, - protected members in final classes are an oxymoron that - indicates an error. - </dd> - <dt>'public' constructor in non-public class</dt> - <dd> - If the class is not visible, the constructor isn't - either. Declaring the constructor of higher - accessibility than its class is pointless and most - likely an error. - </dd> - </dl> - </li> - <li> - Code style issues - <dl> - <dt>Missorted modifiers</dt> - <dt>Modifier order does not match JLS suggestion</dt> - <dd>Annotations should be sorted alphabetically, annotations - MUST be sorted before keywords, keywords must be sorted - according to JLS. - </dd> - </dl> - </li> - <li> - Finalization issues - <dl> - <dt>'finalize()' called explicitly</dt> - <dd>finalize() must only be called by the garbage collector, - but not application software. - </dd> - <dt>'finalize()' does not call 'super.finalize()'</dt> - <dd>This always is an error as this prevents the superclass - from performing its own finalization code. - </dd> - <dt>'finalize()' not declared 'protected'</dt> - <dd>This is an error because 'finalize()' must not be public - because it never needs to be called directly. - </dd> - </dl> - </li> - <li> - General - <dl> - <dt>Declaration has Javadoc problems</dt> - <dd> - Makes sure that a Javadoc comment that is present also - has a certain level of technical quality. Currently the - following omissions are treated as errors: - <code>@author</code> for top level classes, periods in - briefs, <code>@return</code> for methods, - <code>@param</code> and <code>ŧrhwos</code> or <code>@exception</code> - for methods and constructors. Unknown Javadoc tags are - also reported (<code>@note</code> and similar extension - tags are known to this inspection and won't cause false - positives). - <br/> - Though it would be possible to ignore deprecated - elements, they're not. Even if an element is deprecated, - it must still be documented properly and without errors. - </dd> - <dt>Declaration has problems in Javadoc references</dt> - <dd> - Makes sure that references in Javadoc comments (<code>{@link - ...}</code> and eventually <code>@see ...</code>) can be - resolved. - </dd> - <dt>equals() and hashCode() not paired</dt> - <dd> - Due to their contract, equals() and hashCode() must - always be paired. If one of them is overridden, so must - be the other. - </dd> - <dt>Redundant suppression</dt> - <dd>Reports usages of warning suppression when they suppress - something that isn't there. - </dd> - <dt>Variable is assigned to itself</dt> - <dd>Stuff like <code>a = a;</code> most likely is an error. - </dd> - <dt>Wrong package statement</dt> - <dd>Reports when the package statement doesn't correspond to - the project directory structure. - </dd> - </dl> - </li> - <li> - Imports - <dl> - <dt>* import</dt> - <dd> - * imports are forbidden in Gridarta. - </dd> - <dt>Import from same package</dt> - <dt>java.lang import</dt> - <dt>Redundant import</dt> - <dd> - Redundant or pointless imports are forbidden in - Gridarta. - </dd> - <dt>Static import</dt> - <dd>Our code style doesn't allow static import.</dd> - <dt>Unused import</dt> - <dd>Import statements must not list types they don't use. - </dd> - </dl> - </li> - <li> - Inheritance issues - <dl> - <dt>Abstract method with missing implementations</dt> - <dd> - The compiler would of course report this in the - subclasses that miss the implementation. This inspection - supports you while editing or if you're too lazy to - perform a build prior to a commit. - </dd> - </dl> - </li> - </ul> - </li> +<li> +Inspections +<ul> +<li> + Abstraction issues + <dl> + <dt>'instanceof' check for 'this'</dt> + <dd> + This most likely is a failure to understand object oriented + programming. Such constructs must be replaced by proper + polymorphism. + </dd> + </dl> +</li> +<li> + Assignment issues + <dl> + <dt>Assignment replaceable with operator assignment</dt> + <dd> + Operator assignments should be used wherever applicable because they + are easier to read: It's faster to see and understand that the new + variable value is based on a modification of the original value, not + a completely new value. + <br/> + Conditional operators are currently ignored because <code>foo |= + bar();</code> is not the same as <code>foo = foo || bar();</code> + because the behavior regarding side-effects in <code>bar()</code> is + changed. + </dd> + <dt>Assignment to catch block parameter</dt> + <dd> + This reports things like <code>catch (FooException e) { e = ...; + }</code> as they are either errors or, if not, at least very + confusing. + </dd> + </dl> +</li> +<li> + Bitwise operation issues + <dl> + <dt>Incompatible bitwise mask operation</dt> + <dd> + Bitwise mask expressions which are guaranteed to always evaluate to + true or false most likely are logical errors. Example: <code>(var + & constant1) == constant2</code>. + </dd> + <dt>Pointless bitwise expression</dt> + <dd> + Pointless expressions that and with zero, or with zero or shift with + zero most likely are logical errors. + </dd> + <dt>Shift operation by inappropriate constant</dt> + <dd> + Shifts with shift values out of range (0..31 for int, 0..63 for + long) most likely are logical errors. + </dd> + </dl> +</li> +<li> + Class structure + <dl> + <dt>'final' method in 'final' class</dt> + <dd> + This is unnecessary and may be confusing. Methods in final classes + are always implicitly final. A method should only be explicitly + declared final if the context is "the class might be subclasses, but + this method is not designed to be overridden". Thus if a method in a + final class is explicitly declared final, it may lead to the + conclusion that the class was declared final by mistake. + </dd> + <dt>Missing @Deprecated annotation</dt> + <dd> + Makes sure that deprecated members that are documented as deprecated + in Javadoc (<code>@deprecated</code> Javadoc tag) are also annotated + as <code>@Deprecated</code> in the source code. + <br/> + Background: Future compiler versions (JDK 1.6 or JDK 1.7) might stop + to parse Javadoc comments. To get the deprecation information into + the class file, the annotation must be used then. Also, deprecation + information might only be fully reflective on 1.5 or later if it was + declared with the annotation. + </dd> + <dt>Missing @Override annotation</dt> + <dd> + Makes sure that members that override members from a class (not + implement from an interface) are annotated as <code>@Override</code> + in the source code. + <br/> + Background: A missing <code>@Override</code> isn't an error by + itself. But the opposite situation, an <code>@Override</code> when + nothing is overridden is an error. That is useful for finding typos + when wanting to override a method. E.g. if you override <code>toString()</code> + using <code>@Override public String tostring()</code> (not the + typo), the compiler will be able to report this as an error. + </dd> + <dt>'private' method declared 'final'</dt> + <dd> + Private methods are implicitly final. Explicitly declaring them + final looks like the method should be public or protected instead. + </dd> + <dt>'protected' member in 'final' class</dt> + <dd> + Final classes cannot be sub-classed. Protected members are + explicitly visible for subclasses. Because of that, protected + members in final classes are an oxymoron that indicates an error. + </dd> + <dt>'public' constructor in non-public class</dt> + <dd> + If the class is not visible, the constructor isn't either. Declaring + the constructor of higher accessibility than its class is pointless + and most likely an error. + </dd> + </dl> +</li> +<li> + Code style issues + <dl> + <dt>Missorted modifiers</dt> + <dt>Modifier order does not match JLS suggestion</dt> + <dd>Annotations should be sorted alphabetically, annotations MUST be + sorted before keywords, keywords must be sorted according to JLS. + </dd> + </dl> +</li> +<li> + Finalization issues + <dl> + <dt>'finalize()' called explicitly</dt> + <dd>finalize() must only be called by the garbage collector, but not + application software. + </dd> + <dt>'finalize()' does not call 'super.finalize()'</dt> + <dd>This always is an error as this prevents the superclass from + performing its own finalization code. + </dd> + <dt>'finalize()' not declared 'protected'</dt> + <dd>This is an error because 'finalize()' must not be public because it + never needs to be called directly. + </dd> + </dl> +</li> +<li> + General + <dl> + <dt>Declaration has Javadoc problems</dt> + <dd> + Makes sure that a Javadoc comment that is present also has a certain + level of technical quality. Currently the following omissions are + treated as errors: <code>@author</code> for top level classes, + periods in briefs, <code>@return</code> for methods, + <code>@param</code> and <code>ŧrhwos</code> or + <code>@exception</code> for methods and constructors. Unknown + Javadoc tags are also reported (<code>@note</code> and similar + extension tags are known to this inspection and won't cause false + positives). + <br/> + Though it would be possible to ignore deprecated elements, they're + not. Even if an element is deprecated, it must still be documented + properly and without errors. + </dd> + <dt>Declaration has problems in Javadoc references</dt> + <dd> + Makes sure that references in Javadoc comments (<code>{@link + ...}</code> and eventually <code>@see ...</code>) can be resolved. + </dd> + <dt>equals() and hashCode() not paired</dt> + <dd> + Due to their contract, equals() and hashCode() must always be + paired. If one of them is overridden, so must be the other. + </dd> + <dt>Redundant suppression</dt> + <dd>Reports usages of warning suppression when they suppress something + that isn't there. + </dd> + <dt>Variable is assigned to itself</dt> + <dd>Stuff like <code>a = a;</code> most likely is an error. + </dd> + <dt>Wrong package statement</dt> + <dd>Reports when the package statement doesn't correspond to the project + directory structure. + </dd> + </dl> +</li> +<li> + Imports + <dl> + <dt>* import</dt> + <dd> + * imports are forbidden in Gridarta. + </dd> + <dt>Import from same package</dt> + <dt>java.lang import</dt> + <dt>Redundant import</dt> + <dd> + Redundant or pointless imports are forbidden in Gridarta. + </dd> + <dt>Static import</dt> + <dd>Our code style doesn't allow static import.</dd> + <dt>Unused import</dt> + <dd>Import statements must not list types they don't use. + </dd> + </dl> +</li> +<li> + Inheritance issues + <dl> + <dt>Abstract method with missing implementations</dt> + <dd> + The compiler would of course report this in the subclasses that miss + the implementation. This inspection supports you while editing or if + you're too lazy to perform a build prior to a commit. + </dd> + </dl> +</li> </ul> +</li> +</ul> </body> </html> Modified: trunk/src/doc/hist/MergingEditors.xhtml =================================================================== --- trunk/src/doc/hist/MergingEditors.xhtml 2010-05-24 18:49:57 UTC (rev 7986) +++ trunk/src/doc/hist/MergingEditors.xhtml 2010-05-24 19:08:48 UTC (rev 7987) @@ -141,8 +141,7 @@ <p> The following persons have made statements about the possibilities: </p> <ul> - <li>Cher, definitely declining D. and E., but unsure whether to do F. or - G.. + <li>Cher, definitely declining D. and E., but unsure whether to do F. or G.. </li> <li>Ragnor, zergus and other editor developers: votes missing</li> <li>Project leaders / admins: votes missing</li> Modified: trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java 2010-05-24 18:49:57 UTC (rev 7986) +++ trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java 2010-05-24 19:08:48 UTC (rev 7987) @@ -610,7 +610,8 @@ * @param archetypeAttributeName the archetype attribute name * @param attributeName the user interface attribute name * @param description the attribute's description - * @param inputLength the input length in characters for text input fields + * @param inputLength the input length in characters for text input + * fields * @param sectionName the section name */ public TestArchetypeAttribute(@NotNull final String type, @NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { Modified: trunk/src/test/net/sf/gridarta/model/map/grid/MapGridTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/map/grid/MapGridTest.java 2010-05-24 18:49:57 UTC (rev 7986) +++ trunk/src/test/net/sf/gridarta/model/map/grid/MapGridTest.java 2010-05-24 19:08:48 UTC (rev 7987) @@ -89,11 +89,20 @@ for (int y = 0; y < size.getHeight(); y++) { for (int x = 0; x < size.getWidth(); x++) { final int flags = mapGrid.getFlags(x, y); - sb.append(Integer.toHexString( - ((flags & MapGrid.GRID_FLAG_SELECTION_NORTH) == 0 ? 0 : 1) - + ((flags & MapGrid.GRID_FLAG_SELECTION_EAST) == 0 ? 0 : 2) - + ((flags & MapGrid.GRID_FLAG_SELECTION_SOUTH) == 0 ? 0 : 4) - + ((flags & MapGrid.GRID_FLAG_SELECTION_WEST) == 0 ? 0 : 8))); + int value = 0; + if ((flags & MapGrid.GRID_FLAG_SELECTION_NORTH) != 0) { + value |= 1; + } + if ((flags & MapGrid.GRID_FLAG_SELECTION_EAST) != 0) { + value |= 2; + } + if ((flags & MapGrid.GRID_FLAG_SELECTION_SOUTH) != 0) { + value |= 4; + } + if ((flags & MapGrid.GRID_FLAG_SELECTION_WEST) != 0) { + value |= 8; + } + sb.append(Integer.toHexString(value)); } } Assert.assertEquals(expectedBorder, sb.toString()); Modified: trunk/src/test/net/sf/gridarta/model/map/mapmodel/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/map/mapmodel/DefaultMapModelTest.java 2010-05-24 18:49:57 UTC (rev 7986) +++ trunk/src/test/net/sf/gridarta/model/map/mapmodel/DefaultMapModelTest.java 2010-05-24 19:08:48 UTC (rev 7987) @@ -65,6 +65,12 @@ public class DefaultMapModelTest { /** + * Predefined icon names. + */ + @NotNull + private static final String[] ICON_NAMES = { SystemIcons.SQUARE_SEL_SQUARE, SystemIcons.SQUARE_SEL_SQUARE_NORTH, SystemIcons.SQUARE_SEL_SQUARE_EAST, SystemIcons.SQUARE_SEL_SQUARE_SOUTH, SystemIcons.SQUARE_SEL_SQUARE_WEST, SystemIcons.SQUARE_PRESEL_SQUARE, SystemIcons.SQUARE_CURSOR, SystemIcons.SQUARE_EMPTY, SystemIcons.SQUARE_UNKNOWN, SystemIcons.SQUARE_NOFACE, SystemIcons.SQUARE_NOARCH, SystemIcons.DEFAULT_ICON, SystemIcons.DEFAULT_PREVIEW, SystemIcons.SQUARE_WARNING, }; + + /** * The map model listener registered to {@link #mapModel} to record map * changes. */ @@ -178,11 +184,7 @@ mapModel.beginTransaction("TEST"); mapModel.resizeMap(new Size2D(4, 3)); mapModel.endTransaction(); - Assert.assertEquals( - "mapSizeChanged:\n" - + "no squares\n" - + "no game objects\n", - result.toString()); + Assert.assertEquals("mapSizeChanged:\n" + "no squares\n" + "no game objects\n", result.toString()); } /** @@ -216,11 +218,7 @@ addGameObjectToMap(mapModel, "1", 2, 2, insertionModeSet.getAutoInsertionMode()); mapModel.resizeMap(new Size2D(1, 2)); // cancels square changed event mapModel.endTransaction(); - Assert.assertEquals( - "mapSizeChanged:\n" - + "no squares\n" - + "no game objects\n", - result.toString()); + Assert.assertEquals("mapSizeChanged:\n" + "no squares\n" + "no game objects\n", result.toString()); } /** @@ -241,11 +239,7 @@ addGameObjectToMap(mapModel, "1", 2, 2, insertionModeSet.getAutoInsertionMode()); mapModel.resizeMap(new Size2D(1, 2)); // cancels square changed event mapModel.endTransaction(); - Assert.assertEquals( - "mapSizeChanged:\n" - + "no squares\n" - + "no game objects\n", - result.toString()); + Assert.assertEquals("mapSizeChanged:\n" + "no squares\n" + "no game objects\n", result.toString()); } /** @@ -262,11 +256,7 @@ mapModel.beginTransaction("TEST"); addGameObjectToMap(mapModel, "1", 1, 2, insertionModeSet.getAutoInsertionMode()); mapModel.endTransaction(); - Assert.assertEquals( - "mapSquaresChanged:\n" - + "square 1 2\n" - + "no game objects\n", - result.toString()); + Assert.assertEquals("mapSquaresChanged:\n" + "square 1 2\n" + "no game objects\n", result.toString()); } /** @@ -285,12 +275,7 @@ addGameObjectToMap(mapModel, "1", 1, 2, insertionModeSet.getAutoInsertionMode()); addGameObjectToMap(mapModel, "1", 2, 2, insertionModeSet.getAutoInsertionMode()); mapModel.endTransaction(); - Assert.assertEquals( - "mapSquaresChanged:\n" - + "square 1 2\n" - + "square 2 2\n" - + "no game objects\n", - result.toString()); + Assert.assertEquals("mapSquaresChanged:\n" + "square 1 2\n" + "square 2 2\n" + "no game objects\n", result.toString()); } /** @@ -309,11 +294,7 @@ insertGameObject(gameObject, "2"); } mapModel.endTransaction(); - Assert.assertEquals( - "mapObjectsChanged:\n" - + "no squares\n" - + "game object 1 2 1\n", - result.toString()); + Assert.assertEquals("mapObjectsChanged:\n" + "no squares\n" + "game object 1 2 1\n", result.toString()); } /** @@ -332,16 +313,12 @@ gameObject.setAttributeString("key", "value"); } mapModel.endTransaction(); - Assert.assertEquals( - "mapObjectsChanged:\n" - + "no squares\n" - + "game object 1 2 1\n", - result.toString()); + Assert.assertEquals("mapObjectsChanged:\n" + "no squares\n" + "game object 1 2 1\n", result.toString()); } /** - * Test case for {@link DefaultMapModel#getAllGameObjects()}: for a 1x2 - * game object only the head should be returned. + * Test case for {@link DefaultMapModel#getAllGameObjects()}: for a 1x2 game + * object only the head should be returned. */ @Test public void testGetAllGameObjects1() { @@ -442,22 +419,7 @@ final ImageIcon imageIcon = new ImageIcon(new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB)); final GUIUtils guiUtils = new GUIUtils(); systemIcons = new SystemIcons(guiUtils); - for (final String iconName : new String[] { - SystemIcons.SQUARE_SEL_SQUARE, - SystemIcons.SQUARE_SEL_SQUARE_NORTH, - SystemIcons.SQUARE_SEL_SQUARE_EAST, - SystemIcons.SQUARE_SEL_SQUARE_SOUTH, - SystemIcons.SQUARE_SEL_SQUARE_WEST, - SystemIcons.SQUARE_PRESEL_SQUARE, - SystemIcons.SQUARE_CURSOR, - SystemIcons.SQUARE_EMPTY, - SystemIcons.SQUARE_UNKNOWN, - SystemIcons.SQUARE_NOFACE, - SystemIcons.SQUARE_NOARCH, - SystemIcons.DEFAULT_ICON, - SystemIcons.DEFAULT_PREVIEW, - SystemIcons.SQUARE_WARNING, - }) { + for (final String iconName : ICON_NAMES) { guiUtils.addToCache(iconName, imageIcon); } final TestMapArchObject mapArchObject = new TestMapArchObject(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-24 18:50:03
|
Revision: 7986 http://gridarta.svn.sourceforge.net/gridarta/?rev=7986&view=rev Author: akirschbaum Date: 2010-05-24 18:49:57 +0000 (Mon, 24 May 2010) Log Message: ----------- Remove unused code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java Modified: trunk/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java =================================================================== --- trunk/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java 2010-05-24 18:42:47 UTC (rev 7985) +++ trunk/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java 2010-05-24 18:49:57 UTC (rev 7986) @@ -46,10 +46,8 @@ import javax.swing.SwingUtilities; import javax.swing.Timer; import javax.swing.event.CaretEvent; -import javax.swing.event.CaretListener; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; -import javax.swing.event.EventListenerList; import javax.swing.text.BadLocationException; import javax.swing.text.Element; import javax.swing.text.Segment; @@ -121,12 +119,6 @@ @Nullable private JPopupMenu popup; - @NotNull - private final EventListenerList listeners; - - @Nullable - private final CaretEvent caretEvent; - private boolean caretBlinks; private boolean caretVisible; @@ -194,8 +186,6 @@ // Initialize some misc. stuff painter = new TextAreaPainter(this, defaults); documentHandler = new DocumentHandler(); - listeners = new EventListenerList(); - caretEvent = new MutableCaretEvent(); lineSegment = new Segment(); bracketLine = -1; bracketPosition = -1; @@ -306,34 +296,6 @@ } /** - * Sets the input handler. - * @param inputHandler the new input handler - */ - public void setInputHandler(@NotNull final InputHandler inputHandler) { - this.inputHandler = inputHandler; - } - - /** - * Returns true if the caret is blinking, false otherwise. - */ - public boolean isCaretBlinkEnabled() { - return caretBlinks; - } - - /** - * Toggles caret blinking. - * @param caretBlinks true if the caret should blink, false otherwise - */ - public void setCaretBlinkEnabled(final boolean caretBlinks) { - this.caretBlinks = caretBlinks; - if (!caretBlinks) { - blink = false; - } - - painter.invalidateSelectedLines(); - } - - /** * Returns true if the caret is visible, false otherwise. */ public boolean isCaretVisible() { @@ -372,16 +334,6 @@ } /** - * Sets the number of lines from the top and bottom of the text area that - * are always visible. - * @param electricScroll the number of lines always visible from the top or - * bottom - */ - public void setElectricScroll(final int electricScroll) { - this.electricScroll = electricScroll; - } - - /** * Updates the state of the scroll bars. This should be called if the number * of lines in the document changes, or when the size of the text are * changes. @@ -811,15 +763,6 @@ } /** - * Sets the document's token marker. Equivalent to caling - * <code>getDocument().setTokenMarker()</code>. - * @param tokenMarker the token marker - */ - public void setTokenMarker(@NotNull final TokenMarker tokenMarker) { - document.setTokenMarker(tokenMarker); - } - - /** * Returns the length of the document. Equivalent to calling * <code>getDocument().getLength()</code>. */ @@ -975,25 +918,6 @@ } /** - * Returns the offset where the selection starts on the specified line. - */ - public int getSelectionStart(final int line) { - if (line == selectionStartLine) { - return selectionStart; - } else if (rectSelect) { - final Element map = document.getDefaultRootElement(); - final int start = selectionStart - map.getElement(selectionStartLine).getStartOffset(); - - final Element lineElement = map.getElement(line); - final int lineStart = lineElement.getStartOffset(); - final int lineEnd = lineElement.getEndOffset() - 1; - return Math.min(lineEnd, lineStart + start); - } else { - return getLineStartOffset(line); - } - } - - /** * Returns the selection start line. */ public int getSelectionStartLine() { @@ -1001,16 +925,6 @@ } /** - * Sets the selection start. The new selection will be the new selection - * start and the old selection end. - * @param selectionStart the selection start - * @see #select(int, int) - */ - public void setSelectionStart(final int selectionStart) { - select(selectionStart, selectionEnd); - } - - /** * Returns the selection end offset. */ public int getSelectionEnd() { @@ -1018,25 +932,6 @@ } /** - * Returns the offset where the selection ends on the specified line. - */ - public int getSelectionEnd(final int line) { - if (line == selectionEndLine) { - return selectionEnd; - } else if (rectSelect) { - final Element map = document.getDefaultRootElement(); - final int end = selectionEnd - map.getElement(selectionEndLine).getStartOffset(); - - final Element lineElement = map.getElement(line); - final int lineStart = lineElement.getStartOffset(); - final int lineEnd = lineElement.getEndOffset() - 1; - return Math.min(lineEnd, lineStart + end); - } else { - return getLineEndOffset(line) - 1; - } - } - - /** * Returns the selection end line. */ public int getSelectionEndLine() { @@ -1044,16 +939,6 @@ } /** - * Sets the selection end. The new selection will be the old selection start - * and the bew selection end. - * @param selectionEnd the selection end - * @see #select(int, int) - */ - public void setSelectionEnd(final int selectionEnd) { - select(selectionStart, selectionEnd); - } - - /** * Returns the caret position. This will either be the selection start or * the selection end, depending on which direction the selection was made * in. @@ -1079,13 +964,6 @@ } /** - * Returns the mark line. - */ - public int getMarkLine() { - return biasLeft ? selectionEndLine : selectionStartLine; - } - - /** * Sets the caret position. The new selection will consist of the caret * position only (hence no text will be selected). * @param caret the caret position @@ -1103,13 +981,6 @@ } /** - * Moves the mark to the caret position. - */ - public void selectNone() { - select(getCaretPosition(), getCaretPosition()); - } - - /** * Selects from the start offset to the end offset. This is the general * selection method used by all other selecting methods. The caret position * will be start if start < end, and end if end > start. @@ -1162,8 +1033,6 @@ selectionStartLine = newStartLine; selectionEndLine = newEndLine; biasLeft = newBias; - - fireCaretEvent(); } // When the user is typing, etc, we don't want the caret @@ -1312,31 +1181,6 @@ } /** - * Sets if this component is editable. - * @param editable true if this text area should be editable, false - * otherwise - */ - public void setEditable(final boolean editable) { - this.editable = editable; - } - - /** - * Returns the right click popup menu. - */ - @NotNull - public JPopupMenu getRightClickPopup() { - return popup; - } - - /** - * Sets the right click popup menu. - * @param popup the popup - */ - public void setRightClickPopup(@NotNull final JPopupMenu popup) { - this.popup = popup; - } - - /** * Returns the `magic' caret position. This can be used to preserve the * column position when moving up and down lines. */ @@ -1439,22 +1283,6 @@ } /** - * Adds a caret change listener to this text area. - * @param listener the listener - */ - public void addCaretListener(@NotNull final CaretListener listener) { - listeners.add(CaretListener.class, listener); - } - - /** - * Removes a caret change listener from this text area. - * @param listener the listener - */ - public void removeCaretListener(@NotNull final CaretListener listener) { - listeners.remove(CaretListener.class, listener); - } - - /** * Deletes the selected text from the text area and places it into the * clipboard. */ @@ -1550,12 +1378,6 @@ super.processKeyEvent(e); } - void fireCaretEvent() { - for (final CaretListener listener : listeners.getListeners(CaretListener.class)) { - listener.caretUpdate(caretEvent); - } - } - void updateBracketHighlight(final int newCaretPosition) { if (newCaretPosition == 0) { bracketPosition = -1; @@ -1843,13 +1665,13 @@ switch (e.getClickCount()) { case 1: - doSingleClick(e, line, offset, dot); + doSingleClick(e, line); break; case 2: - doDoubleClick(e, line, offset, dot); + doDoubleClick(line, offset, dot); break; case 3: - doTripleClick(e, line, offset, dot); + doTripleClick(line); break; } } @@ -1868,7 +1690,7 @@ vertical.setValue(vertical.getValue() + diff); } - private void doSingleClick(@NotNull final InputEvent evt, final int line, final int offset, final int dot) { + private void doSingleClick(@NotNull final InputEvent evt, final int dot) { if ((evt.getModifiers() & InputEvent.SHIFT_MASK) == 0) { setCaretPosition(dot); } else { @@ -1877,7 +1699,7 @@ } } - private void doDoubleClick(@NotNull final MouseEvent evt, final int line, final int offset, final int dot) { + private void doDoubleClick(final int line, final int offset, final int dot) { // Ignore empty lines if (getLineLength(line) == 0) { return; @@ -1945,7 +1767,7 @@ */ } - private void doTripleClick(@NotNull final MouseEvent evt, final int line, final int offset, final int dot) { + private void doTripleClick(final int line) { select(getLineStartOffset(line), getLineEndOffset(line) - 1); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |