From: <aki...@us...> - 2008-09-27 13:35:20
|
Revision: 5254 http://gridarta.svn.sourceforge.net/gridarta/?rev=5254&view=rev Author: akirschbaum Date: 2008-09-27 13:35:16 +0000 (Sat, 27 Sep 2008) Log Message: ----------- Move icons to common code base. Added Paths: ----------- trunk/resource/icons/development/ trunk/resource/icons/development/Application24.gif trunk/resource/icons/development/Server24.gif Removed Paths: ------------- trunk/crossfire/resource/icons/development/Server24.gif trunk/daimonin/resource/icons/development/Application24.gif trunk/daimonin/resource/icons/development/Server24.gif Property changes on: trunk/resource/icons/development/Application24.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Property changes on: trunk/resource/icons/development/Server24.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-09-27 17:08:21
|
Revision: 5255 http://gridarta.svn.sourceforge.net/gridarta/?rev=5255&view=rev Author: akirschbaum Date: 2008-09-27 17:08:13 +0000 (Sat, 27 Sep 2008) Log Message: ----------- Fix NullPointerException caused by previous commits. Modified Paths: -------------- trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/prefs/AppPrefs.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/gui/prefs/AppPrefsModel.java Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-09-27 13:35:16 UTC (rev 5254) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-09-27 17:08:13 UTC (rev 5255) @@ -67,6 +67,7 @@ import net.sf.gridarta.gui.newmap.NewMapDialogFactory; import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.prefs.AppPrefs; +import net.sf.gridarta.gui.prefs.AppPrefsModel; import net.sf.gridarta.gui.prefs.DevPrefs; import net.sf.gridarta.gui.prefs.GUIPrefs; import net.sf.gridarta.gui.prefs.MapValidatorPrefs; @@ -155,9 +156,12 @@ /** The ViewGameObjectMatcherManager for alpha. */ private final ViewGameObjectMatcherManager vaommAlpha = new ViewGameObjectMatcherManager(moaomAlpha); - /** The {@link AppPrefs} instance. */ + /** The {@link AppPrefsModel} instance. */ @NotNull - private AppPrefs appPrefs; + private AppPrefsModel appPrefsModel = new AppPrefsModel( + "../server/daimonin_server", + System.getProperty("os.name").toLowerCase().startsWith("win") ? "../client/Daimonin.exe" : "../client-BETA3-0.966/daimonin", + "vim"); /** * Constructs the main controller and its model and view. @@ -395,10 +399,10 @@ @ActionMethod public void controlServer() { if (controlServer == null) { - controlServer = new ProcessRunner("controlServer", appPrefs.getServer()); + controlServer = new ProcessRunner("controlServer", appPrefsModel.getServer()); ACTION_FACTORY.showOnetimeMessageDialog(getMainView(), JOptionPane.WARNING_MESSAGE, "controlServerWarning"); } else { - controlServer.setCommand(appPrefs.getServer()); + controlServer.setCommand(appPrefsModel.getServer()); } controlServer.showDialog(getMainView()); } @@ -407,9 +411,9 @@ @ActionMethod public void controlClient() { if (controlClient == null) { - controlClient = new ProcessRunner("controlClient", appPrefs.getClient()); + controlClient = new ProcessRunner("controlClient", appPrefsModel.getClient()); } else { - controlClient.setCommand(appPrefs.getClient()); + controlClient.setCommand(appPrefsModel.getClient()); } controlClient.showDialog(getMainView()); } @@ -457,14 +461,10 @@ @NotNull @Override public PreferencesGroup createPreferencesGroup(@NotNull final GlobalSettings globalSettings, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators) { - appPrefs = new AppPrefs( - "../server/daimonin_server", - System.getProperty("os.name").toLowerCase().startsWith("win") ? "../client/Daimonin.exe" : "../client-BETA3-0.966/daimonin", - "vim"); return new PreferencesGroup( "Gridarta for Daimonin", new ResPrefs((GlobalSettingsImpl) globalSettings), - appPrefs, + new AppPrefs(appPrefsModel), new NetPrefs(), new GUIPrefs(), new MiscPrefs(), Modified: trunk/src/app/net/sf/gridarta/gui/prefs/AppPrefs.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/prefs/AppPrefs.java 2008-09-27 13:35:16 UTC (rev 5254) +++ trunk/src/app/net/sf/gridarta/gui/prefs/AppPrefs.java 2008-09-27 17:08:13 UTC (rev 5255) @@ -22,7 +22,6 @@ import java.awt.Component; import java.awt.Container; import java.awt.FlowLayout; -import java.util.prefs.Preferences; import javax.swing.Box; import javax.swing.JFileChooser; import javax.swing.JLabel; @@ -31,14 +30,11 @@ import javax.swing.border.Border; import javax.swing.border.CompoundBorder; import javax.swing.border.TitledBorder; -import net.sf.gridarta.MainControl; import net.sf.gridarta.gui.GUIConstants; -import net.sf.gridarta.io.PathManager; import net.sf.japi.swing.ActionFactory; import net.sf.japi.swing.misc.JFileChooserButton; import net.sf.japi.swing.prefs.AbstractPrefs; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; /** * Preferences Module for application preferences. @@ -53,8 +49,11 @@ /** Action Factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta"); - /** Preferences. */ - private static final Preferences PREFS = Preferences.userNodeForPackage(MainControl.class); + /** + * The model. + */ + @NotNull + private final AppPrefsModel appPrefsModel; /** TextField for server executable. */ private JTextField serverField; @@ -65,43 +64,12 @@ /** TextField for external editor executable. */ private JTextField editorField; - /** Preferences key for server application. */ - public static final String PREFS_APP_SERVER = "appServer"; - - /** Preferences key for client application. */ - public static final String PREFS_APP_CLIENT = "appClient"; - - /** Preferences key for editor application. */ - public static final String PREFS_APP_EDITOR = "appEditor"; - /** - * The default value for the server setting. - */ - @NotNull - private final String serverDefault; - - /** - * The default value for the client setting. - */ - @NotNull - private final String clientDefault; - - /** - * The default value for the editor setting. - */ - @NotNull - private final String editorDefault; - - /** * Creates a new instance. - * @param serverDefault the default value for the server setting - * @param clientDefault the default value for the client setting - * @param editorDefault the default value for the editor setting + * @param appPrefsModel the model */ - public AppPrefs(@NotNull final String serverDefault, @NotNull final String clientDefault, @NotNull final String editorDefault) { - this.serverDefault = serverDefault; - this.clientDefault = clientDefault; - this.editorDefault = editorDefault; + public AppPrefs(@NotNull final AppPrefsModel appPrefsModel) { + this.appPrefsModel = appPrefsModel; setListLabelText(ACTION_FACTORY.getString("prefsApp.title")); setListLabelIcon(ACTION_FACTORY.getIcon("prefsApp.icon")); @@ -120,31 +88,31 @@ /** {@inheritDoc} */ public void apply() { - PREFS.put(PREFS_APP_SERVER, PathManager.path(serverField.getText())); - PREFS.put(PREFS_APP_CLIENT, PathManager.path(clientField.getText())); - PREFS.put(PREFS_APP_EDITOR, PathManager.path(editorField.getText())); + AppPrefsModel.setServer(serverField.getText()); + AppPrefsModel.setClient(serverField.getText()); + AppPrefsModel.setEditor(serverField.getText()); } /** {@inheritDoc} */ public void revert() { - serverField.setText(PREFS.get(PREFS_APP_SERVER, serverDefault)); - clientField.setText(PREFS.get(PREFS_APP_CLIENT, clientDefault)); - editorField.setText(PREFS.get(PREFS_APP_EDITOR, editorDefault)); + serverField.setText(appPrefsModel.getServer()); + clientField.setText(appPrefsModel.getClient()); + editorField.setText(appPrefsModel.getEditor()); } /** {@inheritDoc} */ public void defaults() { - serverField.setText(serverDefault); - clientField.setText(clientDefault); - editorField.setText(editorDefault); + serverField.setText(appPrefsModel.getServerDefault()); + clientField.setText(appPrefsModel.getClientDefault()); + editorField.setText(appPrefsModel.getEditorDefault()); } /** {@inheritDoc} */ public boolean isChanged() { return !( - serverField.getText().equals(PREFS.get(PREFS_APP_SERVER, serverDefault)) - && clientField.getText().equals(PREFS.get(PREFS_APP_CLIENT, clientDefault)) - && editorField.getText().equals(PREFS.get(PREFS_APP_EDITOR, editorDefault)) + serverField.getText().equals(appPrefsModel.getServer()) + && clientField.getText().equals(appPrefsModel.getClient()) + && editorField.getText().equals(appPrefsModel.getEditor()) ); } @@ -156,9 +124,9 @@ final Box appPanel = Box.createVerticalBox(); appPanel.setBorder(createTitledBorder("optionsApps")); - serverField = createFileField(appPanel, "optionsAppServer", PREFS.get(PREFS_APP_SERVER, serverDefault), JFileChooser.FILES_ONLY); - clientField = createFileField(appPanel, "optionsAppClient", PREFS.get(PREFS_APP_CLIENT, clientDefault), JFileChooser.FILES_ONLY); - editorField = createFileField(appPanel, "optionsAppEditor", PREFS.get(PREFS_APP_EDITOR, editorDefault), JFileChooser.FILES_ONLY); + serverField = createFileField(appPanel, "optionsAppServer", appPrefsModel.getServer(), JFileChooser.FILES_ONLY); + clientField = createFileField(appPanel, "optionsAppClient", appPrefsModel.getClient(), JFileChooser.FILES_ONLY); + editorField = createFileField(appPanel, "optionsAppEditor", appPrefsModel.getEditor(), JFileChooser.FILES_ONLY); return appPanel; } @@ -181,31 +149,4 @@ return textField; } - /** - * Returns the server setting. - * @return the server setting - */ - @Nullable - public String getServer() { - return PREFS.get(PREFS_APP_SERVER, serverDefault); - } - - /** - * Returns the client setting. - * @return the client setting - */ - @Nullable - public String getClient() { - return PREFS.get(PREFS_APP_CLIENT, clientDefault); - } - - /** - * Returns the editor setting. - * @return the editor setting - */ - @Nullable - public String getEditor() { - return PREFS.get(PREFS_APP_EDITOR, editorDefault); - } - } // class AppPrefs Added: trunk/src/app/net/sf/gridarta/gui/prefs/AppPrefsModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/prefs/AppPrefsModel.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/prefs/AppPrefsModel.java 2008-09-27 17:08:13 UTC (rev 5255) @@ -0,0 +1,153 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2007 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gui.prefs; + +import java.util.prefs.Preferences; +import net.sf.gridarta.MainControl; +import net.sf.gridarta.io.PathManager; +import org.jetbrains.annotations.NotNull; + +/** + * Maintains the application preferences state. + * @author Andreas Kirschbaum + */ +public class AppPrefsModel { + + /** Preferences key for server application. */ + public static final String PREFS_APP_SERVER = "appServer"; + + /** Preferences key for client application. */ + public static final String PREFS_APP_CLIENT = "appClient"; + + /** Preferences key for editor application. */ + public static final String PREFS_APP_EDITOR = "appEditor"; + + /** Preferences. */ + private static final Preferences PREFS = Preferences.userNodeForPackage(MainControl.class); + + /** + * The default value for the server setting. + */ + @NotNull + private final String serverDefault; + + /** + * The default value for the client setting. + */ + @NotNull + private final String clientDefault; + + /** + * The default value for the editor setting. + */ + @NotNull + private final String editorDefault; + + /** + * Creates a new instance. + * @param serverDefault the default value for the server setting + * @param clientDefault the default value for the client setting + * @param editorDefault the default value for the editor setting + */ + public AppPrefsModel(@NotNull final String serverDefault, @NotNull final String clientDefault, @NotNull final String editorDefault) { + this.serverDefault = serverDefault; + this.clientDefault = clientDefault; + this.editorDefault = editorDefault; + } + + /** + * Sets the server setting. + * @param server the server setting + */ + public static void setServer(@NotNull final String server) { + PREFS.put(PREFS_APP_SERVER, PathManager.path(server)); + } + + /** + * Sets the client setting. + * @param client the client setting + */ + public static void setClient(@NotNull final String client) { + PREFS.put(PREFS_APP_CLIENT, PathManager.path(client)); + } + + /** + * Sets the editor setting. + * @param editor the editor setting + */ + public static void setEditor(@NotNull final String editor) { + PREFS.put(PREFS_APP_EDITOR, PathManager.path(editor)); + } + + /** + * Returns the server setting. + * @return the server setting + */ + @NotNull + public String getServer() { + return PREFS.get(PREFS_APP_SERVER, serverDefault); + } + + /** + * Returns the client setting. + * @return the client setting + */ + @NotNull + public String getClient() { + return PREFS.get(PREFS_APP_CLIENT, clientDefault); + } + + /** + * Returns the editor setting. + * @return the editor setting + */ + @NotNull + public String getEditor() { + return PREFS.get(PREFS_APP_EDITOR, editorDefault); + } + + /** + * Returns the server setting's default value. + * @return the server setting's default value + */ + @NotNull + public String getServerDefault() { + return serverDefault; + } + + /** + * Returns the client setting's default value. + * @return the client setting's default value + */ + @NotNull + public String getClientDefault() { + return clientDefault; + } + + /** + * Returns the editor setting's default value. + * @return the editor setting's default value + */ + @NotNull + public String getEditorDefault() { + return editorDefault; + } + +} // class AppPrefsModel Property changes on: trunk/src/app/net/sf/gridarta/gui/prefs/AppPrefsModel.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-09-27 18:43:45
|
Revision: 5257 http://gridarta.svn.sourceforge.net/gridarta/?rev=5257&view=rev Author: akirschbaum Date: 2008-09-27 18:43:40 +0000 (Sat, 27 Sep 2008) Log Message: ----------- Move some icons to common code base. Modified Paths: -------------- trunk/daimonin/src/daieditor/action.properties trunk/src/app/net/sf/gridarta/action.properties Added Paths: ----------- trunk/resource/icons/development/Host16.gif trunk/resource/icons/development/Server16.gif Removed Paths: ------------- trunk/daimonin/resource/icons/development/Host16.gif trunk/daimonin/resource/icons/development/Server16.gif Modified: trunk/daimonin/src/daieditor/action.properties =================================================================== --- trunk/daimonin/src/daieditor/action.properties 2008-09-27 17:13:01 UTC (rev 5256) +++ trunk/daimonin/src/daieditor/action.properties 2008-09-27 18:43:40 UTC (rev 5257) @@ -106,8 +106,6 @@ editScript.icon=general/Edit16 -controlServer.icon=development/Server16 -controlClient.icon=development/Host16 #control.toolbar=controlStart controlStop gc.icon=general/Delete16 Property changes on: trunk/resource/icons/development/Host16.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Property changes on: trunk/resource/icons/development/Server16.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Modified: trunk/src/app/net/sf/gridarta/action.properties =================================================================== --- trunk/src/app/net/sf/gridarta/action.properties 2008-09-27 17:13:01 UTC (rev 5256) +++ trunk/src/app/net/sf/gridarta/action.properties 2008-09-27 18:43:40 UTC (rev 5257) @@ -60,6 +60,8 @@ zoomAlg.menu=zoomAlgDefault zoomAlgFast zoomAlgSmooth zoomAlgReplicate zoomAlgAreaAveraging +controlServer.icon=development/Server16 +controlClient.icon=development/Host16 controlStart.icon=media/Play16 controlStop.icon=media/Stop16 controlClear.icon=media/Clear16 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-09-28 06:47:42
|
Revision: 5261 http://gridarta.svn.sourceforge.net/gridarta/?rev=5261&view=rev Author: akirschbaum Date: 2008-09-28 06:47:25 +0000 (Sun, 28 Sep 2008) Log Message: ----------- Move CMainControl.controlServer() and CMainControl.controlClient() to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/messages.properties trunk/crossfire/src/cfeditor/messages_de.properties trunk/crossfire/src/cfeditor/messages_fr.properties trunk/crossfire/src/cfeditor/messages_sv.properties trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/messages.properties trunk/daimonin/src/daieditor/messages_de.properties trunk/daimonin/src/daieditor/messages_fr.properties trunk/daimonin/src/daieditor/messages_sv.properties trunk/src/app/net/sf/gridarta/AbstractMainControl.java trunk/src/app/net/sf/gridarta/messages.properties trunk/src/app/net/sf/gridarta/messages_de.properties trunk/src/app/net/sf/gridarta/messages_fr.properties trunk/src/app/net/sf/gridarta/messages_sv.properties trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-09-27 19:07:43 UTC (rev 5260) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-09-28 06:47:25 UTC (rev 5261) @@ -42,13 +42,11 @@ import java.util.Map; import javax.swing.JComboBox; import javax.swing.JMenu; -import javax.swing.JOptionPane; import net.sf.gridarta.AbstractMainControl; import net.sf.gridarta.EditTypes; import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MapManager; -import net.sf.gridarta.ProcessRunner; import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.filter.FilterControl; import net.sf.gridarta.filter.NamedFilterList; @@ -86,7 +84,6 @@ import net.sf.gridarta.treasurelist.TreasureLocation; import net.sf.gridarta.treasurelist.TreasureTreeNode; import net.sf.japi.swing.ActionFactory; -import net.sf.japi.swing.ActionMethod; import net.sf.japi.swing.prefs.PreferencesGroup; import org.jetbrains.annotations.NotNull; @@ -108,22 +105,9 @@ private FilterControl<GameObject, MapArchObject, Archetype, CMapViewBasic> filterControl; - /** Client Control Component. */ - private ProcessRunner controlClient; - - /** Server Control Component. */ - private ProcessRunner controlServer; - /** Preferences default for auto validation. */ private static final boolean PREFS_VALIDATOR_AUTO_DEFAULT = true; - /** The {@link AppPrefsModel} instance. */ - @NotNull - private AppPrefsModel appPrefsModel = new AppPrefsModel( - "crossfire-server", - System.getProperty("os.name").toLowerCase().startsWith("win") ? "GTKClient.exe" : "crossfire-client-gtk2", - "vim"); - /** * Constructs the main controller and its model and view. * @param gridartaObjectsFactory the gridarta objects factory to use @@ -136,6 +120,16 @@ /** {@inheritDoc} */ @NotNull @Override + protected AppPrefsModel createAppPrefsModel() { + return new AppPrefsModel( + "crossfire-server", + System.getProperty("os.name").toLowerCase().startsWith("win") ? "GTKClient.exe" : "crossfire-client-gtk2", + "vim"); + } + + /** {@inheritDoc} */ + @NotNull + @Override protected MapControlFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControlFactory(@NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory) { return new DefaultMapControlFactory(gridartaObjectsFactory); } @@ -162,7 +156,6 @@ /** {@inheritDoc} */ protected void createActions() { - ACTION_FACTORY.createActions(true, this, "controlServer", "controlClient"); } /** {@inheritDoc} */ @@ -300,33 +293,10 @@ return mapValidators; } - /** Control the server. */ - @ActionMethod - public void controlServer() { - if (controlServer == null) { - controlServer = new ProcessRunner("controlServer", appPrefsModel.getServer()); - ACTION_FACTORY.showOnetimeMessageDialog(getMainView(), JOptionPane.WARNING_MESSAGE, "controlServerWarning"); - } else { - controlServer.setCommand(appPrefsModel.getServer()); - } - controlServer.showDialog(getMainView()); - } - - /** Control the client. */ - @ActionMethod - public void controlClient() { - if (controlClient == null) { - controlClient = new ProcessRunner("controlClient", appPrefsModel.getClient()); - } else { - controlClient.setCommand(appPrefsModel.getClient()); - } - controlClient.showDialog(getMainView()); - } - /** {@inheritDoc} */ @NotNull @Override - public PreferencesGroup createPreferencesGroup(@NotNull final GlobalSettings globalSettings, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators) { + public PreferencesGroup createPreferencesGroup(@NotNull final GlobalSettings globalSettings, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final AppPrefsModel appPrefsModel) { return new PreferencesGroup( "Gridarta for Crossfire", new ResPrefs((GlobalSettingsImpl) globalSettings), Modified: trunk/crossfire/src/cfeditor/messages.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages.properties 2008-09-27 19:07:43 UTC (rev 5260) +++ trunk/crossfire/src/cfeditor/messages.properties 2008-09-28 06:47:25 UTC (rev 5261) @@ -193,13 +193,6 @@ archetypes.mnemonic=A -######## -# Tools - -controlServerWarning.title=Warning -controlServerWarning.message=<html><h3>Warning!</h3><p>Java cannot cope with processes that use signal handlers doing lots of work.<br>The Crossfire Server is such a process.<br>Terminating the server using the Stop button will extremely likely<br>result in a Zombie process only killable via operating system tools.</p><p><strong>You have been warned!</strong></p></html> - - ######### # Plugins Modified: trunk/crossfire/src/cfeditor/messages_de.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_de.properties 2008-09-27 19:07:43 UTC (rev 5260) +++ trunk/crossfire/src/cfeditor/messages_de.properties 2008-09-28 06:47:25 UTC (rev 5261) @@ -174,13 +174,6 @@ archetypes.mnemonic=T -######## -# Tools - -controlServerWarning.title=Warnung -controlServerWarning.message=<html><h3>Warnung!</h3><p>Java kann mit Prozessen nicht richtig umgehen, die im Signal-Handler viel Code ausf\xFChren.<br>Der Crossfire-Server ist so ein Prozess.<br>Die Beendigung durch "Stopp" wird wahrscheinlich einen Zombie-Prozess<br>erzeugen, der durch das Betriebssystem beendet werden muss.</p><p><strong>Sie sind gewarnt worden!</strong></p></html> - - ######### # Plugins Modified: trunk/crossfire/src/cfeditor/messages_fr.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_fr.properties 2008-09-27 19:07:43 UTC (rev 5260) +++ trunk/crossfire/src/cfeditor/messages_fr.properties 2008-09-28 06:47:25 UTC (rev 5261) @@ -175,13 +175,6 @@ archetypes.mnemonic=A -######## -# Tools - -#controlServerWarning.title= -#controlServerWarning.message= - - ######### # Plugins Modified: trunk/crossfire/src/cfeditor/messages_sv.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_sv.properties 2008-09-27 19:07:43 UTC (rev 5260) +++ trunk/crossfire/src/cfeditor/messages_sv.properties 2008-09-28 06:47:25 UTC (rev 5261) @@ -173,13 +173,6 @@ #archetypes.mnemonic= -######## -# Tools - -controlServerWarning.title=Varning -controlServerWarning.message=<html><h3>Varning!</h3><p>Java kan inte hantera processer som anv\xE4nder signalhanterare f\xF6r mycket arbete.<br>Crossfireservern \xE4r en s\xE5dan process.<br>Stopp av servern med "stoppa"-knappen kommer med stor sannolikhet<br>att resultera i en zombie-process som bara g\xE5r att ta bort med operativsystemets verktyg.</p><p><strong>Du har blivit varnad!</strong></p></html> - - ######### # Plugins Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-09-27 19:07:43 UTC (rev 5260) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-09-28 06:47:25 UTC (rev 5261) @@ -49,7 +49,6 @@ import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MapManager; -import net.sf.gridarta.ProcessRunner; import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.filter.FilterControl; import net.sf.gridarta.filter.NamedFilterList; @@ -135,12 +134,6 @@ /** Whether to display double arches like stacked walls in stacked version. */ private boolean drawDouble; - /** Client Control Component. */ - private ProcessRunner controlClient; - - /** Server Control Component. */ - private ProcessRunner controlServer; - /** Preferences default for auto validation. */ private static final boolean PREFS_VALIDATOR_AUTO_DEFAULT = false; @@ -156,13 +149,6 @@ /** The ViewGameObjectMatcherManager for alpha. */ private final ViewGameObjectMatcherManager vaommAlpha = new ViewGameObjectMatcherManager(moaomAlpha); - /** The {@link AppPrefsModel} instance. */ - @NotNull - private AppPrefsModel appPrefsModel = new AppPrefsModel( - "../server/daimonin_server", - System.getProperty("os.name").toLowerCase().startsWith("win") ? "../client/Daimonin.exe" : "../client-BETA3-0.966/daimonin", - "vim"); - /** * Constructs the main controller and its model and view. * @param gridartaObjectsFactory the gridarta objects factory to use @@ -175,6 +161,16 @@ /** {@inheritDoc} */ @NotNull @Override + protected AppPrefsModel createAppPrefsModel() { + return new AppPrefsModel( + "../server/daimonin_server", + System.getProperty("os.name").toLowerCase().startsWith("win") ? "../client/Daimonin.exe" : "../client-BETA3-0.966/daimonin", + "vim"); + } + + /** {@inheritDoc} */ + @NotNull + @Override protected MapControlFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControlFactory(@NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory) { return new DefaultMapControlFactory(gridartaObjectsFactory); } @@ -201,7 +197,7 @@ /** {@inheritDoc} */ protected void createActions() { - ACTION_FACTORY.createActions(true, this, "controlServer", "controlClient", "cleanCompletelyBlockedSquares", "collectSpells"); + ACTION_FACTORY.createActions(true, this, "cleanCompletelyBlockedSquares", "collectSpells"); ACTION_FACTORY.createToggles(true, this, "drawDouble"); } @@ -395,29 +391,6 @@ mapManager.refreshCurrentMap(); } - /** Control the server. */ - @ActionMethod - public void controlServer() { - if (controlServer == null) { - controlServer = new ProcessRunner("controlServer", appPrefsModel.getServer()); - ACTION_FACTORY.showOnetimeMessageDialog(getMainView(), JOptionPane.WARNING_MESSAGE, "controlServerWarning"); - } else { - controlServer.setCommand(appPrefsModel.getServer()); - } - controlServer.showDialog(getMainView()); - } - - /** Control the client. */ - @ActionMethod - public void controlClient() { - if (controlClient == null) { - controlClient = new ProcessRunner("controlClient", appPrefsModel.getClient()); - } else { - controlClient.setCommand(appPrefsModel.getClient()); - } - controlClient.showDialog(getMainView()); - } - /** Collect Spells. */ @ActionMethod public void collectSpells() { @@ -460,7 +433,7 @@ /** {@inheritDoc} */ @NotNull @Override - public PreferencesGroup createPreferencesGroup(@NotNull final GlobalSettings globalSettings, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators) { + public PreferencesGroup createPreferencesGroup(@NotNull final GlobalSettings globalSettings, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final AppPrefsModel appPrefsModel) { return new PreferencesGroup( "Gridarta for Daimonin", new ResPrefs((GlobalSettingsImpl) globalSettings), Modified: trunk/daimonin/src/daieditor/messages.properties =================================================================== --- trunk/daimonin/src/daieditor/messages.properties 2008-09-27 19:07:43 UTC (rev 5260) +++ trunk/daimonin/src/daieditor/messages.properties 2008-09-28 06:47:25 UTC (rev 5261) @@ -187,9 +187,6 @@ ######## # Tools -controlServerWarning.title=Warning -controlServerWarning.message=<html><h3>Warning!</h3><p>Java cannot cope with processes that use signal handlers doing lots of work.<br>The Daimonin Server is such a process.<br>Terminating the server using the Stop button will extremely likely<br>result in a Zombie process only killable via operating system tools.</p><p><strong>You have been warned!</strong></p></html> - cleanCompletelyBlockedSquares.text=Clean blocked squares cleanCompletelyBlockedSquares.mnemonic=B cleanCompletelyBlockedSquares.shortdescription=Cleans squares which are blocking view and passage and are only surrounded by such squares. Modified: trunk/daimonin/src/daieditor/messages_de.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_de.properties 2008-09-27 19:07:43 UTC (rev 5260) +++ trunk/daimonin/src/daieditor/messages_de.properties 2008-09-28 06:47:25 UTC (rev 5261) @@ -168,9 +168,6 @@ ######## # Tools -controlServerWarning.title=Warnung -controlServerWarning.message=<html><h3>Warnung!</h3><p>Java kann mit Prozessen nicht richtig umgehen, die im Signal-Handler viel Code ausf\xFChren.<br>Der Daimonin-Server ist so ein Prozess.<br>Die Beendigung durch "Stopp" wird wahrscheinlich einen Zombie-Prozess<br>erzeugen, der durch das Betriebssystem beendet werden muss.</p><p><strong>Sie sind gewarnt worden!</strong></p></html> - #cleanCompletelyBlockedSquares.text= #cleanCompletelyBlockedSquares.mnemonic= #cleanCompletelyBlockedSquares.shortdescription= Modified: trunk/daimonin/src/daieditor/messages_fr.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_fr.properties 2008-09-27 19:07:43 UTC (rev 5260) +++ trunk/daimonin/src/daieditor/messages_fr.properties 2008-09-28 06:47:25 UTC (rev 5261) @@ -169,9 +169,6 @@ ######## # Tools -#controlServerWarning.title= -#controlServerWarning.message= - #cleanCompletelyBlockedSquares.text= #cleanCompletelyBlockedSquares.mnemonic= #cleanCompletelyBlockedSquares.shortdescription= Modified: trunk/daimonin/src/daieditor/messages_sv.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_sv.properties 2008-09-27 19:07:43 UTC (rev 5260) +++ trunk/daimonin/src/daieditor/messages_sv.properties 2008-09-28 06:47:25 UTC (rev 5261) @@ -170,9 +170,6 @@ ######## # Tools -controlServerWarning.title=Varning -controlServerWarning.message=<html><h3>Varning!</h3><p>Java kan inte hantera processer som anv\xE4nder signalhanterare f\xF6r mycket arbete.<br>Daimoninservern \xE4r en s\xE5dan process.<br>Stopp av servern med "stoppa"-knappen kommer med stor sannolikhet<br>att resultera i en zombie-process som bara g\xE5r att ta bort med operativsystemets verktyg.</p><p><strong>Du har blivit varnad!</strong></p></html> - #cleanCompletelyBlockedSquares.text= #cleanCompletelyBlockedSquares.mnemonic= #cleanCompletelyBlockedSquares.shortdescription= Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-09-27 19:07:43 UTC (rev 5260) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-09-28 06:47:25 UTC (rev 5261) @@ -87,6 +87,7 @@ import net.sf.gridarta.gui.objectchooser.DefaultObjectChooser; import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; +import net.sf.gridarta.gui.prefs.AppPrefsModel; import net.sf.gridarta.gui.selectedsquare.SelectedSquareControl; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.gui.undo.UndoControl; @@ -258,6 +259,16 @@ @NotNull private FileControl<G, A, R, V> fileControl; + /** Client Control Component. */ + private ProcessRunner controlClient; + + /** Server Control Component. */ + private ProcessRunner controlServer; + + /** The {@link AppPrefsModel} instance. */ + @NotNull + private final AppPrefsModel appPrefsModel; + /** * Creates a new instance. * @param gridartaObjectsFactory the gridarta objects factory @@ -290,6 +301,7 @@ protected AbstractMainControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final String key, @NotNull final GlobalSettings globalSettings, @NotNull final AnimationObjects<? extends AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, final boolean createDirectionPane, @Nullable final File mapImageCacheDir, @Nullable final ImageIcon compassIcon, @NotNull final String gridartaJarFilename, @NotNull final FileFilter scriptFileFilter, @NotNull final String scriptExtension, @NotNull final String scriptName, final int spellType, @Nullable final String spellFile, final int typeNoEventConnector, final boolean includeFaceText, final int undefinedSpellIndex, @NotNull final int[] lockedItemsTypeNumbers, final boolean autoValidatorDefault) { this.scriptExtension = scriptExtension; this.globalSettings = globalSettings; + appPrefsModel = createAppPrefsModel(); final MapControlFactory<G, A, R, V> mapControlFactory = newMapControlFactory(gridartaObjectsFactory); final DefaultMapManager<G, A, R, V> tmpMapManager = new DefaultMapManager<G, A, R, V>(this, key, gridartaObjectsFactory, mapControlFactory, globalSettings); final EditTypes<G, A, R, V> editTypes = new EditTypes<G, A, R, V>(tmpMapManager); @@ -404,7 +416,7 @@ final ObjectChoiceDisplay<G, A, R, V> objectChoiceDisplay = new ObjectChoiceDisplay<G, A, R, V>(replaceDialogManager, archetypeTypeSet, objectChooser, archetypeChooserModel, pickmapChooserControl); final ToolPalette<G, A, R, V> toolPalette = new ToolPalette<G, A, R, V>(editTypes, selectedSquareView, objectChooser, pickmapChooserControl); final LeftPanel leftPanel = new LeftPanel(objectChooser, toolPalette, objectChoiceDisplay); - ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "zoom", "gc", "onlineHelp", "tod"); + ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "zoom", "gc", "onlineHelp", "tod", "controlServer", "controlClient"); createActions(); mainView.init(gameObjectAttributesControl, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, pickmapChooserControl, objectChooser, leftPanel); mapActions.updateMenuState(); @@ -447,6 +459,9 @@ } @NotNull + protected abstract AppPrefsModel createAppPrefsModel(); + + @NotNull protected abstract MapControlFactory<G, A, R, V> newMapControlFactory(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory); @NotNull @@ -657,13 +672,13 @@ public void options() { if (prefsGroup == null) { - prefsGroup = createPreferencesGroup(globalSettings, validators); + prefsGroup = createPreferencesGroup(globalSettings, validators, appPrefsModel); } PreferencesPane.showPreferencesDialog(mainView, prefsGroup, false); } @NotNull - protected abstract PreferencesGroup createPreferencesGroup(@NotNull final GlobalSettings globalSettings, @NotNull final DelegatingMapValidator<G, A, R> validators); + protected abstract PreferencesGroup createPreferencesGroup(@NotNull final GlobalSettings globalSettings, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final AppPrefsModel appPrefsModel); /** Invoked when user wants to exit from the program. */ public void exit() { @@ -801,4 +816,27 @@ } } + /** Control the server. */ + @ActionMethod + public void controlServer() { + if (controlServer == null) { + controlServer = new ProcessRunner("controlServer", appPrefsModel.getServer()); + ACTION_FACTORY.showOnetimeMessageDialog(getMainView(), JOptionPane.WARNING_MESSAGE, "controlServerWarning"); + } else { + controlServer.setCommand(appPrefsModel.getServer()); + } + controlServer.showDialog(getMainView()); + } + + /** Control the client. */ + @ActionMethod + public void controlClient() { + if (controlClient == null) { + controlClient = new ProcessRunner("controlClient", appPrefsModel.getClient()); + } else { + controlClient.setCommand(appPrefsModel.getClient()); + } + controlClient.showDialog(getMainView()); + } + } // class AbstractMainControl Modified: trunk/src/app/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages.properties 2008-09-27 19:07:43 UTC (rev 5260) +++ trunk/src/app/net/sf/gridarta/messages.properties 2008-09-28 06:47:25 UTC (rev 5261) @@ -1145,3 +1145,5 @@ controlStop.accel=ESCAPE controlClear.text=Clear controlCloseOkay=You may safely close this window. +controlServerWarning.title=Warning +controlServerWarning.message=<html><h3>Warning!</h3><p>Java cannot cope with processes that use signal handlers doing lots of work.<br>The server is such a process.<br>Terminating the server using the Stop button will extremely likely<br>result in a Zombie process only killable via operating system tools.</p><p><strong>You have been warned!</strong></p></html> Modified: trunk/src/app/net/sf/gridarta/messages_de.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_de.properties 2008-09-27 19:07:43 UTC (rev 5260) +++ trunk/src/app/net/sf/gridarta/messages_de.properties 2008-09-28 06:47:25 UTC (rev 5261) @@ -999,3 +999,5 @@ controlStop.text=Stopp controlClear.text=L\xF6schen controlCloseOkay=Sie k\xF6nnen dieses Fenster schlie\xDFen. +controlServerWarning.title=Warnung +controlServerWarning.message=<html><h3>Warnung!</h3><p>Java kann mit Prozessen nicht richtig umgehen, die im Signal-Handler viel Code ausf\xFChren.<br>Der Server ist so ein Prozess.<br>Die Beendigung durch "Stopp" wird wahrscheinlich einen Zombie-Prozess<br>erzeugen, der durch das Betriebssystem beendet werden muss.</p><p><strong>Sie sind gewarnt worden!</strong></p></html> Modified: trunk/src/app/net/sf/gridarta/messages_fr.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_fr.properties 2008-09-27 19:07:43 UTC (rev 5260) +++ trunk/src/app/net/sf/gridarta/messages_fr.properties 2008-09-28 06:47:25 UTC (rev 5261) @@ -995,3 +995,5 @@ #controlStop.text= #controlClear.text= #controlCloseOkay= +#controlServerWarning.title= +#controlServerWarning.message= Modified: trunk/src/app/net/sf/gridarta/messages_sv.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_sv.properties 2008-09-27 19:07:43 UTC (rev 5260) +++ trunk/src/app/net/sf/gridarta/messages_sv.properties 2008-09-28 06:47:25 UTC (rev 5261) @@ -998,3 +998,5 @@ controlStop.text=Stoppa #controlClear.text= controlCloseOkay=Du kan st\xE4nga f\xF6nstret nu. +controlServerWarning.title=Varning +controlServerWarning.message=<html><h3>Varning!</h3><p>Java kan inte hantera processer som anv\xE4nder signalhanterare f\xF6r mycket arbete.<br>Servern \xE4r en s\xE5dan process.<br>Stopp av servern med "stoppa"-knappen kommer med stor sannolikhet<br>att resultera i en zombie-process som bara g\xE5r att ta bort med operativsystemets verktyg.</p><p><strong>Du har blivit varnad!</strong></p></html> Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-09-27 19:07:43 UTC (rev 5260) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-09-28 06:47:25 UTC (rev 5261) @@ -68,6 +68,7 @@ import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gameobject.match.GameObjectMatchers; import net.sf.gridarta.gui.MainView; +import net.sf.gridarta.gui.prefs.AppPrefsModel; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesModel; @@ -467,7 +468,7 @@ /** {@inheritDoc} */ @NotNull @Override - protected PreferencesGroup createPreferencesGroup(@NotNull final GlobalSettings globalSettings, @NotNull final DelegatingMapValidator<TestGameObject, TestMapArchObject, TestArchetype> validators) { + protected PreferencesGroup createPreferencesGroup(@NotNull final GlobalSettings globalSettings, @NotNull final DelegatingMapValidator<TestGameObject, TestMapArchObject, TestArchetype> validators, @NotNull final AppPrefsModel appPrefsModel) { throw new AssertionError(); } @@ -499,6 +500,13 @@ /** {@inheritDoc} */ @NotNull @Override + protected AppPrefsModel createAppPrefsModel() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + @NotNull + @Override protected MapControlFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> newMapControlFactory(@NotNull final GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> gridartaObjectsFactory) { return new TestMapControlFactory(gridartaObjectsFactory); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-09-28 07:13:01
|
Revision: 5263 http://gridarta.svn.sourceforge.net/gridarta/?rev=5263&view=rev Author: akirschbaum Date: 2008-09-28 07:12:50 +0000 (Sun, 28 Sep 2008) Log Message: ----------- Move message keys to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/messages.properties trunk/crossfire/src/cfeditor/messages_de.properties trunk/crossfire/src/cfeditor/messages_fr.properties trunk/crossfire/src/cfeditor/messages_sv.properties trunk/daimonin/src/daieditor/messages.properties trunk/daimonin/src/daieditor/messages_de.properties trunk/daimonin/src/daieditor/messages_fr.properties trunk/daimonin/src/daieditor/messages_sv.properties trunk/src/app/net/sf/gridarta/messages.properties trunk/src/app/net/sf/gridarta/messages_de.properties trunk/src/app/net/sf/gridarta/messages_fr.properties trunk/src/app/net/sf/gridarta/messages_sv.properties Modified: trunk/crossfire/src/cfeditor/messages.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages.properties 2008-09-28 06:49:56 UTC (rev 5262) +++ trunk/crossfire/src/cfeditor/messages.properties 2008-09-28 07:12:50 UTC (rev 5263) @@ -30,20 +30,9 @@ ########## # Dialogs -mapOutOfMemory.title=Out of memory -mapOutOfMemory.message=<html>Not enough memory available to open the map {0}!<br>You can increase the memory limit by using the <code>-Xmx</code> runtime flag.<br>For example: <code>java -Xmx128m -jar CrossfireEditor.jar</code></html> - mapDirDoesntExist.title=Invalid map directory mapDirDoesntExist.message=The map directory "{0}" doesn''t exist.\nPlease select menu ''File->Options...'' and correct that. -closeLevelNullLevel.title=Close map -closeLevelNullLevel.message=Map does not exist: {1}; number of existing maps: {0}. - -openFileLoadMap.title=Cannot open map -openFileLoadMap.message=An I/O error occurred while loading {0}:\n{1} -openFileOutOfMapBoundsDeleted.title=Loading mapfile {0} -openFileOutOfMapBoundsDeleted.message=While loading mapfile {0}:\nDeleted {1} game objects outside map bounds:{2} - enterExitClose.title=Close previous map? enterExitClose.message=You''ve opened a new map.\nShould I close the previous one? @@ -55,9 +44,6 @@ enterExitNotSaved.title=Map not saved enterExitNotSaved.message=You must save the map first to follow a relative path. -loadArchesNoArchfiles.title=No archfiles -loadArchesNoArchfiles.message=No archfiles could be found. If you have no archfiles\nyet, you need to download them. If you do, make sure\nthe path is correct under menu ''File->Options''. - loadDuplicateFace.title=Error: Duplicate face loadDuplicateFace.message=Warning!\n\nDuplicate face: ''{0}''\nFiles: ''{1}''\nand ''{2}''\nI will ignore this duplicate. @@ -123,8 +109,6 @@ archCollectWarningMissed.title=Collect warning archCollectWarningMissed.message=Collect Warning: {0} arches have been missed during collect! -archCollectErrorFileNotFound.title=Collect error -archCollectErrorFileNotFound.message=Collect Error: Cannot open input file\n{0} ####### @@ -279,8 +263,6 @@ ####################### # Various Log Messages -logExitWithExit=Exiting with System.exit(). -logExitWithoutExit=Trying to exit without System.exit(). logFaceObjectWithoutOriginalName=No originalName for {0}! logDuplicateAnimation=Duplicate Animation: {0} logInventoryInDefArch=Found inventory Object in def arch: {0} Modified: trunk/crossfire/src/cfeditor/messages_de.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_de.properties 2008-09-28 06:49:56 UTC (rev 5262) +++ trunk/crossfire/src/cfeditor/messages_de.properties 2008-09-28 07:12:50 UTC (rev 5263) @@ -26,20 +26,9 @@ ########## # Dialogs -mapOutOfMemory.title=Kann Karte nicht \xF6ffnen -mapOutOfMemory.message=Es ist nicht gen\xFCgend freier Speicher vorhanden, um die\nKarte {0} zu laden. - mapDirDoesntExist.title=Ung\xFCltiges Verzeichnis mapDirDoesntExist.message=Das Verzeichnis f\xFCr Karten "{0}" existiert nicht.\nBitte legen sie es unter ''Datei->Optionen...'' fest. -closeLevelNullLevel.title=Kann Karte nicht schlie\xDFen -closeLevelNullLevel.message=Die Karte {1} existiert nicht; Anzahl existierender Karten: {0}. - -openFileLoadMap.title=Kann Karte nicht \xF6ffnen -openFileLoadMap.message=Beim \xD6ffnen der Datei {0} ist ein Ein-/Ausgabefehler aufgetreten:\n{1} -openFileOutOfMapBoundsDeleted.title=Karte {0} laden -openFileOutOfMapBoundsDeleted.message=Beim Laden von {0}\nwurden {1} Objekte wurden gel\xF6scht, da sie nicht innerhalb der Katenfl\xE4che liegen:{2} - enterExitClose.title=Letzte Karte schlie\xDFen? enterExitClose.message=Sie haben eine neue Karte ge\xF6ffnet.\nSoll die letzte Karte geschlossen werden? @@ -51,9 +40,6 @@ enterExitNotSaved.title=Karte nicht gesichert enterExitNotSaved.message=Der Ausgang verwendet einen relativen Dateinamen. Um ihm zu folgen m\xFCssen Sie die Karte vorher sichern. -loadArchesNoArchfiles.title=Keine Archetypen gefunden -loadArchesNoArchfiles.message=Es konnten keine Archetypen gefunden werden.\nBitte stellen Sie sicher, dass der Pfad\nunter ''Datei->Optionen...'' korrekt ist. - loadDuplicateFace.title=Fehler: doppelte Grafik loadDuplicateFace.message=Warning!\n\nDopplete Grafik: ''{0}''\nDateien: ''{1}''\nund ''{2}''\nDie doppelte Grafik wird ignoriert. @@ -119,8 +105,6 @@ archCollectWarningMissed.title=Fehler beim Sammeln archCollectWarningMissed.message=Warnung: Beim Sammeln der Archetypen sind wurden {0} Archetypen nicht gefunden. -archCollectErrorFileNotFound.title=Fehler beim Sammeln -archCollectErrorFileNotFound.message=Kann Eingabedatei nicht \xF6ffnen:\n{0} ####### Modified: trunk/crossfire/src/cfeditor/messages_fr.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_fr.properties 2008-09-28 06:49:56 UTC (rev 5262) +++ trunk/crossfire/src/cfeditor/messages_fr.properties 2008-09-28 07:12:50 UTC (rev 5263) @@ -27,20 +27,9 @@ ########## # Dialogs -#mapOutOfMemory.title= -#mapOutOfMemory.message= - #mapDirDoesntExist.title= #mapDirDoesntExist.message= -#closeLevelNullLevel.title= -#closeLevelNullLevel.message= - -#openFileLoadMap.title= -#openFileLoadMap.message= -#openFileOutOfMapBoundsDeleted.title= -#openFileOutOfMapBoundsDeleted.message= - #enterExitClose.title= #enterExitClose.message= @@ -52,9 +41,6 @@ #enterExitNotSaved.title= #enterExitNotSaved.message= -#loadArchesNoArchfiles.title= -#loadArchesNoArchfiles.message= - #loadDuplicateFace.title= #loadDuplicateFace.message= @@ -120,8 +106,6 @@ #archCollectWarningMissed.title= #archCollectWarningMissed.message= -#archCollectErrorFileNotFound.title= -#archCollectErrorFileNotFound.message= ####### Modified: trunk/crossfire/src/cfeditor/messages_sv.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_sv.properties 2008-09-28 06:49:56 UTC (rev 5262) +++ trunk/crossfire/src/cfeditor/messages_sv.properties 2008-09-28 07:12:50 UTC (rev 5263) @@ -25,20 +25,9 @@ ########## # Dialogs -mapOutOfMemory.title=Slut p\xE5 minne -mapOutOfMemory.message=<html>Det finns inte tillr\xE4ckligt med minne f\xF6r att \xF6ppna kartan {0}!<br>Du kan h\xF6ja minnesgr\xE4nsen med <code>-Xmx</code> -flaggan.<br>Till exempel: <code>java -Xmx128m -jar DaimoninEditor.jar</code></html> - mapDirDoesntExist.title=Ogiltig katalog f\xF6r kartor. mapDirDoesntExist.message=Katalogen f\xF6r kartor, "{0}", finns inte.\nVar v\xE4nlig och v\xE4lj menyn ''Arkiv->Inst\xE4llningar...'' f\xF6r att byta katalog. -closeLevelNullLevel.title=St\xE4ng niv\xE5 -closeLevelNullLevel.message=FIND NULL LEVEL : {0} v\xE5r karta: {1}. - -openFileLoadMap.title=Kunde inte \xF6ppna kartan -#openFileLoadMap.message= -openFileOutOfMapBoundsDeleted.title=Laddar kartfil {0} -#openFileOutOfMapBoundsDeleted.message= - #enterExitClose.title= #enterExitClose.message= @@ -50,9 +39,6 @@ #enterExitNotSaved.title= #enterExitNotSaved.message= -loadArchesNoArchfiles.title=Inga arketypfiler -loadArchesNoArchfiles.message=Inga arketypfiler kunde hittas. Om du saknar arketypfiler\n m\xE5ste du ladda hem dom. Om du g\xF6r detta, se till\natt s\xF6kv\xE4gen under ''Arkiv->Inst\xE4llningar'' \xE4r korrekt. - loadDuplicateFace.title=Fel: duplicerad bild loadDuplicateFace.message=Varning!\n\nDuplicerad bild: ''{0}''\nFiler: ''{1}''\noch ''{2}''\nJag kommer att ignorera detta duplikat. @@ -118,8 +104,6 @@ archCollectWarningMissed.title=Varning under sammanst\xE4llning archCollectWarningMissed.message=Varning under sammanst\xE4llning: {0} arketyper saknades under sammanst\xE4llningen! -archCollectErrorFileNotFound.title=Fel under sammanst\xE4llning -archCollectErrorFileNotFound.message=Fel under sammanst\xE4llning: kan inte \xF6ppna fil\n{0} ####### Modified: trunk/daimonin/src/daieditor/messages.properties =================================================================== --- trunk/daimonin/src/daieditor/messages.properties 2008-09-28 06:49:56 UTC (rev 5262) +++ trunk/daimonin/src/daieditor/messages.properties 2008-09-28 07:12:50 UTC (rev 5263) @@ -28,31 +28,18 @@ # Dialogs warning=Warning! -mapOutOfMemory.title=Out of memory -mapOutOfMemory.message=<html>Not enough memory available to open the map {0}!<br>You can increase the memory limit by using the <code>-Xmx</code> runtime flag.<br>For example: <code>java -Xmx128m -jar DaimoninEditor.jar</code></html> mapUnsaved.title=Map Not Saved mapUnsaved.message=Please save this map first. mapDirDoesntExist.title=Invalid map directory mapDirDoesntExist.message=The map directory "{0}" doesn''t exist.\nPlease select menu ''File->Options...'' and correct that. -closeLevelNullLevel.title=Close map -closeLevelNullLevel.message=Map does not exist: {1}; number of existing maps: {0}. - -openFileLoadMap.title=Cannot open map -openFileLoadMap.message=An I/O error occurred while loading {0}:\n{1} -openFileOutOfMapBoundsDeleted.title=Loading mapfile {0} -openFileOutOfMapBoundsDeleted.message=While loading mapfile {0}:\nDeleted {1} game objects outside map bounds:{2} - enterExitClose.title=Close previous map? enterExitClose.message=You''ve opened a new map.\nShould I close the previous one? enterTileIOException.title=Invalid path enterTileIOException.message=Failed to load file for tiled map.\n{0} -loadArchesNoArchfiles.title=No archfiles -loadArchesNoArchfiles.message=No archfiles could be found. If you have no archfiles\nyet, you need to download them. If you do, make sure\nthe path is correct under menu ''File->Options''. - loadDuplicateFace.title=Error: Duplicate face loadDuplicateFace.message=Warning!\n\nDuplicate face: ''{0}''\nFiles: ''{1}''\nand ''{2}''\nI will ignore this duplicate. @@ -99,8 +86,6 @@ archCollectWarningMultipartTooShort.message=Collect Warning: Multipart object too short! archCollectWarningMissed.title=Collect warning archCollectWarningMissed.message=Collect Warning: {0} arches have been missed during collect! -archCollectErrorFileNotFound.title=Collect error -archCollectErrorFileNotFound.message=Collect Error: Cannot open input file\n{0} ####### @@ -311,8 +296,6 @@ ####################### # Various Log Messages -logExitWithExit=Exiting with System.exit(). -logExitWithoutExit=Trying to exit without System.exit(). logFaceObjectWithoutOriginalName=No originalName for {0}! logDuplicateAnimation=Duplicate Animation: {0} logInventoryInDefArch=Found inventory Object in def arch: {0} Modified: trunk/daimonin/src/daieditor/messages_de.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_de.properties 2008-09-28 06:49:56 UTC (rev 5262) +++ trunk/daimonin/src/daieditor/messages_de.properties 2008-09-28 07:12:50 UTC (rev 5263) @@ -28,31 +28,18 @@ # Dialogs warning=Warnung! -mapOutOfMemory.title=Kann Karte nicht \xF6ffnen -mapOutOfMemory.message=Es ist nicht gen\xFCgend freier Speicher vorhanden, um die\nKarte {0} zu laden. #mapUnsaved.title= #mapUnsaved.message= mapDirDoesntExist.title=Ung\xFCltiges Verzeichnis mapDirDoesntExist.message=Das Verzeichnis f\xFCr Karten "{0}" existiert nicht.\nBitte legen sie es unter ''Datei->Optionen...'' fest. -closeLevelNullLevel.title=Kann Karte nicht schlie\xDFen -closeLevelNullLevel.message=Die Karte {1} existiert nicht; Anzahl existierender Karten: {0}. - -openFileLoadMap.title=Kann Karte nicht \xF6ffnen -openFileLoadMap.message=Beim \xD6ffnen der Datei {0} ist ein Ein-/Ausgabefehler aufgetreten:\n{1} -openFileOutOfMapBoundsDeleted.title=Karte {0} laden -openFileOutOfMapBoundsDeleted.message=Beim Laden von {0}\nwurden {1} Objekte wurden gel\xF6scht, da sie nicht innerhalb der Katenfl\xE4che liegen:{2} - enterExitClose.title=Letzte Karte schlie\xDFen? enterExitClose.message=Sie haben eine neue Karte ge\xF6ffnet.\nSoll die letzte Karte geschlossen werden? enterTileIOException.title=Ung\xFCltiger Pfad enterTileIOException.message=Kann verbundene Karte nicht laden.\n{0} -loadArchesNoArchfiles.title=Keine Archetypen gefunden -loadArchesNoArchfiles.message=Es konnten keine Archetypen gefunden werden.\nBitte stellen Sie sicher, dass der Pfad\nunter ''Datei->Optionen...'' korrekt ist. - loadDuplicateFace.title=Fehler: doppelte Grafik loadDuplicateFace.message=Warning!\n\nDopplete Grafik: ''{0}''\nDateien: ''{1}''\nund ''{2}''\nDie doppelte Grafik wird ignoriert. @@ -99,8 +86,6 @@ #archCollectWarningMultipartTooShort.message= archCollectWarningMissed.title=Fehler beim Sammeln archCollectWarningMissed.message=Warnung: Beim Sammeln der Archetypen sind wurden {0} Archetypen nicht gefunden. -archCollectErrorFileNotFound.title=Fehler beim Sammeln -archCollectErrorFileNotFound.message=Kann Eingabedatei nicht \xF6ffnen:\n{0} ####### Modified: trunk/daimonin/src/daieditor/messages_fr.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_fr.properties 2008-09-28 06:49:56 UTC (rev 5262) +++ trunk/daimonin/src/daieditor/messages_fr.properties 2008-09-28 07:12:50 UTC (rev 5263) @@ -28,31 +28,18 @@ # Dialogs warning=Attention! -#mapOutOfMemory.title= -#mapOutOfMemory.message= #mapUnsaved.title= #mapUnsaved.message= #mapDirDoesntExist.title= #mapDirDoesntExist.message= -#closeLevelNullLevel.title= -#closeLevelNullLevel.message= - -#openFileLoadMap.title= -#openFileLoadMap.message= -#openFileOutOfMapBoundsDeleted.title= -#openFileOutOfMapBoundsDeleted.message= - #enterExitClose.title= #enterExitClose.message= #enterTileIOException.title= #enterTileIOException.message= -#loadArchesNoArchfiles.title= -#loadArchesNoArchfiles.message= - #loadDuplicateFace.title= #loadDuplicateFace.message= @@ -100,8 +87,6 @@ #archCollectWarningMultipartTooShort.message= #archCollectWarningMissed.title= #archCollectWarningMissed.message= -#archCollectErrorFileNotFound.title= -#archCollectErrorFileNotFound.message= ####### Modified: trunk/daimonin/src/daieditor/messages_sv.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_sv.properties 2008-09-28 06:49:56 UTC (rev 5262) +++ trunk/daimonin/src/daieditor/messages_sv.properties 2008-09-28 07:12:50 UTC (rev 5263) @@ -28,31 +28,18 @@ # Dialogs warning=Varning! -mapOutOfMemory.title=Slut p\xE5 minne -mapOutOfMemory.message=<html>Det finns inte tillr\xE4ckligt med minne f\xF6r att \xF6ppna kartan {0}!<br>Du kan h\xF6ja minnesgr\xE4nsen med <code>-Xmx</code> -flaggan.<br>Till exempel: <code>java -Xmx128m -jar DaimoninEditor.jar</code></html> mapUnsaved.title=Kartan har inte sparats. mapUnsaved.message=Var v\xE4nlig och spara den h\xE4r kartan f\xF6rst. mapDirDoesntExist.title=Ogiltig katalog f\xF6r kartor. mapDirDoesntExist.message=Katalogen f\xF6r kartor, "{0}", finns inte.\nVar v\xE4nlig och v\xE4lj menyn ''Arkiv->Inst\xE4llningar...'' f\xF6r att byta katalog. -closeLevelNullLevel.title=St\xE4ng niv\xE5 -closeLevelNullLevel.message=FIND NULL LEVEL : {0} v\xE5r karta: {1}. - -openFileLoadMap.title=Kunde inte \xF6ppna kartan -#openFileLoadMap.message= -openFileOutOfMapBoundsDeleted.title=Laddar kartfil {0} -#openFileOutOfMapBoundsDeleted.message= - #enterExitClose.title= #enterExitClose.message= enterTileIOException.title=Ogiltig s\xF6kv\xE4g enterTileIOException.message=Misslyckades \xF6ppna filen f\xF6r s\xF6kv\xE4gen.\n{0} -loadArchesNoArchfiles.title=Inga arketypfiler -loadArchesNoArchfiles.message=Inga arketypfiler kunde hittas. Om du saknar arketypfiler\n m\xE5ste du ladda hem dom. Om du g\xF6r detta, se till\natt s\xF6kv\xE4gen under ''Arkiv->Inst\xE4llningar'' \xE4r korrekt. - loadDuplicateFace.title=Fel: duplicerad bild loadDuplicateFace.message=Varning!\n\nDuplicerad bild: ''{0}''\nFiler: ''{1}''\noch ''{2}''\nJag kommer att ignorera detta duplikat. @@ -101,8 +88,6 @@ archCollectWarningMissed.message=Varning under sammanst\xE4llning: {0} arketyper saknades under sammanst\xE4llningen! archCollectErrorIOException.title=Fel under sammanst\xE4llning archCollectErrorIOException.message=Fel under sammanst\xE4llning: ett I/O-fel intr\xE4ffade f\xF6r filen {0}:\n{1} -archCollectErrorFileNotFound.title=Fel under sammanst\xE4llning -archCollectErrorFileNotFound.message=Fel under sammanst\xE4llning: kan inte \xF6ppna fil\n{0} ####### Modified: trunk/src/app/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages.properties 2008-09-28 06:49:56 UTC (rev 5262) +++ trunk/src/app/net/sf/gridarta/messages.properties 2008-09-28 07:12:50 UTC (rev 5263) @@ -177,6 +177,17 @@ # Dialogs +mapOutOfMemory.title=Out of memory +mapOutOfMemory.message=<html>Not enough memory available to open the map {0}!<br>You can increase the memory limit by using the <code>-Xmx</code> runtime flag.<br>For example: <code>java -Xmx128m -jar CrossfireEditor.jar</code></html> + +openFileLoadMap.title=Cannot open map +openFileLoadMap.message=An I/O error occurred while loading {0}:\n{1} +openFileOutOfMapBoundsDeleted.title=Loading mapfile {0} +openFileOutOfMapBoundsDeleted.message=While loading mapfile {0}:\nDeleted {1} game objects outside map bounds:{2} + +closeLevelNullLevel.title=Close map +closeLevelNullLevel.message=Map does not exist: {1}; number of existing maps: {0}. + overwriteOtherFile.title=Overwrite file? overwriteOtherFile.message=A file named "{0}" already exists.\n\nReally overwrite it? @@ -291,6 +302,8 @@ shrinkMapSizeDialogSouthBreaksWestTiling=removing empty tiles from the south border breaks west tiling shrinkMapSizeDialogSouthBreaksEastTiling=removing empty tiles from the south border breaks east tiling +loadArchesNoArchfiles.title=No archfiles +loadArchesNoArchfiles.message=No archfiles could be found. If you have no archfiles\nyet, you need to download them. If you do, make sure\nthe path is correct under menu ''File->Options''. loadDuplicateArch.title=Error: Duplicate arch loadDuplicateArch.message.1=<html><h1>Warning!</h1>Duplicate arches: loadDuplicateArch.message.2.title.1=Archetype @@ -432,6 +445,8 @@ logUnexpectedException=Unexpected exception: {0} logArchfileNotFound=Archfile {0} could not be found logCanonIOE=IOException while canonizing path: {0} +logExitWithExit=Exiting with System.exit(). +logExitWithoutExit=Trying to exit without System.exit(). # Edit undo.text=Undo @@ -776,6 +791,9 @@ optionsAppClient=Client optionsAppEditor=Editor +archCollectErrorFileNotFound.title=Collect error +archCollectErrorFileNotFound.message=Collect Error: Cannot open input file\n{0} + arcDoc.htmlText=<html><head><meta name="Gridarta" content="tmp"><title>{0}</title></head><body><h1 style="text-align:center;colour:navy;">{0}</h1><h3 style="colour:navy;">Functionality of {0}:</h3><p>{1}</p><h3 style="colour:navy;">Notes on Usage:</h3><p>{2}</p></body></html> Modified: trunk/src/app/net/sf/gridarta/messages_de.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_de.properties 2008-09-28 06:49:56 UTC (rev 5262) +++ trunk/src/app/net/sf/gridarta/messages_de.properties 2008-09-28 07:12:50 UTC (rev 5263) @@ -162,6 +162,17 @@ # Dialogs +mapOutOfMemory.title=Kann Karte nicht \xF6ffnen +mapOutOfMemory.message=Es ist nicht gen\xFCgend freier Speicher vorhanden, um die\nKarte {0} zu laden. + +openFileLoadMap.title=Kann Karte nicht \xF6ffnen +openFileLoadMap.message=Beim \xD6ffnen der Datei {0} ist ein Ein-/Ausgabefehler aufgetreten:\n{1} +openFileOutOfMapBoundsDeleted.title=Karte {0} laden +openFileOutOfMapBoundsDeleted.message=Beim Laden von {0}\nwurden {1} Objekte wurden gel\xF6scht, da sie nicht innerhalb der Katenfl\xE4che liegen:{2} + +closeLevelNullLevel.title=Kann Karte nicht schlie\xDFen +closeLevelNullLevel.message=Die Karte {1} existiert nicht; Anzahl existierender Karten: {0}. + overwriteOtherFile.title=Datei \xFCberschreiben? overwriteOtherFile.message=Eine Datei mit Namen "{0}" existiert bereits.\n\nWirklich \xFCberschreiben? @@ -276,6 +287,8 @@ shrinkMapSizeDialogSouthBreaksWestTiling=l\xF6schen von leeren Feldern am s\xFCdlichen Kartenrand st\xF6rt Verbindung zu westlicher Karte shrinkMapSizeDialogSouthBreaksEastTiling=l\xF6schen von leeren Feldern am s\xFCdlichen Kartenrand st\xF6rt Verbindung zu \xF6stlicher Karte +loadArchesNoArchfiles.title=Keine Archetypen gefunden +loadArchesNoArchfiles.message=Es konnten keine Archetypen gefunden werden.\nBitte stellen Sie sicher, dass der Pfad\nunter ''Datei->Optionen...'' korrekt ist. loadDuplicateArch.title=Fehler: Mehrfach definierte Archetypen loadDuplicateArch.message.1=<html><h1>Warnung</h1>Mehrfach definierte Archetypen: loadDuplicateArch.message.2.title.1=Archetyp @@ -731,6 +744,9 @@ optionsAppClient=Client optionsAppEditor=Editor +archCollectErrorFileNotFound.title=Fehler beim Sammeln +archCollectErrorFileNotFound.message=Kann Eingabedatei nicht \xF6ffnen:\n{0} + arcDoc.htmlText=<html><head meta name="Gridarta" content="tmp"><title>{0}</title></head><body><h1 style="text-align:center;colour:navy;">{0}</h1><h3 style="colour:navy;">Funktionalität von {0}:</h3><p>{1}</p><h3 style="colour:navy;">Nutzungshinweise:</h3><p>{2}</p></body></html> ############### Modified: trunk/src/app/net/sf/gridarta/messages_fr.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_fr.properties 2008-09-28 06:49:56 UTC (rev 5262) +++ trunk/src/app/net/sf/gridarta/messages_fr.properties 2008-09-28 07:12:50 UTC (rev 5263) @@ -161,6 +161,17 @@ # Dialogs +#mapOutOfMemory.title= +#mapOutOfMemory.message= + +#openFileLoadMap.title= +#openFileLoadMap.message= +#openFileOutOfMapBoundsDeleted.title= +#openFileOutOfMapBoundsDeleted.message= + +#closeLevelNullLevel.title= +#closeLevelNullLevel.message= + #overwriteOtherFile.title= overwriteOtherFile.message=Un fichier nomm\xE9 "{0}" existe d\xE9j\xE0.\n\nVoulez vous vraiment le remplacer? @@ -275,6 +286,8 @@ #shrinkMapSizeDialogSouthBreaksWestTiling= #shrinkMapSizeDialogSouthBreaksEastTiling= +#loadArchesNoArchfiles.title= +#loadArchesNoArchfiles.message= #loadDuplicateArch.title= #loadDuplicateArch.message.1= #loadDuplicateArch.message.2.title.1= @@ -730,6 +743,9 @@ #optionsAppClient= #optionsAppEditor= +#archCollectErrorFileNotFound.title= +#archCollectErrorFileNotFound.message= + arcDoc.htmlText=<html><head><meta name="Gridarta" contents="tmp"><title>{0}</title></head><body><h1 style="text-align:center;colour:navy;">Type: {0}</h1><h3 style="colour:navy;">Fonctionalit\xE9s de {0}</h3><p>{1}</p><h3 style="colour:navy;">Notes d'utilisation:</h3><p>{2}</p></body></html> ############### Modified: trunk/src/app/net/sf/gridarta/messages_sv.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_sv.properties 2008-09-28 06:49:56 UTC (rev 5262) +++ trunk/src/app/net/sf/gridarta/messages_sv.properties 2008-09-28 07:12:50 UTC (rev 5263) @@ -163,7 +163,19 @@ #zoomAlgAreaAveraging.exception.java.lang.OutOfMemoryError.message= +########## # Dialogs +mapOutOfMemory.title=Slut p\xE5 minne +mapOutOfMemory.message=<html>Det finns inte tillr\xE4ckligt med minne f\xF6r att \xF6ppna kartan {0}!<br>Du kan h\xF6ja minnesgr\xE4nsen med <code>-Xmx</code> -flaggan.<br>Till exempel: <code>java -Xmx128m -jar DaimoninEditor.jar</code></html> + +openFileLoadMap.title=Kunde inte \xF6ppna kartan +#openFileLoadMap.message= +openFileOutOfMapBoundsDeleted.title=Laddar kartfil {0} +#openFileOutOfMapBoundsDeleted.message= + +closeLevelNullLevel.title=St\xE4ng niv\xE5 +closeLevelNullLevel.message=FIND NULL LEVEL : {0} v\xE5r karta: {1}. + overwriteOtherFile.title=Skriv \xF6ver existerande fil? overwriteOtherFile.message=En fil med namnet "{0}" existerar redan.\n\nVill du verkligen skriva \xF6ver den? @@ -278,6 +290,8 @@ #shrinkMapSizeDialogSouthBreaksWestTiling= #shrinkMapSizeDialogSouthBreaksEastTiling= +loadArchesNoArchfiles.title=Inga arketypfiler +loadArchesNoArchfiles.message=Inga arketypfiler kunde hittas. Om du saknar arketypfiler\n m\xE5ste du ladda hem dom. Om du g\xF6r detta, se till\natt s\xF6kv\xE4gen under ''Arkiv->Inst\xE4llningar'' \xE4r korrekt. loadDuplicateArch.title=Fel: duplicerad arketyp loadDuplicateArch.message.1=<html><h1>Varning!</h1>Duplicerad arketyp: #loadDuplicateArch.message.2.title.1= @@ -734,6 +748,9 @@ optionsAppClient=Klient optionsAppEditor=Editor +archCollectErrorFileNotFound.title=Fel under sammanst\xE4llning +archCollectErrorFileNotFound.message=Fel under sammanst\xE4llning: kan inte \xF6ppna fil\n{0} + arcDoc.htmlText=<html><head name="Gridarta" content="tmp"><title>{0}</title></head><body><h1 style="text-align:center;colour:navy;">Type: {0}</h1><h3 style="colour:navy;">Funktionalitet f\xF6r {0}</h3><p>{1}</p><h3 style="colour:navy;">Tips f\xF6r anv\xE4ndning:</h3><p>{2}</p></body></html> ############### This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-09-28 17:35:10
|
Revision: 5268 http://gridarta.svn.sourceforge.net/gridarta/?rev=5268&view=rev Author: akirschbaum Date: 2008-09-28 17:34:59 +0000 (Sun, 28 Sep 2008) Log Message: ----------- Move icons to common code base. Added Paths: ----------- trunk/resource/icons/CreateImageSmallIcon.gif trunk/resource/icons/Dir1.gif trunk/resource/icons/Dir2.gif trunk/resource/icons/Dir3.gif trunk/resource/icons/Dir4.gif trunk/resource/icons/Dir5.gif trunk/resource/icons/Dir6.gif trunk/resource/icons/Dir7.gif trunk/resource/icons/Dir8.gif trunk/resource/icons/EmptySmallIcon.gif trunk/resource/icons/development/Host24.gif trunk/resource/icons/general/ trunk/resource/icons/general/New16.gif trunk/resource/icons/general/Open16.gif trunk/resource/icons/general/Preferences16.gif trunk/resource/icons/general/Preferences24.gif trunk/resource/icons/general/Redo16.gif trunk/resource/icons/general/Refresh16.gif trunk/resource/icons/general/Remove16.gif trunk/resource/icons/general/Save16.gif trunk/resource/icons/general/SaveAs16.gif trunk/resource/icons/general/Search16.gif trunk/resource/icons/general/Undo16.gif trunk/resource/icons/general/Zoom16.gif Removed Paths: ------------- trunk/crossfire/resource/icons/CreateImageSmallIcon.gif trunk/crossfire/resource/icons/Dir1.gif trunk/crossfire/resource/icons/Dir2.gif trunk/crossfire/resource/icons/Dir3.gif trunk/crossfire/resource/icons/Dir4.gif trunk/crossfire/resource/icons/Dir5.gif trunk/crossfire/resource/icons/Dir6.gif trunk/crossfire/resource/icons/Dir7.gif trunk/crossfire/resource/icons/Dir8.gif trunk/crossfire/resource/icons/EmptySmallIcon.gif trunk/crossfire/resource/icons/development/Host24.gif trunk/crossfire/resource/icons/general/New16.gif trunk/crossfire/resource/icons/general/Open16.gif trunk/crossfire/resource/icons/general/Preferences16.gif trunk/crossfire/resource/icons/general/Preferences24.gif trunk/crossfire/resource/icons/general/Redo16.gif trunk/crossfire/resource/icons/general/Refresh16.gif trunk/crossfire/resource/icons/general/Remove16.gif trunk/crossfire/resource/icons/general/Save16.gif trunk/crossfire/resource/icons/general/SaveAs16.gif trunk/crossfire/resource/icons/general/Search16.gif trunk/crossfire/resource/icons/general/Undo16.gif trunk/crossfire/resource/icons/general/Zoom16.gif trunk/daimonin/resource/icons/CreateImageSmallIcon.gif trunk/daimonin/resource/icons/Dir1.gif trunk/daimonin/resource/icons/Dir2.gif trunk/daimonin/resource/icons/Dir3.gif trunk/daimonin/resource/icons/Dir4.gif trunk/daimonin/resource/icons/Dir5.gif trunk/daimonin/resource/icons/Dir6.gif trunk/daimonin/resource/icons/Dir7.gif trunk/daimonin/resource/icons/Dir8.gif trunk/daimonin/resource/icons/EmptySmallIcon.gif trunk/daimonin/resource/icons/development/Host24.gif trunk/daimonin/resource/icons/general/New16.gif trunk/daimonin/resource/icons/general/Open16.gif trunk/daimonin/resource/icons/general/Preferences16.gif trunk/daimonin/resource/icons/general/Preferences24.gif trunk/daimonin/resource/icons/general/Redo16.gif trunk/daimonin/resource/icons/general/Refresh16.gif trunk/daimonin/resource/icons/general/Remove16.gif trunk/daimonin/resource/icons/general/Save16.gif trunk/daimonin/resource/icons/general/SaveAs16.gif trunk/daimonin/resource/icons/general/Search16.gif trunk/daimonin/resource/icons/general/Undo16.gif trunk/daimonin/resource/icons/general/Zoom16.gif Property changes on: trunk/resource/icons/CreateImageSmallIcon.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Property changes on: trunk/resource/icons/Dir1.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Property changes on: trunk/resource/icons/Dir2.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Property changes on: trunk/resource/icons/Dir3.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Property changes on: trunk/resource/icons/Dir4.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Property changes on: trunk/resource/icons/Dir5.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Property changes on: trunk/resource/icons/Dir6.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Property changes on: trunk/resource/icons/Dir7.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Property changes on: trunk/resource/icons/Dir8.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Property changes on: trunk/resource/icons/EmptySmallIcon.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Property changes on: trunk/resource/icons/development/Host24.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Property changes on: trunk/resource/icons/general/New16.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Property changes on: trunk/resource/icons/general/Open16.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Property changes on: trunk/resource/icons/general/Preferences16.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Property changes on: trunk/resource/icons/general/Preferences24.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Property changes on: trunk/resource/icons/general/Redo16.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Property changes on: trunk/resource/icons/general/Refresh16.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Property changes on: trunk/resource/icons/general/Remove16.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Property changes on: trunk/resource/icons/general/Save16.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Property changes on: trunk/resource/icons/general/SaveAs16.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Property changes on: trunk/resource/icons/general/Search16.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Property changes on: trunk/resource/icons/general/Undo16.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Property changes on: trunk/resource/icons/general/Zoom16.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-09-28 18:10:19
|
Revision: 5270 http://gridarta.svn.sourceforge.net/gridarta/?rev=5270&view=rev Author: akirschbaum Date: 2008-09-28 18:09:58 +0000 (Sun, 28 Sep 2008) Log Message: ----------- Fix missing icons in toolbars and menus. Modified Paths: -------------- trunk/crossfire/src/cfeditor/action.properties trunk/daimonin/src/daieditor/action.properties trunk/src/app/net/sf/gridarta/action.properties Added Paths: ----------- trunk/resource/icons/development/Jar16.gif trunk/resource/icons/general/About16.gif trunk/resource/icons/general/Copy16.gif trunk/resource/icons/general/Cut16.gif trunk/resource/icons/general/Delete16.gif trunk/resource/icons/general/Edit16.gif trunk/resource/icons/general/Help16.gif trunk/resource/icons/general/History16.gif trunk/resource/icons/general/Paste16.gif trunk/resource/icons/general/Replace16.gif trunk/resource/icons/general/Save24.gif trunk/resource/icons/general/TipOfTheDay16.gif Removed Paths: ------------- trunk/crossfire/resource/icons/development/ trunk/crossfire/resource/icons/general/About16.gif trunk/crossfire/resource/icons/general/Copy16.gif trunk/crossfire/resource/icons/general/Cut16.gif trunk/crossfire/resource/icons/general/Delete16.gif trunk/crossfire/resource/icons/general/Edit16.gif trunk/crossfire/resource/icons/general/Help16.gif trunk/crossfire/resource/icons/general/History16.gif trunk/crossfire/resource/icons/general/Paste16.gif trunk/crossfire/resource/icons/general/Replace16.gif trunk/crossfire/resource/icons/general/Save24.gif trunk/crossfire/resource/icons/general/Search24.gif trunk/crossfire/resource/icons/general/TipOfTheDay16.gif trunk/daimonin/resource/icons/development/ trunk/daimonin/resource/icons/general/About16.gif trunk/daimonin/resource/icons/general/Copy16.gif trunk/daimonin/resource/icons/general/Cut16.gif trunk/daimonin/resource/icons/general/Delete16.gif trunk/daimonin/resource/icons/general/Edit16.gif trunk/daimonin/resource/icons/general/Help16.gif trunk/daimonin/resource/icons/general/History16.gif trunk/daimonin/resource/icons/general/Paste16.gif trunk/daimonin/resource/icons/general/Replace16.gif trunk/daimonin/resource/icons/general/Save24.gif trunk/daimonin/resource/icons/general/Search24.gif trunk/daimonin/resource/icons/general/TipOfTheDay16.gif Modified: trunk/crossfire/src/cfeditor/action.properties =================================================================== --- trunk/crossfire/src/cfeditor/action.properties 2008-09-28 17:38:30 UTC (rev 5269) +++ trunk/crossfire/src/cfeditor/action.properties 2008-09-28 18:09:58 UTC (rev 5270) @@ -53,59 +53,11 @@ mapTileClear.icon=general/Remove16 mapTileChoose.icon=general/Open16 -####### -# File -createNew.icon=general/New16 - -open.icon=general/Open16 - -recent.icon=general/History16 - -closeAll.icon=EmptySmallIcon - -options.icon=general/Preferences16 - -exit.icon=EmptySmallIcon - - -clear.icon=general/Remove16 - -cut.icon=general/Cut16 - -copy.icon=general/Copy16 - -paste.icon=general/Paste16 - -shift.menu=shiftNorth shiftEast shiftSouth shiftWest shiftNorthEast shiftSouthEast shiftSouthWest shiftNorthWest - -replace.icon=general/Replace16 - -fillAbove.icon=EmptySmallIcon - -fillBelow.icon=EmptySmallIcon - -randFillAbove.icon=EmptySmallIcon - -randFillBelow.icon=EmptySmallIcon - -floodfill.icon=EmptySmallIcon - -selectAll.icon=EmptySmallIcon - - mapProperties.icon=general/Properties16 moveCursor.menu=goNorth goEast goSouth goWest goNorthEast goSouthEast goSouthWest goNorthWest - goLocation -collectArches.icon=development/Jar16 - -newScript.icon=general/New16 - -editScript.icon=general/Edit16 - -gc.icon=general/Delete16 - runPlugin.icon=RunPluginSmallIcon editPlugins.icon=EditPluginSmallIcon @@ -120,16 +72,4 @@ prevWindow.icon=navigation/Back16 -onlineHelp.icon=general/Help16 - -tod.icon=general/TipOfTheDay16 - -about.icon=general/About16 -about.logo=icons/crossfireLogoSmall.png - - update.url=http://www.eracc.com/files/crossfire/update.properties - - -prefsRes.icon=general/Save24 -prefsMapValidator.icon=general/Search24 Modified: trunk/daimonin/src/daieditor/action.properties =================================================================== --- trunk/daimonin/src/daieditor/action.properties 2008-09-28 17:38:30 UTC (rev 5269) +++ trunk/daimonin/src/daieditor/action.properties 2008-09-28 18:09:58 UTC (rev 5270) @@ -55,61 +55,13 @@ oldLibs.okayLibs=.svn CVS README LICENSE-* *-LICENSE japi.jar jlfgr-1_0.jar -####### -# File -createNew.icon=general/New16 - -open.icon=general/Open16 - -recent.icon=general/History16 - -closeAll.icon=EmptySmallIcon - -options.icon=general/Preferences16 - -exit.icon=EmptySmallIcon - - -clear.icon=general/Remove16 - -cut.icon=general/Cut16 - -copy.icon=general/Copy16 - -paste.icon=general/Paste16 - -shift.menu=shiftNorth shiftEast shiftSouth shiftWest shiftNorthEast shiftSouthEast shiftSouthWest shiftNorthWest - -replace.icon=general/Replace16 - -fillAbove.icon=EmptySmallIcon - -fillBelow.icon=EmptySmallIcon - -randFillAbove.icon=EmptySmallIcon - -randFillBelow.icon=EmptySmallIcon - -floodfill.icon=EmptySmallIcon - -selectAll.icon=EmptySmallIcon - - mapProperties.icon=general/Properties16 moveCursor.menu=goNorth goEast goSouth goWest goNorthEast goSouthEast goSouthWest goNorthWest - goLocation -collectArches.icon=development/Jar16 - -newScript.icon=general/New16 - -editScript.icon=general/Edit16 - #control.toolbar=controlStart controlStop -gc.icon=general/Delete16 - #viewAlpha.icon=general/Find16 nextWindow.icon=navigation/Forward16 @@ -117,13 +69,6 @@ prevWindow.icon=navigation/Back16 -onlineHelp.icon=general/Help16 - -tod.icon=general/TipOfTheDay16 - -about.icon=general/About16 -about.logo=icons/daimoninLogoSmall.png - license.1.file=License license.2.file=japi.jar-LICENSE license.3.file=jlfgr-1_0.jar-LICENSE @@ -132,10 +77,6 @@ update.url=http://daimonin.sourceforge.net/editor/update.properties - -prefsRes.icon=general/Save24 -prefsGUI.icon=development/Host24 - ################ # Other Strings nameOfAnimationObject=animation Property changes on: trunk/resource/icons/development/Jar16.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Property changes on: trunk/resource/icons/general/About16.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Property changes on: trunk/resource/icons/general/Copy16.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Property changes on: trunk/resource/icons/general/Cut16.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Property changes on: trunk/resource/icons/general/Delete16.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Property changes on: trunk/resource/icons/general/Edit16.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Property changes on: trunk/resource/icons/general/Help16.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Property changes on: trunk/resource/icons/general/History16.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Property changes on: trunk/resource/icons/general/Paste16.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Property changes on: trunk/resource/icons/general/Replace16.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Property changes on: trunk/resource/icons/general/Save24.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Property changes on: trunk/resource/icons/general/TipOfTheDay16.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Modified: trunk/src/app/net/sf/gridarta/action.properties =================================================================== --- trunk/src/app/net/sf/gridarta/action.properties 2008-09-28 17:38:30 UTC (rev 5269) +++ trunk/src/app/net/sf/gridarta/action.properties 2008-09-28 18:09:58 UTC (rev 5270) @@ -29,6 +29,10 @@ #this is empty but yet must be here. recent.menu= +createNew.icon=general/New16 + +open.icon=general/Open16 + save.icon=general/Save16 saveAs.icon=general/SaveAs16 @@ -39,10 +43,42 @@ close.icon=EmptySmallIcon +closeAll.icon=EmptySmallIcon + undo.icon=general/Undo16 redo.icon=general/Redo16 +recent.icon=general/History16 + +options.icon=general/Preferences16 + +exit.icon=EmptySmallIcon + +clear.icon=general/Remove16 + +cut.icon=general/Cut16 + +copy.icon=general/Copy16 + +paste.icon=general/Paste16 + +shift.menu=shiftNorth shiftEast shiftSouth shiftWest shiftNorthEast shiftSouthEast shiftSouthWest shiftNorthWest + +replace.icon=general/Replace16 + +fillAbove.icon=EmptySmallIcon + +fillBelow.icon=EmptySmallIcon + +randFillAbove.icon=EmptySmallIcon + +randFillBelow.icon=EmptySmallIcon + +floodfill.icon=EmptySmallIcon + +selectAll.icon=EmptySmallIcon + pickmaps.menu=lockAllPickmaps - addNewPickmap deletePickmap - openPickmapMap - savePickmap revertPickmap - createPickmapFolder deletePickmapFolder - pickmapFolders lockAllPickmaps.icon=EmptySmallIcon addNewPickmap.icon=general/New16 @@ -66,6 +102,14 @@ controlStop.icon=media/Stop16 controlClear.icon=media/Clear16 +collectArches.icon=development/Jar16 + +newScript.icon=general/New16 + +editScript.icon=general/Edit16 + +gc.icon=general/Delete16 + ##################### # Script Editor Menu scriptEditMenu.menubar=scriptEditFile scriptEditEdit @@ -73,7 +117,14 @@ scriptEditFile.menu=scriptEditNewScript scriptEditOpen - scriptEditSave scriptEditSaveAs - scriptEditClose scriptEditCloseAll scriptEditEdit.menu=scriptEditUndo scriptEditRedo - scriptEditCut scriptEditCopy scriptEditPaste - scriptEditFind scriptEditReplace scriptEditFindAgain +onlineHelp.icon=general/Help16 +tod.icon=general/TipOfTheDay16 + +about.icon=general/About16 +about.logo=icons/crossfireLogoSmall.png + + direction1.icon=Dir1 direction2.icon=Dir2 direction3.icon=Dir3 @@ -89,6 +140,7 @@ prefsDev.icon=development/Server24 prefsUpdate.icon=general/Search24 prefsGUI.icon=development/Host24 +prefsRes.icon=general/Save24 mapTileRevert.icon=general/Undo16 mapTileClear.icon=general/Remove16 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-09-28 18:57:23
|
Revision: 5274 http://gridarta.svn.sourceforge.net/gridarta/?rev=5274&view=rev Author: akirschbaum Date: 2008-09-28 18:57:15 +0000 (Sun, 28 Sep 2008) Log Message: ----------- Unify code. Modified Paths: -------------- trunk/crossfire/src/cfeditor/MapActions.java trunk/daimonin/src/daieditor/MapActions.java Modified: trunk/crossfire/src/cfeditor/MapActions.java =================================================================== --- trunk/crossfire/src/cfeditor/MapActions.java 2008-09-28 18:44:26 UTC (rev 5273) +++ trunk/crossfire/src/cfeditor/MapActions.java 2008-09-28 18:57:15 UTC (rev 5274) @@ -155,6 +155,11 @@ }; /** + * Whether exit paths may paint to random maps. + */ + private final boolean allowRandomMapParameters = true; + + /** * Create a new instance. * @param parent the component for showing dialog boxes * @param helpParent the parent frame for help windows @@ -304,7 +309,7 @@ exitPos.y = exit.getAttributeInt("sp"); String path = exit.getAttributeString("slaying"); - if (exit != null && path.equals("/!")) { + if (allowRandomMapParameters && exit != null && path.equals("/!")) { // destination is a random map; extract the final non-random map path = getRandomMapParameter(exit, "final_map"); if (path == null) { Modified: trunk/daimonin/src/daieditor/MapActions.java =================================================================== --- trunk/daimonin/src/daieditor/MapActions.java 2008-09-28 18:44:26 UTC (rev 5273) +++ trunk/daimonin/src/daieditor/MapActions.java 2008-09-28 18:57:15 UTC (rev 5274) @@ -155,6 +155,11 @@ }; /** + * Whether exit paths may paint to random maps. + */ + private final boolean allowRandomMapParameters = false; + + /** * Create a new instance. * @param parent the component for showing dialog boxes * @param helpParent the parent frame for help windows @@ -303,7 +308,15 @@ exitPos.x = exit.getAttributeInt("hp"); exitPos.y = exit.getAttributeInt("sp"); - final String path = exit.getAttributeString("slaying"); + String path = exit.getAttributeString("slaying"); + if (allowRandomMapParameters && exit != null && path.equals("/!")) { + // destination is a random map; extract the final non-random map + path = getRandomMapParameter(exit, "final_map"); + if (path == null) { + ACTION_FACTORY.showMessageDialog(parent, "enterExitRandomDestination"); + return; + } + } enterMap(currentMapListener.getCurrentMapView(), path, 0, exitPos); } @@ -558,6 +571,31 @@ } /** + * Extract a parameter value for an exit to a random map. + * @param exit the exit object containing the parameters + * @param parameterName the parameter name to use + * @return the value of the given parameter name, or <code>null</code> if + * the parameter does not exist + */ + @Nullable + private static String getRandomMapParameter(final GameObject exit, final String parameterName) { + final String msg = exit.getMsgText(); + if (msg == null) { + return null; + } + + final String[] lines = msg.split("[\r\n]+"); + for (final String line : lines) { + final String[] tmp = line.split(" +", 2); + if (tmp.length == 2 && tmp[0].equals(parameterName)) { + return tmp[1]; + } + } + + return null; + } + + /** * Calculate the view position for the new viewport. * @param oldMapView the old map view * @param newMapView the new map view This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-09-28 19:06:54
|
Revision: 5275 http://gridarta.svn.sourceforge.net/gridarta/?rev=5275&view=rev Author: akirschbaum Date: 2008-09-28 19:06:44 +0000 (Sun, 28 Sep 2008) Log Message: ----------- Move non-generic code out of MapActions. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/MapActions.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/MapActions.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-09-28 18:57:15 UTC (rev 5274) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-09-28 19:06:44 UTC (rev 5275) @@ -43,6 +43,7 @@ import javax.swing.JComboBox; import javax.swing.JMenu; import net.sf.gridarta.AbstractMainControl; +import net.sf.gridarta.CommonConstants; import net.sf.gridarta.EditTypes; import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.GridartaObjectsFactory; @@ -186,7 +187,17 @@ @Override protected MapActions init1(@NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final GameObjectMatcher exitMatcher) { archetypeTypeSet.getListTable().put("event", ScriptArchUtils.getEventTypes()); - return new MapActions(getMainView(), getMainView(), gridartaObjectsFactory, globalSettings, mapManager, mapViewManager, exitMatcher, mapFileFilter, selectedSquareView); + final int[] directionMap = new int[] { + CommonConstants.NORTH, + CommonConstants.EAST, + CommonConstants.SOUTH, + CommonConstants.WEST, + CommonConstants.NORTH_EAST, + CommonConstants.SOUTH_EAST, + CommonConstants.SOUTH_WEST, + CommonConstants.NORTH_WEST, + }; + return new MapActions(getMainView(), getMainView(), gridartaObjectsFactory, globalSettings, mapManager, mapViewManager, exitMatcher, mapFileFilter, selectedSquareView, directionMap, true); } /** {@inheritDoc} */ Modified: trunk/crossfire/src/cfeditor/MapActions.java =================================================================== --- trunk/crossfire/src/cfeditor/MapActions.java 2008-09-28 18:57:15 UTC (rev 5274) +++ trunk/crossfire/src/cfeditor/MapActions.java 2008-09-28 19:06:44 UTC (rev 5275) @@ -143,21 +143,12 @@ /** * Maps map relative direction to map window direction. */ - private static final int[] directionMap = new int[] { - CommonConstants.NORTH, - CommonConstants.EAST, - CommonConstants.SOUTH, - CommonConstants.WEST, - CommonConstants.NORTH_EAST, - CommonConstants.SOUTH_EAST, - CommonConstants.SOUTH_WEST, - CommonConstants.NORTH_WEST, - }; + private final int[] directionMap; /** - * Whether exit paths may paint to random maps. + * Whether exit paths may point to random maps. */ - private final boolean allowRandomMapParameters = true; + private final boolean allowRandomMapParameters; /** * Create a new instance. @@ -170,8 +161,11 @@ * @param exitMatcher the game object matcher selecting exit objects * @param mapFileFilter the Swing file filter to use * @param selectedSquareView the selected square vuew to use + * @param directionMap maps relative direction to map window direction + * @param allowRandomMapParameters whether exit paths may point to random + * maps */ - public MapActions(@NotNull final Component parent, @NotNull final JFrame helpParent, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapViewManager, final GameObjectMatcher exitMatcher, final FileFilter mapFileFilter, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { + public MapActions(@NotNull final Component parent, @NotNull final JFrame helpParent, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapViewManager, final GameObjectMatcher exitMatcher, final FileFilter mapFileFilter, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final int[] directionMap, final boolean allowRandomMapParameters) { this.parent = parent; this.helpParent = helpParent; this.gridartaObjectsFactory = gridartaObjectsFactory; @@ -180,6 +174,8 @@ this.exitMatcher = exitMatcher; this.mapFileFilter = mapFileFilter; this.selectedSquareView = selectedSquareView; + this.directionMap = directionMap; + this.allowRandomMapParameters = allowRandomMapParameters; shrinkMapSizeDialogManager = new ShrinkMapSizeDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapViewManager); autoJoin = prefs.getBoolean(AUTOJOIN_KEY, false); @@ -602,7 +598,7 @@ * @param direction the direction to scroll * @return the new view position */ - private static Point calculateNewViewPosition(@NotNull final CMapViewBasic oldMapView, @NotNull final CMapViewBasic newMapView, final int direction) { + private Point calculateNewViewPosition(@NotNull final CMapViewBasic oldMapView, @NotNull final CMapViewBasic newMapView, final int direction) { final Dimension newViewSize = newMapView.getViewSize(); final Rectangle oldViewRect = oldMapView.getViewRect(); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-09-28 18:57:15 UTC (rev 5274) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-09-28 19:06:44 UTC (rev 5275) @@ -45,6 +45,7 @@ import javax.swing.JMenu; import javax.swing.JOptionPane; import net.sf.gridarta.AbstractMainControl; +import net.sf.gridarta.CommonConstants; import net.sf.gridarta.EditTypes; import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.GridartaObjectsFactory; @@ -229,7 +230,17 @@ @NotNull @Override protected MapActions init1(@NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final GameObjectMatcher exitMatcher) { - return new MapActions(getMainView(), getMainView(), gridartaObjectsFactory, globalSettings, mapManager, mapViewManager, exitMatcher, mapFileFilter, selectedSquareView); + final int[] directionMap = new int[] { + CommonConstants.NORTH_EAST, + CommonConstants.SOUTH_EAST, + CommonConstants.SOUTH_WEST, + CommonConstants.NORTH_WEST, + CommonConstants.EAST, + CommonConstants.SOUTH, + CommonConstants.WEST, + CommonConstants.NORTH, + }; + return new MapActions(getMainView(), getMainView(), gridartaObjectsFactory, globalSettings, mapManager, mapViewManager, exitMatcher, mapFileFilter, selectedSquareView, directionMap, false); } /** {@inheritDoc} */ Modified: trunk/daimonin/src/daieditor/MapActions.java =================================================================== --- trunk/daimonin/src/daieditor/MapActions.java 2008-09-28 18:57:15 UTC (rev 5274) +++ trunk/daimonin/src/daieditor/MapActions.java 2008-09-28 19:06:44 UTC (rev 5275) @@ -143,21 +143,12 @@ /** * Maps map relative direction to map window direction. */ - private static final int[] directionMap = new int[] { - CommonConstants.NORTH_EAST, - CommonConstants.SOUTH_EAST, - CommonConstants.SOUTH_WEST, - CommonConstants.NORTH_WEST, - CommonConstants.EAST, - CommonConstants.SOUTH, - CommonConstants.WEST, - CommonConstants.NORTH, - }; + private final int[] directionMap; /** - * Whether exit paths may paint to random maps. + * Whether exit paths may point to random maps. */ - private final boolean allowRandomMapParameters = false; + private final boolean allowRandomMapParameters; /** * Create a new instance. @@ -170,8 +161,11 @@ * @param exitMatcher the game object matcher selecting exit objects * @param mapFileFilter the Swing file filter to use * @param selectedSquareView the selected square vuew to use + * @param directionMap maps relative direction to map window direction + * @param allowRandomMapParameters whether exit paths may point to random + * maps */ - public MapActions(@NotNull final Component parent, @NotNull final JFrame helpParent, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapViewManager, final GameObjectMatcher exitMatcher, final FileFilter mapFileFilter, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { + public MapActions(@NotNull final Component parent, @NotNull final JFrame helpParent, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapViewManager, final GameObjectMatcher exitMatcher, final FileFilter mapFileFilter, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final int[] directionMap, final boolean allowRandomMapParameters) { this.parent = parent; this.helpParent = helpParent; this.gridartaObjectsFactory = gridartaObjectsFactory; @@ -180,6 +174,8 @@ this.exitMatcher = exitMatcher; this.mapFileFilter = mapFileFilter; this.selectedSquareView = selectedSquareView; + this.directionMap = directionMap; + this.allowRandomMapParameters = allowRandomMapParameters; shrinkMapSizeDialogManager = new ShrinkMapSizeDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapViewManager); autoJoin = prefs.getBoolean(AUTOJOIN_KEY, false); @@ -602,7 +598,7 @@ * @param direction the direction to scroll * @return the new view position */ - private static Point calculateNewViewPosition(@NotNull final CMapViewBasic oldMapView, @NotNull final CMapViewBasic newMapView, final int direction) { + private Point calculateNewViewPosition(@NotNull final CMapViewBasic oldMapView, @NotNull final CMapViewBasic newMapView, final int direction) { final Dimension newViewSize = newMapView.getViewSize(); final Rectangle oldViewRect = oldMapView.getViewRect(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-09-28 20:03:10
|
Revision: 5277 http://gridarta.svn.sourceforge.net/gridarta/?rev=5277&view=rev Author: akirschbaum Date: 2008-09-28 20:02:43 +0000 (Sun, 28 Sep 2008) Log Message: ----------- Move MapActions to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/action.properties trunk/crossfire/src/cfeditor/messages.properties trunk/crossfire/src/cfeditor/messages_de.properties trunk/crossfire/src/cfeditor/messages_fr.properties trunk/crossfire/src/cfeditor/messages_sv.properties trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/action.properties trunk/daimonin/src/daieditor/messages.properties trunk/daimonin/src/daieditor/messages_de.properties trunk/daimonin/src/daieditor/messages_fr.properties trunk/daimonin/src/daieditor/messages_sv.properties trunk/src/app/net/sf/gridarta/action.properties trunk/src/app/net/sf/gridarta/messages.properties trunk/src/app/net/sf/gridarta/messages_de.properties trunk/src/app/net/sf/gridarta/messages_fr.properties trunk/src/app/net/sf/gridarta/messages_sv.properties Added Paths: ----------- trunk/resource/icons/general/Properties16.gif trunk/src/app/net/sf/gridarta/gui/map/DefaultMapActions.java Removed Paths: ------------- trunk/crossfire/resource/icons/general/Properties16.gif trunk/crossfire/src/cfeditor/MapActions.java trunk/daimonin/resource/icons/general/Properties16.gif trunk/daimonin/src/daieditor/MapActions.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-09-28 19:32:27 UTC (rev 5276) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-09-28 20:02:43 UTC (rev 5277) @@ -48,6 +48,7 @@ import net.sf.gridarta.EditTypes; import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.GridartaObjectsFactory; +import net.sf.gridarta.MapActions; import net.sf.gridarta.MapManager; import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.filter.FilterControl; @@ -60,6 +61,7 @@ import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesModel; +import net.sf.gridarta.gui.map.DefaultMapActions; import net.sf.gridarta.gui.map.MapPropertiesDialogFactory; import net.sf.gridarta.gui.newmap.NewMapDialogFactory; import net.sf.gridarta.gui.objectchooser.ObjectChooser; @@ -200,7 +202,7 @@ CommonConstants.NORTH_WEST, }; final MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> mapPropertiesDialogFactory = new DefaultMapPropertiesDialogFactory(); - return new MapActions(getMainView(), getMainView(), gridartaObjectsFactory, globalSettings, mapManager, mapViewManager, exitMatcher, mapFileFilter, selectedSquareView, directionMap, true, mapPropertiesDialogFactory); + return new DefaultMapActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMainView(), getMainView(), gridartaObjectsFactory, globalSettings, mapManager, mapViewManager, exitMatcher, mapFileFilter, selectedSquareView, directionMap, true, mapPropertiesDialogFactory); } /** {@inheritDoc} */ Deleted: trunk/crossfire/src/cfeditor/MapActions.java =================================================================== --- trunk/crossfire/src/cfeditor/MapActions.java 2008-09-28 19:32:27 UTC (rev 5276) +++ trunk/crossfire/src/cfeditor/MapActions.java 2008-09-28 20:02:43 UTC (rev 5277) @@ -1,704 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2007 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 cfeditor; - -import cfeditor.gameobject.Archetype; -import cfeditor.gameobject.GameObject; -import cfeditor.gui.map.CMapViewBasic; -import cfeditor.map.MapArchObject; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.Point; -import java.awt.Rectangle; -import java.io.File; -import java.io.IOException; -import java.util.prefs.Preferences; -import javax.swing.Action; -import javax.swing.JFrame; -import javax.swing.JOptionPane; -import javax.swing.filechooser.FileFilter; -import net.sf.gridarta.CommonConstants; -import net.sf.gridarta.CurrentMapListener; -import net.sf.gridarta.GlobalSettings; -import net.sf.gridarta.GridartaObjectsFactory; -import net.sf.gridarta.MainControl; -import net.sf.gridarta.MapManager; -import net.sf.gridarta.gameobject.match.GameObjectMatcher; -import net.sf.gridarta.gui.MapViewManager; -import net.sf.gridarta.gui.map.MapCursorEvent; -import net.sf.gridarta.gui.map.MapPropertiesDialogFactory; -import net.sf.gridarta.gui.map.MapView; -import net.sf.gridarta.gui.map.ShrinkMapSizeDialogManager; -import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; -import net.sf.gridarta.map.MapControl; -import net.sf.japi.swing.ActionFactory; -import net.sf.japi.swing.ToggleAction; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * Manages actions in the "map" menu. - * @author Andreas Kirschbaum - */ -public class MapActions implements net.sf.gridarta.MapActions { - - /** Action Factory. */ - private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); - - /** Preferences. */ - private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); - - /** Key for saving {@link #autoJoin} state in preferences. */ - private static final String AUTOJOIN_KEY = "autojoin"; - - /** Possible directions for "enter xxx map". */ - private final String[] directionsMap = {"enterNorthMap", "enterEastMap", "enterSouthMap", "enterWestMap", "enterNorthEastMap", "enterSouthEastMap", "enterSouthWestMap", "enterNorthWestMap"}; - - /** Possible directions for "enter xxx map". */ - private final int[] directionsDir = {CommonConstants.NORTH, CommonConstants.EAST, CommonConstants.SOUTH, CommonConstants.WEST, CommonConstants.NORTH_EAST, CommonConstants.SOUTH_EAST, CommonConstants.SOUTH_WEST, CommonConstants.NORTH_WEST}; - - /** Action for "grid visible". */ - private final ToggleAction aGridVisible = (ToggleAction) ACTION_FACTORY.createToggle(true, "gridVisible", this); - - /** Action for "tile show". */ - private final ToggleAction aTileShow = (ToggleAction) ACTION_FACTORY.createToggle(true, "tileShow", this); - - /** Action for "create view". */ - private final Action aMapCreateView = ACTION_FACTORY.createAction(true, "mapCreateView", this); - - /** Action for "map properties". */ - private final Action aMapProperties = ACTION_FACTORY.createAction(true, "mapProperties", this); - - /** Action for "autojoin". */ - private final ToggleAction aAutoJoin = (ToggleAction) ACTION_FACTORY.createToggle(true, "autoJoin", this); - - /** Action for "shrink map size". */ - private final Action aShrinkMapSize = ACTION_FACTORY.createAction(true, "shrinkMapSize", this); - - /** Action for "enter exit". */ - private final Action aEnterExit = ACTION_FACTORY.createAction(true, "enterExit", this); - - /** Action for "enter xxx map". */ - private final Action[] aDirections = new Action[directionsMap.length]; - - /** Indicates whether autojoining is on/off. */ - private boolean autoJoin; - - /** - * The component for showing dialog boxes. - */ - @NotNull - private final Component parent; - - /** - * The parent frame for help windows. - */ - private final JFrame helpParent; - - /** - * The gridarta objects factory instance. - */ - @NotNull - private final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory; - - /** The global settings instance. */ - @NotNull - private final GlobalSettings globalSettings; - - /** The map manager. */ - private final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager; - - /** The matcher for selecting exit objects. */ - private final GameObjectMatcher exitMatcher; - - /** The Swing file filter to use. */ - private final FileFilter mapFileFilter; - - /** The {@link SelectedSquareView} to use. */ - private final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView; - - /** The current map listener used to detect current map/map view changes. */ - private final CurrentMapListener<GameObject, MapArchObject, Archetype, CMapViewBasic> currentMapListener; - - /** The {@link ShrinkMapSizeDialogManager} instance. */ - private final ShrinkMapSizeDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic> shrinkMapSizeDialogManager; - - /** - * Maps map relative direction to map window direction. - */ - private final int[] directionMap; - - /** - * Whether exit paths may point to random maps. - */ - private final boolean allowRandomMapParameters; - - /** - * The {@link MapPropertiesDialogFactory} to use. - */ - @NotNull - private final MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> mapPropertiesDialogFactory; - - /** - * Create a new instance. - * @param parent the component for showing dialog boxes - * @param helpParent the parent frame for help windows - * @param gridartaObjectsFactory the gridarta objects factory instance - * @param globalSettings the global settings instance - * @param mapManager the map manager - * @param mapViewManager the map view manager - * @param exitMatcher the game object matcher selecting exit objects - * @param mapFileFilter the Swing file filter to use - * @param selectedSquareView the selected square vuew to use - * @param directionMap maps relative direction to map window direction - * @param allowRandomMapParameters whether exit paths may point to random - * maps - * @param mapPropertiesDialogFactory the map properties dialog factory to - * use - */ - public MapActions(@NotNull final Component parent, @NotNull final JFrame helpParent, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapViewManager, final GameObjectMatcher exitMatcher, final FileFilter mapFileFilter, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final int[] directionMap, final boolean allowRandomMapParameters, @NotNull final MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> mapPropertiesDialogFactory) { - this.parent = parent; - this.helpParent = helpParent; - this.gridartaObjectsFactory = gridartaObjectsFactory; - this.globalSettings = globalSettings; - this.mapManager = mapManager; - this.exitMatcher = exitMatcher; - this.mapFileFilter = mapFileFilter; - this.selectedSquareView = selectedSquareView; - this.directionMap = directionMap; - this.allowRandomMapParameters = allowRandomMapParameters; - this.mapPropertiesDialogFactory = mapPropertiesDialogFactory; - shrinkMapSizeDialogManager = new ShrinkMapSizeDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapViewManager); - - autoJoin = prefs.getBoolean(AUTOJOIN_KEY, false); - - for (int i = 0; i < directionsMap.length; i++) { - aDirections[i] = ACTION_FACTORY.createAction(true, directionsMap[i], this); - } - - currentMapListener = new CurrentMapListener<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, mapViewManager, null, false, false, true) { - - /** {@inheritDoc} */ - @Override - protected void mapHasChanged() { - updateActions(); - } - - /** {@inheritDoc} */ - @Override - protected void mapViewHasChanged() { - updateActions(); - } - - /** {@inheritDoc} */ - @Override - protected void mapCursorChangedPos(@NotNull final MapCursorEvent e) { - updateActions(); - } - - }; - - updateActions(); - } - - /** {@inheritDoc} */ - public void updateMenuState() { - aAutoJoin.setSelected(autoJoin); - } - - /** - * Action method for "grid visible". - * @return <code>true</code> if the grid is visible, or <code>false</code> - * if the grid is invisible - */ - public boolean isGridVisible() { - final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = getGridVisibleEnabled(); - return mapView != null && mapView.getMapViewBasic().getRenderer().isGridVisible(); - } - - /** - * Sets whether the grid of the current map should be visible. - * @param gridVisible new visibility of grid in current map, - * <code>true</code> if the grid should be visible, <code>false</code> if - * invisible - * @see #isGridVisible() - */ - public void setGridVisible(final boolean gridVisible) { - final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = getGridVisibleEnabled(); - if (mapView != null) { - mapView.getMapViewBasic().getRenderer().setGridVisible(gridVisible); - } - } - - /** - * Action method for "tile show". - * @return <code>true</code> if adjacent tiles are shown, or - * <code>false</code> if adjacent tiles are not shown - */ - public boolean isTileShow() { - return false; - } - - /** - * Action method for "tile show". - * @param tileShow if set, show adjacent tiles - */ - public void setTileShow(final boolean tileShow) { - // not yet implemented - } - - /** Action method for "create view". */ - public void mapCreateView() { - final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = getCreateViewEnabled(); - if (mapView != null) { - mapManager.mapCreateView(mapView.getMapControl(), mapView.getMapViewBasic().getViewPosition()); - } - } - - /** Action method for "map properties". */ - public void mapProperties() { - final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = getMapPropertiesEnabled(); - if (mapView != null) { - mapPropertiesDialogFactory.showDialog(mapView.getComponent(), helpParent, mapManager, gridartaObjectsFactory, globalSettings, mapView.getMapControl(), mapFileFilter); - } - } - - /** Action method for "shrink map size". */ - public void shrinkMapSize() { - final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = getShrinkMapSizeEnabled(); - if (mapView != null) { - shrinkMapSizeDialogManager.showDialog(mapView); - } - } - - /** {@inheritDoc} */ - public boolean isAutoJoin() { - return autoJoin; - } - - /** - * Action method for "autojoin". - * @param autoJoin if set, enable autojoining - */ - public void setAutoJoin(final boolean autoJoin) { - this.autoJoin = autoJoin; - prefs.putBoolean(AUTOJOIN_KEY, autoJoin); - } - - /** Try to load the map where the selected map-exit points to. */ - public void enterExit() { - final GameObject exit = getEnterExitEnabled(); - if (exit == null) { - return; - } - - final Point exitPos = new Point(); - exitPos.x = exit.getAttributeInt("hp"); - exitPos.y = exit.getAttributeInt("sp"); - - String path = exit.getAttributeString("slaying"); - if (allowRandomMapParameters && exit != null && path.equals("/!")) { - // destination is a random map; extract the final non-random map - path = getRandomMapParameter(exit, "final_map"); - if (path == null) { - ACTION_FACTORY.showMessageDialog(parent, "enterExitRandomDestination"); - return; - } - } - enterMap(currentMapListener.getCurrentMapView(), path, 0, exitPos); - } - - /** Action method for entering the north map. */ - public void enterNorthMap() { - enterMap(CommonConstants.NORTH); - } - - /** Action method for entering the north east map. */ - public void enterNorthEastMap() { - enterMap(CommonConstants.NORTH_EAST); - } - - /** Action method for entering the east map. */ - public void enterEastMap() { - enterMap(CommonConstants.EAST); - } - - /** Action method for entering the south east map. */ - public void enterSouthEastMap() { - enterMap(CommonConstants.SOUTH_EAST); - } - - /** Action method for entering the south map. */ - public void enterSouthMap() { - enterMap(CommonConstants.SOUTH); - } - - /** Action method for entering the south west map. */ - public void enterSouthWestMap() { - enterMap(CommonConstants.SOUTH_WEST); - } - - /** Action method for entering the west map. */ - public void enterWestMap() { - enterMap(CommonConstants.WEST); - } - - /** Action method for entering the north west map. */ - public void enterNorthWestMap() { - enterMap(CommonConstants.NORTH_WEST); - } - - /** - * Try to load the map where the specified map-tile path points to. Usually - * this method can only be invoked when such a path exists. - * @param direction the direction to go - */ - private void enterMap(final int direction) { - final Destination destination = getEnterMapEnabled(direction); - if (destination == null) { - return; - } - - final String path = destination.getPath(); - enterMap(destination.getMapView(), path, direction, null); - } - - /** - * Enter a map wanted. - * @param currentMapView the map view to leave - * @param path path to map that should be loaded - * @param direction the direction to go - * @param destinationPoint the desired destination point on the map (pass - * 0|0 if unknown, and note that the point gets modified) - */ - private void enterMap(@NotNull final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> currentMapView, @NotNull final String path, final int direction, @Nullable final Point destinationPoint) { - final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> currentMap = currentMapView.getMapControl(); - - @NotNull final File newfile; // new mapfile to open - if (path.startsWith(File.pathSeparator) || path.startsWith("/")) { - // we have an absolute path: - newfile = new File(globalSettings.getMapDir().getAbsolutePath(), path.substring(1)); - } else { - // we have a relative path: - if (currentMap.getMapFile() == null) { - ACTION_FACTORY.showMessageDialog(parent, "enterExitNotSaved"); - return; - } - newfile = new File(currentMap.getMapFile().getParent(), path); - } - if (path.length() == 0 || (currentMap.getMapFile() != null && newfile.equals(currentMap.getMapFile()))) { - // path points to the same map - if (destinationPoint != null) { - if (destinationPoint.x == 0 && destinationPoint.y == 0) { - ACTION_FACTORY.showMessageDialog(parent, "enterExitNowhere"); - } else { - showLocation(currentMapView, destinationPoint); - } - } - return; - } - - if (!newfile.exists() || newfile.isDirectory()) { - // The path is wrong - // TODO: Differ between non-existing paths, wrongly formatted paths and directories - give more info to the user. - ACTION_FACTORY.showMessageDialog(parent, "enterExitInvalidPath", newfile.getAbsolutePath()); - return; - } - - // its important to force the canonical file here or the - // file path is added every time we use a ../ or a ./ . - // This results in giant file names like "xx/../yy/../xx/../yy/.." - // and after some times in buffer overflows. - final File canonicalNewFile; - try { - canonicalNewFile = newfile.getCanonicalFile(); - } catch (final IOException e) { - ACTION_FACTORY.showMessageDialog(parent, "enterTileIOException", newfile.getAbsolutePath()); - return; - } - final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapView = mapManager.openMapFileWithView(canonicalNewFile, null); - if (newMapView == null) { - return; - } - - if (destinationPoint != null) { - if (destinationPoint.x == 0 && destinationPoint.y == 0) { - // use the entry point defined by the map header - destinationPoint.x = newMapView.getMapControl().getMapModel().getMapArchObject().getEnterX(); - destinationPoint.y = newMapView.getMapControl().getMapModel().getMapArchObject().getEnterY(); - } - showLocation(newMapView, destinationPoint); - } else { - newMapView.getMapViewBasic().setViewPosition(calculateNewViewPosition(currentMapView.getMapViewBasic(), newMapView.getMapViewBasic(), direction)); - } - - if (ACTION_FACTORY.showOnetimeConfirmDialog(parent, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, "enterExitClose") == JOptionPane.YES_OPTION) { - // only close current level if a new file was opened and user wants to close it - mapManager.closeView(currentMapView); - } - } - - /** - * Scrolls a map view to make a give tile visible. - * @param mapView the map view - * @param point the tile - */ - private void showLocation(final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView, final Point point) { - if (!mapView.getMapControl().getMapModel().isPointValid(point)) { - ACTION_FACTORY.showMessageDialog(parent, "enterExitOutside"); - return; - } - - mapView.getMapViewBasic().setCursorPosition(point); - } - - /** - * Determine whether "grid visible" is enabled. - * @return the current map view, or <code>null</code> if "grid visible" is - * disabled - */ - private MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> getGridVisibleEnabled() { - return currentMapListener.getCurrentMapView(); - } - - /** - * Determine whether "tile show" is enabled. - * @return the current map, or <code>null</code> if "tile show" is disabled - */ - @Nullable - private MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> getTileShowEnabled() { - return null;//currentMapListener.getCurrentMap(); - } - - /** - * Determine whether "create view" is enabled. - * @return the current map, or <code>null</code> if "create view" is - * disabled - */ - private MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> getCreateViewEnabled() { - return currentMapListener.getCurrentMapView(); - } - - /** - * Determine whether "map properties" is enabled. - * @return the current map view, or <code>null</code> if "map properties" is - * disabled - */ - private MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> getMapPropertiesEnabled() { - return currentMapListener.getCurrentMapView(); - } - - /** - * Determine whether "shrink map size" is enabled. - * @return the current map view, or <code>null</code> if "shrink map size" - * is disabled - */ - private MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> getShrinkMapSizeEnabled() { - return currentMapListener.getCurrentMapView(); - } - - /** - * Determine whether "enter exit" is enabled. - * @return the exit to enter, or <code>null</code> if "enter exit" is - * disabled - */ - @Nullable - private GameObject getEnterExitEnabled() { - final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = currentMapListener.getCurrentMapView(); - if (mapView == null) { - return null; - } - - final GameObject selectedExit = selectedSquareView.getSelectedGameObject(); - if (selectedExit != null && exitMatcher.isMatching(selectedExit.getHead()) && selectedExit.getHead().getAttributeString("slaying").length() > 0) { - return selectedExit.getHead(); - } - - final GameObject cursorExit = mapView.getMapControl().getMapModel().getExit(mapView.getMapViewBasic().getMapCursor().getLocation()); - if (cursorExit != null && exitMatcher.isMatching(cursorExit) && cursorExit.getAttributeString("slaying").length() > 0) { - return cursorExit.getHead(); - } - - return null; - } - - /** - * Determine whether "enter xxx map" is enabled. - * @param direction the direction to go - * @return the destination map, or <code>null</code> if "enter xxx map" is - * disabled - */ - @Nullable - private Destination getEnterMapEnabled(final int direction) { - final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = currentMapListener.getCurrentMapView(); - if (mapView == null) { - return null; - } - - final String path = mapView.getMapControl().getMapModel().getMapArchObject().getTilePath(direction); - if (path.length() == 0) { - return null; - } - - return new Destination(mapView, path); - } - - /** Update the actions' state. */ - private void updateActions() { - aGridVisible.setEnabled(getGridVisibleEnabled() != null); - aGridVisible.setSelected(isGridVisible()); - aTileShow.setEnabled(getTileShowEnabled() != null); - aTileShow.setSelected(false); - aMapCreateView.setEnabled(getCreateViewEnabled() != null); - aMapProperties.setEnabled(getMapPropertiesEnabled() != null); - aEnterExit.setEnabled(getEnterExitEnabled() != null); - for (int i = 0; i < directionsDir.length; i++) { - aDirections[i].setEnabled(getEnterMapEnabled(directionsDir[i]) != null); - } - aShrinkMapSize.setEnabled(getShrinkMapSizeEnabled() != null); - } - - /** - * Extract a parameter value for an exit to a random map. - * @param exit the exit object containing the parameters - * @param parameterName the parameter name to use - * @return the value of the given parameter name, or <code>null</code> if - * the parameter does not exist - */ - @Nullable - private static String getRandomMapParameter(final GameObject exit, final String parameterName) { - final String msg = exit.getMsgText(); - if (msg == null) { - return null; - } - - final String[] lines = msg.split("[\r\n]+"); - for (final String line : lines) { - final String[] tmp = line.split(" +", 2); - if (tmp.length == 2 && tmp[0].equals(parameterName)) { - return tmp[1]; - } - } - - return null; - } - - /** - * Calculate the view position for the new viewport. - * @param oldMapView the old map view - * @param newMapView the new map view - * @param direction the direction to scroll - * @return the new view position - */ - private Point calculateNewViewPosition(@NotNull final CMapViewBasic oldMapView, @NotNull final CMapViewBasic newMapView, final int direction) { - final Dimension newViewSize = newMapView.getViewSize(); - final Rectangle oldViewRect = oldMapView.getViewRect(); - - final Rectangle scrollto; // new vieport rect - switch (directionMap[direction]) { - case CommonConstants.SOUTH: - scrollto = new Rectangle(oldViewRect.x, 0, oldViewRect.width, oldViewRect.height); - break; - - case CommonConstants.NORTH: - scrollto = new Rectangle(oldViewRect.x, newViewSize.height - oldViewRect.height, oldViewRect.width, oldViewRect.height); - break; - - case CommonConstants.EAST: - scrollto = new Rectangle(0, oldViewRect.y, oldViewRect.width, oldViewRect.height); - break; - - case CommonConstants.WEST: - scrollto = new Rectangle(newViewSize.width - oldViewRect.width, oldViewRect.y, oldViewRect.width, oldViewRect.height); - break; - - case CommonConstants.NORTH_EAST: - scrollto = new Rectangle(0, newViewSize.height - oldViewRect.height, oldViewRect.width, oldViewRect.height); - break; - - case CommonConstants.SOUTH_EAST: - scrollto = new Rectangle(0, 0, oldViewRect.width, oldViewRect.height); - break; - - case CommonConstants.SOUTH_WEST: - scrollto = new Rectangle(newViewSize.width - oldViewRect.width, 0, oldViewRect.width, oldViewRect.height); - break; - - case CommonConstants.NORTH_WEST: - scrollto = new Rectangle(newViewSize.width - oldViewRect.width, newViewSize.height - oldViewRect.height, oldViewRect.width, oldViewRect.height); - break; - - default: - throw new AssertionError(); - } - - if (scrollto.x + scrollto.width > newViewSize.width) { - scrollto.x = newViewSize.width - scrollto.width; - } - if (scrollto.x < 0) { - scrollto.x = 0; - } - if (scrollto.y + scrollto.height > newViewSize.height) { - scrollto.y = newViewSize.height - scrollto.height; - } - if (scrollto.y < 0) { - scrollto.y = 0; - } - return scrollto.getLocation(); - } - - /** Describes the destination of a "enter xxx map" action. */ - private static class Destination { - - /** The source map to leave. */ - private final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView; - - /** The destination map path to enter. */ - private final String path; - - /** - * Create a new instance. - * @param mapView the source map to leave - * @param path the destination map path to enter - */ - Destination(final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView, final String path) { - this.mapView = mapView; - this.path = path; - } - - /** - * Return the source map to leave. - * @return the source map to leave - */ - public MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> getMapView() { - return mapView; - } - - /** - * Return the destination map path to enter. - * @return the destination map path to enter - */ - public String getPath() { - return path; - } - - } // class Destination - -} // class MapActions Modified: trunk/crossfire/src/cfeditor/action.properties =================================================================== --- trunk/crossfire/src/cfeditor/action.properties 2008-09-28 19:32:27 UTC (rev 5276) +++ trunk/crossfire/src/cfeditor/action.properties 2008-09-28 20:02:43 UTC (rev 5277) @@ -54,8 +54,6 @@ mapTileChoose.icon=general/Open16 -mapProperties.icon=general/Properties16 - moveCursor.menu=goNorth goEast goSouth goWest goNorthEast goSouthEast goSouthWest goNorthWest - goLocation runPlugin.icon=RunPluginSmallIcon Modified: trunk/crossfire/src/cfeditor/messages.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages.properties 2008-09-28 19:32:27 UTC (rev 5276) +++ trunk/crossfire/src/cfeditor/messages.properties 2008-09-28 20:02:43 UTC (rev 5277) @@ -33,17 +33,6 @@ mapDirDoesntExist.title=Invalid map directory mapDirDoesntExist.message=The map directory "{0}" doesn''t exist.\nPlease select menu ''File->Options...'' and correct that. -enterExitClose.title=Close previous map? -enterExitClose.message=You''ve opened a new map.\nShould I close the previous one? - -enterTileIOException.title=Invalid path -enterTileIOException.message=Failed to load file for tiled map.\n{0} - -enterExitRandomDestination.title=Destination invalid -enterExitRandomDestination.message=The destination of this exit is a random map. -enterExitNotSaved.title=Map not saved -enterExitNotSaved.message=You must save the map first to follow a relative path. - loadDuplicateFace.title=Error: Duplicate face loadDuplicateFace.message=Warning!\n\nDuplicate face: ''{0}''\nFiles: ''{1}''\nand ''{2}''\nI will ignore this duplicate. @@ -117,17 +106,6 @@ map.text=Map map.mnemonic=M -autoJoin.text=Autojoin -autoJoin.mnemonic=J - -gridVisible.text=Show Grid -gridVisible.mnemonic=G -gridVisible.shortdescription=Draw a grid that shows the individual map tiles - -enterExit.text=Enter Exit -enterExit.mnemonic=E -enterExit.accel=ctrl pressed E - enterNorthMap.text=Enter North Map enterNorthMap.accel=ctrl pressed UP @@ -140,18 +118,7 @@ enterWestMap.text=Enter West Map enterWestMap.accel=ctrl pressed LEFT -tileShow.text=Show adjacent tiled maps -mapCreateView.text=Create View - -mapProperties.text=Map Properties -mapProperties.mnemonic=M -mapProperties.accel=ctrl pressed M - -shrinkMapSize.text=Shrink Map Size... -shrinkMapSize.shortdescription=Remove empty tiles at right or bottom map border - - ####### # Cursor Modified: trunk/crossfire/src/cfeditor/messages_de.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_de.properties 2008-09-28 19:32:27 UTC (rev 5276) +++ trunk/crossfire/src/cfeditor/messages_de.properties 2008-09-28 20:02:43 UTC (rev 5277) @@ -29,17 +29,6 @@ mapDirDoesntExist.title=Ung\xFCltiges Verzeichnis mapDirDoesntExist.message=Das Verzeichnis f\xFCr Karten "{0}" existiert nicht.\nBitte legen sie es unter ''Datei->Optionen...'' fest. -enterExitClose.title=Letzte Karte schlie\xDFen? -enterExitClose.message=Sie haben eine neue Karte ge\xF6ffnet.\nSoll die letzte Karte geschlossen werden? - -enterTileIOException.title=Ung\xFCltiger Pfad -enterTileIOException.message=Kann verbundene Karte nicht laden.\n{0} - -enterExitRandomDestination.title=Ziel ung\xFCltig -enterExitRandomDestination.message=Der Ausgang zeigt auf eine zuf\xE4llig generierte Karte. -enterExitNotSaved.title=Karte nicht gesichert -enterExitNotSaved.message=Der Ausgang verwendet einen relativen Dateinamen. Um ihm zu folgen m\xFCssen Sie die Karte vorher sichern. - loadDuplicateFace.title=Fehler: doppelte Grafik loadDuplicateFace.message=Warning!\n\nDopplete Grafik: ''{0}''\nDateien: ''{1}''\nund ''{2}''\nDie doppelte Grafik wird ignoriert. @@ -113,16 +102,6 @@ map.text=Karte map.mnemonic=K -autoJoin.text=Automatisch verbinden -autoJoin.mnemonic=V - -gridVisible.text=Gitter anzeigen -gridVisible.mnemonic=G -gridVisible.shortdescription=Zeichne ein Gitter, das die verschiedenen Kartenfelder voneinander abgrenzt - -enterExit.text=Gehe zu Ausgang -enterExit.mnemonic=A - enterNorthMap.text=Gehe zu Nord-Karte enterEastMap.text=Gehe zu Ost-Karte @@ -131,17 +110,7 @@ enterWestMap.text=Gehe zu West-Karte -tileShow.text=Angrenzende Karten zeigen -mapCreateView.text=Neue Kartenansicht - -mapProperties.text=Karteneigenschaften -mapProperties.mnemonic=K - -shrinkMapSize.text=Kartengr\xF6\xDFe reduzieren... -shrinkMapSize.shortdescription=Freien Bereich am rechten bzw. unteren Kartenrand entfernen - - ####### # Cursor Modified: trunk/crossfire/src/cfeditor/messages_fr.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_fr.properties 2008-09-28 19:32:27 UTC (rev 5276) +++ trunk/crossfire/src/cfeditor/messages_fr.properties 2008-09-28 20:02:43 UTC (rev 5277) @@ -30,17 +30,6 @@ #mapDirDoesntExist.title= #mapDirDoesntExist.message= -#enterExitClose.title= -#enterExitClose.message= - -#enterTileIOException.title= -#enterTileIOException.message= - -#enterExitRandomDestination.title= -#enterExitRandomDestination.message= -#enterExitNotSaved.title= -#enterExitNotSaved.message= - #loadDuplicateFace.title= #loadDuplicateFace.message= @@ -114,16 +103,6 @@ map.text=Carte map.mnemonic=C -#autoJoin.text= -#autoJoin.mnemonic= - -gridVisible.text=Montrer la grille -gridVisible.mnemonic=G -#gridVisible.shortdescription= - -enterExit.text=Aller Sortie -enterExit.mnemonic=S - enterNorthMap.text=Aller Carte Nord enterEastMap.text=Aller Carte Est @@ -132,17 +111,7 @@ enterWestMap.text=Aller Carte Ouest -#tileShow.text= -#mapCreateView.text= - -mapProperties.text=Propri\xE9t\xE9s de la carte -mapProperties.mnemonic=P - -#shrinkMapSize.text= -#shrinkMapSize.shortdescription= - - ####### # Cursor Modified: trunk/crossfire/src/cfeditor/messages_sv.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_sv.properties 2008-09-28 19:32:27 UTC (rev 5276) +++ trunk/crossfire/src/cfeditor/messages_sv.properties 2008-09-28 20:02:43 UTC (rev 5277) @@ -28,17 +28,6 @@ mapDirDoesntExist.title=Ogiltig katalog f\xF6r kartor. mapDirDoesntExist.message=Katalogen f\xF6r kartor, "{0}", finns inte.\nVar v\xE4nlig och v\xE4lj menyn ''Arkiv->Inst\xE4llningar...'' f\xF6r att byta katalog. -#enterExitClose.title= -#enterExitClose.message= - -enterTileIOException.title=Ogiltig s\xF6kv\xE4g -enterTileIOException.message=Misslyckades \xF6ppna filen f\xF6r s\xF6kv\xE4gen.\n{0} - -#enterExitRandomDestination.title= -#enterExitRandomDestination.message= -#enterExitNotSaved.title= -#enterExitNotSaved.message= - loadDuplicateFace.title=Fel: duplicerad bild loadDuplicateFace.message=Varning!\n\nDuplicerad bild: ''{0}''\nFiler: ''{1}''\noch ''{2}''\nJag kommer att ignorera detta duplikat. @@ -112,16 +101,6 @@ map.text=Karta map.mnemonic=K -#autoJoin.text= -#autoJoin.mnemonic= - -gridVisible.text=Visa rutn\xE4t -gridVisible.mnemonic=R -gridVisible.shortdescription=Rita ut rutn\xE4t f\xF6r att visa enstaka kartrutor - -enterExit.text=F\xF6lj utg\xE5ng -enterExit.mnemonic=F - enterNorthMap.text=G\xE5 norr enterEastMap.text=G\xE5 \xF6st @@ -130,17 +109,7 @@ enterWestMap.text=G\xE5 v\xE4st -#tileShow.text= -#mapCreateView.text= - -mapProperties.text=Egenskaper... -mapProperties.mnemonic=E - -#shrinkMapSize.text= -#shrinkMapSize.shortdescription= - - ####### # Cursor Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-09-28 19:32:27 UTC (rev 5276) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-09-28 20:02:43 UTC (rev 5277) @@ -50,6 +50,7 @@ import net.sf.gridarta.EditTypes; import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.GridartaObjectsFactory; +import net.sf.gridarta.MapActions; import net.sf.gridarta.MapManager; import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.filter.FilterControl; @@ -65,6 +66,7 @@ import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesModel; +import net.sf.gridarta.gui.map.DefaultMapActions; import net.sf.gridarta.gui.map.MapPropertiesDialogFactory; import net.sf.gridarta.gui.newmap.NewMapDialogFactory; import net.sf.gridarta.gui.objectchooser.ObjectChooser; @@ -243,7 +245,7 @@ CommonConstants.NORTH, }; final MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> mapPropertiesDialogFactory = new DefaultMapPropertiesDialogFactory(); - return new MapActions(getMainView(), getMainView(), gridartaObjectsFactory, globalSettings, mapManager, mapViewManager, exitMatcher, mapFileFilter, selectedSquareView, directionMap, false, mapPropertiesDialogFactory); + return new DefaultMapActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMainView(), getMainView(), gridartaObjectsFactory, globalSettings, mapManager, mapViewManager, exitMatcher, mapFileFilter, selectedSquareView, directionMap, false, mapPropertiesDialogFactory); } /** {@inheritDoc} */ Deleted: trunk/daimonin/src/daieditor/MapActions.java =================================================================== --- trunk/daimonin/src/daieditor/MapActions.java 2008-09-28 19:32:27 UTC (rev 5276) +++ trunk/daimonin/src/daieditor/MapActions.java 2008-09-28 20:02:43 UTC (rev 5277) @@ -1,704 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2007 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 daieditor; - -import daieditor.gameobject.Archetype; -import daieditor.gameobject.GameObject; -import daieditor.gui.map.CMapViewBasic; -import daieditor.map.MapArchObject; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.Point; -import java.awt.Rectangle; -import java.io.File; -import java.io.IOException; -import java.util.prefs.Preferences; -import javax.swing.Action; -import javax.swing.JFrame; -import javax.swing.JOptionPane; -import javax.swing.filechooser.FileFilter; -import net.sf.gridarta.CommonConstants; -import net.sf.gridarta.CurrentMapListener; -import net.sf.gridarta.GlobalSettings; -import net.sf.gridarta.GridartaObjectsFactory; -import net.sf.gridarta.MainControl; -import net.sf.gridarta.MapManager; -import net.sf.gridarta.gameobject.match.GameObjectMatcher; -import net.sf.gridarta.gui.MapViewManager; -import net.sf.gridarta.gui.map.MapCursorEvent; -import net.sf.gridarta.gui.map.MapPropertiesDialogFactory; -import net.sf.gridarta.gui.map.MapView; -import net.sf.gridarta.gui.map.ShrinkMapSizeDialogManager; -import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; -import net.sf.gridarta.map.MapControl; -import net.sf.japi.swing.ActionFactory; -import net.sf.japi.swing.ToggleAction; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * Manages actions in the "map" menu. - * @author Andreas Kirschbaum - */ -public class MapActions implements net.sf.gridarta.MapActions { - - /** Action Factory. */ - private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("daieditor"); - - /** Preferences. */ - private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); - - /** Key for saving {@link #autoJoin} state in preferences. */ - private static final String AUTOJOIN_KEY = "autojoin"; - - /** Possible directions for "enter xxx map". */ - private final String[] directionsMap = {"enterNorthMap", "enterEastMap", "enterSouthMap", "enterWestMap", "enterNorthEastMap", "enterSouthEastMap", "enterSouthWestMap", "enterNorthWestMap"}; - - /** Possible directions for "enter xxx map". */ - private final int[] directionsDir = {CommonConstants.NORTH, CommonConstants.EAST, CommonConstants.SOUTH, CommonConstants.WEST, CommonConstants.NORTH_EAST, CommonConstants.SOUTH_EAST, CommonConstants.SOUTH_WEST, CommonConstants.NORTH_WEST}; - - /** Action for "grid visible". */ - private final ToggleAction aGridVisible = (ToggleAction) ACTION_FACTORY.createToggle(true, "gridVisible", this); - - /** Action for "tile show". */ - private final ToggleAction aTileShow = (ToggleAction) ACTION_FACTORY.createToggle(true, "tileShow", this); - - /** Action for "create view". */ - private final Action aMapCreateView = ACTION_FACTORY.createAction(true, "mapCreateView", this); - - /** Action for "map properties". */ - private final Action aMapProperties = ACTION_FACTORY.createAction(true, "mapProperties", this); - - /** Action for "autojoin". */ - private final ToggleAction aAutoJoin = (ToggleAction) ACTION_FACTORY.createToggle(true, "autoJoin", this); - - /** Action for "shrink map size". */ - private final Action aShrinkMapSize = ACTION_FACTORY.createAction(true, "shrinkMapSize", this); - - /** Action for "enter exit". */ - private final Action aEnterExit = ACTION_FACTORY.createAction(true, "enterExit", this); - - /** Action for "enter xxx map". */ - private final Action[] aDirections = new Action[directionsMap.length]; - - /** Indicates whether autojoining is on/off. */ - private boolean autoJoin; - - /** - * The component for showing dialog boxes. - */ - @NotNull - private final Component parent; - - /** - * The parent frame for help windows. - */ - private final JFrame helpParent; - - /** - * The gridarta objects factory instance. - */ - @NotNull - private final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory; - - /** The global settings instance. */ - @NotNull - private final GlobalSettings globalSettings; - - /** The map manager. */ - private final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager; - - /** The matcher for selecting exit objects. */ - private final GameObjectMatcher exitMatcher; - - /** The Swing file filter to use. */ - private final FileFilter mapFileFilter; - - /** The {@link SelectedSquareView} to use. */ - private final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView; - - /** The current map listener used to detect current map/map view changes. */ - private final CurrentMapListener<GameObject, MapArchObject, Archetype, CMapViewBasic> currentMapListener; - - /** The {@link ShrinkMapSizeDialogManager} instance. */ - private final ShrinkMapSizeDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic> shrinkMapSizeDialogManager; - - /** - * Maps map relative direction to map window direction. - */ - private final int[] directionMap; - - /** - * Whether exit paths may point to random maps. - */ - private final boolean allowRandomMapParameters; - - /** - * The {@link MapPropertiesDialogFactory} to use. - */ - @NotNull - private final MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> mapPropertiesDialogFactory; - - /** - * Create a new instance. - * @param parent the component for showing dialog boxes - * @param helpParent the parent frame for help windows - * @param gridartaObjectsFactory the gridarta objects factory instance - * @param globalSettings the global settings instance - * @param mapManager the map manager - * @param mapViewManager the map view manager - * @param exitMatcher the game object matcher selecting exit objects - * @param mapFileFilter the Swing file filter to use - * @param selectedSquareView the selected square vuew to use - * @param directionMap maps relative direction to map window direction - * @param allowRandomMapParameters whether exit paths may point to random - * maps - * @param mapPropertiesDialogFactory the map properties dialog factory to - * use - */ - public MapActions(@NotNull final Component parent, @NotNull final JFrame helpParent, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapViewManager, final GameObjectMatcher exitMatcher, final FileFilter mapFileFilter, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final int[] directionMap, final boolean allowRandomMapParameters, @NotNull final MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> mapPropertiesDialogFactory) { - this.parent = parent; - this.helpParent = helpParent; - this.gridartaObjectsFactory = gridartaObjectsFactory; - this.globalSettings = globalSettings; - this.mapManager = mapManager; - this.exitMatcher = exitMatcher; - this.mapFileFilter = mapFileFilter; - this.selectedSquareView = selectedSquareView; - this.directionMap = directionMap; - this.allowRandomMapParameters = allowRandomMapParameters; - this.mapPropertiesDialogFactory = mapPropertiesDialogFactory; - shrinkMapSizeDialogManager = new ShrinkMapSizeDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapViewManager); - - autoJoin = prefs.getBoolean(AUTOJOIN_KEY, false); - - for (int i = 0; i < directionsMap.length; i++) { - aDirections[i] = ACTION_FACTORY.createAction(true, directionsMap[i], this); - } - - currentMapListener = new CurrentMapListener<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, mapViewManager, null, false, false, true) { - - /** {@inheritDoc} */ - @Override - protected void mapHasChanged() { - updateActions(); - } - - /** {@inheritDoc} */ - @Override - protected void mapViewHasChanged() { - updateActions(); - } - - /** {@inheritDoc} */ - @Override - protected void mapCursorChangedPos(@NotNull final MapCursorEvent e) { - updateActions(); - } - - }; - - updateActions(); - } - - /** {@inheritDoc} */ - public void updateMenuState() { - aAutoJoin.setSelected(autoJoin); - } - - /** - * Action method for "grid visible". - * @return <code>true</code> if the grid is visible, or <code>false</code> - * if the grid is invisible - */ - public boolean isGridVisible() { - final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = getGridVisibleEnabled(); - return mapView != null && mapView.getMapViewBasic().getRenderer().isGridVisible(); - } - - /** - * Sets whether the grid of the current map should be visible. - * @param gridVisible new visibility of grid in current map, - * <code>true</code> if the grid should be visible, <code>false</code> if - * invisible - * @see #isGridVisible() - */ - public void setGridVisible(final boolean gridVisible) { - final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = getGridVisibleEnabled(); - if (mapView != null) { - mapView.getMapViewBasic().getRenderer().setGridVisible(gridVisible); - } - } - - /** - * Action method for "tile show". - * @return <code>true</code> if adjacent tiles are shown, or - * <code>false</code> if adjacent tiles are not shown - */ - public boolean isTileShow() { - return false; - } - - /** - * Action method for "tile show". - * @param tileShow if set, show adjacent tiles - */ - public void setTileShow(final boolean tileShow) { - // not yet implemented - } - - /** Action method for "create view". */ - public void mapCreateView() { - final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = getCreateViewEnabled(); - if (mapView != null) { - mapManager.mapCreateView(mapView.getMapControl(), mapView.getMapViewBasic().getViewPosition()); - } - } - - /** Action method for "map properties". */ - public void mapProperties() { - final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = getMapPropertiesEnabled(); - if (mapView != null) { - mapPropertiesDialogFactory.showDialog(mapView.getComponent(), helpParent, mapManager, gridartaObjectsFactory, globalSettings, mapView.getMapControl(), mapFileFilter); - } - } - - /** Action method for "shrink map size". */ - public void shrinkMapSize() { - final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = getShrinkMapSizeEnabled(); - if (mapView != null) { - shrinkMapSizeDialogManager.showDialog(mapView); - } - } - - /** {@inheritDoc} */ - public boolean isAutoJoin() { - return autoJoin; - } - - /** - * Action method for "autojoin". - * @param autoJoin if set, enable autojoining - */ - public void setAutoJoin(final boolean autoJoin) { - this.autoJoin = autoJoin; - prefs.putBoolean(AUTOJOIN_KEY, autoJoin); - } - - /** Try to load the map where the selected map-exit points to. */ - public void enterExit() { - final GameObject exit = getEnterExitEnabled(); - if (exit == null) { - return; - } - - final Point exitPos = new Point(); - exitPos.x = exit.getAttributeInt("hp"); - exitPos.y = exit.getAttributeInt("sp"); - - String path = exit.getAttributeString("slaying"); - if (allowRandomMapParameters && exit != null && path.equals("/!")) { - // destination is a random map; extract the final non-random map - path = getRandomMapParameter(exit, "final_map"); - if (path == null) { - ACTION_FACTORY.showMessageDialog(parent, "enterExitRandomDestination"); - return; - } - } - enterMap(currentMapListener.getCurrentMapView(), path, 0, exitPos); - } - - /** Action method for entering the north map. */ - public void enterNorthMap() { - enterMap(CommonConstants.NORTH); - } - - /** Action method for entering the north east map. */ - public void enterNorthEastMap() { - enterMap(CommonConstants.NORTH_EAST); - } - - /** Action method for entering the east map. */ - public void enterEastMap() { - enterMap(CommonConstants.EAST); - } - - /** Action method for entering the south east map. */ - public void enterSouthEastMap() { - enterMap(CommonConstants.SOUTH_EAST); - } - - /** Action method for entering the south map. */ - public void enterSouthMap() { - enterMap(CommonConstants.SOUTH); - } - - /** Action method for entering the south west map. */ - public void enterSouthWestMap() { - enterMap(CommonConstants.SOUTH_WEST); - } - - /** Action method for entering the west map. */ - public void enterWestMap() { - enterMap(CommonConstants.WEST); - } - - /** Action method for entering the north west map. */ - public void enterNorthWestMap() { - enterMap(CommonConstants.NORTH_WEST); - } - - /** - * Try to load the map where the specified map-tile path points to. Usually - * this method can only be invoked when such a path exists. - * @param direction the direction to go - */ - private void enterMap(final int direction) { - final Destination destination = getEnterMapEnabled(direction); - if (destination == null) { - return; - } - - final String path = destination.getPath(); - enterMap(destination.getMapView(), path, direction, null); - } - - /** - * Enter a map wanted. - * @param currentMapView the map view to leave - * @param path path to map that should be loaded - * @param direction the direction to go - * @param destinationPoint the desired destination point on the map (pass - * 0|0 if unknown, and note that the point gets modified) - */ - private void enterMap(@NotNull final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> currentMapView, @NotNull final String path, final int direction, @Nullable final Point destinationPoint) { - final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> currentMap = currentMapView.getMapControl(); - - @NotNull final File newfile; // new mapfile to open - if (path.startsWith(File.pathSeparator) || path.startsWith("/")) { - // we have an absolute path: - newfile = new File(globalSettings.getMapDir().getAbsolutePath(), path.substring(1)); - } else { - // we have a relative path: - if (currentMap.getMapFile() == null) { - ACTION_FACTORY.showMessageDialog(parent, "enterExitNotSaved"); - return; - } - newfile = new File(currentMap.getMapFile().getParent(), path); - } - if (path.length() == 0 || (currentMap.getMapFile() != null && newfile.equals(currentMap.getMapFile()))) { - // path points to the same map - if (destinationPoint != null) { - if (destinationPoint.x == 0 && destinationPoint.y == 0) { - ACTION_FACTORY.showMessageDialog(parent, "enterExitNowhere"); - } else { - showLocation(currentMapView, destinationPoint); - } - } - return; - } - - if (!newfile.exists() || newfile.isDirectory()) { - // The path is wrong - // TODO: Differ between non-existing paths, wrongly formatted paths and directories - give more info to the user. - ACTION_FACTORY.showMessageDialog(parent, "enterExitInvalidPath", newfile.getAbsolutePath()); - return; - } - - // its important to force the canonical file here or the - // file path is added every time we use a ../ or a ./ . - // This results in giant file names like "xx/../yy/../xx/../yy/.." - // and after some times in buffer overflows. - final File canonicalNewFile; - try { - canonicalNewFile = newfile.getCanonicalFile(); - } catch (final IOException e) { - ACTION_FACTORY.showMessageDialog(parent, "enterTileIOException", newfile.getAbsolutePath()); - return; - } - final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapView = mapManager.openMapFileWithView(canonicalNewFile, null); - if (newMapView == null) { - return; - } - - if (destinationPoint != null) { - if (destinationPoint.x == 0 && destinationPoint.y == 0) { - // use the entry point defined by the map header - destinationPoint.x = newMapView.getMapControl().getMapModel().getMapArchObject().getEnterX(); - destinationPoint.y = newMapView.getMapControl().getMapModel().getMapArchObject().getEnterY(); - } - showLocation(... [truncated message content] |
From: <aki...@us...> - 2008-09-28 20:15:24
|
Revision: 5279 http://gridarta.svn.sourceforge.net/gridarta/?rev=5279&view=rev Author: akirschbaum Date: 2008-09-28 20:15:14 +0000 (Sun, 28 Sep 2008) Log Message: ----------- Rename CrossfireObjectsFactory/DaimoninObjectsFactory to DefaultGridartaObjectsFactory. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CFJavaEditor.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/DaimoninEditor.java Added Paths: ----------- trunk/crossfire/src/cfeditor/DefaultGridartaObjectsFactory.java trunk/daimonin/src/daieditor/DefaultGridartaObjectsFactory.java Removed Paths: ------------- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java Modified: trunk/crossfire/src/cfeditor/CFJavaEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/CFJavaEditor.java 2008-09-28 20:08:33 UTC (rev 5278) +++ trunk/crossfire/src/cfeditor/CFJavaEditor.java 2008-09-28 20:15:14 UTC (rev 5279) @@ -143,7 +143,7 @@ // Create the application and give it the parameters final CMainControl mainControl; try { - mainControl = new CMainControl(new CrossfireObjectsFactory()); + mainControl = new CMainControl(new DefaultGridartaObjectsFactory()); } catch (final RuntimeException ex) { log.fatal(ex.getMessage(), ex); System.exit(1); Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-09-28 20:08:33 UTC (rev 5278) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-09-28 20:15:14 UTC (rev 5279) @@ -211,7 +211,7 @@ PluginParameterFactory.init(archetypeSet, gameObjectAttributesModel, objectChooser, mapManager); final NamedFilterList defaultNamedFilterList = new NamedFilterList(gameObjectMatchers.getFilters()); filterControl = new FilterControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, defaultNamedFilterList); - ((CrossfireObjectsFactory) gridartaObjectsFactory).setFilterControl(filterControl); + ((DefaultGridartaObjectsFactory) gridartaObjectsFactory).setFilterControl(filterControl); final ScriptParameters scriptParameters = new ScriptParameters(archetypeSet, globalSettings, mapManager, validators); scriptControl = new ScriptController(filterControl, scriptParameters, getMainView()); } Deleted: trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-09-28 20:08:33 UTC (rev 5278) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-09-28 20:15:14 UTC (rev 5279) @@ -1,140 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2007 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 cfeditor; - -import cfeditor.gameobject.Archetype; -import cfeditor.gameobject.CrossfireGameObjectFactory; -import cfeditor.gameobject.GameObject; -import cfeditor.gameobject.UndefinedArchetype; -import cfeditor.gui.map.CMapViewBasic; -import cfeditor.io.GameObjectParser; -import cfeditor.io.MapArchObjectParser; -import cfeditor.map.MapArchObject; -import java.awt.Point; -import java.io.File; -import java.io.FileNotFoundException; -import java.util.prefs.Preferences; -import net.sf.gridarta.AbstractMainControl; -import net.sf.gridarta.EditTypes; -import net.sf.gridarta.GridartaObjectsFactory; -import net.sf.gridarta.MainControl; -import net.sf.gridarta.MapImageCache; -import net.sf.gridarta.filter.FilterControl; -import net.sf.gridarta.gameobject.ArchetypeSet; -import net.sf.gridarta.gameobject.face.FaceObjects; -import net.sf.gridarta.gui.MainView; -import net.sf.gridarta.gui.map.MapView; -import net.sf.gridarta.gui.map.tools.ToolPalette; -import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; -import net.sf.gridarta.io.DefaultMapReader; -import net.sf.gridarta.io.MapReader; -import net.sf.gridarta.map.MapControl; -import net.sf.japi.swing.ActionFactory; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * The {@link GridartaObjectsFactory} to create Crossfire related objects. - * @author Andreas Kirschbaum - */ -public class CrossfireObjectsFactory implements GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> { - - /** The action factory. */ - private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); - - /** Preferences. */ - private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); - - /** The {@link SelectedSquareView} instance to use. */ - @NotNull - private SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = null; - - /** The {@link MainView} instance to use. */ - @NotNull - private MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView = null; - - /** The {@link EditTypes} instance to use. */ - @NotNull - private EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes = null; - - /** The {@link MapImageCache} instance to use. */ - @NotNull - private MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache = null; - - /** The {@link ArchetypeSet} instance. */ - @NotNull - private ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet = null; - - /** The {@link FilterControl} instance. */ - @NotNull - private FilterControl<GameObject, MapArchObject, Archetype, CMapViewBasic> filterControl; - - /** The tool palette instance. */ - @NotNull - private ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette = null; - - /** {@inheritDoc} */ - @NotNull - public MapArchObject newMapArchObject(final boolean addDefaultAttributes) { - final MapArchObject mapArchObject = new MapArchObject(); - if (addDefaultAttributes) { - mapArchObject.addText("Created: " + String.format("%tF", System.currentTimeMillis()) + " " + prefs.get(AbstractMainControl.PREFS_USERNAME, AbstractMainControl.PREFS_USERNAME_DEFAULT)); - } - return mapArchObject; - } - - /** {@inheritDoc} */ - @NotNull - public MapReader<GameObject, MapArchObject> newMapReader(@NotNull final File file) throws FileNotFoundException { - return new DefaultMapReader<GameObject, MapArchObject, Archetype>(this, new GameObjectParser(new CrossfireGameObjectFactory()), mainView, archetypeSet, editTypes, file); - } - - /** {@inheritDoc} */ - @NotNull - public Archetype newUndefinedArchetype(@NotNull final String archetypeName) { - return new UndefinedArchetype(archetypeName); - } - - /** {@inheritDoc} */ - public MapArchObjectParser newMapArchObjectParser() { - return new MapArchObjectParser(); - } - - /** {@inheritDoc} */ - @NotNull - public MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapView(@NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, @Nullable final Point viewPosition, final int viewCounter) { - return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainView, mapControl, viewCounter, new CMapViewBasic(filterControl, editTypes, mapControl, viewPosition, toolPalette, 32, 32, selectedSquareView), ACTION_FACTORY, mapImageCache); - } - - /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette) { - this.selectedSquareView = selectedSquareView; - this.mainView = mainView; - this.editTypes = editTypes; - this.mapImageCache = mapImageCache; - this.archetypeSet = archetypeSet; - this.toolPalette = toolPalette; - } - - public void setFilterControl(@NotNull final FilterControl<GameObject, MapArchObject, Archetype, CMapViewBasic> filterControl) { - this.filterControl = filterControl; - } - -} // class CrossfireObjectsFactory Copied: trunk/crossfire/src/cfeditor/DefaultGridartaObjectsFactory.java (from rev 5278, trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java) =================================================================== --- trunk/crossfire/src/cfeditor/DefaultGridartaObjectsFactory.java (rev 0) +++ trunk/crossfire/src/cfeditor/DefaultGridartaObjectsFactory.java 2008-09-28 20:15:14 UTC (rev 5279) @@ -0,0 +1,140 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2007 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 cfeditor; + +import cfeditor.gameobject.Archetype; +import cfeditor.gameobject.CrossfireGameObjectFactory; +import cfeditor.gameobject.GameObject; +import cfeditor.gameobject.UndefinedArchetype; +import cfeditor.gui.map.CMapViewBasic; +import cfeditor.io.GameObjectParser; +import cfeditor.io.MapArchObjectParser; +import cfeditor.map.MapArchObject; +import java.awt.Point; +import java.io.File; +import java.io.FileNotFoundException; +import java.util.prefs.Preferences; +import net.sf.gridarta.AbstractMainControl; +import net.sf.gridarta.EditTypes; +import net.sf.gridarta.GridartaObjectsFactory; +import net.sf.gridarta.MainControl; +import net.sf.gridarta.MapImageCache; +import net.sf.gridarta.filter.FilterControl; +import net.sf.gridarta.gameobject.ArchetypeSet; +import net.sf.gridarta.gameobject.face.FaceObjects; +import net.sf.gridarta.gui.MainView; +import net.sf.gridarta.gui.map.MapView; +import net.sf.gridarta.gui.map.tools.ToolPalette; +import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; +import net.sf.gridarta.io.DefaultMapReader; +import net.sf.gridarta.io.MapReader; +import net.sf.gridarta.map.MapControl; +import net.sf.japi.swing.ActionFactory; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * The {@link GridartaObjectsFactory} to create Crossfire related objects. + * @author Andreas Kirschbaum + */ +public class DefaultGridartaObjectsFactory implements GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> { + + /** The action factory. */ + private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); + + /** Preferences. */ + private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); + + /** The {@link SelectedSquareView} instance to use. */ + @NotNull + private SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = null; + + /** The {@link MainView} instance to use. */ + @NotNull + private MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView = null; + + /** The {@link EditTypes} instance to use. */ + @NotNull + private EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes = null; + + /** The {@link MapImageCache} instance to use. */ + @NotNull + private MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache = null; + + /** The {@link ArchetypeSet} instance. */ + @NotNull + private ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet = null; + + /** The {@link FilterControl} instance. */ + @NotNull + private FilterControl<GameObject, MapArchObject, Archetype, CMapViewBasic> filterControl; + + /** The tool palette instance. */ + @NotNull + private ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette = null; + + /** {@inheritDoc} */ + @NotNull + public MapArchObject newMapArchObject(final boolean addDefaultAttributes) { + final MapArchObject mapArchObject = new MapArchObject(); + if (addDefaultAttributes) { + mapArchObject.addText("Created: " + String.format("%tF", System.currentTimeMillis()) + " " + prefs.get(AbstractMainControl.PREFS_USERNAME, AbstractMainControl.PREFS_USERNAME_DEFAULT)); + } + return mapArchObject; + } + + /** {@inheritDoc} */ + @NotNull + public MapReader<GameObject, MapArchObject> newMapReader(@NotNull final File file) throws FileNotFoundException { + return new DefaultMapReader<GameObject, MapArchObject, Archetype>(this, new GameObjectParser(new CrossfireGameObjectFactory()), mainView, archetypeSet, editTypes, file); + } + + /** {@inheritDoc} */ + @NotNull + public Archetype newUndefinedArchetype(@NotNull final String archetypeName) { + return new UndefinedArchetype(archetypeName); + } + + /** {@inheritDoc} */ + public MapArchObjectParser newMapArchObjectParser() { + return new MapArchObjectParser(); + } + + /** {@inheritDoc} */ + @NotNull + public MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapView(@NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, @Nullable final Point viewPosition, final int viewCounter) { + return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainView, mapControl, viewCounter, new CMapViewBasic(filterControl, editTypes, mapControl, viewPosition, toolPalette, 32, 32, selectedSquareView), ACTION_FACTORY, mapImageCache); + } + + /** {@inheritDoc} */ + public void init(@NotNull final FaceObjects faceObjects, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette) { + this.selectedSquareView = selectedSquareView; + this.mainView = mainView; + this.editTypes = editTypes; + this.mapImageCache = mapImageCache; + this.archetypeSet = archetypeSet; + this.toolPalette = toolPalette; + } + + public void setFilterControl(@NotNull final FilterControl<GameObject, MapArchObject, Archetype, CMapViewBasic> filterControl) { + this.filterControl = filterControl; + } + +} // class CrossfireObjectsFactory Property changes on: trunk/crossfire/src/cfeditor/DefaultGridartaObjectsFactory.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:mergeinfo + Added: svn:eol-style + LF Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-09-28 20:08:33 UTC (rev 5278) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-09-28 20:15:14 UTC (rev 5279) @@ -253,7 +253,7 @@ protected void init2(@NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final net.sf.gridarta.gameobject.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectAttributesModel<GameObject, MapArchObject, Archetype> gameObjectAttributesModel, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser) { final NamedFilterList defaultNamedFilterList = new NamedFilterList(gameObjectMatchers.getFilters()); filterControl = new FilterControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, defaultNamedFilterList); - ((DaimoninObjectsFactory) gridartaObjectsFactory).setFilterControl(filterControl); + ((DefaultGridartaObjectsFactory) gridartaObjectsFactory).setFilterControl(filterControl); } /** {@inheritDoc} */ Modified: trunk/daimonin/src/daieditor/DaimoninEditor.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninEditor.java 2008-09-28 20:08:33 UTC (rev 5278) +++ trunk/daimonin/src/daieditor/DaimoninEditor.java 2008-09-28 20:15:14 UTC (rev 5279) @@ -122,7 +122,7 @@ // Create the application and give it the parameters try { - mainControl = new CMainControl(new DaimoninObjectsFactory()); + mainControl = new CMainControl(new DefaultGridartaObjectsFactory()); } catch (final RuntimeException ex) { log.fatal(ex.getMessage()); System.exit(1); Deleted: trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-09-28 20:08:33 UTC (rev 5278) +++ trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-09-28 20:15:14 UTC (rev 5279) @@ -1,149 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2007 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 daieditor; - -import daieditor.gameobject.Archetype; -import daieditor.gameobject.DaimoninGameObjectFactory; -import daieditor.gameobject.GameObject; -import daieditor.gameobject.UndefinedArchetype; -import daieditor.gui.map.CMapViewBasic; -import daieditor.io.GameObjectParser; -import daieditor.io.MapArchObjectParser; -import daieditor.map.MapArchObject; -import java.awt.Point; -import java.io.File; -import java.io.FileNotFoundException; -import java.util.prefs.Preferences; -import net.sf.gridarta.AbstractMainControl; -import net.sf.gridarta.EditTypes; -import net.sf.gridarta.GridartaObjectsFactory; -import net.sf.gridarta.MainControl; -import net.sf.gridarta.MapImageCache; -import net.sf.gridarta.filter.FilterControl; -import net.sf.gridarta.gameobject.ArchetypeSet; -import net.sf.gridarta.gameobject.face.FaceObjects; -import net.sf.gridarta.gui.MainView; -import net.sf.gridarta.gui.map.MapView; -import net.sf.gridarta.gui.map.tools.ToolPalette; -import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; -import net.sf.gridarta.io.DefaultMapReader; -import net.sf.gridarta.io.MapReader; -import net.sf.gridarta.map.MapControl; -import net.sf.japi.swing.ActionFactory; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * The {@link GridartaObjectsFactory} to create Daimonin related objects. - * @author Andreas Kirschbaum - */ -public class DaimoninObjectsFactory implements GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> { - - /** The action factory. */ - private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("daieditor"); - - /** Preferences. */ - private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); - - /** The {@link FaceObjects} instance to use. */ - private FaceObjects faceObjects = null; - - /** The {@link SelectedSquareView} instance to use. */ - @NotNull - private SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = null; - - /** The {@link MainControl} instance to use. */ - @NotNull - private MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl = null; - - /** The {@link MainView} instance to use. */ - @NotNull - private MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView = null; - - /** The {@link EditTypes} instance to use. */ - @NotNull - private EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes = null; - - /** The {@link MapImageCache} instance to use. */ - @NotNull - private MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache = null; - - /** The {@link ArchetypeSet} instance. */ - @NotNull - private ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet = null; - - /** The {@link FilterControl} instance. */ - @NotNull - private FilterControl<GameObject, MapArchObject, Archetype, CMapViewBasic> filterControl; - - /** The tool palette instance. */ - @NotNull - private ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette = null; - - /** {@inheritDoc} */ - @NotNull - public MapArchObject newMapArchObject(final boolean addDefaultAttributes) { - final MapArchObject mapArchObject = new MapArchObject(); - if (addDefaultAttributes) { - mapArchObject.addText("Created: " + String.format("%tF", System.currentTimeMillis()) + " " + prefs.get(AbstractMainControl.PREFS_USERNAME, AbstractMainControl.PREFS_USERNAME_DEFAULT)); - } - return mapArchObject; - } - - /** {@inheritDoc} */ - @NotNull - public MapReader<GameObject, MapArchObject> newMapReader(@NotNull final File file) throws FileNotFoundException { - return new DefaultMapReader<GameObject, MapArchObject, Archetype>(this, new GameObjectParser(new DaimoninGameObjectFactory()), mainView, archetypeSet, editTypes, file); - } - - /** {@inheritDoc} */ - @NotNull - public Archetype newUndefinedArchetype(@NotNull final String archetypeName) { - return new UndefinedArchetype(archetypeName); - } - - /** {@inheritDoc} */ - public MapArchObjectParser newMapArchObjectParser() { - return new MapArchObjectParser(); - } - - /** {@inheritDoc} */ - @NotNull - public MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapView(@NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, @Nullable final Point viewPosition, final int viewCounter) { - return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainView, mapControl, viewCounter, new CMapViewBasic((CMainControl) mainControl, filterControl, editTypes, mapControl, viewPosition, faceObjects, toolPalette, IGUIConstants.TILE_ISO_XLEN, IGUIConstants.TILE_ISO_YLEN, selectedSquareView), ACTION_FACTORY, mapImageCache); - } - - /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette) { - this.faceObjects = faceObjects; - this.selectedSquareView = selectedSquareView; - this.mainControl = mainControl; - this.mainView = mainView; - this.editTypes = editTypes; - this.mapImageCache = mapImageCache; - this.archetypeSet = archetypeSet; - this.toolPalette = toolPalette; - } - - public void setFilterControl(@NotNull final FilterControl<GameObject, MapArchObject, Archetype, CMapViewBasic> filterControl) { - this.filterControl = filterControl; - } - -} // class DaimoninObjectsFactory Copied: trunk/daimonin/src/daieditor/DefaultGridartaObjectsFactory.java (from rev 5278, trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java) =================================================================== --- trunk/daimonin/src/daieditor/DefaultGridartaObjectsFactory.java (rev 0) +++ trunk/daimonin/src/daieditor/DefaultGridartaObjectsFactory.java 2008-09-28 20:15:14 UTC (rev 5279) @@ -0,0 +1,149 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2007 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 daieditor; + +import daieditor.gameobject.Archetype; +import daieditor.gameobject.DaimoninGameObjectFactory; +import daieditor.gameobject.GameObject; +import daieditor.gameobject.UndefinedArchetype; +import daieditor.gui.map.CMapViewBasic; +import daieditor.io.GameObjectParser; +import daieditor.io.MapArchObjectParser; +import daieditor.map.MapArchObject; +import java.awt.Point; +import java.io.File; +import java.io.FileNotFoundException; +import java.util.prefs.Preferences; +import net.sf.gridarta.AbstractMainControl; +import net.sf.gridarta.EditTypes; +import net.sf.gridarta.GridartaObjectsFactory; +import net.sf.gridarta.MainControl; +import net.sf.gridarta.MapImageCache; +import net.sf.gridarta.filter.FilterControl; +import net.sf.gridarta.gameobject.ArchetypeSet; +import net.sf.gridarta.gameobject.face.FaceObjects; +import net.sf.gridarta.gui.MainView; +import net.sf.gridarta.gui.map.MapView; +import net.sf.gridarta.gui.map.tools.ToolPalette; +import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; +import net.sf.gridarta.io.DefaultMapReader; +import net.sf.gridarta.io.MapReader; +import net.sf.gridarta.map.MapControl; +import net.sf.japi.swing.ActionFactory; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * The {@link GridartaObjectsFactory} to create Daimonin related objects. + * @author Andreas Kirschbaum + */ +public class DefaultGridartaObjectsFactory implements GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> { + + /** The action factory. */ + private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("daieditor"); + + /** Preferences. */ + private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); + + /** The {@link FaceObjects} instance to use. */ + private FaceObjects faceObjects = null; + + /** The {@link SelectedSquareView} instance to use. */ + @NotNull + private SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = null; + + /** The {@link MainControl} instance to use. */ + @NotNull + private MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl = null; + + /** The {@link MainView} instance to use. */ + @NotNull + private MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView = null; + + /** The {@link EditTypes} instance to use. */ + @NotNull + private EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes = null; + + /** The {@link MapImageCache} instance to use. */ + @NotNull + private MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache = null; + + /** The {@link ArchetypeSet} instance. */ + @NotNull + private ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet = null; + + /** The {@link FilterControl} instance. */ + @NotNull + private FilterControl<GameObject, MapArchObject, Archetype, CMapViewBasic> filterControl; + + /** The tool palette instance. */ + @NotNull + private ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette = null; + + /** {@inheritDoc} */ + @NotNull + public MapArchObject newMapArchObject(final boolean addDefaultAttributes) { + final MapArchObject mapArchObject = new MapArchObject(); + if (addDefaultAttributes) { + mapArchObject.addText("Created: " + String.format("%tF", System.currentTimeMillis()) + " " + prefs.get(AbstractMainControl.PREFS_USERNAME, AbstractMainControl.PREFS_USERNAME_DEFAULT)); + } + return mapArchObject; + } + + /** {@inheritDoc} */ + @NotNull + public MapReader<GameObject, MapArchObject> newMapReader(@NotNull final File file) throws FileNotFoundException { + return new DefaultMapReader<GameObject, MapArchObject, Archetype>(this, new GameObjectParser(new DaimoninGameObjectFactory()), mainView, archetypeSet, editTypes, file); + } + + /** {@inheritDoc} */ + @NotNull + public Archetype newUndefinedArchetype(@NotNull final String archetypeName) { + return new UndefinedArchetype(archetypeName); + } + + /** {@inheritDoc} */ + public MapArchObjectParser newMapArchObjectParser() { + return new MapArchObjectParser(); + } + + /** {@inheritDoc} */ + @NotNull + public MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapView(@NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, @Nullable final Point viewPosition, final int viewCounter) { + return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainView, mapControl, viewCounter, new CMapViewBasic((CMainControl) mainControl, filterControl, editTypes, mapControl, viewPosition, faceObjects, toolPalette, IGUIConstants.TILE_ISO_XLEN, IGUIConstants.TILE_ISO_YLEN, selectedSquareView), ACTION_FACTORY, mapImageCache); + } + + /** {@inheritDoc} */ + public void init(@NotNull final FaceObjects faceObjects, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette) { + this.faceObjects = faceObjects; + this.selectedSquareView = selectedSquareView; + this.mainControl = mainControl; + this.mainView = mainView; + this.editTypes = editTypes; + this.mapImageCache = mapImageCache; + this.archetypeSet = archetypeSet; + this.toolPalette = toolPalette; + } + + public void setFilterControl(@NotNull final FilterControl<GameObject, MapArchObject, Archetype, CMapViewBasic> filterControl) { + this.filterControl = filterControl; + } + +} // class DaimoninObjectsFactory Property changes on: trunk/daimonin/src/daieditor/DefaultGridartaObjectsFactory.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:mergeinfo + Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-09-28 20:21:50
|
Revision: 5280 http://gridarta.svn.sourceforge.net/gridarta/?rev=5280&view=rev Author: akirschbaum Date: 2008-09-28 20:21:39 +0000 (Sun, 28 Sep 2008) Log Message: ----------- Rename CrossfireGameObjectFactory/DaimoninGameObjectFactory to DefaultGameObjectFactory. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/DefaultGridartaObjectsFactory.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/DefaultGridartaObjectsFactory.java Added Paths: ----------- trunk/crossfire/src/cfeditor/gameobject/DefaultGameObjectFactory.java trunk/daimonin/src/daieditor/gameobject/DefaultGameObjectFactory.java Removed Paths: ------------- trunk/crossfire/src/cfeditor/gameobject/CrossfireGameObjectFactory.java trunk/daimonin/src/daieditor/gameobject/DaimoninGameObjectFactory.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-09-28 20:15:14 UTC (rev 5279) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-09-28 20:21:39 UTC (rev 5280) @@ -23,7 +23,7 @@ import cfeditor.gameobject.ArchetypeParser; import cfeditor.gameobject.ArchetypeSet; import cfeditor.gameobject.ArchetypeSetLoader; -import cfeditor.gameobject.CrossfireGameObjectFactory; +import cfeditor.gameobject.DefaultGameObjectFactory; import cfeditor.gameobject.GameObject; import cfeditor.gameobject.anim.AnimationObjects; import cfeditor.gameobject.face.FaceObjects; @@ -143,7 +143,7 @@ @NotNull @Override protected GameObjectFactory<GameObject, MapArchObject, Archetype> newGameObjectFactory() { - return new CrossfireGameObjectFactory(); + return new DefaultGameObjectFactory(); } /** {@inheritDoc} */ Modified: trunk/crossfire/src/cfeditor/DefaultGridartaObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/DefaultGridartaObjectsFactory.java 2008-09-28 20:15:14 UTC (rev 5279) +++ trunk/crossfire/src/cfeditor/DefaultGridartaObjectsFactory.java 2008-09-28 20:21:39 UTC (rev 5280) @@ -20,7 +20,7 @@ package cfeditor; import cfeditor.gameobject.Archetype; -import cfeditor.gameobject.CrossfireGameObjectFactory; +import cfeditor.gameobject.DefaultGameObjectFactory; import cfeditor.gameobject.GameObject; import cfeditor.gameobject.UndefinedArchetype; import cfeditor.gui.map.CMapViewBasic; @@ -103,7 +103,7 @@ /** {@inheritDoc} */ @NotNull public MapReader<GameObject, MapArchObject> newMapReader(@NotNull final File file) throws FileNotFoundException { - return new DefaultMapReader<GameObject, MapArchObject, Archetype>(this, new GameObjectParser(new CrossfireGameObjectFactory()), mainView, archetypeSet, editTypes, file); + return new DefaultMapReader<GameObject, MapArchObject, Archetype>(this, new GameObjectParser(new DefaultGameObjectFactory()), mainView, archetypeSet, editTypes, file); } /** {@inheritDoc} */ Deleted: trunk/crossfire/src/cfeditor/gameobject/CrossfireGameObjectFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/CrossfireGameObjectFactory.java 2008-09-28 20:15:14 UTC (rev 5279) +++ trunk/crossfire/src/cfeditor/gameobject/CrossfireGameObjectFactory.java 2008-09-28 20:21:39 UTC (rev 5280) @@ -1,38 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2007 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 cfeditor.gameobject; - -import cfeditor.map.MapArchObject; -import net.sf.gridarta.gameobject.GameObjectFactory; -import org.jetbrains.annotations.NotNull; - -/** - * The {@link GameObjectFactory} to create Crossfire related game objects. - * @author Andreas Kirschbaum - */ -public class CrossfireGameObjectFactory implements GameObjectFactory<GameObject, MapArchObject, Archetype> { - - /** {@inheritDoc} */ - @NotNull - public GameObject newGameObject() { - return new GameObject(); - } - -} // class CrossfireGameObjectFactory Copied: trunk/crossfire/src/cfeditor/gameobject/DefaultGameObjectFactory.java (from rev 5278, trunk/crossfire/src/cfeditor/gameobject/CrossfireGameObjectFactory.java) =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/DefaultGameObjectFactory.java (rev 0) +++ trunk/crossfire/src/cfeditor/gameobject/DefaultGameObjectFactory.java 2008-09-28 20:21:39 UTC (rev 5280) @@ -0,0 +1,38 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2007 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 cfeditor.gameobject; + +import cfeditor.map.MapArchObject; +import net.sf.gridarta.gameobject.GameObjectFactory; +import org.jetbrains.annotations.NotNull; + +/** + * The {@link GameObjectFactory} to create Crossfire related game objects. + * @author Andreas Kirschbaum + */ +public class DefaultGameObjectFactory implements GameObjectFactory<GameObject, MapArchObject, Archetype> { + + /** {@inheritDoc} */ + @NotNull + public GameObject newGameObject() { + return new GameObject(); + } + +} // class DefaultGameObjectFactory Property changes on: trunk/crossfire/src/cfeditor/gameobject/DefaultGameObjectFactory.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:mergeinfo + Added: svn:eol-style + LF Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-09-28 20:15:14 UTC (rev 5279) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-09-28 20:21:39 UTC (rev 5280) @@ -23,7 +23,7 @@ import daieditor.gameobject.ArchetypeParser; import daieditor.gameobject.ArchetypeSet; import daieditor.gameobject.ArchetypeSetLoader; -import daieditor.gameobject.DaimoninGameObjectFactory; +import daieditor.gameobject.DefaultGameObjectFactory; import daieditor.gameobject.GameObject; import daieditor.gameobject.anim.AnimationObjects; import daieditor.gameobject.face.FaceObjects; @@ -184,7 +184,7 @@ @NotNull @Override protected GameObjectFactory<GameObject, MapArchObject, Archetype> newGameObjectFactory() { - return new DaimoninGameObjectFactory(); + return new DefaultGameObjectFactory(); } /** {@inheritDoc} */ Modified: trunk/daimonin/src/daieditor/DefaultGridartaObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DefaultGridartaObjectsFactory.java 2008-09-28 20:15:14 UTC (rev 5279) +++ trunk/daimonin/src/daieditor/DefaultGridartaObjectsFactory.java 2008-09-28 20:21:39 UTC (rev 5280) @@ -20,7 +20,7 @@ package daieditor; import daieditor.gameobject.Archetype; -import daieditor.gameobject.DaimoninGameObjectFactory; +import daieditor.gameobject.DefaultGameObjectFactory; import daieditor.gameobject.GameObject; import daieditor.gameobject.UndefinedArchetype; import daieditor.gui.map.CMapViewBasic; @@ -110,7 +110,7 @@ /** {@inheritDoc} */ @NotNull public MapReader<GameObject, MapArchObject> newMapReader(@NotNull final File file) throws FileNotFoundException { - return new DefaultMapReader<GameObject, MapArchObject, Archetype>(this, new GameObjectParser(new DaimoninGameObjectFactory()), mainView, archetypeSet, editTypes, file); + return new DefaultMapReader<GameObject, MapArchObject, Archetype>(this, new GameObjectParser(new DefaultGameObjectFactory()), mainView, archetypeSet, editTypes, file); } /** {@inheritDoc} */ Deleted: trunk/daimonin/src/daieditor/gameobject/DaimoninGameObjectFactory.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/DaimoninGameObjectFactory.java 2008-09-28 20:15:14 UTC (rev 5279) +++ trunk/daimonin/src/daieditor/gameobject/DaimoninGameObjectFactory.java 2008-09-28 20:21:39 UTC (rev 5280) @@ -1,38 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2007 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 daieditor.gameobject; - -import daieditor.map.MapArchObject; -import net.sf.gridarta.gameobject.GameObjectFactory; -import org.jetbrains.annotations.NotNull; - -/** - * The {@link GameObjectFactory} to create Daimonin related game objects. - * @author Andreas Kirschbaum - */ -public class DaimoninGameObjectFactory implements GameObjectFactory<GameObject, MapArchObject, Archetype> { - - /** {@inheritDoc} */ - @NotNull - public GameObject newGameObject() { - return new GameObject(); - } - -} // class DaimoninGameObjectFactory Copied: trunk/daimonin/src/daieditor/gameobject/DefaultGameObjectFactory.java (from rev 5278, trunk/daimonin/src/daieditor/gameobject/DaimoninGameObjectFactory.java) =================================================================== --- trunk/daimonin/src/daieditor/gameobject/DefaultGameObjectFactory.java (rev 0) +++ trunk/daimonin/src/daieditor/gameobject/DefaultGameObjectFactory.java 2008-09-28 20:21:39 UTC (rev 5280) @@ -0,0 +1,38 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2007 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 daieditor.gameobject; + +import daieditor.map.MapArchObject; +import net.sf.gridarta.gameobject.GameObjectFactory; +import org.jetbrains.annotations.NotNull; + +/** + * The {@link GameObjectFactory} to create Daimonin related game objects. + * @author Andreas Kirschbaum + */ +public class DefaultGameObjectFactory implements GameObjectFactory<GameObject, MapArchObject, Archetype> { + + /** {@inheritDoc} */ + @NotNull + public GameObject newGameObject() { + return new GameObject(); + } + +} // class DefaultGameObjectFactory Property changes on: trunk/daimonin/src/daieditor/gameobject/DefaultGameObjectFactory.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:mergeinfo + Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-09-28 20:23:08
|
Revision: 5281 http://gridarta.svn.sourceforge.net/gridarta/?rev=5281&view=rev Author: akirschbaum Date: 2008-09-28 20:23:01 +0000 (Sun, 28 Sep 2008) Log Message: ----------- Fix comments. Modified Paths: -------------- trunk/crossfire/src/cfeditor/DefaultGridartaObjectsFactory.java trunk/daimonin/src/daieditor/DefaultGridartaObjectsFactory.java Modified: trunk/crossfire/src/cfeditor/DefaultGridartaObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/DefaultGridartaObjectsFactory.java 2008-09-28 20:21:39 UTC (rev 5280) +++ trunk/crossfire/src/cfeditor/DefaultGridartaObjectsFactory.java 2008-09-28 20:23:01 UTC (rev 5281) @@ -137,4 +137,4 @@ this.filterControl = filterControl; } -} // class CrossfireObjectsFactory +} // class DefaultGridartaObjectsFactory Modified: trunk/daimonin/src/daieditor/DefaultGridartaObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DefaultGridartaObjectsFactory.java 2008-09-28 20:21:39 UTC (rev 5280) +++ trunk/daimonin/src/daieditor/DefaultGridartaObjectsFactory.java 2008-09-28 20:23:01 UTC (rev 5281) @@ -146,4 +146,4 @@ this.filterControl = filterControl; } -} // class DaimoninObjectsFactory +} // class DefaultGridartaObjectsFactory This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-09-29 18:33:49
|
Revision: 5289 http://gridarta.svn.sourceforge.net/gridarta/?rev=5289&view=rev Author: akirschbaum Date: 2008-09-29 18:33:33 +0000 (Mon, 29 Sep 2008) Log Message: ----------- Remove empty packages. Removed Paths: ------------- trunk/crossfire/src/cfeditor/spells/ trunk/daimonin/src/daieditor/spells/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-09-29 19:45:22
|
Revision: 5292 http://gridarta.svn.sourceforge.net/gridarta/?rev=5292&view=rev Author: akirschbaum Date: 2008-09-29 19:44:17 +0000 (Mon, 29 Sep 2008) Log Message: ----------- Move GameObject.diffTextString() to StringUtils.diffTextString(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/GameObject.java trunk/crossfire/src/cfeditor/io/GameObjectParser.java trunk/daimonin/src/daieditor/gameobject/GameObject.java trunk/daimonin/src/daieditor/io/GameObjectParser.java trunk/src/app/net/sf/gridarta/gameobject/AttributeListUtils.java trunk/src/app/net/sf/gridarta/gameobject/GameObject.java trunk/src/app/net/sf/gridarta/utils/StringUtils.java trunk/src/test/net/sf/gridarta/utils/StringUtilsTest.java Modified: trunk/crossfire/src/cfeditor/gameobject/GameObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2008-09-29 19:27:02 UTC (rev 5291) +++ trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2008-09-29 19:44:17 UTC (rev 5292) @@ -408,7 +408,7 @@ final Archetype archetype = getArchetype(); resetObjectText(); - for (final String line : patternEndOfLine.split(text)) { + for (final String line : StringUtils.patternEndOfLine.split(text)) { if (line.length() > 0) { if (line.startsWith("name ")) { setObjName(line.substring(5)); Modified: trunk/crossfire/src/cfeditor/io/GameObjectParser.java =================================================================== --- trunk/crossfire/src/cfeditor/io/GameObjectParser.java 2008-09-29 19:27:02 UTC (rev 5291) +++ trunk/crossfire/src/cfeditor/io/GameObjectParser.java 2008-09-29 19:44:17 UTC (rev 5292) @@ -30,6 +30,7 @@ import java.util.regex.Pattern; import net.sf.gridarta.gameobject.GameObjectFactory; import net.sf.gridarta.io.AbstractGameObjectParser; +import net.sf.gridarta.utils.StringUtils; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; @@ -384,7 +385,7 @@ final String objText = gameObject.getObjectText(); if (objText.length() != 0) { - for (final String aTmp : net.sf.gridarta.gameobject.GameObject.patternEndOfLine.split(objText, 0)) { + for (final String aTmp : StringUtils.patternEndOfLine.split(objText, 0)) { final String[] line = patternSpaces.split(aTmp, 2); if (line.length != 2) { log.warn("writeMapArch: ignoring invalid arch line: " + aTmp); Modified: trunk/daimonin/src/daieditor/gameobject/GameObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/GameObject.java 2008-09-29 19:27:02 UTC (rev 5291) +++ trunk/daimonin/src/daieditor/gameobject/GameObject.java 2008-09-29 19:44:17 UTC (rev 5292) @@ -30,6 +30,7 @@ import net.sf.gridarta.gameobject.anim.AnimationObject; import net.sf.gridarta.gameobject.scripts.AbstractScriptArchEditor; import net.sf.gridarta.gui.gameobjectattributespanel.ScriptTab; +import net.sf.gridarta.utils.StringUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -453,7 +454,7 @@ final Archetype archetype = getArchetype(); resetObjectText(); - for (final String line : patternEndOfLine.split(text)) { + for (final String line : StringUtils.patternEndOfLine.split(text)) { if (line.length() > 0) { if (line.startsWith("name ")) { setObjName(line.substring(5)); Modified: trunk/daimonin/src/daieditor/io/GameObjectParser.java =================================================================== --- trunk/daimonin/src/daieditor/io/GameObjectParser.java 2008-09-29 19:27:02 UTC (rev 5291) +++ trunk/daimonin/src/daieditor/io/GameObjectParser.java 2008-09-29 19:44:17 UTC (rev 5292) @@ -26,6 +26,7 @@ import java.util.Formatter; import net.sf.gridarta.gameobject.GameObjectFactory; import net.sf.gridarta.io.AbstractGameObjectParser; +import net.sf.gridarta.utils.StringUtils; import org.jetbrains.annotations.NotNull; /** @@ -78,7 +79,7 @@ final StringBuilder newArchText = new StringBuilder(); final String objText = gameObject.getObjectText(); if (objText.length() != 0) { - for (final String line : net.sf.gridarta.gameobject.GameObject.patternEndOfLine.split(objText, 0)) { + for (final String line : StringUtils.patternEndOfLine.split(objText, 0)) { if (!line.startsWith("type ")) { newArchText.append(line).append('\n'); } Modified: trunk/src/app/net/sf/gridarta/gameobject/AttributeListUtils.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/AttributeListUtils.java 2008-09-29 19:27:02 UTC (rev 5291) +++ trunk/src/app/net/sf/gridarta/gameobject/AttributeListUtils.java 2008-09-29 19:44:17 UTC (rev 5292) @@ -19,6 +19,7 @@ package net.sf.gridarta.gameobject; +import net.sf.gridarta.utils.StringUtils; import org.jetbrains.annotations.NotNull; /** @@ -46,7 +47,7 @@ final String prefix = key + " "; - final String[] lines = GameObject.patternEndOfLine.split(attributeList, -1); + final String[] lines = StringUtils.patternEndOfLine.split(attributeList, -1); final StringBuilder sb = new StringBuilder(); for (final String line : lines) { Modified: trunk/src/app/net/sf/gridarta/gameobject/GameObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2008-09-29 19:27:02 UTC (rev 5291) +++ trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2008-09-29 19:44:17 UTC (rev 5292) @@ -22,7 +22,6 @@ import java.awt.Frame; import java.util.HashMap; import java.util.Map; -import java.util.regex.Pattern; import javax.swing.ImageIcon; import javax.swing.JList; import net.sf.gridarta.MapManager; @@ -55,12 +54,6 @@ public static final int TYPE_UNSET = -666; /** - * The pattern to match end of line characters separating lines in the arch - * text. - */ - public static final Pattern patternEndOfLine = Pattern.compile("\\s*\n"); - - /** * The archetype set to use. */ protected static ArchetypeSet archetypeSet = null; @@ -295,7 +288,7 @@ private String getAttributeValue(@NotNull final String attributeName) { final String attr2 = attributeName.trim() + ' '; String result = null; - for (final String line : patternEndOfLine.split(getObjectText(), 0)) { + for (final String line : StringUtils.patternEndOfLine.split(getObjectText(), 0)) { if (line.startsWith(attr2)) { result = line.substring(attr2.length()); break; @@ -459,7 +452,7 @@ final boolean sameAsInArchetype = hasArchetype() && archetype.getAttributeString(attributeName).equals(value); boolean exists = false; final StringBuilder result = new StringBuilder(); - for (final String line : patternEndOfLine.split(getObjectText(), 0)) { + for (final String line : StringUtils.patternEndOfLine.split(getObjectText(), 0)) { if (line.length() == 0) { // skip empty lines that occur due to split on empty object texts. } else if (!line.startsWith(attributeNameWithSpace)) { @@ -485,7 +478,7 @@ final String attributeNameWithSpace = attributeName.trim() + " "; // attributeName must be followed by space final StringBuilder sb = new StringBuilder(); - for (final String line : patternEndOfLine.split(getObjectText(), 0)) { + for (final String line : StringUtils.patternEndOfLine.split(getObjectText(), 0)) { if (!line.startsWith(attributeNameWithSpace)) { sb.append(line).append('\n'); } @@ -1293,15 +1286,15 @@ @NotNull public String diffArchText(@NotNull final String atxt, final boolean ignoreValues) { final StringBuilder result = new StringBuilder(); - for (final String line : patternEndOfLine.split(atxt, 0)) { + for (final String line : StringUtils.patternEndOfLine.split(atxt, 0)) { if (ignoreValues) { final int spaceIndex = line.indexOf(' '); - if (line.length() > 0 && spaceIndex > 0 && diffTextString(getObjectText(), line.substring(0, spaceIndex + 1), ignoreValues) == null) { + if (line.length() > 0 && spaceIndex > 0 && StringUtils.diffTextString(getObjectText(), line.substring(0, spaceIndex + 1), ignoreValues) == null) { result.append(line).append('\n'); } } else { try { - final String test = diffTextString(getObjectText(), line, ignoreValues); + final String test = StringUtils.diffTextString(getObjectText(), line, ignoreValues); char c = '\n'; if (test != null) { c = test.charAt(0); @@ -1318,27 +1311,6 @@ } /** - * Helper function for 'diffArchText()': Looks for occurrence of the - * attribute 'str' in 'base' and if found, returns the full line where 'str' - * occurs in base. Only occurrences of 'str' at the beginning of a new line - * are counted as valid. If not found, null is returned. - * @param argBase full text to search - * @param str string (attribute) to look for - * @param ignoreValues if true, lines are matched against 'str' only till - * the first space (" ") - * @return The text that differs. - */ - @Nullable - private static String diffTextString(final String argBase, final String str, final boolean ignoreValues) { - for (final String line : patternEndOfLine.split(argBase, 0)) { - if (ignoreValues ? line.startsWith(str) : line.equals(str)) { - return line; - } - } - return null; - } - - /** * Return the editor folder. * @return the editor folder */ @@ -1434,7 +1406,7 @@ final ArchetypeType<G, A, R> type = archetypeType != null ? archetypeType : archetypeTypeSet.getTypeOfArch(this); final StringBuilder errors = new StringBuilder(); // return value: all error lines - for (final String line : patternEndOfLine.split(getObjectText())) { + for (final String line : StringUtils.patternEndOfLine.split(getObjectText())) { // get only the key-part of the attribute. final int spaceIndex = line.indexOf(' '); final String attrKey = spaceIndex != -1 ? line.substring(0, spaceIndex) : line; @@ -1495,7 +1467,7 @@ } boolean scriptflag = false; - for (final String line : patternEndOfLine.split(text)) { + for (final String line : StringUtils.patternEndOfLine.split(text)) { if (line.length() > 0) { if (scriptflag) { addObjectText(line); Modified: trunk/src/app/net/sf/gridarta/utils/StringUtils.java =================================================================== --- trunk/src/app/net/sf/gridarta/utils/StringUtils.java 2008-09-29 19:27:02 UTC (rev 5291) +++ trunk/src/app/net/sf/gridarta/utils/StringUtils.java 2008-09-29 19:44:17 UTC (rev 5292) @@ -20,6 +20,7 @@ package net.sf.gridarta.utils; import java.util.regex.Pattern; +import org.jetbrains.annotations.Nullable; /** * Utility class for string manipulation. @@ -33,6 +34,11 @@ /** Pattern to match trailing whitespace in a multiline string. */ private static final Pattern patternMultilineTrailingWhitespace = Pattern.compile("(?m)[\\x00-\\x09\\x0b\\x20]+$"); + /** + * The pattern to match end of line characters separating lines. + */ + public static final Pattern patternEndOfLine = Pattern.compile("\\s*\n"); + /** Private constructor to prevent instantiation. */ private StringUtils() { } @@ -77,4 +83,25 @@ return text.replaceAll("\\s+", "").length() > 0; } + /** + * Helper function for 'diffArchText()': Looks for occurrence of the + * attribute 'str' in 'base' and if found, returns the full line where 'str' + * occurs in base. Only occurrences of 'str' at the beginning of a new line + * are counted as valid. If not found, null is returned. + * @param base full text to search + * @param str string (attribute) to look for + * @param ignoreValues if true, lines are matched against 'str' only till + * the first space (" ") + * @return The text that differs. + */ + @Nullable + public static String diffTextString(final String base, final String str, final boolean ignoreValues) { + for (final String line : patternEndOfLine.split(base, 0)) { + if (ignoreValues ? line.startsWith(str) : line.equals(str)) { + return line; + } + } + return null; + } + } // class StringUtils Modified: trunk/src/test/net/sf/gridarta/utils/StringUtilsTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/utils/StringUtilsTest.java 2008-09-29 19:27:02 UTC (rev 5291) +++ trunk/src/test/net/sf/gridarta/utils/StringUtilsTest.java 2008-09-29 19:44:17 UTC (rev 5292) @@ -88,4 +88,35 @@ Assert.assertEquals(output, StringUtils.ensureTrailingNewline(input)); } + /** Test case for {@link StringUtils#diffTextString(String,String,boolean)}. */ + @Test + public void testDiffTextString() { + testDiffTextString("", "abc", null, null); + + testDiffTextString("abc", "abc", "abc", "abc"); + testDiffTextString("abc\ndef", "abc", "abc", "abc"); + testDiffTextString("def\nabc\ndef", "abc", "abc", "abc"); + testDiffTextString("def\nabc", "abc", "abc", "abc"); + + testDiffTextString("abc def", "abc", null, "abc def"); + testDiffTextString("def abc\nabc def", "abc", null, "abc def"); + testDiffTextString("abc def\ndef abc", "abc", null, "abc def"); + testDiffTextString("def abc\nabc def\ndef abc", "abc", null, "abc def"); + } + + /** + * Checks two invocations of {@link + * StringUtils#diffTextString(String,String,boolean)}. + * @param base the 'base' parameter to use + * @param str the 'str' parameter to use + * @param expectedFalse the expected return value if 'ignoreValues' is + * <code>false</code> + * @param expectedTrue the expected return value if 'ignoreValues' is + * <code>true</code> + */ + private static void testDiffTextString(final String base, final String str, final String expectedFalse, final String expectedTrue) { + Assert.assertEquals(expectedFalse, StringUtils.diffTextString(base, str, false)); + Assert.assertEquals(expectedTrue, StringUtils.diffTextString(base, str, true)); + } + } // class StringUtilsTest This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-09-30 04:30:35
|
Revision: 5294 http://gridarta.svn.sourceforge.net/gridarta/?rev=5294&view=rev Author: akirschbaum Date: 2008-09-30 04:30:18 +0000 (Tue, 30 Sep 2008) Log Message: ----------- Fix 'Enter N/S/E/W Map' in CrossfireEditor. Modified Paths: -------------- trunk/crossfire/src/cfeditor/messages.properties trunk/crossfire/src/cfeditor/messages_de.properties trunk/crossfire/src/cfeditor/messages_fr.properties trunk/crossfire/src/cfeditor/messages_sv.properties trunk/daimonin/src/daieditor/messages.properties trunk/daimonin/src/daieditor/messages_de.properties trunk/daimonin/src/daieditor/messages_fr.properties trunk/daimonin/src/daieditor/messages_sv.properties trunk/src/app/net/sf/gridarta/messages.properties trunk/src/app/net/sf/gridarta/messages_de.properties trunk/src/app/net/sf/gridarta/messages_fr.properties trunk/src/app/net/sf/gridarta/messages_sv.properties Modified: trunk/crossfire/src/cfeditor/messages.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages.properties 2008-09-29 19:53:17 UTC (rev 5293) +++ trunk/crossfire/src/cfeditor/messages.properties 2008-09-30 04:30:18 UTC (rev 5294) @@ -106,19 +106,7 @@ map.text=Map map.mnemonic=M -enterNorthMap.text=Enter North Map -enterNorthMap.accel=ctrl pressed UP -enterEastMap.text=Enter East Map -enterEastMap.accel=ctrl pressed RIGHT - -enterSouthMap.text=Enter South Map -enterSouthMap.accel=ctrl pressed DOWN - -enterWestMap.text=Enter West Map -enterWestMap.accel=ctrl pressed LEFT - - ####### # Cursor Modified: trunk/crossfire/src/cfeditor/messages_de.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_de.properties 2008-09-29 19:53:17 UTC (rev 5293) +++ trunk/crossfire/src/cfeditor/messages_de.properties 2008-09-30 04:30:18 UTC (rev 5294) @@ -102,15 +102,7 @@ map.text=Karte map.mnemonic=K -enterNorthMap.text=Gehe zu Nord-Karte -enterEastMap.text=Gehe zu Ost-Karte - -enterSouthMap.text=Gehe zu S\xFCd-Karte - -enterWestMap.text=Gehe zu West-Karte - - ####### # Cursor Modified: trunk/crossfire/src/cfeditor/messages_fr.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_fr.properties 2008-09-29 19:53:17 UTC (rev 5293) +++ trunk/crossfire/src/cfeditor/messages_fr.properties 2008-09-30 04:30:18 UTC (rev 5294) @@ -103,15 +103,7 @@ map.text=Carte map.mnemonic=C -enterNorthMap.text=Aller Carte Nord -enterEastMap.text=Aller Carte Est - -enterSouthMap.text=Aller Carte Sud - -enterWestMap.text=Aller Carte Ouest - - ####### # Cursor Modified: trunk/crossfire/src/cfeditor/messages_sv.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_sv.properties 2008-09-29 19:53:17 UTC (rev 5293) +++ trunk/crossfire/src/cfeditor/messages_sv.properties 2008-09-30 04:30:18 UTC (rev 5294) @@ -101,15 +101,7 @@ map.text=Karta map.mnemonic=K -enterNorthMap.text=G\xE5 norr -enterEastMap.text=G\xE5 \xF6st - -enterSouthMap.text=G\xE5 s\xF6der - -enterWestMap.text=G\xE5 v\xE4st - - ####### # Cursor Modified: trunk/daimonin/src/daieditor/messages.properties =================================================================== --- trunk/daimonin/src/daieditor/messages.properties 2008-09-29 19:53:17 UTC (rev 5293) +++ trunk/daimonin/src/daieditor/messages.properties 2008-09-30 04:30:18 UTC (rev 5294) @@ -88,31 +88,7 @@ map.text=Map map.mnemonic=M -enterNorthMap.text=Enter North Map -enterNorthMap.accel=ctrl pressed NUMPAD9 -enterNorthEastMap.text=Enter Northeast Map -enterNorthEastMap.accel=ctrl pressed NUMPAD6 - -enterEastMap.text=Enter East Map -enterEastMap.accel=ctrl pressed NUMPAD3 - -enterSouthEastMap.text=Enter Southeast Map -enterSouthEastMap.accel=ctrl pressed NUMPAD2 - -enterSouthMap.text=Enter South Map -enterSouthMap.accel=ctrl pressed NUMPAD1 - -enterSouthWestMap.text=Enter Southwest Map -enterSouthWestMap.accel=ctrl pressed NUMPAD4 - -enterWestMap.text=Enter West Map -enterWestMap.accel=ctrl pressed NUMPAD7 - -enterNorthWestMap.text=Enter Northwest Map -enterNorthWestMap.accel=ctrl pressed NUMPAD8 - - ####### # Cursor Modified: trunk/daimonin/src/daieditor/messages_de.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_de.properties 2008-09-29 19:53:17 UTC (rev 5293) +++ trunk/daimonin/src/daieditor/messages_de.properties 2008-09-30 04:30:18 UTC (rev 5294) @@ -88,23 +88,7 @@ map.text=Karte map.mnemonic=K -enterNorthMap.text=Gehe zu Nord-Karte -enterNorthEastMap.text=Gehe zu Nordost-Karte - -enterEastMap.text=Gehe zu Ost-Karte - -enterSouthEastMap.text=Gehe zu S\xFCdost-Karte - -enterSouthMap.text=Gehe zu S\xFCd-Karte - -enterSouthWestMap.text=Gehe zu S\xFCdwest-Karte - -enterWestMap.text=Gehe zu West-Karte - -enterNorthWestMap.text=Gehe zu Nordwest-Karte - - ####### # Cursor Modified: trunk/daimonin/src/daieditor/messages_fr.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_fr.properties 2008-09-29 19:53:17 UTC (rev 5293) +++ trunk/daimonin/src/daieditor/messages_fr.properties 2008-09-30 04:30:18 UTC (rev 5294) @@ -89,23 +89,7 @@ map.text=Carte map.mnemonic=C -enterNorthMap.text=Aller Carte Nord -enterNorthEastMap.text=Aller Carte Nord-Est - -enterEastMap.text=Aller Carte Est - -enterSouthEastMap.text=Aller Carte Sud-Est - -enterSouthMap.text=Aller Carte Sud - -enterSouthWestMap.text=Aller Carte Sud-Ouest - -enterWestMap.text=Aller Carte Ouest - -enterNorthWestMap.text=Aller Carte Nord-Ouest - - ####### # Cursor Modified: trunk/daimonin/src/daieditor/messages_sv.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_sv.properties 2008-09-29 19:53:17 UTC (rev 5293) +++ trunk/daimonin/src/daieditor/messages_sv.properties 2008-09-30 04:30:18 UTC (rev 5294) @@ -90,23 +90,7 @@ map.text=Karta map.mnemonic=K -enterNorthMap.text=G\xE5 norr -enterNorthEastMap.text=G\xE5 nordost - -enterEastMap.text=G\xE5 \xF6st - -enterSouthEastMap.text=G\xE5 sydost - -enterSouthMap.text=G\xE5 s\xF6der - -enterSouthWestMap.text=G\xE5 sydv\xE4st - -enterWestMap.text=G\xE5 v\xE4st - -enterNorthWestMap.text=G\xE5 nordv\xE4st - - ####### # Cursor Modified: trunk/src/app/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages.properties 2008-09-29 19:53:17 UTC (rev 5293) +++ trunk/src/app/net/sf/gridarta/messages.properties 2008-09-30 04:30:18 UTC (rev 5294) @@ -135,7 +135,31 @@ enterExitNotSaved.title=Map not saved enterExitNotSaved.message=You must save the map first to follow a relative path. +enterNorthMap.text=Enter North Map +enterNorthMap.accel=ctrl pressed NUMPAD9 +enterNorthEastMap.text=Enter Northeast Map +enterNorthEastMap.accel=ctrl pressed NUMPAD6 + +enterEastMap.text=Enter East Map +enterEastMap.accel=ctrl pressed NUMPAD3 + +enterSouthEastMap.text=Enter Southeast Map +enterSouthEastMap.accel=ctrl pressed NUMPAD2 + +enterSouthMap.text=Enter South Map +enterSouthMap.accel=ctrl pressed NUMPAD1 + +enterSouthWestMap.text=Enter Southwest Map +enterSouthWestMap.accel=ctrl pressed NUMPAD4 + +enterWestMap.text=Enter West Map +enterWestMap.accel=ctrl pressed NUMPAD7 + +enterNorthWestMap.text=Enter Northwest Map +enterNorthWestMap.accel=ctrl pressed NUMPAD8 + + # Resources viewTreasurelists.text=View Treasurelists viewTreasurelists.mnemonic=T Modified: trunk/src/app/net/sf/gridarta/messages_de.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_de.properties 2008-09-29 19:53:17 UTC (rev 5293) +++ trunk/src/app/net/sf/gridarta/messages_de.properties 2008-09-30 04:30:18 UTC (rev 5294) @@ -120,7 +120,23 @@ enterExitNotSaved.title=Karte nicht gesichert enterExitNotSaved.message=Der Ausgang verwendet einen relativen Dateinamen. Um ihm zu folgen m\xFCssen Sie die Karte vorher sichern. +enterNorthMap.text=Gehe zu Nord-Karte +enterNorthEastMap.text=Gehe zu Nordost-Karte + +enterEastMap.text=Gehe zu Ost-Karte + +enterSouthEastMap.text=Gehe zu S\xFCdost-Karte + +enterSouthMap.text=Gehe zu S\xFCd-Karte + +enterSouthWestMap.text=Gehe zu S\xFCdwest-Karte + +enterWestMap.text=Gehe zu West-Karte + +enterNorthWestMap.text=Gehe zu Nordwest-Karte + + # Resources viewTreasurelists.text=Schatzlisten anschauen viewTreasurelists.mnemonic=S Modified: trunk/src/app/net/sf/gridarta/messages_fr.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_fr.properties 2008-09-29 19:53:17 UTC (rev 5293) +++ trunk/src/app/net/sf/gridarta/messages_fr.properties 2008-09-30 04:30:18 UTC (rev 5294) @@ -119,7 +119,23 @@ #enterExitNotSaved.title= #enterExitNotSaved.message= +enterNorthMap.text=Aller Carte Nord +enterNorthEastMap.text=Aller Carte Nord-Est + +enterEastMap.text=Aller Carte Est + +enterSouthEastMap.text=Aller Carte Sud-Est + +enterSouthMap.text=Aller Carte Sud + +enterSouthWestMap.text=Aller Carte Sud-Ouest + +enterWestMap.text=Aller Carte Ouest + +enterNorthWestMap.text=Aller Carte Nord-Ouest + + # Resources viewTreasurelists.text=Afficher listes de tr\xE9sors viewTreasurelists.mnemonic=T Modified: trunk/src/app/net/sf/gridarta/messages_sv.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_sv.properties 2008-09-29 19:53:17 UTC (rev 5293) +++ trunk/src/app/net/sf/gridarta/messages_sv.properties 2008-09-30 04:30:18 UTC (rev 5294) @@ -119,7 +119,23 @@ #enterExitNotSaved.title= #enterExitNotSaved.message= +enterNorthMap.text=G\xE5 norr +enterNorthEastMap.text=G\xE5 nordost + +enterEastMap.text=G\xE5 \xF6st + +enterSouthEastMap.text=G\xE5 sydost + +enterSouthMap.text=G\xE5 s\xF6der + +enterSouthWestMap.text=G\xE5 sydv\xE4st + +enterWestMap.text=G\xE5 v\xE4st + +enterNorthWestMap.text=G\xE5 nordv\xE4st + + # Resources viewTreasurelists.text=Visa skattlistor viewTreasurelists.mnemonic=V This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-09-30 04:47:26
|
Revision: 5295 http://gridarta.svn.sourceforge.net/gridarta/?rev=5295&view=rev Author: akirschbaum Date: 2008-09-30 04:47:19 +0000 (Tue, 30 Sep 2008) Log Message: ----------- Make 'Close previous map' dialog work again. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/map/DefaultMapActions.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-09-30 04:30:18 UTC (rev 5294) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-09-30 04:47:19 UTC (rev 5295) @@ -205,7 +205,7 @@ CommonConstants.NORTH_WEST, }; final MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> mapPropertiesDialogFactory = new DefaultMapPropertiesDialogFactory(); - return new DefaultMapActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMainView(), getMainView(), gridartaObjectsFactory, globalSettings, mapManager, mapViewManager, exitMatcher, mapFileFilter, selectedSquareView, directionMap, true, mapPropertiesDialogFactory); + return new DefaultMapActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, getMainView(), getMainView(), gridartaObjectsFactory, globalSettings, mapManager, mapViewManager, exitMatcher, mapFileFilter, selectedSquareView, directionMap, true, mapPropertiesDialogFactory); } /** {@inheritDoc} */ Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-09-30 04:30:18 UTC (rev 5294) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-09-30 04:47:19 UTC (rev 5295) @@ -245,7 +245,7 @@ CommonConstants.NORTH, }; final MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> mapPropertiesDialogFactory = new DefaultMapPropertiesDialogFactory(); - return new DefaultMapActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMainView(), getMainView(), gridartaObjectsFactory, globalSettings, mapManager, mapViewManager, exitMatcher, mapFileFilter, selectedSquareView, directionMap, false, mapPropertiesDialogFactory); + return new DefaultMapActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, getMainView(), getMainView(), gridartaObjectsFactory, globalSettings, mapManager, mapViewManager, exitMatcher, mapFileFilter, selectedSquareView, directionMap, false, mapPropertiesDialogFactory); } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/gui/map/DefaultMapActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/DefaultMapActions.java 2008-09-30 04:30:18 UTC (rev 5294) +++ trunk/src/app/net/sf/gridarta/gui/map/DefaultMapActions.java 2008-09-30 04:47:19 UTC (rev 5295) @@ -55,7 +55,8 @@ public class DefaultMapActions<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> implements MapActions { /** Action Factory. */ - private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta"); + @NotNull + private final ActionFactory actionFactory; /** Preferences. */ private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); @@ -70,25 +71,25 @@ private final int[] directionsDir = {CommonConstants.NORTH, CommonConstants.EAST, CommonConstants.SOUTH, CommonConstants.WEST, CommonConstants.NORTH_EAST, CommonConstants.SOUTH_EAST, CommonConstants.SOUTH_WEST, CommonConstants.NORTH_WEST}; /** Action for "grid visible". */ - private final ToggleAction aGridVisible = (ToggleAction) ACTION_FACTORY.createToggle(true, "gridVisible", this); + private final ToggleAction aGridVisible; /** Action for "tile show". */ - private final ToggleAction aTileShow = (ToggleAction) ACTION_FACTORY.createToggle(true, "tileShow", this); + private final ToggleAction aTileShow; /** Action for "create view". */ - private final Action aMapCreateView = ACTION_FACTORY.createAction(true, "mapCreateView", this); + private final Action aMapCreateView; /** Action for "map properties". */ - private final Action aMapProperties = ACTION_FACTORY.createAction(true, "mapProperties", this); + private final Action aMapProperties; /** Action for "autojoin". */ - private final ToggleAction aAutoJoin = (ToggleAction) ACTION_FACTORY.createToggle(true, "autoJoin", this); + private final ToggleAction aAutoJoin; /** Action for "shrink map size". */ - private final Action aShrinkMapSize = ACTION_FACTORY.createAction(true, "shrinkMapSize", this); + private final Action aShrinkMapSize; /** Action for "enter exit". */ - private final Action aEnterExit = ACTION_FACTORY.createAction(true, "enterExit", this); + private final Action aEnterExit; /** Action for "enter xxx map". */ private final Action[] aDirections = new Action[directionsMap.length]; @@ -153,6 +154,7 @@ /** * Create a new instance. + * @param actionFactory the action factory to use * @param parent the component for showing dialog boxes * @param helpParent the parent frame for help windows * @param gridartaObjectsFactory the gridarta objects factory instance @@ -168,7 +170,8 @@ * @param mapPropertiesDialogFactory the map properties dialog factory to * use */ - public DefaultMapActions(@NotNull final Component parent, @NotNull final JFrame helpParent, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final MapViewManager<G, A, R, V> mapViewManager, final GameObjectMatcher exitMatcher, final FileFilter mapFileFilter, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final int[] directionMap, final boolean allowRandomMapParameters, @NotNull final MapPropertiesDialogFactory<G, A, R, V> mapPropertiesDialogFactory) { + public DefaultMapActions(@NotNull final ActionFactory actionFactory, @NotNull final Component parent, @NotNull final JFrame helpParent, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final MapViewManager<G, A, R, V> mapViewManager, final GameObjectMatcher exitMatcher, final FileFilter mapFileFilter, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final int[] directionMap, final boolean allowRandomMapParameters, @NotNull final MapPropertiesDialogFactory<G, A, R, V> mapPropertiesDialogFactory) { + this.actionFactory = actionFactory; this.parent = parent; this.helpParent = helpParent; this.gridartaObjectsFactory = gridartaObjectsFactory; @@ -180,12 +183,18 @@ this.directionMap = directionMap; this.allowRandomMapParameters = allowRandomMapParameters; this.mapPropertiesDialogFactory = mapPropertiesDialogFactory; + aGridVisible = (ToggleAction) actionFactory.createToggle(true, "gridVisible", this); shrinkMapSizeDialogManager = new ShrinkMapSizeDialogManager<G, A, R, V>(mapViewManager); - + aTileShow = (ToggleAction) actionFactory.createToggle(true, "tileShow", this); + aMapCreateView = actionFactory.createAction(true, "mapCreateView", this); + aMapProperties = actionFactory.createAction(true, "mapProperties", this); + aAutoJoin = (ToggleAction) actionFactory.createToggle(true, "autoJoin", this); + aShrinkMapSize = actionFactory.createAction(true, "shrinkMapSize", this); + aEnterExit = actionFactory.createAction(true, "enterExit", this); autoJoin = prefs.getBoolean(AUTOJOIN_KEY, false); for (int i = 0; i < directionsMap.length; i++) { - aDirections[i] = ACTION_FACTORY.createAction(true, directionsMap[i], this); + aDirections[i] = actionFactory.createAction(true, directionsMap[i], this); } currentMapListener = new CurrentMapListener<G, A, R, V>(mapManager, mapViewManager, null, false, false, true) { @@ -313,7 +322,7 @@ // destination is a random map; extract the final non-random map path = getRandomMapParameter(exit, "final_map"); if (path == null) { - ACTION_FACTORY.showMessageDialog(parent, "enterExitRandomDestination"); + actionFactory.showMessageDialog(parent, "enterExitRandomDestination"); return; } } @@ -393,7 +402,7 @@ } else { // we have a relative path: if (currentMap.getMapFile() == null) { - ACTION_FACTORY.showMessageDialog(parent, "enterExitNotSaved"); + actionFactory.showMessageDialog(parent, "enterExitNotSaved"); return; } newfile = new File(currentMap.getMapFile().getParent(), path); @@ -402,7 +411,7 @@ // path points to the same map if (destinationPoint != null) { if (destinationPoint.x == 0 && destinationPoint.y == 0) { - ACTION_FACTORY.showMessageDialog(parent, "enterExitNowhere"); + actionFactory.showMessageDialog(parent, "enterExitNowhere"); } else { showLocation(currentMapView, destinationPoint); } @@ -413,7 +422,7 @@ if (!newfile.exists() || newfile.isDirectory()) { // The path is wrong // TODO: Differ between non-existing paths, wrongly formatted paths and directories - give more info to the user. - ACTION_FACTORY.showMessageDialog(parent, "enterExitInvalidPath", newfile.getAbsolutePath()); + actionFactory.showMessageDialog(parent, "enterExitInvalidPath", newfile.getAbsolutePath()); return; } @@ -425,7 +434,7 @@ try { canonicalNewFile = newfile.getCanonicalFile(); } catch (final IOException e) { - ACTION_FACTORY.showMessageDialog(parent, "enterTileIOException", newfile.getAbsolutePath()); + actionFactory.showMessageDialog(parent, "enterTileIOException", newfile.getAbsolutePath()); return; } final MapView<G, A, R, V> newMapView = mapManager.openMapFileWithView(canonicalNewFile, null); @@ -444,7 +453,7 @@ newMapView.getMapViewBasic().setViewPosition(calculateNewViewPosition(currentMapView.getMapViewBasic(), newMapView.getMapViewBasic(), direction)); } - if (ACTION_FACTORY.showOnetimeConfirmDialog(parent, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, "enterExitClose") == JOptionPane.YES_OPTION) { + if (actionFactory.showOnetimeConfirmDialog(parent, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, "enterExitClose") == JOptionPane.YES_OPTION) { // only close current level if a new file was opened and user wants to close it mapManager.closeView(currentMapView); } @@ -457,7 +466,7 @@ */ private void showLocation(final MapView<G, A, R, V> mapView, final Point point) { if (!mapView.getMapControl().getMapModel().isPointValid(point)) { - ACTION_FACTORY.showMessageDialog(parent, "enterExitOutside"); + actionFactory.showMessageDialog(parent, "enterExitOutside"); return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-09-30 05:05:10
|
Revision: 5296 http://gridarta.svn.sourceforge.net/gridarta/?rev=5296&view=rev Author: akirschbaum Date: 2008-09-30 05:04:55 +0000 (Tue, 30 Sep 2008) Log Message: ----------- Restore former keyboard shortcuts for 'enter exit/map' actions in CrossfireEditor. Modified Paths: -------------- trunk/crossfire/src/cfeditor/messages.properties trunk/daimonin/src/daieditor/messages.properties trunk/src/app/net/sf/gridarta/messages.properties Modified: trunk/crossfire/src/cfeditor/messages.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages.properties 2008-09-30 04:47:19 UTC (rev 5295) +++ trunk/crossfire/src/cfeditor/messages.properties 2008-09-30 05:04:55 UTC (rev 5296) @@ -106,6 +106,11 @@ map.text=Map map.mnemonic=M +enterExit.accel=ctrl pressed E +enterNorthMap.accel=ctrl pressed UP +enterEastMap.accel=ctrl pressed RIGHT +enterSouthMap.accel=ctrl pressed DOWN +enterWestMap.accel=ctrl pressed LEFT ####### # Cursor Modified: trunk/daimonin/src/daieditor/messages.properties =================================================================== --- trunk/daimonin/src/daieditor/messages.properties 2008-09-30 04:47:19 UTC (rev 5295) +++ trunk/daimonin/src/daieditor/messages.properties 2008-09-30 05:04:55 UTC (rev 5296) @@ -88,7 +88,17 @@ map.text=Map map.mnemonic=M +enterExit.accel=ctrl pressed NUMPAD5 +enterNorthMap.accel=ctrl pressed NUMPAD9 +enterNorthEastMap.accel=ctrl pressed NUMPAD6 +enterEastMap.accel=ctrl pressed NUMPAD3 +enterSouthEastMap.accel=ctrl pressed NUMPAD2 +enterSouthMap.accel=ctrl pressed NUMPAD1 +enterSouthWestMap.accel=ctrl pressed NUMPAD4 +enterWestMap.accel=ctrl pressed NUMPAD7 +enterNorthWestMap.accel=ctrl pressed NUMPAD8 + ####### # Cursor Modified: trunk/src/app/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages.properties 2008-09-30 04:47:19 UTC (rev 5295) +++ trunk/src/app/net/sf/gridarta/messages.properties 2008-09-30 05:04:55 UTC (rev 5296) @@ -120,7 +120,6 @@ enterExit.text=Enter Exit enterExit.mnemonic=E -enterExit.accel=ctrl pressed NUMPAD5 enterExitIOException.title=Invalid path enterExitIOException.message=Failed to load file for path.\n{0} @@ -136,28 +135,20 @@ enterExitNotSaved.message=You must save the map first to follow a relative path. enterNorthMap.text=Enter North Map -enterNorthMap.accel=ctrl pressed NUMPAD9 enterNorthEastMap.text=Enter Northeast Map -enterNorthEastMap.accel=ctrl pressed NUMPAD6 enterEastMap.text=Enter East Map -enterEastMap.accel=ctrl pressed NUMPAD3 enterSouthEastMap.text=Enter Southeast Map -enterSouthEastMap.accel=ctrl pressed NUMPAD2 enterSouthMap.text=Enter South Map -enterSouthMap.accel=ctrl pressed NUMPAD1 enterSouthWestMap.text=Enter Southwest Map -enterSouthWestMap.accel=ctrl pressed NUMPAD4 enterWestMap.text=Enter West Map -enterWestMap.accel=ctrl pressed NUMPAD7 enterNorthWestMap.text=Enter Northwest Map -enterNorthWestMap.accel=ctrl pressed NUMPAD8 # Resources This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-09-30 20:49:03
|
Revision: 5300 http://gridarta.svn.sourceforge.net/gridarta/?rev=5300&view=rev Author: akirschbaum Date: 2008-09-30 20:48:09 +0000 (Tue, 30 Sep 2008) Log Message: ----------- Fix 'about' logo for DaimoninEditor. Modified Paths: -------------- trunk/crossfire/src/cfeditor/action.properties trunk/daimonin/src/daieditor/action.properties trunk/src/app/net/sf/gridarta/action.properties Modified: trunk/crossfire/src/cfeditor/action.properties =================================================================== --- trunk/crossfire/src/cfeditor/action.properties 2008-09-30 20:23:57 UTC (rev 5299) +++ trunk/crossfire/src/cfeditor/action.properties 2008-09-30 20:48:09 UTC (rev 5300) @@ -69,5 +69,6 @@ prevWindow.icon=navigation/Back16 +about.logo=icons/crossfireLogoSmall.png update.url=http://www.eracc.com/files/crossfire/update.properties Modified: trunk/daimonin/src/daieditor/action.properties =================================================================== --- trunk/daimonin/src/daieditor/action.properties 2008-09-30 20:23:57 UTC (rev 5299) +++ trunk/daimonin/src/daieditor/action.properties 2008-09-30 20:48:09 UTC (rev 5300) @@ -72,6 +72,7 @@ license.3.file=jlfgr-1_0.jar-LICENSE license.4.file=log4j-1.2.13.jar-LICENSE +about.logo=icons/daimoninLogoSmall.png update.url=http://daimonin.sourceforge.net/editor/update.properties Modified: trunk/src/app/net/sf/gridarta/action.properties =================================================================== --- trunk/src/app/net/sf/gridarta/action.properties 2008-09-30 20:23:57 UTC (rev 5299) +++ trunk/src/app/net/sf/gridarta/action.properties 2008-09-30 20:48:09 UTC (rev 5300) @@ -124,7 +124,6 @@ tod.icon=general/TipOfTheDay16 about.icon=general/About16 -about.logo=icons/crossfireLogoSmall.png direction1.icon=Dir1 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-09-30 21:30:04
|
Revision: 5301 http://gridarta.svn.sourceforge.net/gridarta/?rev=5301&view=rev Author: akirschbaum Date: 2008-09-30 21:28:47 +0000 (Tue, 30 Sep 2008) Log Message: ----------- Move PluginParameter and subclasses to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/gui/script/ScriptEditor.java trunk/crossfire/src/cfeditor/gui/script/parameter/ArchParameterView.java trunk/crossfire/src/cfeditor/gui/script/parameter/BooleanParameterView.java trunk/crossfire/src/cfeditor/gui/script/parameter/DoubleParameterView.java trunk/crossfire/src/cfeditor/gui/script/parameter/FilterParameterView.java trunk/crossfire/src/cfeditor/gui/script/parameter/IntegerParameterView.java trunk/crossfire/src/cfeditor/gui/script/parameter/MapParameterView.java trunk/crossfire/src/cfeditor/gui/script/parameter/ParameterDescriptionEditor.java trunk/crossfire/src/cfeditor/gui/script/parameter/ParameterNameEditor.java trunk/crossfire/src/cfeditor/gui/script/parameter/ParameterTypeEditor.java trunk/crossfire/src/cfeditor/gui/script/parameter/PluginParameterView.java trunk/crossfire/src/cfeditor/gui/script/parameter/PluginParameterViewFactory.java trunk/crossfire/src/cfeditor/gui/script/parameter/StringParameterView.java trunk/crossfire/src/cfeditor/script/ScriptModel.java trunk/src/app/net/sf/gridarta/script/parameter/ArchParameter.java trunk/src/app/net/sf/gridarta/script/parameter/BooleanConfig.java trunk/src/app/net/sf/gridarta/script/parameter/BooleanParameter.java trunk/src/app/net/sf/gridarta/script/parameter/DoubleConfig.java trunk/src/app/net/sf/gridarta/script/parameter/DoubleParameter.java trunk/src/app/net/sf/gridarta/script/parameter/FilterParameter.java trunk/src/app/net/sf/gridarta/script/parameter/IntegerConfig.java trunk/src/app/net/sf/gridarta/script/parameter/IntegerParameter.java trunk/src/app/net/sf/gridarta/script/parameter/MapParameter.java trunk/src/app/net/sf/gridarta/script/parameter/NoSuchParameterException.java trunk/src/app/net/sf/gridarta/script/parameter/PluginParameter.java trunk/src/app/net/sf/gridarta/script/parameter/PluginParameterFactory.java trunk/src/app/net/sf/gridarta/script/parameter/PluginParameterVisitor.java trunk/src/app/net/sf/gridarta/script/parameter/StringParameter.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/script/ trunk/src/app/net/sf/gridarta/script/parameter/ Removed Paths: ------------- trunk/crossfire/src/cfeditor/script/parameter/ trunk/src/app/net/sf/gridarta/script/parameter/PluginParameterViewFactory.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-09-30 20:48:09 UTC (rev 5300) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-09-30 21:28:47 UTC (rev 5301) @@ -38,7 +38,6 @@ import cfeditor.script.ScriptController; import cfeditor.script.ScriptExecException; import cfeditor.script.ScriptParameters; -import cfeditor.script.parameter.PluginParameterFactory; import java.io.File; import java.util.Collections; import java.util.List; @@ -88,6 +87,7 @@ import net.sf.gridarta.map.validation.checks.MapDifficultyChecker; import net.sf.gridarta.map.validation.checks.UndefinedArchetypeChecker; import net.sf.gridarta.map.validation.checks.UnsetSlayingChecker; +import net.sf.gridarta.script.parameter.PluginParameterFactory; import net.sf.gridarta.treasurelist.CFTreasureListTree; import net.sf.gridarta.treasurelist.TreasureLocation; import net.sf.gridarta.treasurelist.TreasureTreeNode; Modified: trunk/crossfire/src/cfeditor/gui/script/ScriptEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/ScriptEditor.java 2008-09-30 20:48:09 UTC (rev 5300) +++ trunk/crossfire/src/cfeditor/gui/script/ScriptEditor.java 2008-09-30 21:28:47 UTC (rev 5301) @@ -27,7 +27,6 @@ import cfeditor.gui.script.parameter.PluginParameterViewFactory; import cfeditor.script.ScriptController; import cfeditor.script.ScriptModel; -import cfeditor.script.parameter.PluginParameter; import java.awt.BorderLayout; import java.awt.Component; import java.awt.FlowLayout; @@ -57,6 +56,7 @@ import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import net.sf.gridarta.gui.utils.GUIUtils; +import net.sf.gridarta.script.parameter.PluginParameter; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; Modified: trunk/crossfire/src/cfeditor/gui/script/parameter/ArchParameterView.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/parameter/ArchParameterView.java 2008-09-30 20:48:09 UTC (rev 5300) +++ trunk/crossfire/src/cfeditor/gui/script/parameter/ArchParameterView.java 2008-09-30 21:28:47 UTC (rev 5301) @@ -22,7 +22,6 @@ import cfeditor.gameobject.Archetype; import cfeditor.gameobject.GameObject; import cfeditor.map.MapArchObject; -import cfeditor.script.parameter.ArchParameter; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import javax.swing.JComponent; @@ -30,9 +29,10 @@ import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesModel; import net.sf.gridarta.gui.objectchooser.ObjectChooser; +import net.sf.gridarta.script.parameter.ArchParameter; import org.jetbrains.annotations.NotNull; -public class ArchParameterView implements PluginParameterView<Archetype, Void, ArchParameter> { +public class ArchParameterView implements PluginParameterView<Archetype, Void, ArchParameter<GameObject, MapArchObject, Archetype>> { /** * The archetype set. @@ -44,9 +44,9 @@ private final ArchComboBox value; - private final ArchParameter parameter; + private final ArchParameter<GameObject, MapArchObject, Archetype> parameter; - public ArchParameterView(final ArchParameter param, @NotNull final GameObjectAttributesModel<GameObject, MapArchObject, Archetype> gameObjectAttributesModel, @NotNull final ArchetypeSet<?, ?, Archetype> archetypeSet, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser) { + public ArchParameterView(final ArchParameter<GameObject, MapArchObject, Archetype> param, @NotNull final GameObjectAttributesModel<GameObject, MapArchObject, Archetype> gameObjectAttributesModel, @NotNull final ArchetypeSet<?, ?, Archetype> archetypeSet, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser) { this.archetypeSet = archetypeSet; value = new ArchComboBox(gameObjectAttributesModel, archetypeSet, objectChooser); parameter = param; @@ -60,11 +60,11 @@ }); } - public JComponent getConfigComponent(final Void config, final ArchParameter parameter) { + public JComponent getConfigComponent(final Void config, final ArchParameter<GameObject, MapArchObject, Archetype> parameter) { return this.config; } - public JComponent getValueComponent(final Archetype value, final ArchParameter parameter) { + public JComponent getValueComponent(final Archetype value, final ArchParameter<GameObject, MapArchObject, Archetype> parameter) { return this.value; } Modified: trunk/crossfire/src/cfeditor/gui/script/parameter/BooleanParameterView.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/parameter/BooleanParameterView.java 2008-09-30 20:48:09 UTC (rev 5300) +++ trunk/crossfire/src/cfeditor/gui/script/parameter/BooleanParameterView.java 2008-09-30 21:28:47 UTC (rev 5301) @@ -19,14 +19,14 @@ package cfeditor.gui.script.parameter; -import cfeditor.script.parameter.BooleanConfig; -import cfeditor.script.parameter.BooleanParameter; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JComponent; import javax.swing.JOptionPane; +import net.sf.gridarta.script.parameter.BooleanConfig; +import net.sf.gridarta.script.parameter.BooleanParameter; import org.jetbrains.annotations.NotNull; public class BooleanParameterView implements PluginParameterView<Boolean, BooleanConfig, BooleanParameter>, ActionListener { Modified: trunk/crossfire/src/cfeditor/gui/script/parameter/DoubleParameterView.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/parameter/DoubleParameterView.java 2008-09-30 20:48:09 UTC (rev 5300) +++ trunk/crossfire/src/cfeditor/gui/script/parameter/DoubleParameterView.java 2008-09-30 21:28:47 UTC (rev 5301) @@ -19,8 +19,6 @@ package cfeditor.gui.script.parameter; -import cfeditor.script.parameter.DoubleConfig; -import cfeditor.script.parameter.DoubleParameter; import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -32,6 +30,8 @@ import javax.swing.SpinnerNumberModel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; +import net.sf.gridarta.script.parameter.DoubleConfig; +import net.sf.gridarta.script.parameter.DoubleParameter; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; Modified: trunk/crossfire/src/cfeditor/gui/script/parameter/FilterParameterView.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/parameter/FilterParameterView.java 2008-09-30 20:48:09 UTC (rev 5300) +++ trunk/crossfire/src/cfeditor/gui/script/parameter/FilterParameterView.java 2008-09-30 21:28:47 UTC (rev 5301) @@ -19,12 +19,12 @@ package cfeditor.gui.script.parameter; -import cfeditor.script.parameter.FilterParameter; import javax.swing.JComponent; import javax.swing.JMenuItem; import javax.swing.JPanel; import net.sf.gridarta.filter.FilterConfig; import net.sf.gridarta.filter.NamedFilterList; +import net.sf.gridarta.script.parameter.FilterParameter; import org.jetbrains.annotations.NotNull; public class FilterParameterView implements PluginParameterView<FilterConfig, Void, FilterParameter> { Modified: trunk/crossfire/src/cfeditor/gui/script/parameter/IntegerParameterView.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/parameter/IntegerParameterView.java 2008-09-30 20:48:09 UTC (rev 5300) +++ trunk/crossfire/src/cfeditor/gui/script/parameter/IntegerParameterView.java 2008-09-30 21:28:47 UTC (rev 5301) @@ -19,8 +19,6 @@ package cfeditor.gui.script.parameter; -import cfeditor.script.parameter.IntegerConfig; -import cfeditor.script.parameter.IntegerParameter; import java.awt.Component; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -32,6 +30,8 @@ import javax.swing.SpinnerNumberModel; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; +import net.sf.gridarta.script.parameter.IntegerConfig; +import net.sf.gridarta.script.parameter.IntegerParameter; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; Modified: trunk/crossfire/src/cfeditor/gui/script/parameter/MapParameterView.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/parameter/MapParameterView.java 2008-09-30 20:48:09 UTC (rev 5300) +++ trunk/crossfire/src/cfeditor/gui/script/parameter/MapParameterView.java 2008-09-30 21:28:47 UTC (rev 5301) @@ -23,28 +23,28 @@ import cfeditor.gameobject.GameObject; import cfeditor.gui.map.CMapViewBasic; import cfeditor.map.MapArchObject; -import cfeditor.script.parameter.MapParameter; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JPanel; import net.sf.gridarta.MapManager; +import net.sf.gridarta.script.parameter.MapParameter; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; -public class MapParameterView implements PluginParameterView<Object, Void, MapParameter> { +public class MapParameterView implements PluginParameterView<Object, Void, MapParameter<GameObject, MapArchObject, Archetype, CMapViewBasic>> { /** The Logger for printing log messages. */ private static final Logger log = Logger.getLogger(MapParameterView.class); - private final MapParameter parameter; + private final MapParameter<GameObject, MapArchObject, Archetype, CMapViewBasic> parameter; private final JPanel config = new JPanel(); private final JComboBox value; - public MapParameterView(final MapParameter param, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager) { + public MapParameterView(final MapParameter<GameObject, MapArchObject, Archetype, CMapViewBasic> param, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager) { parameter = param; value = new JComboBox(); final MapParameterComboBoxModel myModel = new MapParameterComboBoxModel(mapManager); @@ -70,14 +70,14 @@ /* (non-Javadoc) * @see cfeditor.PluginParameterView#getValueComponent(java.lang.Object, cfeditor.PluginParameter) */ - public JComponent getValueComponent(final Object value, final MapParameter parameter) { + public JComponent getValueComponent(final Object value, final MapParameter<GameObject, MapArchObject, Archetype, CMapViewBasic> parameter) { return this.value; } /* (non-Javadoc) * @see cfeditor.PluginParameterView#getConfigComponent(java.lang.Object, cfeditor.PluginParameter) */ - public JComponent getConfigComponent(final Void config, final MapParameter parameter) { + public JComponent getConfigComponent(final Void config, final MapParameter<GameObject, MapArchObject, Archetype, CMapViewBasic> parameter) { return this.config; } Modified: trunk/crossfire/src/cfeditor/gui/script/parameter/ParameterDescriptionEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/parameter/ParameterDescriptionEditor.java 2008-09-30 20:48:09 UTC (rev 5300) +++ trunk/crossfire/src/cfeditor/gui/script/parameter/ParameterDescriptionEditor.java 2008-09-30 21:28:47 UTC (rev 5301) @@ -19,10 +19,10 @@ package cfeditor.gui.script.parameter; -import cfeditor.script.parameter.PluginParameter; import javax.swing.JTextField; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; +import net.sf.gridarta.script.parameter.PluginParameter; public class ParameterDescriptionEditor extends JTextField { Modified: trunk/crossfire/src/cfeditor/gui/script/parameter/ParameterNameEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/parameter/ParameterNameEditor.java 2008-09-30 20:48:09 UTC (rev 5300) +++ trunk/crossfire/src/cfeditor/gui/script/parameter/ParameterNameEditor.java 2008-09-30 21:28:47 UTC (rev 5301) @@ -19,10 +19,10 @@ package cfeditor.gui.script.parameter; -import cfeditor.script.parameter.PluginParameter; import javax.swing.JTextField; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; +import net.sf.gridarta.script.parameter.PluginParameter; public class ParameterNameEditor extends JTextField { Modified: trunk/crossfire/src/cfeditor/gui/script/parameter/ParameterTypeEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/parameter/ParameterTypeEditor.java 2008-09-30 20:48:09 UTC (rev 5300) +++ trunk/crossfire/src/cfeditor/gui/script/parameter/ParameterTypeEditor.java 2008-09-30 21:28:47 UTC (rev 5301) @@ -20,12 +20,12 @@ package cfeditor.gui.script.parameter; import cfeditor.script.ScriptModel; -import cfeditor.script.parameter.NoSuchParameterException; -import cfeditor.script.parameter.PluginParameter; -import cfeditor.script.parameter.PluginParameterFactory; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import javax.swing.JComboBox; +import net.sf.gridarta.script.parameter.NoSuchParameterException; +import net.sf.gridarta.script.parameter.PluginParameter; +import net.sf.gridarta.script.parameter.PluginParameterFactory; import org.apache.log4j.Logger; public class ParameterTypeEditor extends JComboBox { Modified: trunk/crossfire/src/cfeditor/gui/script/parameter/PluginParameterView.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/parameter/PluginParameterView.java 2008-09-30 20:48:09 UTC (rev 5300) +++ trunk/crossfire/src/cfeditor/gui/script/parameter/PluginParameterView.java 2008-09-30 21:28:47 UTC (rev 5301) @@ -19,8 +19,8 @@ package cfeditor.gui.script.parameter; -import cfeditor.script.parameter.PluginParameter; import javax.swing.JComponent; +import net.sf.gridarta.script.parameter.PluginParameter; import org.jetbrains.annotations.NotNull; /** Modified: trunk/crossfire/src/cfeditor/gui/script/parameter/PluginParameterViewFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/parameter/PluginParameterViewFactory.java 2008-09-30 20:48:09 UTC (rev 5300) +++ trunk/crossfire/src/cfeditor/gui/script/parameter/PluginParameterViewFactory.java 2008-09-30 21:28:47 UTC (rev 5301) @@ -23,20 +23,20 @@ import cfeditor.gameobject.GameObject; import cfeditor.gui.map.CMapViewBasic; import cfeditor.map.MapArchObject; -import cfeditor.script.parameter.ArchParameter; -import cfeditor.script.parameter.BooleanParameter; -import cfeditor.script.parameter.DoubleParameter; -import cfeditor.script.parameter.FilterParameter; -import cfeditor.script.parameter.IntegerParameter; -import cfeditor.script.parameter.MapParameter; -import cfeditor.script.parameter.PluginParameter; -import cfeditor.script.parameter.PluginParameterVisitor; -import cfeditor.script.parameter.StringParameter; import net.sf.gridarta.MapManager; import net.sf.gridarta.filter.NamedFilterList; import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesModel; import net.sf.gridarta.gui.objectchooser.ObjectChooser; +import net.sf.gridarta.script.parameter.ArchParameter; +import net.sf.gridarta.script.parameter.BooleanParameter; +import net.sf.gridarta.script.parameter.DoubleParameter; +import net.sf.gridarta.script.parameter.FilterParameter; +import net.sf.gridarta.script.parameter.IntegerParameter; +import net.sf.gridarta.script.parameter.MapParameter; +import net.sf.gridarta.script.parameter.PluginParameter; +import net.sf.gridarta.script.parameter.PluginParameterVisitor; +import net.sf.gridarta.script.parameter.StringParameter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; Modified: trunk/crossfire/src/cfeditor/gui/script/parameter/StringParameterView.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/parameter/StringParameterView.java 2008-09-30 20:48:09 UTC (rev 5300) +++ trunk/crossfire/src/cfeditor/gui/script/parameter/StringParameterView.java 2008-09-30 21:28:47 UTC (rev 5301) @@ -19,13 +19,13 @@ package cfeditor.gui.script.parameter; -import cfeditor.script.parameter.StringParameter; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.text.Document; +import net.sf.gridarta.script.parameter.StringParameter; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; Modified: trunk/crossfire/src/cfeditor/script/ScriptModel.java =================================================================== --- trunk/crossfire/src/cfeditor/script/ScriptModel.java 2008-09-30 20:48:09 UTC (rev 5300) +++ trunk/crossfire/src/cfeditor/script/ScriptModel.java 2008-09-30 21:28:47 UTC (rev 5301) @@ -19,9 +19,6 @@ package cfeditor.script; -import cfeditor.script.parameter.NoSuchParameterException; -import cfeditor.script.parameter.PluginParameter; -import cfeditor.script.parameter.PluginParameterFactory; import java.io.File; import java.util.ArrayList; import java.util.HashSet; @@ -29,6 +26,9 @@ import java.util.Set; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; +import net.sf.gridarta.script.parameter.NoSuchParameterException; +import net.sf.gridarta.script.parameter.PluginParameter; +import net.sf.gridarta.script.parameter.PluginParameterFactory; import org.apache.log4j.Logger; import org.jdom.CDATA; import org.jdom.Element; Property changes on: trunk/src/app/net/sf/gridarta/script/parameter ___________________________________________________________________ Added: svn:mergeinfo + Modified: trunk/src/app/net/sf/gridarta/script/parameter/ArchParameter.java =================================================================== --- trunk/crossfire/src/cfeditor/script/parameter/ArchParameter.java 2008-09-30 04:47:19 UTC (rev 5295) +++ trunk/src/app/net/sf/gridarta/script/parameter/ArchParameter.java 2008-09-30 21:28:47 UTC (rev 5301) @@ -17,17 +17,19 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -package cfeditor.script.parameter; +package net.sf.gridarta.script.parameter; -import cfeditor.gameobject.Archetype; +import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.ArchetypeSet; +import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.map.MapArchObject; import org.jdom.Element; import org.jetbrains.annotations.NotNull; -public class ArchParameter extends PluginParameter<Archetype, Void, ArchParameter> { +public class ArchParameter<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends PluginParameter<R, Void, ArchParameter<G, A, R>> { @NotNull - private static ArchetypeSet<?, ?, Archetype> archetypeSet; + private static ArchetypeSet<?, ?, ?> archetypeSet; private String valueString; @@ -35,7 +37,7 @@ super(getParameterType()); } - public static void init(@NotNull final ArchetypeSet<?, ?, Archetype> archetypeSet) { + public static void init(@NotNull final ArchetypeSet<?, ?, ?> archetypeSet) { ArchParameter.archetypeSet = archetypeSet; } @@ -43,7 +45,7 @@ public void fromXML(final Element e) { super.fromXML(e); valueString = e.getChildTextTrim("value"); - setValue(archetypeSet.getArchetype(valueString)); + setValue((R) archetypeSet.getArchetype(valueString)); } /** {@inheritDoc} */ @@ -65,9 +67,9 @@ } @Override - public Archetype getValue() { + public R getValue() { if (super.getValue() == null) { - final Archetype o = archetypeSet.getArchetype(valueString); + final R o = (R) archetypeSet.getArchetype(valueString); if (o != null) { setValue(o); } Modified: trunk/src/app/net/sf/gridarta/script/parameter/BooleanConfig.java =================================================================== --- trunk/crossfire/src/cfeditor/script/parameter/BooleanConfig.java 2008-09-30 04:47:19 UTC (rev 5295) +++ trunk/src/app/net/sf/gridarta/script/parameter/BooleanConfig.java 2008-09-30 21:28:47 UTC (rev 5301) @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -package cfeditor.script.parameter; +package net.sf.gridarta.script.parameter; public class BooleanConfig { Modified: trunk/src/app/net/sf/gridarta/script/parameter/BooleanParameter.java =================================================================== --- trunk/crossfire/src/cfeditor/script/parameter/BooleanParameter.java 2008-09-30 04:47:19 UTC (rev 5295) +++ trunk/src/app/net/sf/gridarta/script/parameter/BooleanParameter.java 2008-09-30 21:28:47 UTC (rev 5301) @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -package cfeditor.script.parameter; +package net.sf.gridarta.script.parameter; import org.jdom.Element; import org.jetbrains.annotations.NotNull; Modified: trunk/src/app/net/sf/gridarta/script/parameter/DoubleConfig.java =================================================================== --- trunk/crossfire/src/cfeditor/script/parameter/DoubleConfig.java 2008-09-30 04:47:19 UTC (rev 5295) +++ trunk/src/app/net/sf/gridarta/script/parameter/DoubleConfig.java 2008-09-30 21:28:47 UTC (rev 5301) @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -package cfeditor.script.parameter; +package net.sf.gridarta.script.parameter; public class DoubleConfig { Modified: trunk/src/app/net/sf/gridarta/script/parameter/DoubleParameter.java =================================================================== --- trunk/crossfire/src/cfeditor/script/parameter/DoubleParameter.java 2008-09-30 04:47:19 UTC (rev 5295) +++ trunk/src/app/net/sf/gridarta/script/parameter/DoubleParameter.java 2008-09-30 21:28:47 UTC (rev 5301) @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -package cfeditor.script.parameter; +package net.sf.gridarta.script.parameter; import org.jdom.Element; import org.jetbrains.annotations.NotNull; Modified: trunk/src/app/net/sf/gridarta/script/parameter/FilterParameter.java =================================================================== --- trunk/crossfire/src/cfeditor/script/parameter/FilterParameter.java 2008-09-30 04:47:19 UTC (rev 5295) +++ trunk/src/app/net/sf/gridarta/script/parameter/FilterParameter.java 2008-09-30 21:28:47 UTC (rev 5301) @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -package cfeditor.script.parameter; +package net.sf.gridarta.script.parameter; import net.sf.gridarta.filter.FilterConfig; import net.sf.gridarta.filter.NamedFilterConfig; Modified: trunk/src/app/net/sf/gridarta/script/parameter/IntegerConfig.java =================================================================== --- trunk/crossfire/src/cfeditor/script/parameter/IntegerConfig.java 2008-09-30 04:47:19 UTC (rev 5295) +++ trunk/src/app/net/sf/gridarta/script/parameter/IntegerConfig.java 2008-09-30 21:28:47 UTC (rev 5301) @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -package cfeditor.script.parameter; +package net.sf.gridarta.script.parameter; public class IntegerConfig { Modified: trunk/src/app/net/sf/gridarta/script/parameter/IntegerParameter.java =================================================================== --- trunk/crossfire/src/cfeditor/script/parameter/IntegerParameter.java 2008-09-30 04:47:19 UTC (rev 5295) +++ trunk/src/app/net/sf/gridarta/script/parameter/IntegerParameter.java 2008-09-30 21:28:47 UTC (rev 5301) @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -package cfeditor.script.parameter; +package net.sf.gridarta.script.parameter; import org.jdom.Element; import org.jetbrains.annotations.NotNull; Modified: trunk/src/app/net/sf/gridarta/script/parameter/MapParameter.java =================================================================== --- trunk/crossfire/src/cfeditor/script/parameter/MapParameter.java 2008-09-30 04:47:19 UTC (rev 5295) +++ trunk/src/app/net/sf/gridarta/script/parameter/MapParameter.java 2008-09-30 21:28:47 UTC (rev 5301) @@ -17,27 +17,27 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -package cfeditor.script.parameter; +package net.sf.gridarta.script.parameter; -import cfeditor.gameobject.Archetype; -import cfeditor.gameobject.GameObject; -import cfeditor.gui.map.CMapViewBasic; -import cfeditor.map.MapArchObject; import net.sf.gridarta.MapManager; +import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gui.map.MapViewBasic; +import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapControl; import org.jdom.Element; import org.jetbrains.annotations.NotNull; -public class MapParameter extends PluginParameter<Object, Void, MapParameter> { // XXX: find correct parameter type: String or MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> +public class MapParameter<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> extends PluginParameter<Object, Void, MapParameter<G, A, R, V>> { // XXX: find correct parameter type: String or MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> @NotNull - private static MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager; + private static MapManager<?, ?, ?, ?> mapManager; public MapParameter() { super(getParameterType()); } - public static void init(@NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager) { + public static void init(@NotNull final MapManager<?, ?, ?, ?> mapManager) { MapParameter.mapManager = mapManager; } @@ -72,7 +72,7 @@ return mapManager.getCurrentMap(); } - for (final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl : mapManager.getOpenedMaps()) { + for (final MapControl<G, A, R, V> mapControl : ((MapManager<G, A, R, V>) mapManager).getOpenedMaps()) { if (mapControl.getMapFileName().equalsIgnoreCase(s)) { return mapControl; } @@ -86,7 +86,7 @@ if (value == null) { return super.setValue(null); } else { - final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> map = (MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>) value; + final MapControl<G, A, R, V> map = (MapControl<G, A, R, V>) value; return super.setValue(map.getMapModel().getMapArchObject().getMapName()); } } Modified: trunk/src/app/net/sf/gridarta/script/parameter/NoSuchParameterException.java =================================================================== --- trunk/crossfire/src/cfeditor/script/parameter/NoSuchParameterException.java 2008-09-30 04:47:19 UTC (rev 5295) +++ trunk/src/app/net/sf/gridarta/script/parameter/NoSuchParameterException.java 2008-09-30 21:28:47 UTC (rev 5301) @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -package cfeditor.script.parameter; +package net.sf.gridarta.script.parameter; import org.jetbrains.annotations.NotNull; Modified: trunk/src/app/net/sf/gridarta/script/parameter/PluginParameter.java =================================================================== --- trunk/crossfire/src/cfeditor/script/parameter/PluginParameter.java 2008-09-30 04:47:19 UTC (rev 5295) +++ trunk/src/app/net/sf/gridarta/script/parameter/PluginParameter.java 2008-09-30 21:28:47 UTC (rev 5301) @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -package cfeditor.script.parameter; +package net.sf.gridarta.script.parameter; import java.util.HashSet; import java.util.Set; Modified: trunk/src/app/net/sf/gridarta/script/parameter/PluginParameterFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/script/parameter/PluginParameterFactory.java 2008-09-30 04:47:19 UTC (rev 5295) +++ trunk/src/app/net/sf/gridarta/script/parameter/PluginParameterFactory.java 2008-09-30 21:28:47 UTC (rev 5301) @@ -17,12 +17,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -package cfeditor.script.parameter; +package net.sf.gridarta.script.parameter; -import cfeditor.gameobject.Archetype; -import cfeditor.gameobject.GameObject; -import cfeditor.gui.map.CMapViewBasic; -import cfeditor.map.MapArchObject; import java.util.LinkedHashMap; import java.util.Map; import net.sf.gridarta.MapManager; @@ -43,7 +39,7 @@ private static final Map<String, Class<? extends PluginParameter>> parameterTypes = new LinkedHashMap<String, Class<? extends PluginParameter>>(); - public static void init(@NotNull final ArchetypeSet<?, ?, Archetype> archetypeSet, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager) { + public static void init(@NotNull final ArchetypeSet<?, ?, ?> archetypeSet, @NotNull final MapManager<?, ?, ?, ?> mapManager) { ArchParameter.init(archetypeSet); MapParameter.init(mapManager); parameterTypes.put(StringParameter.getParameterType(), StringParameter.class); Deleted: trunk/src/app/net/sf/gridarta/script/parameter/PluginParameterViewFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/script/parameter/PluginParameterViewFactory.java 2008-09-30 04:47:19 UTC (rev 5295) +++ trunk/src/app/net/sf/gridarta/script/parameter/PluginParameterViewFactory.java 2008-09-30 21:28:47 UTC (rev 5301) @@ -1,124 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2007 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 cfeditor.script.parameter; - -import cfeditor.gameobject.Archetype; -import cfeditor.gameobject.GameObject; -import cfeditor.gui.map.CMapViewBasic; -import cfeditor.gui.script.parameter.ArchParameterView; -import cfeditor.gui.script.parameter.BooleanParameterView; -import cfeditor.gui.script.parameter.DoubleParameterView; -import cfeditor.gui.script.parameter.FilterParameterView; -import cfeditor.gui.script.parameter.IntegerParameterView; -import cfeditor.gui.script.parameter.MapParameterView; -import cfeditor.gui.script.parameter.PluginParameterView; -import cfeditor.gui.script.parameter.StringParameterView; -import cfeditor.map.MapArchObject; -import net.sf.gridarta.MapManager; -import net.sf.gridarta.filter.NamedFilterList; -import net.sf.gridarta.gameobject.ArchetypeSet; -import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesModel; -import net.sf.gridarta.gui.objectchooser.ObjectChooser; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * Factory for creating {@link PluginParameterView} instances. - * @author Andreas Kirschbaum - */ -public class PluginParameterViewFactory { - - @NotNull - private final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet; - - @NotNull - private final GameObjectAttributesModel<GameObject, MapArchObject, Archetype> gameObjectAttributesModel; - - @NotNull - private final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser; - - @NotNull - private final NamedFilterList defaultFilterList; - - @NotNull - private final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager; - - @Nullable - private PluginParameterView view = null; - - private final PluginParameterVisitor visitor = new PluginParameterVisitor() { - - /** {@inheritDoc} */ - public void visit(final ArchParameter parameter) { - view = new ArchParameterView(parameter, gameObjectAttributesModel, archetypeSet, objectChooser); - } - - /** {@inheritDoc} */ - public void visit(final BooleanParameter parameter) { - view = new BooleanParameterView(parameter); - } - - /** {@inheritDoc} */ - public void visit(final DoubleParameter parameter) { - view = new DoubleParameterView(parameter); - } - - /** {@inheritDoc} */ - public void visit(final FilterParameter parameter) { - view = new FilterParameterView(defaultFilterList); // XXX: does not use "parameter"? - } - - /** {@inheritDoc} */ - public void visit(final IntegerParameter parameter) { - view = new IntegerParameterView(parameter); - } - - /** {@inheritDoc} */ - public void visit(final MapParameter parameter) { - view = new MapParameterView(parameter, mapManager); - } - - /** {@inheritDoc} */ - public void visit(final StringParameter parameter) { - view = new StringParameterView(parameter); - } - - }; - - /** - * Creates a new instance. - */ - public PluginParameterViewFactory(@NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final GameObjectAttributesModel<GameObject, MapArchObject, Archetype> gameObjectAttributesModel, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final NamedFilterList defaultFilterList, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager) { - this.archetypeSet = archetypeSet; - this.gameObjectAttributesModel = gameObjectAttributesModel; - this.objectChooser = objectChooser; - this.defaultFilterList = defaultFilterList; - this.mapManager = mapManager; - } - - @NotNull - public PluginParameterView getView(@NotNull final PluginParameter parameter) { - view = null; - parameter.visit(visitor); - assert view != null; - return view; - } - -} // class PluginParameterViewFactory Modified: trunk/src/app/net/sf/gridarta/script/parameter/PluginParameterVisitor.java =================================================================== --- trunk/crossfire/src/cfeditor/script/parameter/PluginParameterVisitor.java 2008-09-30 04:47:19 UTC (rev 5295) +++ trunk/src/app/net/sf/gridarta/script/parameter/PluginParameterVisitor.java 2008-09-30 21:28:47 UTC (rev 5301) @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -package cfeditor.script.parameter; +package net.sf.gridarta.script.parameter; /** * Interface for visitors of {@link PluginParameter} instances. Modified: trunk/src/app/net/sf/gridarta/script/parameter/StringParameter.java =================================================================== --- trunk/crossfire/src/cfeditor/script/parameter/StringParameter.java 2008-09-30 04:47:19 UTC (rev 5295) +++ trunk/src/app/net/sf/gridarta/script/parameter/StringParameter.java 2008-09-30 21:28:47 UTC (rev 5301) @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -package cfeditor.script.parameter; +package net.sf.gridarta.script.parameter; import org.apache.log4j.Logger; import org.jdom.Element; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-09-30 21:36:16
|
Revision: 5302 http://gridarta.svn.sourceforge.net/gridarta/?rev=5302&view=rev Author: akirschbaum Date: 2008-09-30 21:35:47 +0000 (Tue, 30 Sep 2008) Log Message: ----------- Remove unused type parameters. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/script/parameter/ParameterNameEditor.java trunk/crossfire/src/cfeditor/gui/script/parameter/PluginParameterView.java trunk/src/app/net/sf/gridarta/script/parameter/ArchParameter.java trunk/src/app/net/sf/gridarta/script/parameter/BooleanParameter.java trunk/src/app/net/sf/gridarta/script/parameter/DoubleParameter.java trunk/src/app/net/sf/gridarta/script/parameter/FilterParameter.java trunk/src/app/net/sf/gridarta/script/parameter/IntegerParameter.java trunk/src/app/net/sf/gridarta/script/parameter/MapParameter.java trunk/src/app/net/sf/gridarta/script/parameter/PluginParameter.java trunk/src/app/net/sf/gridarta/script/parameter/StringParameter.java Modified: trunk/crossfire/src/cfeditor/gui/script/parameter/ParameterNameEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/parameter/ParameterNameEditor.java 2008-09-30 21:28:47 UTC (rev 5301) +++ trunk/crossfire/src/cfeditor/gui/script/parameter/ParameterNameEditor.java 2008-09-30 21:35:47 UTC (rev 5302) @@ -28,7 +28,7 @@ private static final long serialVersionUID = 1L; - private final PluginParameter<?, ?, ?> parameter; + private final PluginParameter<?, ?> parameter; private final DocumentListener documentListener = new DocumentListener() { @@ -49,7 +49,7 @@ }; - public ParameterNameEditor(final PluginParameter<?, ?, ?> parameter) { + public ParameterNameEditor(final PluginParameter<?, ?> parameter) { this.parameter = parameter; setText(parameter.getName()); getDocument().addDocumentListener(documentListener); Modified: trunk/crossfire/src/cfeditor/gui/script/parameter/PluginParameterView.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/parameter/PluginParameterView.java 2008-09-30 21:28:47 UTC (rev 5301) +++ trunk/crossfire/src/cfeditor/gui/script/parameter/PluginParameterView.java 2008-09-30 21:35:47 UTC (rev 5302) @@ -27,7 +27,7 @@ * Interface for Views that display plugin parameters. * @author tchize */ -public interface PluginParameterView<V, C, P extends PluginParameter<V, C, P>> { +public interface PluginParameterView<V, C, P extends PluginParameter<V, C>> { JComponent getValueComponent(V value, P parameter); Modified: trunk/src/app/net/sf/gridarta/script/parameter/ArchParameter.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/parameter/ArchParameter.java 2008-09-30 21:28:47 UTC (rev 5301) +++ trunk/src/app/net/sf/gridarta/script/parameter/ArchParameter.java 2008-09-30 21:35:47 UTC (rev 5302) @@ -26,7 +26,7 @@ import org.jdom.Element; import org.jetbrains.annotations.NotNull; -public class ArchParameter<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends PluginParameter<R, Void, ArchParameter<G, A, R>> { +public class ArchParameter<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends PluginParameter<R, Void> { @NotNull private static ArchetypeSet<?, ?, ?> archetypeSet; Modified: trunk/src/app/net/sf/gridarta/script/parameter/BooleanParameter.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/parameter/BooleanParameter.java 2008-09-30 21:28:47 UTC (rev 5301) +++ trunk/src/app/net/sf/gridarta/script/parameter/BooleanParameter.java 2008-09-30 21:35:47 UTC (rev 5302) @@ -22,7 +22,7 @@ import org.jdom.Element; import org.jetbrains.annotations.NotNull; -public class BooleanParameter extends PluginParameter<Boolean, BooleanConfig, BooleanParameter> { +public class BooleanParameter extends PluginParameter<Boolean, BooleanConfig> { public BooleanParameter() { super(getParameterType()); Modified: trunk/src/app/net/sf/gridarta/script/parameter/DoubleParameter.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/parameter/DoubleParameter.java 2008-09-30 21:28:47 UTC (rev 5301) +++ trunk/src/app/net/sf/gridarta/script/parameter/DoubleParameter.java 2008-09-30 21:35:47 UTC (rev 5302) @@ -22,7 +22,7 @@ import org.jdom.Element; import org.jetbrains.annotations.NotNull; -public class DoubleParameter extends PluginParameter<Double, DoubleConfig, DoubleParameter> { +public class DoubleParameter extends PluginParameter<Double, DoubleConfig> { public DoubleParameter() { super(getParameterType()); Modified: trunk/src/app/net/sf/gridarta/script/parameter/FilterParameter.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/parameter/FilterParameter.java 2008-09-30 21:28:47 UTC (rev 5301) +++ trunk/src/app/net/sf/gridarta/script/parameter/FilterParameter.java 2008-09-30 21:35:47 UTC (rev 5302) @@ -25,7 +25,7 @@ import org.jdom.Element; import org.jetbrains.annotations.NotNull; -public class FilterParameter extends PluginParameter<FilterConfig, Void, FilterParameter> { +public class FilterParameter extends PluginParameter<FilterConfig, Void> { private final NamedFilterList defaultFilterList; Modified: trunk/src/app/net/sf/gridarta/script/parameter/IntegerParameter.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/parameter/IntegerParameter.java 2008-09-30 21:28:47 UTC (rev 5301) +++ trunk/src/app/net/sf/gridarta/script/parameter/IntegerParameter.java 2008-09-30 21:35:47 UTC (rev 5302) @@ -22,7 +22,7 @@ import org.jdom.Element; import org.jetbrains.annotations.NotNull; -public class IntegerParameter extends PluginParameter<Integer, IntegerConfig, IntegerParameter> { +public class IntegerParameter extends PluginParameter<Integer, IntegerConfig> { public IntegerParameter() { super(getParameterType()); Modified: trunk/src/app/net/sf/gridarta/script/parameter/MapParameter.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/parameter/MapParameter.java 2008-09-30 21:28:47 UTC (rev 5301) +++ trunk/src/app/net/sf/gridarta/script/parameter/MapParameter.java 2008-09-30 21:35:47 UTC (rev 5302) @@ -28,7 +28,7 @@ import org.jdom.Element; import org.jetbrains.annotations.NotNull; -public class MapParameter<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> extends PluginParameter<Object, Void, MapParameter<G, A, R, V>> { // XXX: find correct parameter type: String or MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> +public class MapParameter<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> extends PluginParameter<Object, Void> { // XXX: find correct parameter type: String or MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> @NotNull private static MapManager<?, ?, ?, ?> mapManager; Modified: trunk/src/app/net/sf/gridarta/script/parameter/PluginParameter.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/parameter/PluginParameter.java 2008-09-30 21:28:47 UTC (rev 5301) +++ trunk/src/app/net/sf/gridarta/script/parameter/PluginParameter.java 2008-09-30 21:35:47 UTC (rev 5302) @@ -31,7 +31,7 @@ * Parameter for a Plugin. * @author tchize */ -public abstract class PluginParameter<V, C, Q extends PluginParameter<V, C, Q>> implements Cloneable { +public abstract class PluginParameter<V, C> implements Cloneable { private V value; Modified: trunk/src/app/net/sf/gridarta/script/parameter/StringParameter.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/parameter/StringParameter.java 2008-09-30 21:28:47 UTC (rev 5301) +++ trunk/src/app/net/sf/gridarta/script/parameter/StringParameter.java 2008-09-30 21:35:47 UTC (rev 5302) @@ -23,7 +23,7 @@ import org.jdom.Element; import org.jetbrains.annotations.NotNull; -public class StringParameter extends PluginParameter<String, Void, StringParameter> { +public class StringParameter extends PluginParameter<String, Void> { /** The Logger for printing log messages. */ private static final Logger log = Logger.getLogger(StringParameter.class); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-10-01 14:59:12
|
Revision: 5303 http://gridarta.svn.sourceforge.net/gridarta/?rev=5303&view=rev Author: akirschbaum Date: 2008-10-01 14:58:44 +0000 (Wed, 01 Oct 2008) Log Message: ----------- Move ScriptModel to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/script/ScriptEditor.java trunk/crossfire/src/cfeditor/gui/script/ScriptManager.java trunk/crossfire/src/cfeditor/gui/script/ScriptView.java trunk/crossfire/src/cfeditor/gui/script/parameter/ParameterTypeEditor.java trunk/crossfire/src/cfeditor/script/BshThread.java trunk/crossfire/src/cfeditor/script/ScriptControlListener.java trunk/crossfire/src/cfeditor/script/ScriptController.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/script/ScriptModel.java Removed Paths: ------------- trunk/crossfire/src/cfeditor/script/ScriptModel.java Modified: trunk/crossfire/src/cfeditor/gui/script/ScriptEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/ScriptEditor.java 2008-09-30 21:35:47 UTC (rev 5302) +++ trunk/crossfire/src/cfeditor/gui/script/ScriptEditor.java 2008-10-01 14:58:44 UTC (rev 5303) @@ -26,7 +26,6 @@ import cfeditor.gui.script.parameter.PluginParameterView; import cfeditor.gui.script.parameter.PluginParameterViewFactory; import cfeditor.script.ScriptController; -import cfeditor.script.ScriptModel; import java.awt.BorderLayout; import java.awt.Component; import java.awt.FlowLayout; @@ -56,6 +55,7 @@ import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import net.sf.gridarta.gui.utils.GUIUtils; +import net.sf.gridarta.script.ScriptModel; import net.sf.gridarta.script.parameter.PluginParameter; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; Modified: trunk/crossfire/src/cfeditor/gui/script/ScriptManager.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/ScriptManager.java 2008-09-30 21:35:47 UTC (rev 5302) +++ trunk/crossfire/src/cfeditor/gui/script/ScriptManager.java 2008-10-01 14:58:44 UTC (rev 5303) @@ -22,7 +22,6 @@ import cfeditor.gui.script.parameter.PluginParameterViewFactory; import cfeditor.script.ScriptControlListener; import cfeditor.script.ScriptController; -import cfeditor.script.ScriptModel; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Color; @@ -42,6 +41,7 @@ import javax.swing.border.LineBorder; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; +import net.sf.gridarta.script.ScriptModel; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; Modified: trunk/crossfire/src/cfeditor/gui/script/ScriptView.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/ScriptView.java 2008-09-30 21:35:47 UTC (rev 5302) +++ trunk/crossfire/src/cfeditor/gui/script/ScriptView.java 2008-10-01 14:58:44 UTC (rev 5303) @@ -25,7 +25,6 @@ import cfeditor.gui.script.parameter.PluginParameterViewFactory; import cfeditor.script.ScriptControlListener; import cfeditor.script.ScriptController; -import cfeditor.script.ScriptModel; import java.awt.BorderLayout; import java.awt.Component; import java.awt.GridBagConstraints; @@ -42,6 +41,7 @@ import javax.swing.JOptionPane; import javax.swing.JPanel; import net.sf.gridarta.gui.utils.MenuUtils; +import net.sf.gridarta.script.ScriptModel; import net.sf.japi.swing.ActionFactory; import net.sf.japi.swing.ReflectionAction; import org.apache.log4j.Logger; Modified: trunk/crossfire/src/cfeditor/gui/script/parameter/ParameterTypeEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/parameter/ParameterTypeEditor.java 2008-09-30 21:35:47 UTC (rev 5302) +++ trunk/crossfire/src/cfeditor/gui/script/parameter/ParameterTypeEditor.java 2008-10-01 14:58:44 UTC (rev 5303) @@ -19,10 +19,10 @@ package cfeditor.gui.script.parameter; -import cfeditor.script.ScriptModel; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import javax.swing.JComboBox; +import net.sf.gridarta.script.ScriptModel; import net.sf.gridarta.script.parameter.NoSuchParameterException; import net.sf.gridarta.script.parameter.PluginParameter; import net.sf.gridarta.script.parameter.PluginParameterFactory; Modified: trunk/crossfire/src/cfeditor/script/BshThread.java =================================================================== --- trunk/crossfire/src/cfeditor/script/BshThread.java 2008-09-30 21:35:47 UTC (rev 5302) +++ trunk/crossfire/src/cfeditor/script/BshThread.java 2008-10-01 14:58:44 UTC (rev 5303) @@ -21,6 +21,7 @@ import bsh.EvalError; import bsh.Interpreter; +import net.sf.gridarta.script.ScriptModel; /** * A BshThread. Modified: trunk/crossfire/src/cfeditor/script/ScriptControlListener.java =================================================================== --- trunk/crossfire/src/cfeditor/script/ScriptControlListener.java 2008-09-30 21:35:47 UTC (rev 5302) +++ trunk/crossfire/src/cfeditor/script/ScriptControlListener.java 2008-10-01 14:58:44 UTC (rev 5303) @@ -20,6 +20,7 @@ package cfeditor.script; import java.util.EventListener; +import net.sf.gridarta.script.ScriptModel; import org.jetbrains.annotations.NotNull; /** Modified: trunk/crossfire/src/cfeditor/script/ScriptController.java =================================================================== --- trunk/crossfire/src/cfeditor/script/ScriptController.java 2008-09-30 21:35:47 UTC (rev 5302) +++ trunk/crossfire/src/cfeditor/script/ScriptController.java 2008-10-01 14:58:44 UTC (rev 5303) @@ -49,6 +49,7 @@ import javax.swing.event.EventListenerList; import net.sf.gridarta.filter.Filter; import net.sf.gridarta.filter.FilterControl; +import net.sf.gridarta.script.ScriptModel; import net.sf.japi.swing.ActionFactory; import org.apache.log4j.Logger; import org.jdom.Document; Deleted: trunk/crossfire/src/cfeditor/script/ScriptModel.java =================================================================== --- trunk/crossfire/src/cfeditor/script/ScriptModel.java 2008-09-30 21:35:47 UTC (rev 5302) +++ trunk/crossfire/src/cfeditor/script/ScriptModel.java 2008-10-01 14:58:44 UTC (rev 5303) @@ -1,512 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2007 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 cfeditor.script; - -import java.io.File; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import net.sf.gridarta.script.parameter.NoSuchParameterException; -import net.sf.gridarta.script.parameter.PluginParameter; -import net.sf.gridarta.script.parameter.PluginParameterFactory; -import org.apache.log4j.Logger; -import org.jdom.CDATA; -import org.jdom.Element; -import org.jdom.IllegalDataException; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * Model for Scripts. - * @author tchize - * @todo documentation - */ -public final class ScriptModel implements Cloneable { - - /** The Logger for printing log messages. */ - private static final Logger log = Logger.getLogger(ScriptModel.class); - - public static final int PLUGIN_AUTOBOOT = 1; - - public static final int PLUGIN_FILTER = 2; - - public static final int PLUGIN_SCRIPT = 4; - - public static final Integer RUN_AUTOBOOT = 1; - - public static final Integer RUN_FILTER = 2; - - public static final Integer RUN_SCRIPT = 4; - - private String code = ""; - - private final List<PluginParameter> parameters = new ArrayList<PluginParameter>(); - - private String name = ""; - - private int scriptType; - - private final Set<ChangeListener> listeners = new HashSet<ChangeListener>(); - - /** - * The location to save this script to; set to <code>null</code> if the - * script has no associated location. - */ - @Nullable - private File file = null; - - /** Whether the script contents has been modified since last save. */ - private boolean modified = false; - - /** - * Creates a new instance. - */ - public ScriptModel() { - } - - /** - * Returns the name of this ScriptModel. - * @return The name of this ScriptModel. - */ - public String getName() { - return name; - } - - /** - * Sets the name of this ScriptModel. - * @param name The name of this ScriptModel. - * @todo Maybe this should be moved to the constructor and the underlying - * field made final. - */ - public void setName(final String name) { - if (this.name.equals(name)) { - return; - } - - this.name = name; - modified = true; - notifyListeners(); - } - - /** - * Returns the code of this ScriptModel. - * @return The code of this ScriptModel. - * @todo Improve name - what code is it? Source code? A special coded - * String? - */ - public String getCode() { - return code; - } - - /** - * Sets the code of this ScriptModel. - * @param code The code of this ScriptModel. - */ - public void setCode(final String code) { - if (this.code.equals(code)) { - return; - } - - this.code = code; - modified = true; - notifyListeners(); - } - - /** - * Set the name of a given parameter. - * @param index The index of parameter to rename - * @param name the new name of parameter - */ - public void setParamName(final int index, final String name) { - try { - if (parameters.get(index).setName(name)) { - modified = true; - notifyListeners(); - } - } catch (final Exception e) { - } - } - - /** - * Get the name of a script parameter. - * @param index The index number of parameter - * @return the name of parameter - */ - @Nullable - public String getParamName(final int index) { - try { - return parameters.get(index).getName(); - } catch (final Exception e) { - return null; - } - - } - - /** - * Returns the parameter description for the parameter with the specified - * index. - * @param index the parameter index to get - * @return The description of the specified parameter. - */ - @Nullable - public String getParamDescription(final int index) { - try { - return parameters.get(index).getDescription(); - } catch (final Exception e) { - return null; - } - } - - /** - * Sets the parameter description for the parameter with the specified - * index. - * @param index the parameter index to set - * @param description the new description of parameter - */ - public void setParamDescription(final int index, final String description) { - try { - if (parameters.get(index).setDescription(description)) { - modified = true; - notifyListeners(); - } - } catch (final Exception e) { - } - } - - /** - * Returns the parameter value for the parameter with the specified index. - * @param index the parameter index to get - * @return Returns the parameter default value. - */ - @Nullable - public Object getParamValue(final int index) { - try { - return parameters.get(index).getValue(); - } catch (final Exception e) { - e.printStackTrace(); - return null; - } - } - - /** - * Sets the parameter value for the parameter with the specified index. - * @param index the parameter index to set - * @param value the default value to set - */ - public void setParamValue(final int index, final Object value) { - try { - if (parameters.get(index).setValue(value)) { - modified = true; - notifyListeners(); - } - } catch (final Exception e) { - } - } - - public int getParametersCount() { - return parameters.size(); - } - - public String[] getParameters() { - final List<String> l = new ArrayList<String>(); - for (final PluginParameter p : parameters) { - if (!l.contains(p.getName())) { - l.add(p.getName()); - } - } - return l.toArray(new String[l.size()]); - } - - /** - * Returns the index for a parameter name. - * @param paramName the parameter name - * @return the index or <code>-1</code> if the parameter name does not - * exist - */ - public int getParameter(@NotNull final String paramName) { - int index = 0; - for (final PluginParameter param : parameters) { - if (param.getName().equals(paramName)) { - return index; - } - index++; - } - return -1; - } - - @Override - public String toString() { - return name; - } - - public void newParameter() { - final PluginParameter p; - try { - p = PluginParameterFactory.createParameter((String) null); - } catch (final NoSuchParameterException ex) { - log.warn("Cannot create parameter: " + ex.getMessage()); - return; - } - parameters.add(p); - modified = true; - notifyListeners(); - } - - public void removeParameter(final int index) { - parameters.remove(index); - modified = true; - notifyListeners(); - } - - public void addChangeListener(final ChangeListener listener) { - listeners.add(listener); - } - - public void removeListener(final ChangeListener listener) { - listeners.remove(listener); - } - - /** Tell all listeners plugged on this ScriptModel its content has changed. */ - private void notifyListeners() { - final ChangeEvent e = new ChangeEvent(this); - for (final ChangeListener listener : listeners) { - listener.stateChanged(e); - } - } - - /** - * Get a clone copy of this SCriptModel. The copy include name, code, type - * and a clone of each parameter. The listener are not moved along. - * @return a clone of this ScriptModel - */ - @Override - public Object clone() throws CloneNotSupportedException { - final ScriptModel model = new ScriptModel(); - model.code = code; - model.name = name; - model.scriptType = scriptType; - model.modified = modified; - for (final PluginParameter param : parameters) { - model.addParameter((PluginParameter) param.clone()); - } - return model; - } - - /** - * Adds a parameter to this script. - * @param p the parameter to add - */ - public void addParameter(final PluginParameter p) { - parameters.add(p); - modified = true; - notifyListeners(); - } - - /** - * Gets the PluginParameter at a given index. - * @param index The index of parameter to get. Must be between 0 and - * getParametersCount(). If index is out of range, result is undefined. - * @return the requested parameter - */ - public PluginParameter getParameter(final int index) { - return parameters.get(index); - } - - /** - * Check if this script is an autoboot script (a script run at load time). - * @return true if script is an autoboot script, false otherwise - */ - public boolean isAutoboot() { - if (log.isDebugEnabled()) { - log.debug("isautoboot: scriptType = " + scriptType); - } - return (scriptType & PLUGIN_AUTOBOOT) != 0; - } - - /** - * Check if this script is a bash script (script run from the run script - * menu). - * @return true if script is a bash script, false otherwise - */ - public boolean isBash() { - return (scriptType & PLUGIN_SCRIPT) != 0; - } - - /** - * Check if this script is a filter script (will appear in the map filter - * list menu). - * @return true if the script is a filter script, false otherwise - */ - public boolean isFilter() { - return (scriptType & PLUGIN_FILTER) != 0; - } - - public void toggleScriptType(final int type, final boolean b) { - if (b) { - if ((scriptType & type) == type) { - return; - } - - scriptType |= type; - } else { - if ((scriptType & type) == 0) { - return; - } - - scriptType &= ~type; - } - modified = true; - notifyListeners(); - } - - public void setAutoboot(final boolean b) { - toggleScriptType(PLUGIN_AUTOBOOT, b); - } - - public void setBash(final boolean b) { - toggleScriptType(PLUGIN_SCRIPT, b); - } - - public void setFilter(final boolean b) { - toggleScriptType(PLUGIN_FILTER, b); - } - - public void fromXML(final Element node) { - setName(node.getChildTextTrim("name")); - setCode(node.getChildTextTrim("code")); - scriptType = 0; - final Element mode = node.getChild("mode"); - if (mode == null) { - scriptType = PLUGIN_SCRIPT; - } else { - final List<Element> modes = mode.getChildren(); - for (final Element m : modes) { - final boolean b = Boolean.valueOf(m.getTextTrim()); - final String name = m.getName(); - if ("autoboot".equalsIgnoreCase(name) && b) { - scriptType |= PLUGIN_AUTOBOOT; - } else if ("filter".equalsIgnoreCase(name) && b) { - scriptType |= PLUGIN_FILTER; - } else if ("bash".equalsIgnoreCase(name) && b) { - scriptType |= PLUGIN_SCRIPT; - } - } - } - final List<Element> params = node.getChildren("parameter"); - if (params != null && !params.isEmpty()) { - for (final Element parameter : params) { - final PluginParameter p; - try { - p = PluginParameterFactory.createParameter(parameter); - } catch (final NoSuchParameterException ex) { - log.warn("Cannot create parameter type " + ex.getMessage() + ", dropping parameter"); - continue; - } - addParameter(p); - } - } - modified = false; - } - - public Element toXML() { - final Element root = new Element("script"); - final Element n = new Element("name"); - final Element c = new Element("code"); - n.addContent(name); - try { - c.addContent(new CDATA(code));// protect code in xml! - } catch (final IllegalDataException e) { - //can't be converted to CDATA :( - c.addContent(code); - } - root.addContent(n); - root.addContent(c); - final Element modes = new Element("mode"); - - { - final Element autoboot = new Element("autoboot"); - autoboot.addContent(Boolean.toString((scriptType & PLUGIN_AUTOBOOT) != 0)); - final Element bash = new Element("bash"); - bash.addContent(Boolean.toString((scriptType & PLUGIN_SCRIPT) != 0)); - final Element filter = new Element("filter"); - filter.addContent(Boolean.toString((scriptType & PLUGIN_FILTER) != 0)); - modes.addContent(autoboot); - modes.addContent(bash); - modes.addContent(filter); - } - - root.addContent(modes); - for (final PluginParameter parameter : parameters) { - root.addContent(parameter.toXML()); - } - return root; - } - - public void convertType(final int index, final String newType) throws NoSuchParameterException { - parameters.set(index, PluginParameterFactory.createParameter(newType, parameters.get(index).toXML())); - modified = true; - notifyListeners(); - } - - public void convertType(final PluginParameter parameter, final String newType) throws NoSuchParameterException { - final int index = parameters.indexOf(parameter); - convertType(index, newType); - } - - /** - * Return whether the script contents has been modified since last save. - * @return Whether the script contents has been modified since last save. - */ - public boolean isModified() { - return modified; - } - - /** Mark the script as unmodified since last save. */ - public void resetModified() { - if (!modified) { - return; - } - - modified = false; - notifyListeners(); - } - - /** - * Return the location to save this script to. - * @return The location to save to, or <code>null</code> if the script has - * no associated location. - */ - @Nullable - public File getFile() { - return file; - } - - /** - * Set The location to save this script to. - * @param file The location; may be <code>null</code>. - */ - public void setFile(@Nullable final File file) { - this.file = file; - } - -} // class ScriptModel Copied: trunk/src/app/net/sf/gridarta/script/ScriptModel.java (from rev 5301, trunk/crossfire/src/cfeditor/script/ScriptModel.java) =================================================================== --- trunk/src/app/net/sf/gridarta/script/ScriptModel.java (rev 0) +++ trunk/src/app/net/sf/gridarta/script/ScriptModel.java 2008-10-01 14:58:44 UTC (rev 5303) @@ -0,0 +1,512 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2007 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.script; + +import java.io.File; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import net.sf.gridarta.script.parameter.NoSuchParameterException; +import net.sf.gridarta.script.parameter.PluginParameter; +import net.sf.gridarta.script.parameter.PluginParameterFactory; +import org.apache.log4j.Logger; +import org.jdom.CDATA; +import org.jdom.Element; +import org.jdom.IllegalDataException; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Model for Scripts. + * @author tchize + * @todo documentation + */ +public final class ScriptModel implements Cloneable { + + /** The Logger for printing log messages. */ + private static final Logger log = Logger.getLogger(ScriptModel.class); + + public static final int PLUGIN_AUTOBOOT = 1; + + public static final int PLUGIN_FILTER = 2; + + public static final int PLUGIN_SCRIPT = 4; + + public static final Integer RUN_AUTOBOOT = 1; + + public static final Integer RUN_FILTER = 2; + + public static final Integer RUN_SCRIPT = 4; + + private String code = ""; + + private final List<PluginParameter> parameters = new ArrayList<PluginParameter>(); + + private String name = ""; + + private int scriptType; + + private final Set<ChangeListener> listeners = new HashSet<ChangeListener>(); + + /** + * The location to save this script to; set to <code>null</code> if the + * script has no associated location. + */ + @Nullable + private File file = null; + + /** Whether the script contents has been modified since last save. */ + private boolean modified = false; + + /** + * Creates a new instance. + */ + public ScriptModel() { + } + + /** + * Returns the name of this ScriptModel. + * @return The name of this ScriptModel. + */ + public String getName() { + return name; + } + + /** + * Sets the name of this ScriptModel. + * @param name The name of this ScriptModel. + * @todo Maybe this should be moved to the constructor and the underlying + * field made final. + */ + public void setName(final String name) { + if (this.name.equals(name)) { + return; + } + + this.name = name; + modified = true; + notifyListeners(); + } + + /** + * Returns the code of this ScriptModel. + * @return The code of this ScriptModel. + * @todo Improve name - what code is it? Source code? A special coded + * String? + */ + public String getCode() { + return code; + } + + /** + * Sets the code of this ScriptModel. + * @param code The code of this ScriptModel. + */ + public void setCode(final String code) { + if (this.code.equals(code)) { + return; + } + + this.code = code; + modified = true; + notifyListeners(); + } + + /** + * Set the name of a given parameter. + * @param index The index of parameter to rename + * @param name the new name of parameter + */ + public void setParamName(final int index, final String name) { + try { + if (parameters.get(index).setName(name)) { + modified = true; + notifyListeners(); + } + } catch (final Exception e) { + } + } + + /** + * Get the name of a script parameter. + * @param index The index number of parameter + * @return the name of parameter + */ + @Nullable + public String getParamName(final int index) { + try { + return parameters.get(index).getName(); + } catch (final Exception e) { + return null; + } + + } + + /** + * Returns the parameter description for the parameter with the specified + * index. + * @param index the parameter index to get + * @return The description of the specified parameter. + */ + @Nullable + public String getParamDescription(final int index) { + try { + return parameters.get(index).getDescription(); + } catch (final Exception e) { + return null; + } + } + + /** + * Sets the parameter description for the parameter with the specified + * index. + * @param index the parameter index to set + * @param description the new description of parameter + */ + public void setParamDescription(final int index, final String description) { + try { + if (parameters.get(index).setDescription(description)) { + modified = true; + notifyListeners(); + } + } catch (final Exception e) { + } + } + + /** + * Returns the parameter value for the parameter with the specified index. + * @param index the parameter index to get + * @return Returns the parameter default value. + */ + @Nullable + public Object getParamValue(final int index) { + try { + return parameters.get(index).getValue(); + } catch (final Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * Sets the parameter value for the parameter with the specified index. + * @param index the parameter index to set + * @param value the default value to set + */ + public void setParamValue(final int index, final Object value) { + try { + if (parameters.get(index).setValue(value)) { + modified = true; + notifyListeners(); + } + } catch (final Exception e) { + } + } + + public int getParametersCount() { + return parameters.size(); + } + + public String[] getParameters() { + final List<String> l = new ArrayList<String>(); + for (final PluginParameter p : parameters) { + if (!l.contains(p.getName())) { + l.add(p.getName()); + } + } + return l.toArray(new String[l.size()]); + } + + /** + * Returns the index for a parameter name. + * @param paramName the parameter name + * @return the index or <code>-1</code> if the parameter name does not + * exist + */ + public int getParameter(@NotNull final String paramName) { + int index = 0; + for (final PluginParameter param : parameters) { + if (param.getName().equals(paramName)) { + return index; + } + index++; + } + return -1; + } + + @Override + public String toString() { + return name; + } + + public void newParameter() { + final PluginParameter p; + try { + p = PluginParameterFactory.createParameter((String) null); + } catch (final NoSuchParameterException ex) { + log.warn("Cannot create parameter: " + ex.getMessage()); + return; + } + parameters.add(p); + modified = true; + notifyListeners(); + } + + public void removeParameter(final int index) { + parameters.remove(index); + modified = true; + notifyListeners(); + } + + public void addChangeListener(final ChangeListener listener) { + listeners.add(listener); + } + + public void removeListener(final ChangeListener listener) { + listeners.remove(listener); + } + + /** Tell all listeners plugged on this ScriptModel its content has changed. */ + private void notifyListeners() { + final ChangeEvent e = new ChangeEvent(this); + for (final ChangeListener listener : listeners) { + listener.stateChanged(e); + } + } + + /** + * Get a clone copy of this SCriptModel. The copy include name, code, type + * and a clone of each parameter. The listener are not moved along. + * @return a clone of this ScriptModel + */ + @Override + public Object clone() throws CloneNotSupportedException { + final ScriptModel model = new ScriptModel(); + model.code = code; + model.name = name; + model.scriptType = scriptType; + model.modified = modified; + for (final PluginParameter param : parameters) { + model.addParameter((PluginParameter) param.clone()); + } + return model; + } + + /** + * Adds a parameter to this script. + * @param p the parameter to add + */ + public void addParameter(final PluginParameter p) { + parameters.add(p); + modified = true; + notifyListeners(); + } + + /** + * Gets the PluginParameter at a given index. + * @param index The index of parameter to get. Must be between 0 and + * getParametersCount(). If index is out of range, result is undefined. + * @return the requested parameter + */ + public PluginParameter getParameter(final int index) { + return parameters.get(index); + } + + /** + * Check if this script is an autoboot script (a script run at load time). + * @return true if script is an autoboot script, false otherwise + */ + public boolean isAutoboot() { + if (log.isDebugEnabled()) { + log.debug("isautoboot: scriptType = " + scriptType); + } + return (scriptType & PLUGIN_AUTOBOOT) != 0; + } + + /** + * Check if this script is a bash script (script run from the run script + * menu). + * @return true if script is a bash script, false otherwise + */ + public boolean isBash() { + return (scriptType & PLUGIN_SCRIPT) != 0; + } + + /** + * Check if this script is a filter script (will appear in the map filter + * list menu). + * @return true if the script is a filter script, false otherwise + */ + public boolean isFilter() { + return (scriptType & PLUGIN_FILTER) != 0; + } + + public void toggleScriptType(final int type, final boolean b) { + if (b) { + if ((scriptType & type) == type) { + return; + } + + scriptType |= type; + } else { + if ((scriptType & type) == 0) { + return; + } + + scriptType &= ~type; + } + modified = true; + notifyListeners(); + } + + public void setAutoboot(final boolean b) { + toggleScriptType(PLUGIN_AUTOBOOT, b); + } + + public void setBash(final boolean b) { + toggleScriptType(PLUGIN_SCRIPT, b); + } + + public void setFilter(final boolean b) { + toggleScriptType(PLUGIN_FILTER, b); + } + + public void fromXML(final Element node) { + setName(node.getChildTextTrim("name")); + setCode(node.getChildTextTrim("code")); + scriptType = 0; + final Element mode = node.getChild("mode"); + if (mode == null) { + scriptType = PLUGIN_SCRIPT; + } else { + final List<Element> modes = mode.getChildren(); + for (final Element m : modes) { + final boolean b = Boolean.valueOf(m.getTextTrim()); + final String name = m.getName(); + if ("autoboot".equalsIgnoreCase(name) && b) { + scriptType |= PLUGIN_AUTOBOOT; + } else if ("filter".equalsIgnoreCase(name) && b) { + scriptType |= PLUGIN_FILTER; + } else if ("bash".equalsIgnoreCase(name) && b) { + scriptType |= PLUGIN_SCRIPT; + } + } + } + final List<Element> params = node.getChildren("parameter"); + if (params != null && !params.isEmpty()) { + for (final Element parameter : params) { + final PluginParameter p; + try { + p = PluginParameterFactory.createParameter(parameter); + } catch (final NoSuchParameterException ex) { + log.warn("Cannot create parameter type " + ex.getMessage() + ", dropping parameter"); + continue; + } + addParameter(p); + } + } + modified = false; + } + + public Element toXML() { + final Element root = new Element("script"); + final Element n = new Element("name"); + final Element c = new Element("code"); + n.addContent(name); + try { + c.addContent(new CDATA(code));// protect code in xml! + } catch (final IllegalDataException e) { + //can't be converted to CDATA :( + c.addContent(code); + } + root.addContent(n); + root.addContent(c); + final Element modes = new Element("mode"); + + { + final Element autoboot = new Element("autoboot"); + autoboot.addContent(Boolean.toString((scriptType & PLUGIN_AUTOBOOT) != 0)); + final Element bash = new Element("bash"); + bash.addContent(Boolean.toString((scriptType & PLUGIN_SCRIPT) != 0)); + final Element filter = new Element("filter"); + filter.addContent(Boolean.toString((scriptType & PLUGIN_FILTER) != 0)); + modes.addContent(autoboot); + modes.addContent(bash); + modes.addContent(filter); + } + + root.addContent(modes); + for (final PluginParameter parameter : parameters) { + root.addContent(parameter.toXML()); + } + return root; + } + + public void convertType(final int index, final String newType) throws NoSuchParameterException { + parameters.set(index, PluginParameterFactory.createParameter(newType, parameters.get(index).toXML())); + modified = true; + notifyListeners(); + } + + public void convertType(final PluginParameter parameter, final String newType) throws NoSuchParameterException { + final int index = parameters.indexOf(parameter); + convertType(index, newType); + } + + /** + * Return whether the script contents has been modified since last save. + * @return Whether the script contents has been modified since last save. + */ + public boolean isModified() { + return modified; + } + + /** Mark the script as unmodified since last save. */ + public void resetModified() { + if (!modified) { + return; + } + + modified = false; + notifyListeners(); + } + + /** + * Return the location to save this script to. + * @return The location to save to, or <code>null</code> if the script has + * no associated location. + */ + @Nullable + public File getFile() { + return file; + } + + /** + * Set The location to save this script to. + * @param file The location; may be <code>null</code>. + */ + public void setFile(@Nullable final File file) { + this.file = file; + } + +} // class ScriptModel Property changes on: trunk/src/app/net/sf/gridarta/script/ScriptModel.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:mergeinfo + Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-10-01 16:03:06
|
Revision: 5308 http://gridarta.svn.sourceforge.net/gridarta/?rev=5308&view=rev Author: akirschbaum Date: 2008-10-01 16:02:21 +0000 (Wed, 01 Oct 2008) Log Message: ----------- Remove raw types. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/script/ScriptEditor.java trunk/crossfire/src/cfeditor/gui/script/ScriptView.java trunk/crossfire/src/cfeditor/gui/script/parameter/ParameterDescriptionEditor.java trunk/crossfire/src/cfeditor/gui/script/parameter/ParameterTypeEditor.java trunk/crossfire/src/cfeditor/gui/script/parameter/PluginParameterViewFactory.java trunk/crossfire/src/cfeditor/script/ScriptController.java trunk/src/app/net/sf/gridarta/script/ScriptModel.java trunk/src/app/net/sf/gridarta/script/parameter/PluginParameterFactory.java Modified: trunk/crossfire/src/cfeditor/gui/script/ScriptEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/ScriptEditor.java 2008-10-01 15:35:31 UTC (rev 5307) +++ trunk/crossfire/src/cfeditor/gui/script/ScriptEditor.java 2008-10-01 16:02:21 UTC (rev 5308) @@ -77,13 +77,13 @@ private final ScriptModel script; - private final Map<PluginParameter, ParameterNameEditor> paramNameEditors = new HashMap<PluginParameter, ParameterNameEditor>(); + private final Map<PluginParameter<?, ?>, ParameterNameEditor> paramNameEditors = new HashMap<PluginParameter<?, ?>, ParameterNameEditor>(); - private final Map<PluginParameter, ParameterDescriptionEditor> paramDescriptionEditors = new HashMap<PluginParameter, ParameterDescriptionEditor>(); + private final Map<PluginParameter<?, ?>, ParameterDescriptionEditor> paramDescriptionEditors = new HashMap<PluginParameter<?, ?>, ParameterDescriptionEditor>(); - private final Map<PluginParameter, ParameterTypeEditor> paramTypeEditors = new HashMap<PluginParameter, ParameterTypeEditor>(); + private final Map<PluginParameter<?, ?>, ParameterTypeEditor> paramTypeEditors = new HashMap<PluginParameter<?, ?>, ParameterTypeEditor>(); - private final Map<PluginParameter, PluginParameterView> paramViews = new HashMap<PluginParameter, PluginParameterView>(); + private final Map<PluginParameter<?, ?>, PluginParameterView> paramViews = new HashMap<PluginParameter<?, ?>, PluginParameterView>(); private int selectedRow = -1; @@ -233,7 +233,7 @@ return; } - final PluginParameter parameter; + final PluginParameter<?, ?> parameter; try { parameter = getScript().getParameter(selectedRow); } catch (final NoSuchParameterException ex) { @@ -301,7 +301,7 @@ gbc.gridx = 4; paramTable.add(new JLabel("Default"), gbc); int i = 0; - for (final PluginParameter parameter : script) { + for (final PluginParameter<?, ?> parameter : script) { gbc.gridy = i + 1; putRow(gbc, parameter); i++; @@ -314,7 +314,7 @@ c.addMouseListener(cellMouseListener); } - private ParameterNameEditor getParameterNameEditor(final PluginParameter param) { + private ParameterNameEditor getParameterNameEditor(final PluginParameter<?, ?> param) { if (log.isDebugEnabled()) { log.debug("Doing " + param); } @@ -330,7 +330,7 @@ return newParameterNameEditor; } - private ParameterDescriptionEditor getParameterDescriptionEditor(final PluginParameter param) { + private ParameterDescriptionEditor getParameterDescriptionEditor(final PluginParameter<?, ?> param) { final ParameterDescriptionEditor existingParameterDescriptionEditor = paramDescriptionEditors.get(param); if (existingParameterDescriptionEditor != null) { return existingParameterDescriptionEditor; @@ -342,7 +342,7 @@ return newParameterDescriptionEditor; } - private ParameterTypeEditor getParameterTypeEditor(final PluginParameter param) { + private ParameterTypeEditor getParameterTypeEditor(final PluginParameter<?, ?> param) { final ParameterTypeEditor existingPArameterTypeEditor = paramTypeEditors.get(param); if (existingPArameterTypeEditor != null) { return existingPArameterTypeEditor; @@ -354,7 +354,7 @@ return newParameterTypeEditor; } - private PluginParameterView getParameterView(final PluginParameter param) { + private PluginParameterView getParameterView(final PluginParameter<?, ?> param) { final PluginParameterView existingPluginParameterView = paramViews.get(param); if (existingPluginParameterView != null) { return existingPluginParameterView; @@ -375,7 +375,7 @@ return newPluginParameterView; } - private void putRow(final GridBagConstraints gbc, final PluginParameter param) { + private void putRow(final GridBagConstraints gbc, final PluginParameter<?, ?> param) { gbc.gridx = 0; paramTable.add(getParameterNameEditor(param), gbc); gbc.gridx = 1; Modified: trunk/crossfire/src/cfeditor/gui/script/ScriptView.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/ScriptView.java 2008-10-01 15:35:31 UTC (rev 5307) +++ trunk/crossfire/src/cfeditor/gui/script/ScriptView.java 2008-10-01 16:02:21 UTC (rev 5308) @@ -217,7 +217,7 @@ dialog.setTitle(model.getName()); dialog.getContentPane().removeAll(); int i = 0; - for (final PluginParameter parameter : model) { + for (final PluginParameter<?, ?> parameter : model) { log.debug("adding parameter"); final JLabel name = new JLabel(parameter.getName()); final PluginParameterView view = pluginParameterViewFactory.getView(parameter); Modified: trunk/crossfire/src/cfeditor/gui/script/parameter/ParameterDescriptionEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/parameter/ParameterDescriptionEditor.java 2008-10-01 15:35:31 UTC (rev 5307) +++ trunk/crossfire/src/cfeditor/gui/script/parameter/ParameterDescriptionEditor.java 2008-10-01 16:02:21 UTC (rev 5308) @@ -26,11 +26,11 @@ public class ParameterDescriptionEditor extends JTextField { - private final PluginParameter parameter; + private final PluginParameter<?, ?> parameter; private static final long serialVersionUID = 1L; - public ParameterDescriptionEditor(final PluginParameter param) { + public ParameterDescriptionEditor(final PluginParameter<?, ?> param) { parameter = param; setText(param.getDescription()); getDocument().addDocumentListener(new DocumentListener() { Modified: trunk/crossfire/src/cfeditor/gui/script/parameter/ParameterTypeEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/parameter/ParameterTypeEditor.java 2008-10-01 15:35:31 UTC (rev 5307) +++ trunk/crossfire/src/cfeditor/gui/script/parameter/ParameterTypeEditor.java 2008-10-01 16:02:21 UTC (rev 5308) @@ -35,7 +35,7 @@ private static final long serialVersionUID = 1L; - private final PluginParameter parameter; + private final PluginParameter<?, ?> parameter; private final ScriptModel script; @@ -56,7 +56,7 @@ }; - public ParameterTypeEditor(final ScriptModel script, final PluginParameter parameter) { + public ParameterTypeEditor(final ScriptModel script, final PluginParameter<?, ?> parameter) { super(PluginParameterFactory.getTypes()); this.parameter = parameter; this.script = script; Modified: trunk/crossfire/src/cfeditor/gui/script/parameter/PluginParameterViewFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/parameter/PluginParameterViewFactory.java 2008-10-01 15:35:31 UTC (rev 5307) +++ trunk/crossfire/src/cfeditor/gui/script/parameter/PluginParameterViewFactory.java 2008-10-01 16:02:21 UTC (rev 5308) @@ -115,7 +115,7 @@ } @NotNull - public PluginParameterView getView(@NotNull final PluginParameter parameter) { + public PluginParameterView getView(@NotNull final PluginParameter<?, ?> parameter) { view = null; parameter.visit(visitor); assert view != null; Modified: trunk/crossfire/src/cfeditor/script/ScriptController.java =================================================================== --- trunk/crossfire/src/cfeditor/script/ScriptController.java 2008-10-01 15:35:31 UTC (rev 5307) +++ trunk/crossfire/src/cfeditor/script/ScriptController.java 2008-10-01 16:02:21 UTC (rev 5308) @@ -387,7 +387,7 @@ try { runner.setConsole(console); scriptParameters.setInterpreterValues(runner, ScriptRunMode.BATCH); - for (final PluginParameter parameter : model) { + for (final PluginParameter<?, ?> parameter : model) { runner.set(parameter.getName(), parameter.getValue()); } scriptThread = new BshThread(model.getName()); @@ -540,7 +540,7 @@ if (index == -1) { final StringBuilder sb = new StringBuilder(); boolean firstParameter = true; - for (final PluginParameter parameter : model) { + for (final PluginParameter<?, ?> parameter : model) { sb.append(firstParameter ? " " : ", "); sb.append(parameter.getName()); firstParameter = false; @@ -548,7 +548,7 @@ throw new ScriptExecException("script " + script + " has no parameter " + tmp[0] + "; available parameters:" + sb); } - final PluginParameter parameter; + final PluginParameter<?, ?> parameter; try { parameter = model.getParameter(index); } catch (final NoSuchParameterException ex) { Modified: trunk/src/app/net/sf/gridarta/script/ScriptModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/ScriptModel.java 2008-10-01 15:35:31 UTC (rev 5307) +++ trunk/src/app/net/sf/gridarta/script/ScriptModel.java 2008-10-01 16:02:21 UTC (rev 5308) @@ -43,7 +43,7 @@ * @author tchize * @todo documentation */ -public final class ScriptModel implements Cloneable, Iterable<PluginParameter> { +public final class ScriptModel implements Cloneable, Iterable<PluginParameter<?, ?>> { /** The Logger for printing log messages. */ private static final Logger log = Logger.getLogger(ScriptModel.class); @@ -56,7 +56,7 @@ private String code = ""; - private final List<PluginParameter> parameters = new ArrayList<PluginParameter>(); + private final List<PluginParameter<?, ?>> parameters = new ArrayList<PluginParameter<?, ?>>(); private String name = ""; @@ -144,7 +144,7 @@ */ public int getParameter(@NotNull final String paramName) { int index = 0; - for (final PluginParameter param : parameters) { + for (final PluginParameter<?, ?> param : parameters) { if (param.getName().equals(paramName)) { return index; } @@ -159,7 +159,7 @@ } public void newParameter() { - final PluginParameter p; + final PluginParameter<?, ?> p; try { p = PluginParameterFactory.createParameter((String) null); } catch (final NoSuchParameterException ex) { @@ -205,8 +205,8 @@ model.name = name; model.scriptType = scriptType; model.modified = modified; - for (final PluginParameter param : parameters) { - model.addParameter((PluginParameter) param.clone()); + for (final PluginParameter<?, ?> param : parameters) { + model.addParameter((PluginParameter<?, ?>) param.clone()); } return model; } @@ -215,7 +215,7 @@ * Adds a parameter to this script. * @param p the parameter to add */ - public void addParameter(final PluginParameter p) { + public void addParameter(final PluginParameter<?, ?> p) { parameters.add(p); modified = true; notifyListeners(); @@ -227,7 +227,7 @@ * getParametersCount(). If index is out of range, result is undefined. * @return the requested parameter */ - public PluginParameter getParameter(final int index) throws NoSuchParameterException { + public PluginParameter<?, ?> getParameter(final int index) throws NoSuchParameterException { try { return parameters.get(index); } catch (final IndexOutOfBoundsException ex) { @@ -318,7 +318,7 @@ final List<Element> params = node.getChildren("parameter"); if (params != null && !params.isEmpty()) { for (final Element parameter : params) { - final PluginParameter p; + final PluginParameter<?, ?> p; try { p = PluginParameterFactory.createParameter(parameter); } catch (final NoSuchParameterException ex) { @@ -359,7 +359,7 @@ } root.addContent(modes); - for (final PluginParameter parameter : parameters) { + for (final PluginParameter<?, ?> parameter : parameters) { root.addContent(parameter.toXML()); } return root; @@ -371,7 +371,7 @@ notifyListeners(); } - public void convertType(final PluginParameter parameter, final String newType) throws NoSuchParameterException { + public void convertType(final PluginParameter<?, ?> parameter, final String newType) throws NoSuchParameterException { final int index = parameters.indexOf(parameter); convertType(index, newType); } @@ -413,7 +413,7 @@ } /** {@inheritDoc} */ - public Iterator<PluginParameter> iterator() { + public Iterator<PluginParameter<?, ?>> iterator() { return Collections.unmodifiableList(parameters).iterator(); } Modified: trunk/src/app/net/sf/gridarta/script/parameter/PluginParameterFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/parameter/PluginParameterFactory.java 2008-10-01 15:35:31 UTC (rev 5307) +++ trunk/src/app/net/sf/gridarta/script/parameter/PluginParameterFactory.java 2008-10-01 16:02:21 UTC (rev 5308) @@ -56,12 +56,12 @@ } @Nullable - public static PluginParameter createParameter(final Element parameterNode) throws NoSuchParameterException { + public static PluginParameter<?, ?> createParameter(final Element parameterNode) throws NoSuchParameterException { return createParameter(parameterNode.getChildText("type"), parameterNode); } @NotNull - public static PluginParameter createParameter(@Nullable final String type) throws NoSuchParameterException { + public static PluginParameter<?, ?> createParameter(@Nullable final String type) throws NoSuchParameterException { final String typeClass = type == null ? "java.lang.String" : type; final Class<? extends PluginParameter> c = parameterTypes.get(typeClass); if (c == null) { @@ -81,7 +81,7 @@ } @NotNull - public static PluginParameter createParameter(@Nullable final String type, final Element parameterNode) throws NoSuchParameterException { + public static PluginParameter<?, ?> createParameter(@Nullable final String type, final Element parameterNode) throws NoSuchParameterException { final String typeClass = type == null ? "java.lang.String" : type; final Class<? extends PluginParameter> c = parameterTypes.get(typeClass); if (c == null) { @@ -89,7 +89,7 @@ } try { - final PluginParameter p = c.newInstance(); + final PluginParameter<?, ?> p = c.newInstance(); p.fromXML(parameterNode); return p; } catch (final Exception e) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-10-01 16:15:46
|
Revision: 5309 http://gridarta.svn.sourceforge.net/gridarta/?rev=5309&view=rev Author: akirschbaum Date: 2008-10-01 16:15:21 +0000 (Wed, 01 Oct 2008) Log Message: ----------- Extract ScriptModelParser from ScriptModel. Modified Paths: -------------- trunk/crossfire/src/cfeditor/script/ScriptController.java trunk/src/app/net/sf/gridarta/script/ScriptModel.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/script/ScriptModelParser.java Modified: trunk/crossfire/src/cfeditor/script/ScriptController.java =================================================================== --- trunk/crossfire/src/cfeditor/script/ScriptController.java 2008-10-01 16:02:21 UTC (rev 5308) +++ trunk/crossfire/src/cfeditor/script/ScriptController.java 2008-10-01 16:15:21 UTC (rev 5309) @@ -50,6 +50,7 @@ import net.sf.gridarta.filter.Filter; import net.sf.gridarta.filter.FilterControl; import net.sf.gridarta.script.ScriptModel; +import net.sf.gridarta.script.ScriptModelParser; import net.sf.gridarta.script.parameter.PluginParameter; import net.sf.gridarta.script.parameter.NoSuchParameterException; import net.sf.japi.swing.ActionFactory; @@ -195,7 +196,7 @@ } final ScriptModel cScript = new ScriptModel(); - cScript.fromXML(elt); + ScriptModelParser.fromXML(cScript, elt); cScript.setFile(file); log.debug("script: " + cScript.getName()); if (override || !scripts.containsKey(cScript.getName())) { @@ -318,7 +319,7 @@ public static void saveScript(@NotNull final ScriptModel scriptModel, @NotNull final File file) throws IOException { final FileOutputStream fos = new FileOutputStream(file); try { - final Element root = scriptModel.toXML(); + final Element root = ScriptModelParser.toXML(scriptModel); final Document d = new Document(root); final XMLOutputter out = new XMLOutputter(); out.setFormat(Format.getPrettyFormat()); Modified: trunk/src/app/net/sf/gridarta/script/ScriptModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/ScriptModel.java 2008-10-01 16:02:21 UTC (rev 5308) +++ trunk/src/app/net/sf/gridarta/script/ScriptModel.java 2008-10-01 16:15:21 UTC (rev 5309) @@ -32,9 +32,6 @@ import net.sf.gridarta.script.parameter.PluginParameter; import net.sf.gridarta.script.parameter.PluginParameterFactory; import org.apache.log4j.Logger; -import org.jdom.CDATA; -import org.jdom.Element; -import org.jdom.IllegalDataException; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -282,6 +279,16 @@ notifyListeners(); } + public void setScriptType(final int type) { + if (scriptType == type) { + return; + } + + scriptType = type; + modified = true; + notifyListeners(); + } + public void setAutoboot(final boolean b) { toggleScriptType(PLUGIN_AUTOBOOT, b); } @@ -294,77 +301,6 @@ toggleScriptType(PLUGIN_FILTER, b); } - public void fromXML(final Element node) { - setName(node.getChildTextTrim("name")); - setCode(node.getChildTextTrim("code")); - scriptType = 0; - final Element mode = node.getChild("mode"); - if (mode == null) { - scriptType = PLUGIN_SCRIPT; - } else { - final List<Element> modes = mode.getChildren(); - for (final Element m : modes) { - final boolean b = Boolean.valueOf(m.getTextTrim()); - final String name = m.getName(); - if ("autoboot".equalsIgnoreCase(name) && b) { - scriptType |= PLUGIN_AUTOBOOT; - } else if ("filter".equalsIgnoreCase(name) && b) { - scriptType |= PLUGIN_FILTER; - } else if ("bash".equalsIgnoreCase(name) && b) { - scriptType |= PLUGIN_SCRIPT; - } - } - } - final List<Element> params = node.getChildren("parameter"); - if (params != null && !params.isEmpty()) { - for (final Element parameter : params) { - final PluginParameter<?, ?> p; - try { - p = PluginParameterFactory.createParameter(parameter); - } catch (final NoSuchParameterException ex) { - log.warn("Cannot create parameter type " + ex.getMessage() + ", dropping parameter"); - continue; - } - addParameter(p); - } - } - modified = false; - } - - public Element toXML() { - final Element root = new Element("script"); - final Element n = new Element("name"); - final Element c = new Element("code"); - n.addContent(name); - try { - c.addContent(new CDATA(code));// protect code in xml! - } catch (final IllegalDataException e) { - //can't be converted to CDATA :( - c.addContent(code); - } - root.addContent(n); - root.addContent(c); - final Element modes = new Element("mode"); - - { - final Element autoboot = new Element("autoboot"); - autoboot.addContent(Boolean.toString((scriptType & PLUGIN_AUTOBOOT) != 0)); - final Element bash = new Element("bash"); - bash.addContent(Boolean.toString((scriptType & PLUGIN_SCRIPT) != 0)); - final Element filter = new Element("filter"); - filter.addContent(Boolean.toString((scriptType & PLUGIN_FILTER) != 0)); - modes.addContent(autoboot); - modes.addContent(bash); - modes.addContent(filter); - } - - root.addContent(modes); - for (final PluginParameter<?, ?> parameter : parameters) { - root.addContent(parameter.toXML()); - } - return root; - } - public void convertType(final int index, final String newType) throws NoSuchParameterException { parameters.set(index, PluginParameterFactory.createParameter(newType, parameters.get(index).toXML())); modified = true; Added: trunk/src/app/net/sf/gridarta/script/ScriptModelParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/ScriptModelParser.java (rev 0) +++ trunk/src/app/net/sf/gridarta/script/ScriptModelParser.java 2008-10-01 16:15:21 UTC (rev 5309) @@ -0,0 +1,118 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2007 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.script; + +import java.util.List; +import net.sf.gridarta.script.parameter.NoSuchParameterException; +import net.sf.gridarta.script.parameter.PluginParameter; +import net.sf.gridarta.script.parameter.PluginParameterFactory; +import org.apache.log4j.Logger; +import org.jdom.CDATA; +import org.jdom.Element; +import org.jdom.IllegalDataException; +import org.jetbrains.annotations.NotNull; + +/** + * Utility parser class for {@link ScriptModel} instances. + * @author tchize + */ +public class ScriptModelParser { + + /** The Logger for printing log messages. */ + private static final Logger log = Logger.getLogger(ScriptModelParser.class); + + /** + * Private constructor to prevent instantiation. + */ + private ScriptModelParser() { + } + + public static void fromXML(@NotNull final ScriptModel scriptModel, @NotNull final Element node) { + scriptModel.setName(node.getChildTextTrim("name")); + scriptModel.setCode(node.getChildTextTrim("code")); + int scriptType = 0; + final Element mode = node.getChild("mode"); + if (mode == null) { + scriptType = ScriptModel.PLUGIN_SCRIPT; + } else { + final List<Element> modes = mode.getChildren(); + for (final Element m : modes) { + final boolean b = Boolean.valueOf(m.getTextTrim()); + final String name = m.getName(); + if ("autoboot".equalsIgnoreCase(name) && b) { + scriptType |= ScriptModel.PLUGIN_AUTOBOOT; + } else if ("filter".equalsIgnoreCase(name) && b) { + scriptType |= ScriptModel.PLUGIN_FILTER; + } else if ("bash".equalsIgnoreCase(name) && b) { + scriptType |= ScriptModel.PLUGIN_SCRIPT; + } + } + } + scriptModel.setScriptType(scriptType); + final List<Element> params = node.getChildren("parameter"); + if (params != null && !params.isEmpty()) { + for (final Element parameter : params) { + final PluginParameter<?, ?> p; + try { + p = PluginParameterFactory.createParameter(parameter); + } catch (final NoSuchParameterException ex) { + log.warn("Cannot create parameter type " + ex.getMessage() + ", dropping parameter"); + continue; + } + scriptModel.addParameter(p); + } + } + scriptModel.resetModified(); + } + + public static Element toXML(@NotNull final ScriptModel scriptModel) { + final Element root = new Element("script"); + final Element n = new Element("name"); + final Element c = new Element("code"); + n.addContent(scriptModel.getName()); + try { + c.addContent(new CDATA(scriptModel.getCode()));// protect code in xml! + } catch (final IllegalDataException e) { + //can't be converted to CDATA :( + c.addContent(scriptModel.getCode()); + } + root.addContent(n); + root.addContent(c); + final Element modes = new Element("mode"); + + { + final Element autoboot = new Element("autoboot"); + autoboot.addContent(Boolean.toString(scriptModel.isAutoboot())); + final Element bash = new Element("bash"); + bash.addContent(Boolean.toString(scriptModel.isBash())); + final Element filter = new Element("filter"); + filter.addContent(Boolean.toString(scriptModel.isFilter())); + modes.addContent(autoboot); + modes.addContent(bash); + modes.addContent(filter); + } + + root.addContent(modes); + for (final PluginParameter<?, ?> parameter : scriptModel) { + root.addContent(parameter.toXML()); + } + return root; + } +} // class ScriptModelParser Property changes on: trunk/src/app/net/sf/gridarta/script/ScriptModelParser.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-10-01 16:24:14
|
Revision: 5313 http://gridarta.svn.sourceforge.net/gridarta/?rev=5313&view=rev Author: akirschbaum Date: 2008-10-01 16:23:42 +0000 (Wed, 01 Oct 2008) Log Message: ----------- Rename method names. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/script/ScriptEditor.java trunk/crossfire/src/cfeditor/gui/script/ScriptView.java trunk/src/app/net/sf/gridarta/script/ScriptModel.java trunk/src/app/net/sf/gridarta/script/ScriptModelParser.java Modified: trunk/crossfire/src/cfeditor/gui/script/ScriptEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/ScriptEditor.java 2008-10-01 16:22:09 UTC (rev 5312) +++ trunk/crossfire/src/cfeditor/gui/script/ScriptEditor.java 2008-10-01 16:23:42 UTC (rev 5313) @@ -181,10 +181,10 @@ typeBash = new JCheckBox("reference in the manual run list"); typeBash.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { - getScript().setBash(typeBash.isSelected()); + getScript().setScript(typeBash.isSelected()); } }); - typeBash.setSelected(script.isBash()); + typeBash.setSelected(script.isScript()); optionsTab.add(typeBash, gbc); gbc.gridx = 0; gbc.gridy = 4; Modified: trunk/crossfire/src/cfeditor/gui/script/ScriptView.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/ScriptView.java 2008-10-01 16:22:09 UTC (rev 5312) +++ trunk/crossfire/src/cfeditor/gui/script/ScriptView.java 2008-10-01 16:23:42 UTC (rev 5313) @@ -140,7 +140,7 @@ int index = 0; for (final String script : control.listScript()) { - if (!control.getScript(script).isBash()) { + if (!control.getScript(script).isScript()) { continue; } Modified: trunk/src/app/net/sf/gridarta/script/ScriptModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/ScriptModel.java 2008-10-01 16:22:09 UTC (rev 5312) +++ trunk/src/app/net/sf/gridarta/script/ScriptModel.java 2008-10-01 16:23:42 UTC (rev 5313) @@ -244,11 +244,10 @@ } /** - * Check if this script is a bash script (script run from the run script - * menu). - * @return true if script is a bash script, false otherwise + * Check if this script is a script (script run from the run script menu). + * @return true if script is a script, false otherwise */ - public boolean isBash() { + public boolean isScript() { return (scriptType & PLUGIN_SCRIPT) != 0; } @@ -283,7 +282,7 @@ setScriptType(PLUGIN_AUTOBOOT, b); } - public void setBash(final boolean b) { + public void setScript(final boolean b) { setScriptType(PLUGIN_SCRIPT, b); } Modified: trunk/src/app/net/sf/gridarta/script/ScriptModelParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/ScriptModelParser.java 2008-10-01 16:22:09 UTC (rev 5312) +++ trunk/src/app/net/sf/gridarta/script/ScriptModelParser.java 2008-10-01 16:23:42 UTC (rev 5313) @@ -69,7 +69,7 @@ } scriptModel.setAutoboot(isAutoboot); scriptModel.setFilter(isFilter); - scriptModel.setBash(isScript); + scriptModel.setScript(isScript); final List<Element> params = node.getChildren("parameter"); if (params != null && !params.isEmpty()) { for (final Element parameter : params) { @@ -105,7 +105,7 @@ final Element autoboot = new Element("autoboot"); autoboot.addContent(Boolean.toString(scriptModel.isAutoboot())); final Element bash = new Element("bash"); - bash.addContent(Boolean.toString(scriptModel.isBash())); + bash.addContent(Boolean.toString(scriptModel.isScript())); final Element filter = new Element("filter"); filter.addContent(Boolean.toString(scriptModel.isFilter())); modes.addContent(autoboot); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |