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...> - 2013-07-12 03:28:08
|
Revision: 9310 http://sourceforge.net/p/gridarta/code/9310 Author: akirschbaum Date: 2013-07-12 03:28:03 +0000 (Fri, 12 Jul 2013) Log Message: ----------- Add nullable annotation. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/UndoActions.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/UndoActions.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/UndoActions.java 2013-07-10 20:48:00 UTC (rev 9309) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/UndoActions.java 2013-07-12 03:28:03 UTC (rev 9310) @@ -63,7 +63,7 @@ * @param mapModel the map model to affect * @param undoState the change to apply */ - private static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> void applyChange(final UndoModel<G, A, R> undoModel, final MapModel<G, A, R> mapModel, final UndoState<G, A, R> undoState) { + private static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> void applyChange(@NotNull final UndoModel<G, A, R> undoModel, @NotNull final MapModel<G, A, R> mapModel, @NotNull final UndoState<G, A, R> undoState) { try { mapModel.beginTransaction(undoState.getName()); try { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-07-10 20:48:03
|
Revision: 9309 http://sourceforge.net/p/gridarta/code/9309 Author: akirschbaum Date: 2013-07-10 20:48:00 +0000 (Wed, 10 Jul 2013) Log Message: ----------- Extract SaveAllMapsAction from DefaultFileControl. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java Added Paths: ----------- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/SaveAllMapsAction.java Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/SaveAllMapsAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/SaveAllMapsAction.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/SaveAllMapsAction.java 2013-07-10 20:48:00 UTC (rev 9309) @@ -0,0 +1,66 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.action; + +import javax.swing.Action; +import net.sf.gridarta.gui.misc.DefaultFileControl; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.utils.EditorAction; +import net.sf.japi.swing.action.ActionMethod; +import org.jetbrains.annotations.NotNull; + +/** + * An {@link EditorAction} that saves all modified maps. + * @author Andreas Kirschbaum + */ +public class SaveAllMapsAction<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements EditorAction { + + /** + * The global {@link DefaultFileControl} instance. + */ + @NotNull + private final DefaultFileControl<G, A, R> fileControl; + + /** + * Creates a new instance. + * @param fileControl the global file control instance + */ + public SaveAllMapsAction(@NotNull final DefaultFileControl<G, A, R> fileControl) { + this.fileControl = fileControl; + } + + /** + * Saves all modified maps. + */ + @ActionMethod + public void saveAllMaps() { + fileControl.saveAllMaps(); + } + + /** + * {@inheritDoc} + */ + @Override + public void setAction(@NotNull final Action action, @NotNull final String name) { + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/SaveAllMapsAction.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java 2013-07-10 20:46:52 UTC (rev 9308) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java 2013-07-10 20:48:00 UTC (rev 9309) @@ -22,7 +22,6 @@ import java.awt.Component; import java.io.File; import java.io.IOException; -import javax.swing.Action; import javax.swing.JFileChooser; import javax.swing.JOptionPane; import javax.swing.filechooser.FileFilter; @@ -40,11 +39,9 @@ import net.sf.gridarta.textedit.scripteditor.ScriptEditControl; import net.sf.gridarta.utils.ActionBuilderUtils; import net.sf.gridarta.utils.CommonConstants; -import net.sf.gridarta.utils.EditorAction; import net.sf.gridarta.utils.FileChooserUtils; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; -import net.sf.japi.swing.action.ActionMethod; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -52,7 +49,7 @@ * Default {@link FileControl} implementation. Asks the user for directions. * @author Andreas Kirschbaum */ -public class DefaultFileControl<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements EditorAction, FileControl<G, A, R> { +public class DefaultFileControl<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements FileControl<G, A, R> { /** * The {@link ActionBuilder}. @@ -236,7 +233,6 @@ /** * {@inheritDoc} */ - @ActionMethod @Override public void saveAllMaps() { for (final MapControl<G, A, R> mapControl : mapManager.getOpenedMaps()) { @@ -397,11 +393,4 @@ ACTION_BUILDER.showMessageDialog(parent, "teleportCharacterError", mapPath, message); } - /** - * {@inheritDoc} - */ - @Override - public void setAction(@NotNull final Action action, @NotNull final String name) { - } - } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-07-10 20:46:52 UTC (rev 9308) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-07-10 20:48:00 UTC (rev 9309) @@ -68,6 +68,7 @@ import net.sf.gridarta.action.OptionsAction; import net.sf.gridarta.action.ReleaseDragAction; import net.sf.gridarta.action.ReloadFacesAction; +import net.sf.gridarta.action.SaveAllMapsAction; import net.sf.gridarta.action.SelectArchAboveAction; import net.sf.gridarta.action.SelectArchBelowAction; import net.sf.gridarta.action.SelectSquareAction; @@ -578,7 +579,7 @@ createAction("newScript", "Script", scriptEditControl); createAction("editScript", "Script", new EditScriptAction<G, A, R>(fileControl)); createAction("openFile", "Map", new OpenFileAction<G, A, R>(fileControl)); - createAction("saveAllMaps", "Map", fileControl); + createAction("saveAllMaps", "Map", new SaveAllMapsAction<G, A, R>(fileControl)); final Action aCloseAllMaps = createAction("closeAllMaps", "Map,Window", new CloseAllMapsAction<G, A, R>(fileControl)); createAction("gameObjectTextEditor", "Tool", new MainViewActions<G, A, R>(mainView, gameObjectAttributesControl, gameObjectTab, textEditorTab)); createAction("manageBookmarks", "Bookmarks", new ManageBookmarksAction<G, A, R>(mapMenu, mapImageCache, parent)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-07-10 20:46:54
|
Revision: 9308 http://sourceforge.net/p/gridarta/code/9308 Author: akirschbaum Date: 2013-07-10 20:46:52 +0000 (Wed, 10 Jul 2013) Log Message: ----------- Fix Javadoc issue. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/EditScriptAction.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/EditScriptAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/EditScriptAction.java 2013-07-10 20:45:33 UTC (rev 9307) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/EditScriptAction.java 2013-07-10 20:46:52 UTC (rev 9308) @@ -49,7 +49,7 @@ } /** - * {@inheritDoc} + * Opens a script file. */ @ActionMethod public void editScript() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-07-10 20:45:39
|
Revision: 9307 http://sourceforge.net/p/gridarta/code/9307 Author: akirschbaum Date: 2013-07-10 20:45:33 +0000 (Wed, 10 Jul 2013) Log Message: ----------- Rename function name. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/OpenFileAction.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/OpenFileAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/OpenFileAction.java 2013-07-10 20:42:20 UTC (rev 9306) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/OpenFileAction.java 2013-07-10 20:45:33 UTC (rev 9307) @@ -49,10 +49,10 @@ } /** - * {@inheritDoc} + * Opens a map file. */ @ActionMethod - public void editScript() { + public void openFile() { fileControl.openFile(true); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-07-10 20:42:26
|
Revision: 9306 http://sourceforge.net/p/gridarta/code/9306 Author: akirschbaum Date: 2013-07-10 20:42:20 +0000 (Wed, 10 Jul 2013) Log Message: ----------- Extract OpenFileAction from DefaultFileControl. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java Added Paths: ----------- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/OpenFileAction.java Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/OpenFileAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/OpenFileAction.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/OpenFileAction.java 2013-07-10 20:42:20 UTC (rev 9306) @@ -0,0 +1,66 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.action; + +import javax.swing.Action; +import net.sf.gridarta.gui.misc.DefaultFileControl; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.utils.EditorAction; +import net.sf.japi.swing.action.ActionMethod; +import org.jetbrains.annotations.NotNull; + +/** + * An {@link EditorAction} that edits or creates a map file. + * @author Andreas Kirschbaum + */ +public class OpenFileAction<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements EditorAction { + + /** + * The global {@link DefaultFileControl} instance. + */ + @NotNull + private final DefaultFileControl<G, A, R> fileControl; + + /** + * Creates a new instance. + * @param fileControl the global file control instance + */ + public OpenFileAction(@NotNull final DefaultFileControl<G, A, R> fileControl) { + this.fileControl = fileControl; + } + + /** + * {@inheritDoc} + */ + @ActionMethod + public void editScript() { + fileControl.openFile(true); + } + + /** + * {@inheritDoc} + */ + @Override + public void setAction(@NotNull final Action action, @NotNull final String name) { + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/OpenFileAction.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java 2013-07-10 20:38:58 UTC (rev 9305) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java 2013-07-10 20:42:20 UTC (rev 9306) @@ -171,11 +171,6 @@ return tmpFileChooser; } - @ActionMethod - public void openFile() { - openFile(true); - } - /** * {@inheritDoc} */ Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-07-10 20:38:58 UTC (rev 9305) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-07-10 20:42:20 UTC (rev 9306) @@ -64,6 +64,7 @@ import net.sf.gridarta.action.MoveSquareTopAction; import net.sf.gridarta.action.MoveSquareUpAction; import net.sf.gridarta.action.NewMapAction; +import net.sf.gridarta.action.OpenFileAction; import net.sf.gridarta.action.OptionsAction; import net.sf.gridarta.action.ReleaseDragAction; import net.sf.gridarta.action.ReloadFacesAction; @@ -576,7 +577,7 @@ createAction("archAttributes", "Map", new ArchAttributesAction<G, A, R>(mapViewManager, gameObjectAttributesDialogFactory)); createAction("newScript", "Script", scriptEditControl); createAction("editScript", "Script", new EditScriptAction<G, A, R>(fileControl)); - createAction("openFile", "Map", fileControl); + createAction("openFile", "Map", new OpenFileAction<G, A, R>(fileControl)); createAction("saveAllMaps", "Map", fileControl); final Action aCloseAllMaps = createAction("closeAllMaps", "Map,Window", new CloseAllMapsAction<G, A, R>(fileControl)); createAction("gameObjectTextEditor", "Tool", new MainViewActions<G, A, R>(mainView, gameObjectAttributesControl, gameObjectTab, textEditorTab)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-07-10 20:39:01
|
Revision: 9305 http://sourceforge.net/p/gridarta/code/9305 Author: akirschbaum Date: 2013-07-10 20:38:58 +0000 (Wed, 10 Jul 2013) Log Message: ----------- Fix comment. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/EditScriptAction.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/EditScriptAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/EditScriptAction.java 2013-07-10 20:37:07 UTC (rev 9304) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/EditScriptAction.java 2013-07-10 20:38:58 UTC (rev 9305) @@ -29,7 +29,7 @@ import org.jetbrains.annotations.NotNull; /** - * An {@link EditorAction} that edits or creates a file. + * An {@link EditorAction} that edits or creates a script file. * @author Andreas Kirschbaum */ public class EditScriptAction<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements EditorAction { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-07-10 20:37:10
|
Revision: 9304 http://sourceforge.net/p/gridarta/code/9304 Author: akirschbaum Date: 2013-07-10 20:37:07 +0000 (Wed, 10 Jul 2013) Log Message: ----------- Extract EditScriptAction from DefaultFileControl. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java Added Paths: ----------- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/EditScriptAction.java Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/EditScriptAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/EditScriptAction.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/EditScriptAction.java 2013-07-10 20:37:07 UTC (rev 9304) @@ -0,0 +1,66 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.action; + +import javax.swing.Action; +import net.sf.gridarta.gui.misc.DefaultFileControl; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.utils.EditorAction; +import net.sf.japi.swing.action.ActionMethod; +import org.jetbrains.annotations.NotNull; + +/** + * An {@link EditorAction} that edits or creates a file. + * @author Andreas Kirschbaum + */ +public class EditScriptAction<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements EditorAction { + + /** + * The global {@link DefaultFileControl} instance. + */ + @NotNull + private final DefaultFileControl<G, A, R> fileControl; + + /** + * Creates a new instance. + * @param fileControl the global file control instance + */ + public EditScriptAction(@NotNull final DefaultFileControl<G, A, R> fileControl) { + this.fileControl = fileControl; + } + + /** + * {@inheritDoc} + */ + @ActionMethod + public void editScript() { + fileControl.openFile(false); + } + + /** + * {@inheritDoc} + */ + @Override + public void setAction(@NotNull final Action action, @NotNull final String name) { + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/EditScriptAction.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java 2013-07-10 20:33:42 UTC (rev 9303) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java 2013-07-10 20:37:07 UTC (rev 9304) @@ -172,11 +172,6 @@ } @ActionMethod - public void editScript() { - openFile(false); - } - - @ActionMethod public void openFile() { openFile(true); } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-07-10 20:33:42 UTC (rev 9303) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-07-10 20:37:07 UTC (rev 9304) @@ -47,6 +47,7 @@ import net.sf.gridarta.action.DisplayArchetypeNamesAction; import net.sf.gridarta.action.DisplayGameObjectNamesAction; import net.sf.gridarta.action.DisplayIconsOnlyAction; +import net.sf.gridarta.action.EditScriptAction; import net.sf.gridarta.action.ExitAction; import net.sf.gridarta.action.FindArchetypesAction; import net.sf.gridarta.action.GcAction; @@ -574,7 +575,7 @@ createAction("selectArchBelow", "Map Cursor,Selected Square View", new SelectArchAboveAction<G, A, R>(mapViewManager)); createAction("archAttributes", "Map", new ArchAttributesAction<G, A, R>(mapViewManager, gameObjectAttributesDialogFactory)); createAction("newScript", "Script", scriptEditControl); - createAction("editScript", "Script", fileControl); + createAction("editScript", "Script", new EditScriptAction<G, A, R>(fileControl)); createAction("openFile", "Map", fileControl); createAction("saveAllMaps", "Map", fileControl); final Action aCloseAllMaps = createAction("closeAllMaps", "Map,Window", new CloseAllMapsAction<G, A, R>(fileControl)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-07-10 20:33:47
|
Revision: 9303 http://sourceforge.net/p/gridarta/code/9303 Author: akirschbaum Date: 2013-07-10 20:33:42 +0000 (Wed, 10 Jul 2013) Log Message: ----------- Merge FileControl.editScript() and editFile() into openFile(). Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapmanager/FileControl.java trunk/src/model/src/test/java/net/sf/gridarta/model/mapmanager/TestFileControl.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java 2013-07-10 20:23:11 UTC (rev 9302) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java 2013-07-10 20:33:42 UTC (rev 9303) @@ -171,36 +171,26 @@ return tmpFileChooser; } - /** - * {@inheritDoc} - */ @ActionMethod - @Override public void editScript() { openFile(false); } - /** - * {@inheritDoc} - */ @ActionMethod - @Override public void openFile() { openFile(true); } /** - * The user wants to open a file. The file filters and preselected file - * filter are set accordingly to <code>mapFilter</code>. - * @param mapFilter set to <code>true</code> if the user probably wants to - * open a map, <code>false</code> otherwise + * {@inheritDoc} */ - private void openFile(final boolean mapFilter) { + @Override + public void openFile(final boolean mapFile) { if (fileChooser == null) { fileChooser = createFileChooser(); } final JFileChooser tmpFileChooser = fileChooser; - if (mapFilter) { + if (mapFile) { tmpFileChooser.setFileFilter(mapFileFilter); } else { tmpFileChooser.setFileFilter(scriptFileFilter); Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/mapmanager/FileControl.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/mapmanager/FileControl.java 2013-07-10 20:23:11 UTC (rev 9302) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/mapmanager/FileControl.java 2013-07-10 20:33:42 UTC (rev 9303) @@ -30,16 +30,13 @@ public interface FileControl<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { /** - * The user wants to edit a script file. + * The user wants to edit a file. + * @param mapFile {@code true} for map files, {@code false} for script + * files */ - void editScript(); + void openFile(boolean mapFile); /** - * The user wants to open a map file. - */ - void openFile(); - - /** * Save one map. * @param mapControl the map * @return <code>false</code> if saving failed, <code>true</code> otherwise Modified: trunk/src/model/src/test/java/net/sf/gridarta/model/mapmanager/TestFileControl.java =================================================================== --- trunk/src/model/src/test/java/net/sf/gridarta/model/mapmanager/TestFileControl.java 2013-07-10 20:23:11 UTC (rev 9302) +++ trunk/src/model/src/test/java/net/sf/gridarta/model/mapmanager/TestFileControl.java 2013-07-10 20:33:42 UTC (rev 9303) @@ -43,7 +43,7 @@ * {@inheritDoc} */ @Override - public void editScript() { + public void openFile(final boolean mapFile) { throw new AssertionError(); } @@ -51,14 +51,6 @@ * {@inheritDoc} */ @Override - public void openFile() { - throw new AssertionError(); - } - - /** - * {@inheritDoc} - */ - @Override public boolean save(@NotNull final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl) { throw new AssertionError(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-07-10 20:23:15
|
Revision: 9302 http://sourceforge.net/p/gridarta/code/9302 Author: akirschbaum Date: 2013-07-10 20:23:11 +0000 (Wed, 10 Jul 2013) Log Message: ----------- Extract CloseAllMapsAction from DefaultFileControl. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java Added Paths: ----------- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/CloseAllMapsAction.java Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/CloseAllMapsAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/CloseAllMapsAction.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/CloseAllMapsAction.java 2013-07-10 20:23:11 UTC (rev 9302) @@ -0,0 +1,66 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.action; + +import javax.swing.Action; +import net.sf.gridarta.gui.misc.DefaultFileControl; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.utils.EditorAction; +import net.sf.japi.swing.action.ActionMethod; +import org.jetbrains.annotations.NotNull; + +/** + * An {@link EditorAction} that closes all map windows. + * @author Andreas Kirschbaum + */ +public class CloseAllMapsAction<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements EditorAction { + + /** + * The global {@link DefaultFileControl} instance. + */ + @NotNull + private final DefaultFileControl<G, A, R> fileControl; + + /** + * Creates a new instance. + * @param fileControl the global file control instance + */ + public CloseAllMapsAction(@NotNull final DefaultFileControl<G, A, R> fileControl) { + this.fileControl = fileControl; + } + + /** + * Closes all open map windows. + */ + @ActionMethod + public void closeAllMaps() { + fileControl.closeAllMaps(); + } + + /** + * {@inheritDoc} + */ + @Override + public void setAction(@NotNull final Action action, @NotNull final String name) { + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/CloseAllMapsAction.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java 2013-07-10 20:17:21 UTC (rev 9301) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java 2013-07-10 20:23:11 UTC (rev 9302) @@ -269,7 +269,6 @@ /** * {@inheritDoc} */ - @ActionMethod @Override public boolean closeAllMaps() { while (true) { Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-07-10 20:17:21 UTC (rev 9301) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-07-10 20:23:11 UTC (rev 9302) @@ -38,6 +38,7 @@ import net.sf.gridarta.action.AddToSelectionAction; import net.sf.gridarta.action.ArchAttributesAction; import net.sf.gridarta.action.CleanCompletelyBlockedSquaresAction; +import net.sf.gridarta.action.CloseAllMapsAction; import net.sf.gridarta.action.CollectArchesAction; import net.sf.gridarta.action.CollectSpellsAction; import net.sf.gridarta.action.ControlClientAction; @@ -576,7 +577,7 @@ createAction("editScript", "Script", fileControl); createAction("openFile", "Map", fileControl); createAction("saveAllMaps", "Map", fileControl); - final Action aCloseAllMaps = createAction("closeAllMaps", "Map,Window", fileControl); + final Action aCloseAllMaps = createAction("closeAllMaps", "Map,Window", new CloseAllMapsAction<G, A, R>(fileControl)); createAction("gameObjectTextEditor", "Tool", new MainViewActions<G, A, R>(mainView, gameObjectAttributesControl, gameObjectTab, textEditorTab)); createAction("manageBookmarks", "Bookmarks", new ManageBookmarksAction<G, A, R>(mapMenu, mapImageCache, parent)); createAction("addBookmark", "Bookmarks", new AddBookmarkAction<G, A, R>(bookmarksMapMenuPreferences, mapViewManager)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-07-10 20:17:28
|
Revision: 9301 http://sourceforge.net/p/gridarta/code/9301 Author: akirschbaum Date: 2013-07-10 20:17:21 +0000 (Wed, 10 Jul 2013) Log Message: ----------- Extract AddBookmarkAction from BookmarkActions. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java Added Paths: ----------- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AddBookmarkAction.java Removed Paths: ------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/bookmarks/BookmarkActions.java Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AddBookmarkAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AddBookmarkAction.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AddBookmarkAction.java 2013-07-10 20:17:21 UTC (rev 9301) @@ -0,0 +1,151 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.action; + +import java.io.File; +import javax.swing.Action; +import net.sf.gridarta.gui.dialog.bookmarks.EditBookmarkDialog; +import net.sf.gridarta.gui.map.mapview.MapView; +import net.sf.gridarta.gui.map.mapview.MapViewManager; +import net.sf.gridarta.gui.map.mapview.MapViewManagerListener; +import net.sf.gridarta.gui.mapmenu.AbstractMapMenuPreferences; +import net.sf.gridarta.gui.mapmenu.MapMenuEntryMap; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.model.mapcontrol.MapControl; +import net.sf.gridarta.model.mapmodel.MapModel; +import net.sf.gridarta.utils.EditorAction; +import net.sf.japi.swing.action.ActionMethod; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * An {@link EditorAction} that creates a new bookmark for the current map. + * @author Andreas Kirschbaum + */ +public class AddBookmarkAction<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements EditorAction { + + /** + * The {@link AbstractMapMenuPreferences} for adding new bookmarks. + */ + @NotNull + private final AbstractMapMenuPreferences bookmarksMapMenuPreferences; + + /** + * The {@link MapViewManager} instance. + */ + @NotNull + private final MapViewManager<G, A, R> mapViewManager; + + /** + * The action associated with this editor action. Set to {@code null} if no + * action is associated. + */ + @Nullable + private Action action; + + /** + * Creates a new instance. + * @param bookmarksMapMenuPreferences the map menu preferences defining the + * bookmarks menu entries + * @param mapViewManager the map view manager instance + */ + public AddBookmarkAction(@NotNull final AbstractMapMenuPreferences bookmarksMapMenuPreferences, @NotNull final MapViewManager<G, A, R> mapViewManager) { + this.bookmarksMapMenuPreferences = bookmarksMapMenuPreferences; + this.mapViewManager = mapViewManager; + final MapViewManagerListener<G, A, R> mapViewManagerListener = new MapViewManagerListener<G, A, R>() { + + @Override + public void activeMapViewChanged(@Nullable final MapView<G, A, R> mapView) { + updateAction(); + } + + @Override + public void mapViewCreated(@NotNull final MapView<G, A, R> mapView) { + } + + @Override + public void mapViewClosing(@NotNull final MapView<G, A, R> mapView) { + } + + }; + mapViewManager.addMapViewManagerListener(mapViewManagerListener); + } + + /** + * Action method for "addBookmark". Creates a new bookmark for the currently + * opened map. + */ + @ActionMethod + public void addBookmark() { + doAddBookmark(true); + } + + /** + * {@inheritDoc} + */ + @Override + public void setAction(@NotNull final Action action, @NotNull final String name) { + this.action = action; + updateAction(); + } + + /** + * Updates the enabled state of all actions. + */ + private void updateAction() { + if (action != null) { + //noinspection ConstantConditions + action.setEnabled(doAddBookmark(false)); + } + } + + /** + * Preforms the action "add bookmark". + * @param performAction whether the action should be performed + * @return whether the action has or can be performed + */ + private boolean doAddBookmark(final boolean performAction) { + final MapView<G, A, R> mapView = mapViewManager.getActiveMapView(); + if (mapView == null) { + return false; + } + + final MapControl<G, A, R> mapControl = mapView.getMapControl(); + final MapModel<G, A, R> mapModel = mapControl.getMapModel(); + final File mapFile = mapModel.getMapFile(); + if (mapFile == null) { + return false; + } + + if (performAction) { + final A mapArchObject = mapModel.getMapArchObject(); + final EditBookmarkDialog editBookmarkDialog = new EditBookmarkDialog(mapView.getInternalFrame(), mapArchObject.getMapName()); + if (editBookmarkDialog.showDialog()) { + final MapMenuEntryMap mapMenuEntry = new MapMenuEntryMap(mapFile, editBookmarkDialog.getDescription()); + bookmarksMapMenuPreferences.addEntry(mapMenuEntry); + } + } + + return true; + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AddBookmarkAction.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Deleted: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/bookmarks/BookmarkActions.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/bookmarks/BookmarkActions.java 2013-07-10 20:10:27 UTC (rev 9300) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/bookmarks/BookmarkActions.java 2013-07-10 20:17:21 UTC (rev 9301) @@ -1,153 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2011 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package net.sf.gridarta.gui.dialog.bookmarks; - -import java.io.File; -import javax.swing.Action; -import net.sf.gridarta.gui.map.mapview.MapView; -import net.sf.gridarta.gui.map.mapview.MapViewManager; -import net.sf.gridarta.gui.map.mapview.MapViewManagerListener; -import net.sf.gridarta.gui.mapmenu.AbstractMapMenuPreferences; -import net.sf.gridarta.gui.mapmenu.MapMenuEntryMap; -import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.maparchobject.MapArchObject; -import net.sf.gridarta.model.mapcontrol.MapControl; -import net.sf.gridarta.model.mapmodel.MapModel; -import net.sf.gridarta.utils.EditorAction; -import net.sf.japi.swing.action.ActionMethod; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * Implements actions for managing bookmarks. - * @author Andreas Kirschbaum - */ -public class BookmarkActions<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements EditorAction { - - /** - * The {@link AbstractMapMenuPreferences} for adding new bookmarks. - */ - @NotNull - private final AbstractMapMenuPreferences bookmarksMapMenuPreferences; - - /** - * The {@link MapViewManager} instance. - */ - @NotNull - private final MapViewManager<G, A, R> mapViewManager; - - /** - * The {@link Action} for "add bookmark". - */ - @Nullable - private Action aAddBookmark; - - /** - * Creates a new instance. - * @param bookmarksMapMenuPreferences the map menu preferences defining the - * bookmarks menu entries - * @param mapViewManager the map view manager instance - */ - public BookmarkActions(@NotNull final AbstractMapMenuPreferences bookmarksMapMenuPreferences, @NotNull final MapViewManager<G, A, R> mapViewManager) { - this.bookmarksMapMenuPreferences = bookmarksMapMenuPreferences; - this.mapViewManager = mapViewManager; - final MapViewManagerListener<G, A, R> mapViewManagerListener = new MapViewManagerListener<G, A, R>() { - - @Override - public void activeMapViewChanged(@Nullable final MapView<G, A, R> mapView) { - updateActions(); - } - - @Override - public void mapViewCreated(@NotNull final MapView<G, A, R> mapView) { - // ignore - } - - @Override - public void mapViewClosing(@NotNull final MapView<G, A, R> mapView) { - // ignore - } - - }; - mapViewManager.addMapViewManagerListener(mapViewManagerListener); - } - - /** - * Action method for "addBookmark". Creates a new bookmark for the currently - * opened map. - */ - @ActionMethod - public void addBookmark() { - doAddBookmark(true); - } - - /** - * Updates the enabled state of all actions. - */ - private void updateActions() { - if (aAddBookmark != null) { - //noinspection ConstantConditions - aAddBookmark.setEnabled(doAddBookmark(false)); - } - } - - /** - * Preforms the action "add bookmark". - * @param performAction whether the action should be performed - * @return whether the action has or can be performed - */ - private boolean doAddBookmark(final boolean performAction) { - final MapView<G, A, R> mapView = mapViewManager.getActiveMapView(); - if (mapView == null) { - return false; - } - - final MapControl<G, A, R> mapControl = mapView.getMapControl(); - final MapModel<G, A, R> mapModel = mapControl.getMapModel(); - final File mapFile = mapModel.getMapFile(); - if (mapFile == null) { - return false; - } - - if (performAction) { - final A mapArchObject = mapModel.getMapArchObject(); - final EditBookmarkDialog editBookmarkDialog = new EditBookmarkDialog(mapView.getInternalFrame(), mapArchObject.getMapName()); - if (editBookmarkDialog.showDialog()) { - final MapMenuEntryMap mapMenuEntry = new MapMenuEntryMap(mapFile, editBookmarkDialog.getDescription()); - bookmarksMapMenuPreferences.addEntry(mapMenuEntry); - } - } - - return true; - } - - /** - * {@inheritDoc} - */ - @Override - public void setAction(@NotNull final Action action, @NotNull final String name) { - if (name.equals("addBookmark")) { - aAddBookmark = action; - updateActions(); - } - } - -} Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-07-10 20:10:27 UTC (rev 9300) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-07-10 20:17:21 UTC (rev 9301) @@ -34,6 +34,7 @@ import javax.swing.JMenuBar; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.MainControl; +import net.sf.gridarta.action.AddBookmarkAction; import net.sf.gridarta.action.AddToSelectionAction; import net.sf.gridarta.action.ArchAttributesAction; import net.sf.gridarta.action.CleanCompletelyBlockedSquaresAction; @@ -79,7 +80,6 @@ import net.sf.gridarta.gui.autovalidator.AutoValidator; import net.sf.gridarta.gui.copybuffer.CopyBuffer; import net.sf.gridarta.gui.delayedmapmodel.DelayedMapModelListenerManager; -import net.sf.gridarta.gui.dialog.bookmarks.BookmarkActions; import net.sf.gridarta.gui.dialog.find.FindDialogManager; import net.sf.gridarta.gui.dialog.gameobjectattributes.GameObjectAttributesDialogFactory; import net.sf.gridarta.gui.dialog.goexit.GoExitDialogManager; @@ -436,7 +436,6 @@ final BookmarksMapMenuPreferences bookmarksMapMenuPreferences = new BookmarksMapMenuPreferences(); final MapMenu mapMenu = bookmarksMapMenuPreferences.getMapMenu(); @Nullable final MapMenuManager<G, A, R> bookmarksMapMenuManager = new MapMenuManager<G, A, R>(mapMenu, mapViewsManager, fileControl, mapImageCache); - final EditorAction bookmarkActions = new BookmarkActions<G, A, R>(bookmarksMapMenuPreferences, mapViewManager); final ExitConnectorActions<G, A, R> exitConnectorActions = new ExitConnectorActions<G, A, R>(exitConnectorModel, exitMatcher, archetypeSet, mapManager, fileControl, pathManager, insertionModeSet); // XXX: should be part of DefaultMainControl final EditorAction exitConnectorController = new ExitConnectorController<G, A, R>(exitConnectorActions, exitConnectorModel, mapViewManager); final Action displayGameObjectNamesAction = createAction("displayGameObjectNames", "Archetype Chooser", new DisplayGameObjectNamesAction<G, A, R>(archetypeChooserModel, displayModeArchetypeNames)); @@ -580,7 +579,7 @@ final Action aCloseAllMaps = createAction("closeAllMaps", "Map,Window", fileControl); createAction("gameObjectTextEditor", "Tool", new MainViewActions<G, A, R>(mainView, gameObjectAttributesControl, gameObjectTab, textEditorTab)); createAction("manageBookmarks", "Bookmarks", new ManageBookmarksAction<G, A, R>(mapMenu, mapImageCache, parent)); - createAction("addBookmark", "Bookmarks", bookmarkActions); + createAction("addBookmark", "Bookmarks", new AddBookmarkAction<G, A, R>(bookmarksMapMenuPreferences, mapViewManager)); createActionOptional("openInClient", "Map", editorFactory.newServerActions(mapViewManager, fileControl, pathManager)); createAction("exitCopy", "Exit Connector", exitConnectorController); createAction("exitPaste", "Exit Connector", exitConnectorController); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-07-10 20:10:33
|
Revision: 9300 http://sourceforge.net/p/gridarta/code/9300 Author: akirschbaum Date: 2013-07-10 20:10:27 +0000 (Wed, 10 Jul 2013) Log Message: ----------- Extract ManageBookmarksAction from BookmarkActions. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/bookmarks/BookmarkActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java Added Paths: ----------- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ManageBookmarksAction.java Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ManageBookmarksAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ManageBookmarksAction.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ManageBookmarksAction.java 2013-07-10 20:10:27 UTC (rev 9300) @@ -0,0 +1,97 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.action; + +import java.awt.Component; +import javax.swing.Action; +import net.sf.gridarta.gui.dialog.bookmarks.ManageBookmarksDialog; +import net.sf.gridarta.gui.mapimagecache.MapImageCache; +import net.sf.gridarta.gui.mapmenu.MapMenu; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.utils.EditorAction; +import net.sf.japi.swing.action.ActionMethod; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * An {@link EditorAction} that opens the bookmarks manager. + * @author Andreas Kirschbaum + */ +public class ManageBookmarksAction<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements EditorAction { + + /** + * The {@link MapMenu} defining the bookmarks menu entries. + */ + @NotNull + private final MapMenu mapMenu; + + /** + * The {@link MapImageCache} for creating map previews. + */ + @NotNull + private final MapImageCache<G, A, R> mapImageCache; + + /** + * The parent component for dialogs. + */ + @NotNull + private final Component parentComponent; + + /** + * The {@link ManageBookmarksDialog} instance. Set to <code>null</code> if + * not yet created. + */ + @Nullable + private ManageBookmarksDialog<G, A, R> manageBookmarksDialog; + + /** + * Creates a new instance. + * @param mapMenu the map menu definition the bookmarks menu entries + * @param mapImageCache the map image cache for creating map previews + * @param parentComponent the parent component for dialogs + */ + public ManageBookmarksAction(@NotNull final MapMenu mapMenu, @NotNull final MapImageCache<G, A, R> mapImageCache, @NotNull final Component parentComponent) { + this.mapMenu = mapMenu; + this.mapImageCache = mapImageCache; + this.parentComponent = parentComponent; + } + + /** + * Action method for "manage bookmarks". Opens the dialog for editing + * existing bookmarks. + */ + @ActionMethod + public void manageBookmarks() { + if (manageBookmarksDialog == null) { + manageBookmarksDialog = new ManageBookmarksDialog<G, A, R>(parentComponent, mapImageCache, mapMenu); + } + manageBookmarksDialog.showDialog(parentComponent); + } + + /** + * {@inheritDoc} + */ + @Override + public void setAction(@NotNull final Action action, @NotNull final String name) { + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ManageBookmarksAction.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/bookmarks/BookmarkActions.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/bookmarks/BookmarkActions.java 2013-07-10 07:15:54 UTC (rev 9299) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/bookmarks/BookmarkActions.java 2013-07-10 20:10:27 UTC (rev 9300) @@ -19,15 +19,12 @@ package net.sf.gridarta.gui.dialog.bookmarks; -import java.awt.Component; import java.io.File; import javax.swing.Action; import net.sf.gridarta.gui.map.mapview.MapView; import net.sf.gridarta.gui.map.mapview.MapViewManager; import net.sf.gridarta.gui.map.mapview.MapViewManagerListener; -import net.sf.gridarta.gui.mapimagecache.MapImageCache; import net.sf.gridarta.gui.mapmenu.AbstractMapMenuPreferences; -import net.sf.gridarta.gui.mapmenu.MapMenu; import net.sf.gridarta.gui.mapmenu.MapMenuEntryMap; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; @@ -52,57 +49,26 @@ private final AbstractMapMenuPreferences bookmarksMapMenuPreferences; /** - * The {@link MapMenu} defining the bookmarks menu entries. - */ - @NotNull - private final MapMenu mapMenu; - - /** - * The {@link MapImageCache} for creating map previews. - */ - @NotNull - private final MapImageCache<G, A, R> mapImageCache; - - /** * The {@link MapViewManager} instance. */ @NotNull private final MapViewManager<G, A, R> mapViewManager; /** - * The parent component for dialogs. - */ - @NotNull - private final Component parentComponent; - - /** * The {@link Action} for "add bookmark". */ @Nullable private Action aAddBookmark; /** - * The {@link ManageBookmarksDialog} instance. Set to <code>null</code> if - * not yet created. - */ - @Nullable - private ManageBookmarksDialog<G, A, R> manageBookmarksDialog; - - /** * Creates a new instance. * @param bookmarksMapMenuPreferences the map menu preferences defining the * bookmarks menu entries - * @param mapMenu the map menu definition the bookmarks menu entries * @param mapViewManager the map view manager instance - * @param parentComponent the parent component for dialogs - * @param mapImageCache the map image cache for creating map previews */ - public BookmarkActions(@NotNull final AbstractMapMenuPreferences bookmarksMapMenuPreferences, @NotNull final MapMenu mapMenu, @NotNull final MapViewManager<G, A, R> mapViewManager, @NotNull final Component parentComponent, @NotNull final MapImageCache<G, A, R> mapImageCache) { + public BookmarkActions(@NotNull final AbstractMapMenuPreferences bookmarksMapMenuPreferences, @NotNull final MapViewManager<G, A, R> mapViewManager) { this.bookmarksMapMenuPreferences = bookmarksMapMenuPreferences; - this.mapMenu = mapMenu; this.mapViewManager = mapViewManager; - this.parentComponent = parentComponent; - this.mapImageCache = mapImageCache; final MapViewManagerListener<G, A, R> mapViewManagerListener = new MapViewManagerListener<G, A, R>() { @Override @@ -134,18 +100,6 @@ } /** - * Action method for "manage bookmarks". Opens the dialog for editing - * existing bookmarks. - */ - @ActionMethod - public void manageBookmarks() { - if (manageBookmarksDialog == null) { - manageBookmarksDialog = new ManageBookmarksDialog<G, A, R>(parentComponent, mapImageCache, mapMenu); - } - manageBookmarksDialog.showDialog(parentComponent); - } - - /** * Updates the enabled state of all actions. */ private void updateActions() { Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-07-10 07:15:54 UTC (rev 9299) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-07-10 20:10:27 UTC (rev 9300) @@ -51,6 +51,7 @@ import net.sf.gridarta.action.GoLocationAction; import net.sf.gridarta.action.InsertArchAction; import net.sf.gridarta.action.LightVisibleAction; +import net.sf.gridarta.action.ManageBookmarksAction; import net.sf.gridarta.action.MoveSquareBottomAction; import net.sf.gridarta.action.MoveSquareDownAction; import net.sf.gridarta.action.MoveSquareEnvAction; @@ -435,7 +436,7 @@ final BookmarksMapMenuPreferences bookmarksMapMenuPreferences = new BookmarksMapMenuPreferences(); final MapMenu mapMenu = bookmarksMapMenuPreferences.getMapMenu(); @Nullable final MapMenuManager<G, A, R> bookmarksMapMenuManager = new MapMenuManager<G, A, R>(mapMenu, mapViewsManager, fileControl, mapImageCache); - final EditorAction bookmarkActions = new BookmarkActions<G, A, R>(bookmarksMapMenuPreferences, mapMenu, mapViewManager, parent, mapImageCache); + final EditorAction bookmarkActions = new BookmarkActions<G, A, R>(bookmarksMapMenuPreferences, mapViewManager); final ExitConnectorActions<G, A, R> exitConnectorActions = new ExitConnectorActions<G, A, R>(exitConnectorModel, exitMatcher, archetypeSet, mapManager, fileControl, pathManager, insertionModeSet); // XXX: should be part of DefaultMainControl final EditorAction exitConnectorController = new ExitConnectorController<G, A, R>(exitConnectorActions, exitConnectorModel, mapViewManager); final Action displayGameObjectNamesAction = createAction("displayGameObjectNames", "Archetype Chooser", new DisplayGameObjectNamesAction<G, A, R>(archetypeChooserModel, displayModeArchetypeNames)); @@ -578,7 +579,7 @@ createAction("saveAllMaps", "Map", fileControl); final Action aCloseAllMaps = createAction("closeAllMaps", "Map,Window", fileControl); createAction("gameObjectTextEditor", "Tool", new MainViewActions<G, A, R>(mainView, gameObjectAttributesControl, gameObjectTab, textEditorTab)); - createAction("manageBookmarks", "Bookmarks", bookmarkActions); + createAction("manageBookmarks", "Bookmarks", new ManageBookmarksAction<G, A, R>(mapMenu, mapImageCache, parent)); createAction("addBookmark", "Bookmarks", bookmarkActions); createActionOptional("openInClient", "Map", editorFactory.newServerActions(mapViewManager, fileControl, pathManager)); createAction("exitCopy", "Exit Connector", exitConnectorController); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-07-10 07:16:01
|
Revision: 9299 http://sourceforge.net/p/gridarta/code/9299 Author: akirschbaum Date: 2013-07-10 07:15:54 +0000 (Wed, 10 Jul 2013) Log Message: ----------- Extract FindArchetypesAction from AbstractDialogManager. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/findarchetypes/FindArchetypesDialogManager.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/utils/AbstractDialogManager.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java Added Paths: ----------- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/FindArchetypesAction.java Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/FindArchetypesAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/FindArchetypesAction.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/FindArchetypesAction.java 2013-07-10 07:15:54 UTC (rev 9299) @@ -0,0 +1,76 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.action; + +import java.awt.Component; +import javax.swing.Action; +import net.sf.gridarta.gui.dialog.findarchetypes.FindArchetypesDialogManager; +import net.sf.gridarta.gui.panel.archetypechooser.ArchetypeChooserControl; +import net.sf.gridarta.gui.panel.objectchooser.ObjectChooser; +import net.sf.gridarta.gui.utils.AbstractDialogManager; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.utils.EditorAction; +import net.sf.japi.swing.action.ActionMethod; +import org.jetbrains.annotations.NotNull; + +/** + * An {@link EditorAction} that displays the find archetypes dialog. + * @author Andreas Kirschbaum + */ +public class FindArchetypesAction<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements EditorAction { + + /** + * The find archetypes dialog manager. + */ + @NotNull + private final AbstractDialogManager dialogManager; + + /** + * Creates a new instance. + * @param parent the parent component for the dialog + * @param archetypeChooserControl the archetype chooser control to search + * @param objectChooser the object chooser to use when selecting search + * results + * @param archetypeTypeSet the archetype type set for looking up archetype + * types + */ + public FindArchetypesAction(@NotNull final Component parent, @NotNull final ArchetypeChooserControl<G, A, R> archetypeChooserControl, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final ArchetypeTypeSet archetypeTypeSet) { + dialogManager = new FindArchetypesDialogManager<G, A, R>(parent, archetypeChooserControl, objectChooser, archetypeTypeSet); + } + + /** + * Shows the find archetypes dialog. + */ + @ActionMethod + public void findArchetypes() { + dialogManager.showDialog(); + } + + /** + * {@inheritDoc} + */ + @Override + public void setAction(@NotNull final Action action, @NotNull final String name) { + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/FindArchetypesAction.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/findarchetypes/FindArchetypesDialogManager.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/findarchetypes/FindArchetypesDialogManager.java 2013-07-10 06:52:12 UTC (rev 9298) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/findarchetypes/FindArchetypesDialogManager.java 2013-07-10 07:15:54 UTC (rev 9299) @@ -27,7 +27,6 @@ import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; -import net.sf.japi.swing.action.ActionMethod; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -84,7 +83,6 @@ * types */ 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; this.objectChooser = objectChooser; @@ -107,12 +105,4 @@ dialog.show(); } - /** - * Action method for "find archetype". - */ - @ActionMethod - public void findArchetypes() { - showDialog(); - } - } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/utils/AbstractDialogManager.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/utils/AbstractDialogManager.java 2013-07-10 06:52:12 UTC (rev 9298) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/utils/AbstractDialogManager.java 2013-07-10 07:15:54 UTC (rev 9299) @@ -19,12 +19,6 @@ package net.sf.gridarta.gui.utils; -import java.awt.event.ActionEvent; -import javax.swing.AbstractAction; -import net.sf.japi.swing.action.ActionBuilder; -import net.sf.japi.swing.action.ActionBuilderFactory; -import org.jetbrains.annotations.NotNull; - /** * Abstract base class for classes managing a single dialog instance. The dialog * instance can be shown by calling the associated action. The actual creation @@ -35,43 +29,8 @@ public abstract class AbstractDialogManager { /** - * The {@link ActionBuilder}. - */ - private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); - - /** - * Creates a new instance. - * @param actionName the name of the action to show the dialog - */ - protected AbstractDialogManager(@NotNull final String actionName) { - ACTION_BUILDER.initAction(true, new AbstractAction() { - - /** - * The serial version UID. - */ - private static final long serialVersionUID = 1L; - - @Override - public void actionPerformed(@NotNull final ActionEvent e) { - showDialog(); - } - - @NotNull - @Override - public Object clone() { - try { - return super.clone(); - } catch (@NotNull CloneNotSupportedException ex) { - throw new AssertionError(ex); - } - } - - }, actionName); - } - - /** * Displays the dialog. */ - protected abstract void showDialog(); + public abstract void showDialog(); } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-07-10 06:52:12 UTC (rev 9298) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-07-10 07:15:54 UTC (rev 9299) @@ -46,6 +46,7 @@ import net.sf.gridarta.action.DisplayGameObjectNamesAction; import net.sf.gridarta.action.DisplayIconsOnlyAction; import net.sf.gridarta.action.ExitAction; +import net.sf.gridarta.action.FindArchetypesAction; import net.sf.gridarta.action.GcAction; import net.sf.gridarta.action.GoLocationAction; import net.sf.gridarta.action.InsertArchAction; @@ -79,7 +80,6 @@ import net.sf.gridarta.gui.delayedmapmodel.DelayedMapModelListenerManager; import net.sf.gridarta.gui.dialog.bookmarks.BookmarkActions; import net.sf.gridarta.gui.dialog.find.FindDialogManager; -import net.sf.gridarta.gui.dialog.findarchetypes.FindArchetypesDialogManager; import net.sf.gridarta.gui.dialog.gameobjectattributes.GameObjectAttributesDialogFactory; import net.sf.gridarta.gui.dialog.goexit.GoExitDialogManager; import net.sf.gridarta.gui.dialog.gomap.GoMapDialogManager; @@ -451,8 +451,6 @@ final ReplaceDialogManager<G, A, R> replaceDialogManager = new ReplaceDialogManager<G, A, R>(parent, copyBuffer, objectChooser, mapViewManager, faceObjectProviders, insertionModeSet); final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory = new PluginParameterViewFactory<G, A, R>(archetypeSet, gameObjectAttributesModel, objectChooser, mapManager, faceObjectProviders); final PluginController<G, A, R> pluginControl = new PluginController<G, A, R>(filterControl, pluginParameters, parent, pluginParameterViewFactory, scriptsFile, pluginModel, pluginParameterFactory, pluginExecutor, systemIcons); - //noinspection ResultOfObjectAllocationIgnored - new FindArchetypesDialogManager<G, A, R>(parent, archetypeChooserControl, objectChooser, archetypeTypeSet); final EditorAction mainActions = new MainActions<G, A, R>(findDialogManager, replaceDialogManager, mainViewFrame, mapViewSettings, archetypeSet, copyBuffer, objectChooser, mapManager, mapViewManager, insertionModeSet); final EditorAction mapCursorActions = new MapCursorActions<G, A, R>(mapViewManager); final Action moveSquareDownAction = createAction("moveSquareDown", "Selected Square View", new MoveSquareDownAction<G, A, R>(selectedSquareModel, mapManager)); @@ -461,6 +459,7 @@ final Action moveSquareEnvAction = createAction("moveSquareEnv", "Selected Square View", new MoveSquareEnvAction<G, A, R>(selectedSquareModel, mapManager)); final Action moveSquareInvAction = createAction("moveSquareInv", "Selected Square View", new MoveSquareInvAction<G, A, R>(selectedSquareModel, mapManager)); final Action moveSquareTopAction = createAction("moveSquareTop", "Selected Square View", new MoveSquareTopAction<G, A, R>(selectedSquareModel, mapManager)); + createAction("findArchetypes", "Archetypes", new FindArchetypesAction<G, A, R>(parent, archetypeChooserControl, objectChooser, archetypeTypeSet)); createAction("moveSquarePrev", "Selected Square View", new MoveSquarePrevAction<G, A, R>(selectedSquareModel, mapManager)); createAction("moveSquareNext", "Selected Square View", new MoveSquareNextAction<G, A, R>(selectedSquareModel, mapManager)); createAction("prevWindow", "Map,Window", mapDesktop); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-07-10 06:52:16
|
Revision: 9298 http://sourceforge.net/p/gridarta/code/9298 Author: akirschbaum Date: 2013-07-10 06:52:12 +0000 (Wed, 10 Jul 2013) Log Message: ----------- Add nullable annotation. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/objectchooser/DefaultObjectChooser.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/objectchooser/DefaultObjectChooser.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/objectchooser/DefaultObjectChooser.java 2013-07-10 06:52:01 UTC (rev 9297) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/objectchooser/DefaultObjectChooser.java 2013-07-10 06:52:12 UTC (rev 9298) @@ -245,7 +245,7 @@ * Adds a tab. * @param tab the tab to add */ - private void addTab(final ObjectChooserTab<G, A, R> tab) { + private void addTab(@NotNull final ObjectChooserTab<G, A, R> tab) { tabs.add(tab); tabbedPane.addTab(tab.getTitle(), tab.getComponent()); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-07-10 06:52:07
|
Revision: 9297 http://sourceforge.net/p/gridarta/code/9297 Author: akirschbaum Date: 2013-07-10 06:52:01 +0000 (Wed, 10 Jul 2013) Log Message: ----------- Fix typo. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/ArchetypeChooserControl.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/ArchetypeChooserControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/ArchetypeChooserControl.java 2013-07-10 06:46:21 UTC (rev 9296) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/ArchetypeChooserControl.java 2013-07-10 06:52:01 UTC (rev 9297) @@ -73,7 +73,7 @@ * Creates a new instance. * @param archetypeChooserModel the archetype chooser model to use; no new * archetypes must be added afterwards - * @param archetypeChooserView the archetyoe chooser view to use + * @param archetypeChooserView the archetype chooser view to use * @param createDirectionPane whether to create a "direction" panel * @param faceObjectProviders the face object providers for looking up * faces This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-07-10 06:46:24
|
Revision: 9296 http://sourceforge.net/p/gridarta/code/9296 Author: akirschbaum Date: 2013-07-10 06:46:21 +0000 (Wed, 10 Jul 2013) Log Message: ----------- Extract CollectArchesAction from MainActions. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/mainactions/MainActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java Added Paths: ----------- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/CollectArchesAction.java Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/CollectArchesAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/CollectArchesAction.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/CollectArchesAction.java 2013-07-10 06:46:21 UTC (rev 9296) @@ -0,0 +1,221 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.action; + +import java.awt.Component; +import javax.swing.Action; +import javax.swing.JFrame; +import net.sf.gridarta.commands.Collector; +import net.sf.gridarta.gui.utils.AsynchronousProgress; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.model.resource.AbstractResources; +import net.sf.gridarta.model.settings.GlobalSettings; +import net.sf.gridarta.utils.ActionBuilderUtils; +import net.sf.gridarta.utils.EditorAction; +import net.sf.gridarta.utils.Exiter; +import net.sf.gridarta.utils.ExiterListener; +import net.sf.japi.swing.action.ActionBuilder; +import net.sf.japi.swing.action.ActionBuilderFactory; +import net.sf.japi.swing.action.ActionMethod; +import net.sf.japi.swing.misc.Progress; +import net.sf.japi.swing.misc.ProgressDisplay; +import org.apache.log4j.Category; +import org.apache.log4j.Logger; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * An {@link EditorAction} that runs the archetype collection. + * @author Andreas Kirschbaum + */ +public class CollectArchesAction<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements EditorAction { + + /** + * Action Builder to create Actions. + */ + @NotNull + private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); + + /** + * The Logger for printing log messages. + */ + @NotNull + private static final Category log = Logger.getLogger(CollectArchesAction.class); + + /** + * The global settings instance. + */ + @NotNull + private final GlobalSettings globalSettings; + + /** + * The {@link AbstractResources} to collect. + */ + @NotNull + private final AbstractResources<G, A, R> resources; + + /** + * The parent component for dialog windows. + */ + @NotNull + private final JFrame parent; + + /** + * The {@link Collector} if an archetype collection is running, or else + * <code>null</code>. + */ + @Nullable + private volatile Collector collector; + + /** + * The action associated with this editor action. Set to {@code null} if no + * action is associated. + */ + @Nullable + private Action action; + + /** + * Creates a new instance. + * @param globalSettings the global settings instance + * @param resources the resources to collect + * @param exiter the exiter instance + * @param parent the parent component for dialog windows + */ + public CollectArchesAction(@NotNull final GlobalSettings globalSettings, @NotNull final AbstractResources<G, A, R> resources, @NotNull final Exiter exiter, @NotNull final JFrame parent) { + this.globalSettings = globalSettings; + this.resources = resources; + this.parent = parent; + exiter.addExiterListener(newExiterListener()); + } + + /** + * Runs the archetype collection. + */ + @ActionMethod + public void collectArches() { + doCollectArches(true); + } + + /** + * {@inheritDoc} + */ + @Override + public void setAction(@NotNull final Action action, @NotNull final String name) { + this.action = action; + } + + /** + * Executes the "collect arches" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed + */ + private boolean doCollectArches(final boolean performAction) { + synchronized (this) { + if (collector != null || !resources.canWriteCollected()) { + return false; + } + + if (performAction) { + final Progress progress = new AsynchronousProgress(new ProgressDisplay(parent, ActionBuilderUtils.getString(ACTION_BUILDER, "archCollectTitle"), 0, ActionBuilderUtils.getString(ACTION_BUILDER, "archCollectArches"))); + final Progress collectArches = new Progress() { + + @Override + public void finished() { + progress.finished(); + collector = null; + updateAction(); + } + + @Override + public Component getParentComponent() { + return progress.getParentComponent(); + } + + @Override + public void setLabel(final String msg, final int max) { + progress.setLabel(msg, max); + } + + @Override + public void setValue(final int value) { + progress.setValue(value); + } + + }; + + collector = new Collector(collectArches, resources, globalSettings.getCollectedDirectory()); + assert collector != null; + collector.start(); + updateAction(); + } + } + + return true; + } + + /** + * Updates the action's enabled state. + */ + private void updateAction() { + if (action != null) { + //noinspection ConstantConditions + action.setEnabled(doCollectArches(false)); + } + } + + /** + * Creates a new {@link ExiterListener} that delays application exit until + * archetype collection has finished. + * @return the exiter listener + */ + @NotNull + private ExiterListener newExiterListener() { + final ExiterListener exiterListener = new ExiterListener() { + + @Override + public void preExitNotify() { + // ignore + } + + @Override + public void appExitNotify() { + // ignore + } + + @Override + public void waitExitNotify() { + final Collector tmp = collector; + if (tmp != null) { + try { + tmp.waitUntilFinished(); + } catch (final InterruptedException ignored) { + Thread.currentThread().interrupt(); + log.warn("DelayedMapModelListenerManager was interrupted"); + } + } + } + + }; + return exiterListener; + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/CollectArchesAction.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/mainactions/MainActions.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/mainactions/MainActions.java 2013-07-10 06:33:13 UTC (rev 9295) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/mainactions/MainActions.java 2013-07-10 06:46:21 UTC (rev 9296) @@ -19,7 +19,6 @@ package net.sf.gridarta.mainactions; -import java.awt.Component; import java.awt.Point; import java.awt.Rectangle; import java.io.File; @@ -29,7 +28,6 @@ import java.util.Set; import javax.swing.Action; import javax.swing.JFrame; -import net.sf.gridarta.commands.Collector; import net.sf.gridarta.gui.copybuffer.CopyBuffer; import net.sf.gridarta.gui.dialog.find.FindDialogManager; import net.sf.gridarta.gui.dialog.replace.ReplaceDialogManager; @@ -38,7 +36,6 @@ import net.sf.gridarta.gui.map.mapview.MapViewManagerListener; import net.sf.gridarta.gui.misc.ShiftProcessor; import net.sf.gridarta.gui.panel.objectchooser.ObjectChooser; -import net.sf.gridarta.gui.utils.AsynchronousProgress; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.archetype.ArchetypeSetListener; import net.sf.gridarta.model.archetypeset.ArchetypeSet; @@ -60,21 +57,10 @@ import net.sf.gridarta.model.mapmodel.MapModelListener; import net.sf.gridarta.model.mapmodel.MapSquare; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; -import net.sf.gridarta.model.resource.AbstractResources; -import net.sf.gridarta.model.settings.GlobalSettings; import net.sf.gridarta.model.validation.ErrorCollector; -import net.sf.gridarta.utils.ActionBuilderUtils; import net.sf.gridarta.utils.EditorAction; -import net.sf.gridarta.utils.Exiter; -import net.sf.gridarta.utils.ExiterListener; import net.sf.gridarta.utils.Size2D; -import net.sf.japi.swing.action.ActionBuilder; -import net.sf.japi.swing.action.ActionBuilderFactory; import net.sf.japi.swing.action.ActionMethod; -import net.sf.japi.swing.misc.Progress; -import net.sf.japi.swing.misc.ProgressDisplay; -import org.apache.log4j.Category; -import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -85,18 +71,6 @@ public class MainActions<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements EditorAction { /** - * Action Builder to create Actions. - */ - @NotNull - private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); - - /** - * The Logger for printing log messages. - */ - @NotNull - private static final Category log = Logger.getLogger(MainActions.class); - - /** * The find dialog manager to use. */ @NotNull @@ -115,12 +89,6 @@ private final JFrame parent; /** - * The global settings instance. - */ - @NotNull - private final GlobalSettings globalSettings; - - /** * The map view settings instance. */ @NotNull @@ -139,12 +107,6 @@ private final ObjectChooser<G, A, R> objectChooser; /** - * The {@link AbstractResources} to collect. - */ - @NotNull - private final AbstractResources<G, A, R> resources; - - /** * The {@link InsertionModeSet} to use. */ @NotNull @@ -325,12 +287,6 @@ private Action aShrinkSelection; /** - * Action called for "collect archetypes". - */ - @Nullable - private Action aCollectArches; - - /** * The {@link RandomFillDialog} instance. */ @NotNull @@ -350,13 +306,6 @@ private MapView<G, A, R> currentMapView; /** - * The {@link Collector} if an archetype collection is running, or else - * <code>null</code>. - */ - @Nullable - private volatile Collector collector; - - /** * The map grid listener used to detect map grid changes. */ @NotNull @@ -402,26 +351,21 @@ * @param findDialogManager the find dialog manager to use * @param replaceDialogManager the replace dialog manager to use * @param parent the parent component for dialog windows - * @param globalSettings the global settings instance * @param mapViewSettings the map view settings instance * @param archetypeSet the archetype set * @param copyBuffer the copy buffer instance * @param objectChooser the animation objects instance to use * @param mapManager the map manager instance * @param mapViewManager the map view manager instance - * @param resources the resources to collect * @param insertionModeSet the insertion mode set to use - * @param exiter the exiter instance */ - public MainActions(@NotNull final FindDialogManager<G, A, R> findDialogManager, @NotNull final ReplaceDialogManager<G, A, R> replaceDialogManager, @NotNull final JFrame parent, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final CopyBuffer<G, A, R> copyBuffer, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final MapManager<G, A, R> mapManager, @NotNull final MapViewManager<G, A, R> mapViewManager, @NotNull final AbstractResources<G, A, R> resources, @NotNull final InsertionModeSet<G, A, R> insertionModeSet, @NotNull final Exiter exiter) { + public MainActions(@NotNull final FindDialogManager<G, A, R> findDialogManager, @NotNull final ReplaceDialogManager<G, A, R> replaceDialogManager, @NotNull final JFrame parent, @NotNull final MapViewSettings mapViewSettings, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final CopyBuffer<G, A, R> copyBuffer, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final MapManager<G, A, R> mapManager, @NotNull final MapViewManager<G, A, R> mapViewManager, @NotNull final InsertionModeSet<G, A, R> insertionModeSet) { this.findDialogManager = findDialogManager; this.replaceDialogManager = replaceDialogManager; this.parent = parent; - this.globalSettings = globalSettings; this.mapViewSettings = mapViewSettings; this.copyBuffer = copyBuffer; this.objectChooser = objectChooser; - this.resources = resources; this.insertionModeSet = insertionModeSet; mapManager.addMapManagerListener(newMapManagerListener()); @@ -432,7 +376,6 @@ archetypeSet.addArchetypeSetListener(newArchetypeSetListener()); copyBuffer.addMapModelListener(newMapModelListener()); - exiter.addExiterListener(newExiterListener()); } /** @@ -562,42 +505,6 @@ } /** - * Creates a new {@link ExiterListener} that delays application exit until - * archetype collection has finished. - * @return the exiter listener - */ - @NotNull - private ExiterListener newExiterListener() { - final ExiterListener exiterListener = new ExiterListener() { - - @Override - public void preExitNotify() { - // ignore - } - - @Override - public void appExitNotify() { - // ignore - } - - @Override - public void waitExitNotify() { - final Collector tmp = collector; - if (tmp != null) { - try { - tmp.waitUntilFinished(); - } catch (final InterruptedException ignored) { - Thread.currentThread().interrupt(); - log.warn("DelayedMapModelListenerManager was interrupted"); - } - } - } - - }; - return exiterListener; - } - - /** * Enable/disable menu entries based on the current state. */ private void refreshMenus() { @@ -717,10 +624,6 @@ //noinspection ConstantConditions aShrinkSelection.setEnabled(doShrinkSelection(false)); } - if (aCollectArches != null) { - //noinspection ConstantConditions - aCollectArches.setEnabled(doCollectArches(false)); - } } /** @@ -957,14 +860,6 @@ } /** - * Invoked when "collect archetypes" was selected. - */ - @ActionMethod - public void collectArches() { - doCollectArches(true); - } - - /** * Determine if the current map has a selection. * @return the map view if a selection exists, or <code>null</code> * otherwise @@ -1521,61 +1416,6 @@ } /** - * Executes the "collect arches" action. - * @param performAction whether the action should be performed - * @return whether the action was or can be performed - */ - private boolean doCollectArches(final boolean performAction) { - synchronized (this) { - if (collector != null || !resources.canWriteCollected()) { - return false; - } - - if (performAction) { - final Progress progress = new AsynchronousProgress(new ProgressDisplay(parent, ActionBuilderUtils.getString(ACTION_BUILDER, "archCollectTitle"), 0, ActionBuilderUtils.getString(ACTION_BUILDER, "archCollectArches"))); - final Progress collectArches = new Progress() { - - @Override - public void finished() { - progress.finished(); - collector = null; - if (aCollectArches != null) { - //noinspection ConstantConditions - aCollectArches.setEnabled(doCollectArches(false)); - } - } - - @Override - public Component getParentComponent() { - return progress.getParentComponent(); - } - - @Override - public void setLabel(final String msg, final int max) { - progress.setLabel(msg, max); - } - - @Override - public void setValue(final int value) { - progress.setValue(value); - } - - }; - - collector = new Collector(collectArches, resources, globalSettings.getCollectedDirectory()); - assert collector != null; - collector.start(); - if (aCollectArches != null) { - //noinspection ConstantConditions - aCollectArches.setEnabled(doCollectArches(false)); - } - } - } - - return true; - } - - /** * "Fill" was selected from the Edit menu. * @param mapView the map view to fill * @param insertionMode the insertion mode to use @@ -1662,8 +1502,6 @@ aGrowSelection = action; } else if (name.equals("shrinkSelection")) { aShrinkSelection = action; - } else if (name.equals("collectArches")) { - aCollectArches = action; } else { throw new IllegalArgumentException(); } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-07-10 06:33:13 UTC (rev 9295) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-07-10 06:46:21 UTC (rev 9296) @@ -37,6 +37,7 @@ import net.sf.gridarta.action.AddToSelectionAction; import net.sf.gridarta.action.ArchAttributesAction; import net.sf.gridarta.action.CleanCompletelyBlockedSquaresAction; +import net.sf.gridarta.action.CollectArchesAction; import net.sf.gridarta.action.CollectSpellsAction; import net.sf.gridarta.action.ControlClientAction; import net.sf.gridarta.action.ControlServerAction; @@ -452,7 +453,7 @@ final PluginController<G, A, R> pluginControl = new PluginController<G, A, R>(filterControl, pluginParameters, parent, pluginParameterViewFactory, scriptsFile, pluginModel, pluginParameterFactory, pluginExecutor, systemIcons); //noinspection ResultOfObjectAllocationIgnored new FindArchetypesDialogManager<G, A, R>(parent, archetypeChooserControl, objectChooser, archetypeTypeSet); - final EditorAction mainActions = new MainActions<G, A, R>(findDialogManager, replaceDialogManager, mainViewFrame, globalSettings, mapViewSettings, archetypeSet, copyBuffer, objectChooser, mapManager, mapViewManager, resources, insertionModeSet, exiter); + final EditorAction mainActions = new MainActions<G, A, R>(findDialogManager, replaceDialogManager, mainViewFrame, mapViewSettings, archetypeSet, copyBuffer, objectChooser, mapManager, mapViewManager, insertionModeSet); final EditorAction mapCursorActions = new MapCursorActions<G, A, R>(mapViewManager); final Action moveSquareDownAction = createAction("moveSquareDown", "Selected Square View", new MoveSquareDownAction<G, A, R>(selectedSquareModel, mapManager)); final Action moveSquareUpAction = createAction("moveSquareUp", "Selected Square View", new MoveSquareUpAction<G, A, R>(selectedSquareModel, mapManager)); @@ -537,7 +538,7 @@ createAction("expandEmptySelection", "Map/Selection", mainActions); createAction("growSelection", "Map/Selection", mainActions); createAction("shrinkSelection", "Map/Selection", mainActions); - createAction("collectArches", "Tool", mainActions); + createAction("collectArches", "Tool", new CollectArchesAction<G, A, R>(globalSettings, resources, exiter, mainViewFrame)); createAction("reloadFaces", "Image,Tool", new ReloadFacesAction<G, A, R>(archetypeSet, faceObjectProviders)); createAction("validateMap", "Map,Tool", new ValidateMapAction<G, A, R>(validators, mapManager)); final Action helpAction = createAction("showHelp", "Help", new ShowHelpAction(parent)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-07-10 06:33:18
|
Revision: 9295 http://sourceforge.net/p/gridarta/code/9295 Author: akirschbaum Date: 2013-07-10 06:33:13 +0000 (Wed, 10 Jul 2013) Log Message: ----------- Extract ViewTreasurelistsAction from CFTreasureListTree. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/treasurelist/CFTreasureListTree.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java Added Paths: ----------- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ViewTreasurelistsAction.java Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ViewTreasurelistsAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ViewTreasurelistsAction.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ViewTreasurelistsAction.java 2013-07-10 06:33:13 UTC (rev 9295) @@ -0,0 +1,71 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.action; + +import java.awt.Frame; +import javax.swing.Action; +import net.sf.gridarta.gui.treasurelist.CFTreasureListTree; +import net.sf.gridarta.utils.EditorAction; +import net.sf.japi.swing.action.ActionMethod; +import org.jetbrains.annotations.NotNull; + +/** + * An {@link EditorAction} tha shows the treasurelists dialog. + * @author Andreas Kirschbaum + */ +public class ViewTreasurelistsAction implements EditorAction { + + /** + * The treasurelists instance. + */ + @NotNull + private final CFTreasureListTree treasureListTree; + /** + * The parent component for the treasure lists dialog. + */ + @NotNull + private final Frame parent; + + /** + * Creates a new instance. + * @param treasureListTree the treasurelists instance + * @param parent the parent component for the treasurelists dialog + */ + public ViewTreasurelistsAction(@NotNull final CFTreasureListTree treasureListTree, @NotNull final Frame parent) { + this.treasureListTree = treasureListTree; + this.parent = parent; + } + + /** + * Shows the treasurelists dialog. + */ + @ActionMethod + public void viewTreasurelists() { + treasureListTree.showDialog(null, parent); + } + + /** + * {@inheritDoc} + */ + @Override + public void setAction(@NotNull final Action action, @NotNull final String name) { + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ViewTreasurelistsAction.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/treasurelist/CFTreasureListTree.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/treasurelist/CFTreasureListTree.java 2013-07-10 05:07:35 UTC (rev 9294) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/treasurelist/CFTreasureListTree.java 2013-07-10 06:33:13 UTC (rev 9295) @@ -26,7 +26,6 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.AbstractButton; -import javax.swing.Action; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JDialog; @@ -48,11 +47,9 @@ import net.sf.gridarta.model.treasurelist.FolderTreasureObj; import net.sf.gridarta.model.treasurelist.TreasureTree; import net.sf.gridarta.model.treasurelist.TreasureTreeNode; -import net.sf.gridarta.utils.EditorAction; import net.sf.gridarta.utils.SystemIcons; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; -import net.sf.japi.swing.action.ActionMethod; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -63,7 +60,7 @@ * @author <a href="mailto:ch...@ri...">Christian Hujer</a> * @todo don't extend JTree, instead create a proper model */ -public class CFTreasureListTree extends JTree implements EditorAction { +public class CFTreasureListTree extends JTree { /** * The string displayed in attribute dialog for "none". @@ -150,14 +147,6 @@ } /** - * Wrapper method for showing the dialog from the Resource menu. - */ - @ActionMethod - public void viewTreasurelists() { - showDialog(null, parent); - } - - /** * Shows the dialog window containing this tree. The user can select a * treasurelist which is returned as a string. The dialog window is built * only ONCE, then hidden/shown as needed. As a side-effect, only one @@ -366,11 +355,4 @@ return treasureTreeNode.getTreasureObj().getName(); } - /** - * {@inheritDoc} - */ - @Override - public void setAction(@NotNull final Action action, @NotNull final String name) { - } - } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-07-10 05:07:35 UTC (rev 9294) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-07-10 06:33:13 UTC (rev 9295) @@ -70,6 +70,7 @@ import net.sf.gridarta.action.SubFromSelectionAction; import net.sf.gridarta.action.TipOfTheDayAction; import net.sf.gridarta.action.ValidateMapAction; +import net.sf.gridarta.action.ViewTreasurelistsAction; import net.sf.gridarta.action.ZoomAction; import net.sf.gridarta.actions.ExitConnectorActions; import net.sf.gridarta.gui.autovalidator.AutoValidator; @@ -468,7 +469,7 @@ createAction("deletePickmap", "Pickmap", pickmapChooserControl); createAction("savePickmap", "Pickmap", pickmapChooserControl); createAction("revertPickmap", "Pickmap", pickmapChooserControl); - createAction("viewTreasurelists", "Tool", treasureListTree); + createAction("viewTreasurelists", "Tool", new ViewTreasurelistsAction(treasureListTree, parent)); createAction("mapCreateView", "Map,Window", mapActions); createAction("mapProperties", "Map", mapActions); createToggleAction("autoJoin", "Map", mapActions); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-07-10 05:07:42
|
Revision: 9294 http://sourceforge.net/p/gridarta/code/9294 Author: akirschbaum Date: 2013-07-10 05:07:35 +0000 (Wed, 10 Jul 2013) Log Message: ----------- Extract NewMapAction from NewMapDialogFactory. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/newmap/NewMapDialogFactory.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java Added Paths: ----------- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/NewMapAction.java Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/NewMapAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/NewMapAction.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/NewMapAction.java 2013-07-10 05:07:35 UTC (rev 9294) @@ -0,0 +1,66 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.action; + +import javax.swing.Action; +import net.sf.gridarta.gui.dialog.newmap.NewMapDialogFactory; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.utils.EditorAction; +import net.sf.japi.swing.action.ActionMethod; +import org.jetbrains.annotations.NotNull; + +/** + * An {@link EditorAction} that opens the "Create New Map" dialog. + * @author Andreas Kirschbaum + */ +public class NewMapAction<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements EditorAction { + + /** + * The {@link NewMapDialogFactory} for opening "Create New Map" dialogs. + */ + @NotNull + private final NewMapDialogFactory<G, A, R> newMapDialogFactory; + + /** + * Creates a new instance. + * @param newMapDialogFactory the new map dialog factory to use + */ + public NewMapAction(final NewMapDialogFactory<G, A, R> newMapDialogFactory) { + this.newMapDialogFactory = newMapDialogFactory; + } + + /** + * Shows a dialog for creating a new map. + */ + @ActionMethod + public void newMap() { + newMapDialogFactory.showNewMapDialog(); + } + + /** + * {@inheritDoc} + */ + @Override + public void setAction(@NotNull final Action action, @NotNull final String name) { + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/NewMapAction.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/newmap/NewMapDialogFactory.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/newmap/NewMapDialogFactory.java 2013-07-09 19:58:15 UTC (rev 9293) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/newmap/NewMapDialogFactory.java 2013-07-10 05:07:35 UTC (rev 9294) @@ -20,7 +20,6 @@ package net.sf.gridarta.gui.dialog.newmap; import java.awt.Component; -import javax.swing.Action; import net.sf.gridarta.gui.map.mapview.MapViewsManager; import net.sf.gridarta.gui.mapfiles.MapFolder; import net.sf.gridarta.gui.mapfiles.MapFolderTree; @@ -30,8 +29,6 @@ import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.maparchobject.MapArchObjectFactory; -import net.sf.gridarta.utils.EditorAction; -import net.sf.japi.swing.action.ActionMethod; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -39,7 +36,7 @@ * Utility class to create {@link NewMapDialog} instances. * @author Andreas Kirschbaum */ -public class NewMapDialogFactory<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements EditorAction { +public class NewMapDialogFactory<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { /** * The {@link MapViewsManager} to use. @@ -145,8 +142,7 @@ /** * Shows a dialog for creating a new map. */ - @ActionMethod - public void newMap() { + public void showNewMapDialog() { new NewMapDialog<G, A, R>(mapViewsManager, mapArchObjectFactory, parent, showMapSizeDefault, showMapDifficulty, defaultMapWidth, defaultMapHeight, defaultMapDifficulty); } @@ -166,11 +162,4 @@ new NewPickmapFolderDialog<G, A, R>(this.parent, mapFolderTree, parent, mapViewsManager); } - /** - * {@inheritDoc} - */ - @Override - public void setAction(@NotNull final Action action, @NotNull final String name) { - } - } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java 2013-07-09 19:58:15 UTC (rev 9293) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java 2013-07-10 05:07:35 UTC (rev 9294) @@ -228,7 +228,7 @@ if (isScriptFile) { scriptEditControl.newScript(); // TODO: pass filename } else { - newMapDialogFactory.newMap(); // XXX: pass file + newMapDialogFactory.showNewMapDialog(); // XXX: pass file } } // If neither branch matches, it's a directory - what to do with directories? } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-07-09 19:58:15 UTC (rev 9293) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-07-10 05:07:35 UTC (rev 9294) @@ -57,6 +57,7 @@ import net.sf.gridarta.action.MoveSquarePrevAction; import net.sf.gridarta.action.MoveSquareTopAction; import net.sf.gridarta.action.MoveSquareUpAction; +import net.sf.gridarta.action.NewMapAction; import net.sf.gridarta.action.OptionsAction; import net.sf.gridarta.action.ReleaseDragAction; import net.sf.gridarta.action.ReloadFacesAction; @@ -540,7 +541,7 @@ createAction("validateMap", "Map,Tool", new ValidateMapAction<G, A, R>(validators, mapManager)); final Action helpAction = createAction("showHelp", "Help", new ShowHelpAction(parent)); createAction("tipOfTheDay", "Help", new TipOfTheDayAction(parent)); - createAction("newMap", "Map", newMapDialogFactory); + createAction("newMap", "Map", new NewMapAction<G, A, R>(newMapDialogFactory)); createAction("goMap", "Map", new GoMapDialogManager<G, A, R>(parent, mapManager, mapViewsManager, globalSettings, exiter)); createAction("goExit", "Map Navigation", new GoExitDialogManager<G, A, R>(parent, mapManager, mapViewManager, exitGameObjectMatcher, pathManager, enterMap, faceObjectProviders)); createAction("cleanCompletelyBlockedSquares", "Tool", new CleanCompletelyBlockedSquaresAction<G, A, R>(mapManager)); @@ -720,7 +721,7 @@ // TODO: pass filename scriptEditControl.newScript(); } else { - newMapDialogFactory.newMap(); // XXX: pass file + newMapDialogFactory.showNewMapDialog(); // XXX: pass file } } // If neither branch matches, it's a directory - what to do with directories? This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-07-09 19:58:19
|
Revision: 9293 http://sourceforge.net/p/gridarta/code/9293 Author: akirschbaum Date: 2013-07-09 19:58:15 +0000 (Tue, 09 Jul 2013) Log Message: ----------- Extract GoLocationAction from MapCursorActions. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AbstractMapCursorAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java Added Paths: ----------- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/GoLocationAction.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AbstractMapCursorAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AbstractMapCursorAction.java 2013-07-09 19:47:11 UTC (rev 9292) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AbstractMapCursorAction.java 2013-07-09 19:58:15 UTC (rev 9293) @@ -113,6 +113,15 @@ } /** + * Return the current map view. + * @return the current map view or {@code null} + */ + @Nullable + protected MapView<G, A, R> getActiveMapView() { + return currentMapView; + } + + /** * Return the map cursor of a map view if it is active. * @param mapView the map view * @return the map cursor, or <code>null</code> if the cursor is not active, Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/GoLocationAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/GoLocationAction.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/GoLocationAction.java 2013-07-09 19:58:15 UTC (rev 9293) @@ -0,0 +1,110 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.action; + +import javax.swing.Action; +import net.sf.gridarta.gui.dialog.golocation.GoLocationDialog; +import net.sf.gridarta.gui.dialog.golocation.GoLocationDialogManager; +import net.sf.gridarta.gui.map.AbstractPerMapDialogManager; +import net.sf.gridarta.gui.map.mapview.MapView; +import net.sf.gridarta.gui.map.mapview.MapViewManager; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.utils.EditorAction; +import net.sf.japi.swing.action.ActionMethod; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * An {@link EditorAction} that openes the "go location" dialog. + * @author Andreas Kirschbaum + */ +public class GoLocationAction<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractMapCursorAction<G, A, R> implements EditorAction { + + /** + * The {@link AbstractPerMapDialogManager} to track go location dialog + * instances. + */ + @NotNull + private final AbstractPerMapDialogManager<G, A, R, GoLocationDialog<G, A, R>> goLocationDialogManager; + + /** + * The {@link Action} associated with this editor action. Set to {@code + * null} if no action is associated. + */ + @Nullable + private Action action; + + /** + * Creates a new instance. + * @param mapViewManager the map view manager + */ + public GoLocationAction(@NotNull final MapViewManager<G, A, R> mapViewManager) { + super(mapViewManager); + goLocationDialogManager = new GoLocationDialogManager<G, A, R>(mapViewManager); + } + + /** + * {@inheritDoc} + */ + @Override + public void setAction(@NotNull final Action action, @NotNull final String name) { + this.action = action; + } + + /** + * Opens the "go location" dialog. + */ + @ActionMethod + public void goLocation() { + doGoLocation(true); + } + + /** + * {@inheritDoc} + */ + @Override + protected void updateAction() { + if (action != null) { + //noinspection ConstantConditions + action.setEnabled(doGoLocation(false)); + } + } + + /** + * Executes the "go location" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed + */ + private boolean doGoLocation(final boolean performAction) { + final MapView<G, A, R> mapView = getActiveMapView(); + if (mapView == null) { + return false; + } + + if (performAction) { + goLocationDialogManager.showDialog(mapView); + } + + return true; + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/GoLocationAction.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java 2013-07-09 19:47:11 UTC (rev 9292) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java 2013-07-09 19:58:15 UTC (rev 9293) @@ -21,9 +21,6 @@ import java.awt.Point; import javax.swing.Action; -import net.sf.gridarta.gui.dialog.golocation.GoLocationDialog; -import net.sf.gridarta.gui.dialog.golocation.GoLocationDialogManager; -import net.sf.gridarta.gui.map.AbstractPerMapDialogManager; import net.sf.gridarta.gui.map.mapview.MapView; import net.sf.gridarta.gui.map.mapview.MapViewManager; import net.sf.gridarta.gui.map.mapview.MapViewManagerListener; @@ -65,19 +62,6 @@ private final Action[] aMoveCursor; /** - * Action for "go location". - */ - @Nullable - private Action aGoLocation; - - /** - * The {@link GoLocationDialogManager} to track go location dialog - * instances. - */ - @NotNull - private final AbstractPerMapDialogManager<G, A, R, GoLocationDialog<G, A, R>> goLocationDialogManager; - - /** * The active map view, or <code>null</code> if no map view exists. */ @Nullable @@ -136,7 +120,6 @@ * @param mapViewManager the map view manager */ public MapCursorActions(@NotNull final MapViewManager<G, A, R> mapViewManager) { - goLocationDialogManager = new GoLocationDialogManager<G, A, R>(mapViewManager); aMoveCursor = new Action[directions.length]; mapViewManager.addMapViewManagerListener(mapViewManagerListener); currentMapView = mapViewManager.getActiveMapView(); @@ -208,14 +191,6 @@ } /** - * Action method for "go location". - */ - @ActionMethod - public void goLocation() { - doGoLocation(true); - } - - /** * Return the map cursor of a map view if it is active. * @param mapView the map view * @return the map cursor, or <code>null</code> if the cursor is not active, @@ -237,10 +212,6 @@ action.setEnabled(doMoveCursor(false, direction)); } } - if (aGoLocation != null) { - //noinspection ConstantConditions - aGoLocation.setEnabled(doGoLocation(false)); - } } /** @@ -277,24 +248,6 @@ } /** - * Executes the "go location" action. - * @param performAction whether the action should be performed - * @return whether the action was or can be performed - */ - private boolean doGoLocation(final boolean performAction) { - final MapView<G, A, R> mapView = currentMapView; - if (mapView == null) { - return false; - } - - if (performAction) { - goLocationDialogManager.showDialog(mapView); - } - - return true; - } - - /** * {@inheritDoc} */ @Override @@ -311,8 +264,6 @@ if (!found) { throw new IllegalArgumentException(); } - } else if (name.equals("goLocation")) { - aGoLocation = action; } else { throw new IllegalArgumentException(); } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-07-09 19:47:11 UTC (rev 9292) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-07-09 19:58:15 UTC (rev 9293) @@ -46,6 +46,7 @@ import net.sf.gridarta.action.DisplayIconsOnlyAction; import net.sf.gridarta.action.ExitAction; import net.sf.gridarta.action.GcAction; +import net.sf.gridarta.action.GoLocationAction; import net.sf.gridarta.action.InsertArchAction; import net.sf.gridarta.action.LightVisibleAction; import net.sf.gridarta.action.MoveSquareBottomAction; @@ -558,7 +559,7 @@ createAction("moveCursorSouthEast", "Map Cursor,Map/Selection", mapCursorActions); createAction("moveCursorSouthWest", "Map Cursor,Map/Selection", mapCursorActions); createAction("moveCursorNorthWest", "Map Cursor,Map/Selection", mapCursorActions); - createAction("goLocation", "Map Cursor", mapCursorActions); + createAction("goLocation", "Map Cursor", new GoLocationAction<G, A, R>(mapViewManager)); createAction("selectSquare", "Map Cursor,Map/Selection", new SelectSquareAction<G, A, R>(mapViewManager)); createAction("addToSelection", "Map Cursor,Map/Selection", new AddToSelectionAction<G, A, R>(mapViewManager)); createAction("subFromSelection", "Map Cursor,Map/Selection", new SubFromSelectionAction<G, A, R>(mapViewManager)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-07-09 19:47:17
|
Revision: 9292 http://sourceforge.net/p/gridarta/code/9292 Author: akirschbaum Date: 2013-07-09 19:47:11 +0000 (Tue, 09 Jul 2013) Log Message: ----------- Extract SelectSquareAction from MapCursorActions. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java Added Paths: ----------- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/SelectSquareAction.java Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/SelectSquareAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/SelectSquareAction.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/SelectSquareAction.java 2013-07-09 19:47:11 UTC (rev 9292) @@ -0,0 +1,91 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.action; + +import javax.swing.Action; +import net.sf.gridarta.gui.map.mapview.MapViewManager; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.model.mapgrid.SelectionMode; +import net.sf.gridarta.utils.EditorAction; +import net.sf.japi.swing.action.ActionMethod; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * An {@link EditorAction} that toggles the current pre-selection in the + * selection. + * @author Andreas Kirschbaum + */ +public class SelectSquareAction<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractSelectionAction<G, A, R> implements EditorAction { + + /** + * The {@link Action} associated with this editor action. Set to {@code + * null} if no action is associated. + */ + @Nullable + private Action action; + + /** + * Creates a new instance. + * @param mapViewManager the map view manager + */ + public SelectSquareAction(@NotNull final MapViewManager<G, A, R> mapViewManager) { + super(mapViewManager); + } + + /** + * {@inheritDoc} + */ + @Override + public void setAction(@NotNull final Action action, @NotNull final String name) { + this.action = action; + } + + /** + * Toggles the current pre-selection in the selection. + */ + @ActionMethod + public void selectSquare() { + doSelectSquare(true); + } + + /** + * Executes the action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed + */ + private boolean doSelectSquare(final boolean performAction) { + return doSelection(performAction, SelectionMode.FLIP); + } + + /** + * {@inheritDoc} + */ + @Override + protected void updateAction() { + if (action != null) { + //noinspection ConstantConditions + action.setEnabled(doSelectSquare(false)); + } + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/SelectSquareAction.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java 2013-07-09 08:39:10 UTC (rev 9291) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java 2013-07-09 19:47:11 UTC (rev 9292) @@ -34,7 +34,6 @@ import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.mapcursor.MapCursor; import net.sf.gridarta.model.mapcursor.MapCursorListener; -import net.sf.gridarta.model.mapgrid.SelectionMode; import net.sf.gridarta.model.mapmodel.MapSquare; import net.sf.gridarta.utils.EditorAction; import net.sf.japi.swing.action.ActionMethod; @@ -217,17 +216,6 @@ } /** - * Return the map cursor of the current map view if it is active. - * @return the map cursor, or <code>null</code> if the cursor is not active, - * or if no map view exists - */ - @Nullable - private MapCursor<G, A, R> getActiveMapCursor() { - final MapView<G, A, R> mapView = currentMapView; - return mapView == null ? null : getActiveMapCursor(mapView); - } - - /** * Return the map cursor of a map view if it is active. * @param mapView the map view * @return the map cursor, or <code>null</code> if the cursor is not active, @@ -255,11 +243,6 @@ } } - private void selectSquare(@NotNull final MapCursor<G, A, R> mapCursor, final SelectionMode mode) { - mapCursor.dragStart(); - mapCursor.dragSelect(mode); - } - /** * Executes the "move cursor" action. * @param performAction whether the action should be performed @@ -312,25 +295,6 @@ } /** - * Executes an action for changing the selection. - * @param performAction whether the action should be performed - * @param mode the type of action to perform - * @return whether the action was or can be performed - */ - private boolean doSelection(final boolean performAction, @NotNull final SelectionMode mode) { - final MapCursor<G, A, R> mapCursor = getActiveMapCursor(); - if (mapCursor == null) { - return false; - } - - if (performAction) { - selectSquare(mapCursor, mode); - } - - return true; - } - - /** * {@inheritDoc} */ @Override Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-07-09 08:39:10 UTC (rev 9291) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-07-09 19:47:11 UTC (rev 9292) @@ -61,6 +61,7 @@ import net.sf.gridarta.action.ReloadFacesAction; import net.sf.gridarta.action.SelectArchAboveAction; import net.sf.gridarta.action.SelectArchBelowAction; +import net.sf.gridarta.action.SelectSquareAction; import net.sf.gridarta.action.ShortcutsAction; import net.sf.gridarta.action.ShowHelpAction; import net.sf.gridarta.action.StartStopDragAction; @@ -558,7 +559,7 @@ createAction("moveCursorSouthWest", "Map Cursor,Map/Selection", mapCursorActions); createAction("moveCursorNorthWest", "Map Cursor,Map/Selection", mapCursorActions); createAction("goLocation", "Map Cursor", mapCursorActions); - createAction("selectSquare", "Map Cursor,Map/Selection", mapCursorActions); + createAction("selectSquare", "Map Cursor,Map/Selection", new SelectSquareAction<G, A, R>(mapViewManager)); createAction("addToSelection", "Map Cursor,Map/Selection", new AddToSelectionAction<G, A, R>(mapViewManager)); createAction("subFromSelection", "Map Cursor,Map/Selection", new SubFromSelectionAction<G, A, R>(mapViewManager)); createAction("startStopDrag", "Map Cursor,Map/Selection", new StartStopDragAction<G, A, R>(mapViewManager)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-07-09 08:39:15
|
Revision: 9291 http://sourceforge.net/p/gridarta/code/9291 Author: akirschbaum Date: 2013-07-09 08:39:10 +0000 (Tue, 09 Jul 2013) Log Message: ----------- Extract AddToSelectionAction from MapCursorActions. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java Added Paths: ----------- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AddToSelectionAction.java Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AddToSelectionAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AddToSelectionAction.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AddToSelectionAction.java 2013-07-09 08:39:10 UTC (rev 9291) @@ -0,0 +1,91 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.action; + +import javax.swing.Action; +import net.sf.gridarta.gui.map.mapview.MapViewManager; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.model.mapgrid.SelectionMode; +import net.sf.gridarta.utils.EditorAction; +import net.sf.japi.swing.action.ActionMethod; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * An {@link EditorAction} that adds the current pre-selection to the + * selection. + * @author Andreas Kirschbaum + */ +public class AddToSelectionAction<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractSelectionAction<G, A, R> implements EditorAction { + + /** + * The {@link Action} associated with this editor action. Set to {@code + * null} if no action is associated. + */ + @Nullable + private Action action; + + /** + * Creates a new instance. + * @param mapViewManager the map view manager + */ + public AddToSelectionAction(@NotNull final MapViewManager<G, A, R> mapViewManager) { + super(mapViewManager); + } + + /** + * {@inheritDoc} + */ + @Override + public void setAction(@NotNull final Action action, @NotNull final String name) { + this.action = action; + } + + /** + * Adds the current pre-selection to the selection. + */ + @ActionMethod + public void addToSelection() { + doAddToSelection(true); + } + + /** + * Executes the action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed + */ + private boolean doAddToSelection(final boolean performAction) { + return doSelection(performAction, SelectionMode.ADD); + } + + /** + * {@inheritDoc} + */ + @Override + protected void updateAction() { + if (action != null) { + //noinspection ConstantConditions + action.setEnabled(doAddToSelection(false)); + } + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AddToSelectionAction.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java 2013-07-09 07:27:33 UTC (rev 9290) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java 2013-07-09 08:39:10 UTC (rev 9291) @@ -72,18 +72,6 @@ private Action aGoLocation; /** - * Action for "select square". - */ - @Nullable - private Action aSelectSquare; - - /** - * Action for "add to selection". - */ - @Nullable - private Action aAddToSelection; - - /** * The {@link GoLocationDialogManager} to track go location dialog * instances. */ @@ -229,22 +217,6 @@ } /** - * Action method for "select square". - */ - @ActionMethod - public void selectSquare() { - doSelectSquare(true); - } - - /** - * Action method for "add to selection". - */ - @ActionMethod - public void addToSelection() { - doAddToSelection(true); - } - - /** * Return the map cursor of the current map view if it is active. * @return the map cursor, or <code>null</code> if the cursor is not active, * or if no map view exists @@ -281,14 +253,6 @@ //noinspection ConstantConditions aGoLocation.setEnabled(doGoLocation(false)); } - if (aSelectSquare != null) { - //noinspection ConstantConditions - aSelectSquare.setEnabled(doSelectSquare(false)); - } - if (aAddToSelection != null) { - //noinspection ConstantConditions - aAddToSelection.setEnabled(doAddToSelection(false)); - } } private void selectSquare(@NotNull final MapCursor<G, A, R> mapCursor, final SelectionMode mode) { @@ -348,24 +312,6 @@ } /** - * Executes the "select square" action. - * @param performAction whether the action should be performed - * @return whether the action was or can be performed - */ - private boolean doSelectSquare(final boolean performAction) { - return doSelection(performAction, SelectionMode.FLIP); - } - - /** - * Executes the "add to selection" action. - * @param performAction whether the action should be performed - * @return whether the action was or can be performed - */ - private boolean doAddToSelection(final boolean performAction) { - return doSelection(performAction, SelectionMode.ADD); - } - - /** * Executes an action for changing the selection. * @param performAction whether the action should be performed * @param mode the type of action to perform @@ -403,10 +349,6 @@ } } else if (name.equals("goLocation")) { aGoLocation = action; - } else if (name.equals("selectSquare")) { - aSelectSquare = action; - } else if (name.equals("addToSelection")) { - aAddToSelection = action; } else { throw new IllegalArgumentException(); } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-07-09 07:27:33 UTC (rev 9290) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-07-09 08:39:10 UTC (rev 9291) @@ -34,6 +34,7 @@ import javax.swing.JMenuBar; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.MainControl; +import net.sf.gridarta.action.AddToSelectionAction; import net.sf.gridarta.action.ArchAttributesAction; import net.sf.gridarta.action.CleanCompletelyBlockedSquaresAction; import net.sf.gridarta.action.CollectSpellsAction; @@ -558,7 +559,7 @@ createAction("moveCursorNorthWest", "Map Cursor,Map/Selection", mapCursorActions); createAction("goLocation", "Map Cursor", mapCursorActions); createAction("selectSquare", "Map Cursor,Map/Selection", mapCursorActions); - createAction("addToSelection", "Map Cursor,Map/Selection", mapCursorActions); + createAction("addToSelection", "Map Cursor,Map/Selection", new AddToSelectionAction<G, A, R>(mapViewManager)); createAction("subFromSelection", "Map Cursor,Map/Selection", new SubFromSelectionAction<G, A, R>(mapViewManager)); createAction("startStopDrag", "Map Cursor,Map/Selection", new StartStopDragAction<G, A, R>(mapViewManager)); createAction("releaseDrag", "Map Cursor,Map/Selection", new ReleaseDragAction<G, A, R>(mapViewManager)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-07-09 07:27:36
|
Revision: 9290 http://sourceforge.net/p/gridarta/code/9290 Author: akirschbaum Date: 2013-07-09 07:27:33 +0000 (Tue, 09 Jul 2013) Log Message: ----------- Fix typo. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/SubFromSelectionAction.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/SubFromSelectionAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/SubFromSelectionAction.java 2013-07-09 07:26:17 UTC (rev 9289) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/SubFromSelectionAction.java 2013-07-09 07:27:33 UTC (rev 9290) @@ -61,7 +61,7 @@ } /** - * Removes the surrent pre-selection from the selection. + * Removes the current pre-selection from the selection. */ @ActionMethod public void subFromSelection() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-07-09 07:26:21
|
Revision: 9289 http://sourceforge.net/p/gridarta/code/9289 Author: akirschbaum Date: 2013-07-09 07:26:17 +0000 (Tue, 09 Jul 2013) Log Message: ----------- Extract SubFromSelectionAction from MapCursorActions. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java Added Paths: ----------- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AbstractSelectionAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/action/SubFromSelectionAction.java Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AbstractSelectionAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AbstractSelectionAction.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AbstractSelectionAction.java 2013-07-09 07:26:17 UTC (rev 9289) @@ -0,0 +1,64 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.action; + +import net.sf.gridarta.gui.map.mapview.MapViewManager; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.model.mapcursor.MapCursor; +import net.sf.gridarta.model.mapgrid.SelectionMode; +import org.jetbrains.annotations.NotNull; + +/** + * Abstract base class for actions that change the current selection. + * @author Andreas Kirschbaum + */ +public abstract class AbstractSelectionAction<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractMapCursorAction<G, A, R> { + + /** + * Creates a new instance. + * @param mapViewManager the map view manager + */ + protected AbstractSelectionAction(@NotNull final MapViewManager<G, A, R> mapViewManager) { + super(mapViewManager); + } + + /** + * Executes an action for changing the selection. + * @param performAction whether the action should be performed + * @param mode the type of action to perform + * @return whether the action was or can be performed + */ + protected boolean doSelection(final boolean performAction, @NotNull final SelectionMode mode) { + final MapCursor<G, A, R> mapCursor = getActiveMapCursor(); + if (mapCursor == null) { + return false; + } + + if (performAction) { + mapCursor.dragStart(); + mapCursor.dragSelect(mode); + } + + return true; + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AbstractSelectionAction.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/SubFromSelectionAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/SubFromSelectionAction.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/SubFromSelectionAction.java 2013-07-09 07:26:17 UTC (rev 9289) @@ -0,0 +1,91 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.action; + +import javax.swing.Action; +import net.sf.gridarta.gui.map.mapview.MapViewManager; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.model.mapgrid.SelectionMode; +import net.sf.gridarta.utils.EditorAction; +import net.sf.japi.swing.action.ActionMethod; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * An {@link EditorAction} that removes the current pre-selection from the + * selection. + * @author Andreas Kirschbaum + */ +public class SubFromSelectionAction<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractSelectionAction<G, A, R> implements EditorAction { + + /** + * The {@link Action} associated with this editor action. Set to {@code + * null} if no action is associated. + */ + @Nullable + private Action action; + + /** + * Creates a new instance. + * @param mapViewManager the map view manager + */ + public SubFromSelectionAction(@NotNull final MapViewManager<G, A, R> mapViewManager) { + super(mapViewManager); + } + + /** + * {@inheritDoc} + */ + @Override + public void setAction(@NotNull final Action action, @NotNull final String name) { + this.action = action; + } + + /** + * Removes the surrent pre-selection from the selection. + */ + @ActionMethod + public void subFromSelection() { + doSubFromSelection(true); + } + + /** + * Executes the action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed + */ + private boolean doSubFromSelection(final boolean performAction) { + return doSelection(performAction, SelectionMode.SUB); + } + + /** + * {@inheritDoc} + */ + @Override + protected void updateAction() { + if (action != null) { + //noinspection ConstantConditions + action.setEnabled(doSubFromSelection(false)); + } + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/SubFromSelectionAction.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java 2013-07-09 07:16:29 UTC (rev 9288) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java 2013-07-09 07:26:17 UTC (rev 9289) @@ -84,12 +84,6 @@ private Action aAddToSelection; /** - * Action for "remove from selection". - */ - @Nullable - private Action aSubFromSelection; - - /** * The {@link GoLocationDialogManager} to track go location dialog * instances. */ @@ -251,14 +245,6 @@ } /** - * Action method for "remove from selection". - */ - @ActionMethod - public void subFromSelection() { - doSubFromSelection(true); - } - - /** * Return the map cursor of the current map view if it is active. * @return the map cursor, or <code>null</code> if the cursor is not active, * or if no map view exists @@ -303,10 +289,6 @@ //noinspection ConstantConditions aAddToSelection.setEnabled(doAddToSelection(false)); } - if (aSubFromSelection != null) { - //noinspection ConstantConditions - aSubFromSelection.setEnabled(doSubFromSelection(false)); - } } private void selectSquare(@NotNull final MapCursor<G, A, R> mapCursor, final SelectionMode mode) { @@ -384,15 +366,6 @@ } /** - * Executes the "sub from selection" action. - * @param performAction whether the action should be performed - * @return whether the action was or can be performed - */ - private boolean doSubFromSelection(final boolean performAction) { - return doSelection(performAction, SelectionMode.SUB); - } - - /** * Executes an action for changing the selection. * @param performAction whether the action should be performed * @param mode the type of action to perform @@ -434,8 +407,6 @@ aSelectSquare = action; } else if (name.equals("addToSelection")) { aAddToSelection = action; - } else if (name.equals("subFromSelection")) { - aSubFromSelection = action; } else { throw new IllegalArgumentException(); } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-07-09 07:16:29 UTC (rev 9288) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-07-09 07:26:17 UTC (rev 9289) @@ -63,6 +63,7 @@ import net.sf.gridarta.action.ShortcutsAction; import net.sf.gridarta.action.ShowHelpAction; import net.sf.gridarta.action.StartStopDragAction; +import net.sf.gridarta.action.SubFromSelectionAction; import net.sf.gridarta.action.TipOfTheDayAction; import net.sf.gridarta.action.ValidateMapAction; import net.sf.gridarta.action.ZoomAction; @@ -558,7 +559,7 @@ createAction("goLocation", "Map Cursor", mapCursorActions); createAction("selectSquare", "Map Cursor,Map/Selection", mapCursorActions); createAction("addToSelection", "Map Cursor,Map/Selection", mapCursorActions); - createAction("subFromSelection", "Map Cursor,Map/Selection", mapCursorActions); + createAction("subFromSelection", "Map Cursor,Map/Selection", new SubFromSelectionAction<G, A, R>(mapViewManager)); createAction("startStopDrag", "Map Cursor,Map/Selection", new StartStopDragAction<G, A, R>(mapViewManager)); createAction("releaseDrag", "Map Cursor,Map/Selection", new ReleaseDragAction<G, A, R>(mapViewManager)); createAction("insertArch", "Map Cursor,Map", new InsertArchAction<G, A, R>(mapViewManager, objectChooser)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-07-09 07:16:32
|
Revision: 9288 http://sourceforge.net/p/gridarta/code/9288 Author: akirschbaum Date: 2013-07-09 07:16:29 +0000 (Tue, 09 Jul 2013) Log Message: ----------- Extract StartStopDragAction from MapCursorActions. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java Added Paths: ----------- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/StartStopDragAction.java Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/StartStopDragAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/StartStopDragAction.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/StartStopDragAction.java 2013-07-09 07:16:29 UTC (rev 9288) @@ -0,0 +1,104 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.action; + +import javax.swing.Action; +import net.sf.gridarta.gui.map.mapview.MapViewManager; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.model.mapcursor.MapCursor; +import net.sf.gridarta.model.mapgrid.SelectionMode; +import net.sf.gridarta.utils.EditorAction; +import net.sf.japi.swing.action.ActionMethod; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * An {@link EditorAction} that toggles a selection process. + * @author Andreas Kirschbaum + */ +public class StartStopDragAction<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractMapCursorAction<G, A, R> implements EditorAction { + + /** + * The {@link Action} associated with this editor action. Set to {@code + * null} if no action is associated. + */ + @Nullable + private Action action; + + /** + * Creates a new instance. + * @param mapViewManager the map view manager + */ + public StartStopDragAction(@NotNull final MapViewManager<G, A, R> mapViewManager) { + super(mapViewManager); + } + + /** + * {@inheritDoc} + */ + @Override + public void setAction(@NotNull final Action action, @NotNull final String name) { + this.action = action; + } + + /** + * Action method for "start stop drag". + */ + @ActionMethod + public void startStopDrag() { + doStartStopDrag(true); + } + + /** + * Executes the "start stop drag" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed + */ + private boolean doStartStopDrag(final boolean performAction) { + final MapCursor<G, A, R> mapCursor = getActiveMapCursor(); + if (mapCursor == null) { + return false; + } + + if (performAction) { + if (mapCursor.isDragging()) { + mapCursor.dragSelect(SelectionMode.FLIP); + } else { + mapCursor.dragStart(); + } + } + + return true; + } + + /** + * {@inheritDoc} + */ + @Override + protected void updateAction() { + if (action != null) { + //noinspection ConstantConditions + action.setEnabled(doStartStopDrag(false)); + } + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/StartStopDragAction.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java 2013-07-09 07:15:36 UTC (rev 9287) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java 2013-07-09 07:16:29 UTC (rev 9288) @@ -90,12 +90,6 @@ private Action aSubFromSelection; /** - * Action for "stop stop drag". - */ - @Nullable - private Action aStartStopDrag; - - /** * The {@link GoLocationDialogManager} to track go location dialog * instances. */ @@ -265,14 +259,6 @@ } /** - * Action method for "start stop drag". - */ - @ActionMethod - public void startStopDrag() { - doStartStopDrag(true); - } - - /** * Return the map cursor of the current map view if it is active. * @return the map cursor, or <code>null</code> if the cursor is not active, * or if no map view exists @@ -321,10 +307,6 @@ //noinspection ConstantConditions aSubFromSelection.setEnabled(doSubFromSelection(false)); } - if (aStartStopDrag != null) { - //noinspection ConstantConditions - aStartStopDrag.setEnabled(doStartStopDrag(false)); - } } private void selectSquare(@NotNull final MapCursor<G, A, R> mapCursor, final SelectionMode mode) { @@ -430,28 +412,6 @@ } /** - * Executes the "start stop drag" action. - * @param performAction whether the action should be performed - * @return whether the action was or can be performed - */ - private boolean doStartStopDrag(final boolean performAction) { - final MapCursor<G, A, R> mapCursor = getActiveMapCursor(); - if (mapCursor == null) { - return false; - } - - if (performAction) { - if (mapCursor.isDragging()) { - mapCursor.dragSelect(SelectionMode.FLIP); - } else { - mapCursor.dragStart(); - } - } - - return true; - } - - /** * {@inheritDoc} */ @Override @@ -476,8 +436,6 @@ aAddToSelection = action; } else if (name.equals("subFromSelection")) { aSubFromSelection = action; - } else if (name.equals("startStopDrag")) { - aStartStopDrag = action; } else { throw new IllegalArgumentException(); } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-07-09 07:15:36 UTC (rev 9287) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-07-09 07:16:29 UTC (rev 9288) @@ -62,6 +62,7 @@ import net.sf.gridarta.action.SelectArchBelowAction; import net.sf.gridarta.action.ShortcutsAction; import net.sf.gridarta.action.ShowHelpAction; +import net.sf.gridarta.action.StartStopDragAction; import net.sf.gridarta.action.TipOfTheDayAction; import net.sf.gridarta.action.ValidateMapAction; import net.sf.gridarta.action.ZoomAction; @@ -558,7 +559,7 @@ createAction("selectSquare", "Map Cursor,Map/Selection", mapCursorActions); createAction("addToSelection", "Map Cursor,Map/Selection", mapCursorActions); createAction("subFromSelection", "Map Cursor,Map/Selection", mapCursorActions); - createAction("startStopDrag", "Map Cursor,Map/Selection", mapCursorActions); + createAction("startStopDrag", "Map Cursor,Map/Selection", new StartStopDragAction<G, A, R>(mapViewManager)); createAction("releaseDrag", "Map Cursor,Map/Selection", new ReleaseDragAction<G, A, R>(mapViewManager)); createAction("insertArch", "Map Cursor,Map", new InsertArchAction<G, A, R>(mapViewManager, objectChooser)); createAction("deleteArch", "Map Cursor,Map", new DeleteArchAction<G, A, R>(mapViewManager)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-07-09 07:15:39
|
Revision: 9287 http://sourceforge.net/p/gridarta/code/9287 Author: akirschbaum Date: 2013-07-09 07:15:36 +0000 (Tue, 09 Jul 2013) Log Message: ----------- Fix Javadoc issue. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ReleaseDragAction.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ReleaseDragAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ReleaseDragAction.java 2013-07-09 07:13:43 UTC (rev 9286) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ReleaseDragAction.java 2013-07-09 07:15:36 UTC (rev 9287) @@ -32,7 +32,8 @@ import org.jetbrains.annotations.Nullable; /** - * An {@link EditorAction} that finishes a selction process when the mouse button is released. + * An {@link EditorAction} that finishes a selection process when the mouse + * button is released. * @author Andreas Kirschbaum */ public class ReleaseDragAction<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractMapCursorAction<G, A, R> implements EditorAction { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-07-09 07:13:51
|
Revision: 9286 http://sourceforge.net/p/gridarta/code/9286 Author: akirschbaum Date: 2013-07-09 07:13:43 +0000 (Tue, 09 Jul 2013) Log Message: ----------- Rename incorrect action method name. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ReleaseDragAction.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ReleaseDragAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ReleaseDragAction.java 2013-07-09 07:10:17 UTC (rev 9285) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ReleaseDragAction.java 2013-07-09 07:13:43 UTC (rev 9286) @@ -64,7 +64,7 @@ * Action method for "release drag". */ @ActionMethod - public void insertArch() { + public void releaseDrag() { doReleaseDrag(true); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |