From: <aki...@us...> - 2008-06-04 21:20:49
|
Revision: 4102 http://gridarta.svn.sourceforge.net/gridarta/?rev=4102&view=rev Author: akirschbaum Date: 2008-06-04 14:20:44 -0700 (Wed, 04 Jun 2008) Log Message: ----------- Move CPreview as MapPreview to common code base. Modified Paths: -------------- trunk/daimonin/src/daieditor/action.properties trunk/src/app/net/sf/gridarta/action.properties Modified: trunk/daimonin/src/daieditor/action.properties =================================================================== --- trunk/daimonin/src/daieditor/action.properties 2008-06-04 21:18:17 UTC (rev 4101) +++ trunk/daimonin/src/daieditor/action.properties 2008-06-04 21:20:44 UTC (rev 4102) @@ -113,8 +113,6 @@ controlStop.icon=media/Stop16 #control.toolbar=controlStart controlStop -zoom.icon=general/Zoom16 - gc.icon=general/Delete16 #viewAlpha.icon=general/Find16 Modified: trunk/src/app/net/sf/gridarta/action.properties =================================================================== --- trunk/src/app/net/sf/gridarta/action.properties 2008-06-04 21:18:17 UTC (rev 4101) +++ trunk/src/app/net/sf/gridarta/action.properties 2008-06-04 21:20:44 UTC (rev 4102) @@ -50,6 +50,8 @@ pickmapFolders.menu= # Zoom +zoom.icon=general/Zoom16 + zoomBar.menubar=zoomMen zoomAlg zoomMen.menu=zoom0 zoom12 zoom25 zoom50 - zoom100 - zoom150 zoom200 zoom250 zoom300 zoom400 - zoomSave - zoomClose This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-06-05 17:55:12
|
Revision: 4108 http://gridarta.svn.sourceforge.net/gridarta/?rev=4108&view=rev Author: akirschbaum Date: 2008-06-05 10:55:07 -0700 (Thu, 05 Jun 2008) Log Message: ----------- Split off ScriptEditControlInstance from ScriptEditControl. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchEditor.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchEditor.java trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEventEditor.java trunk/src/app/net/sf/gridarta/textedit/scripteditor/CFPythonPopup.java trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditControl.java trunk/src/app/net/sf/gridarta/textedit/textarea/actions/Save.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditControlInstance.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-06-05 17:35:19 UTC (rev 4107) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-06-05 17:55:07 UTC (rev 4108) @@ -98,7 +98,7 @@ import net.sf.gridarta.spells.GameObjectSpell; import net.sf.gridarta.spells.NumberSpell; import net.sf.gridarta.spells.Spells; -import net.sf.gridarta.textedit.scripteditor.ScriptEditControl; +import net.sf.gridarta.textedit.scripteditor.ScriptEditControlInstance; import net.sf.gridarta.treasurelist.CFTreasureListTree; import net.sf.gridarta.treasurelist.TreasureListsParser; import net.sf.gridarta.treasurelist.TreasureLocation; @@ -247,7 +247,7 @@ createMapImageCache(CResourceLoader.getHomeFile("thumbnails"), SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview()); // initialize the script-editor pad - ScriptEditControl.init(globalSettings.getMapDefaultFolder(), this); + ScriptEditControlInstance.init(globalSettings.getMapDefaultFolder(), this); // load the list with archtype-data from "types.xml" final XmlHelper xmlHelper; @@ -476,7 +476,7 @@ /** Create and open a new script. */ @ActionMethod public void newScript() { - ScriptEditControl.getInstance().openScriptNew(); + ScriptEditControlInstance.getInstance().openScriptNew(); } /** Edit an existing script. */ @@ -604,7 +604,7 @@ final boolean isScriptFile = file.getName().toLowerCase().endsWith(".py"); if (file.isFile()) { if (isScriptFile) { - ScriptEditControl.getInstance().openScriptFile(file.getAbsolutePath()); + ScriptEditControlInstance.getInstance().openScriptFile(file.getAbsolutePath()); } else { globalSettings.setCurrentDir(dir); getMapManager().openMapFileWithView(file, null); @@ -612,7 +612,7 @@ } else if (!file.exists()) { if (isScriptFile) { // TODO: pass filename - ScriptEditControl.getInstance().openScriptNew(); + ScriptEditControlInstance.getInstance().openScriptNew(); } else { newLevelWanted(file.getName()); } @@ -630,14 +630,14 @@ final boolean isScriptFile = filename.toLowerCase().endsWith(".py"); if (file.isFile()) { if (isScriptFile) { - ScriptEditControl.getInstance().openScriptFile(file.getAbsolutePath()); + ScriptEditControlInstance.getInstance().openScriptFile(file.getAbsolutePath()); } else { getMapManager().openMapFileWithView(file, null); } } else if (!file.exists()) { if (isScriptFile) { // TODO: pass filename - ScriptEditControl.getInstance().openScriptNew(); + ScriptEditControlInstance.getInstance().openScriptNew(); } else { newLevelWanted(file.getName()); } @@ -776,7 +776,7 @@ /** Invoked when user wants to exit from the program. */ public void exit() { - if (ScriptEditControl.getInstance().closeAllTabs() && getMapManager().closeAll() && objectChooser.getPickmapChooserControl().canExit() && scriptControl.canExit()) { + if (ScriptEditControlInstance.getInstance().closeAllTabs() && getMapManager().closeAll() && objectChooser.getPickmapChooserControl().canExit() && scriptControl.canExit()) { doExit(); } } @@ -785,7 +785,7 @@ public void doExit() { mainView.setEnabled(false); appExitNotify(); - ScriptEditControl.getInstance().appExitNotify(); + ScriptEditControlInstance.getInstance().appExitNotify(); final Thread thread = new Thread() { /** {@inheritDoc} */ public void run() { Modified: trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchEditor.java 2008-06-05 17:35:19 UTC (rev 4107) +++ trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchEditor.java 2008-06-05 17:55:07 UTC (rev 4108) @@ -44,7 +44,7 @@ import net.sf.gridarta.gameobject.scripts.PathButtonListener; import net.sf.gridarta.gameobject.scripts.UndefinedEventArchetypeException; import net.sf.gridarta.io.PathManager; -import net.sf.gridarta.textedit.scripteditor.ScriptEditControl; +import net.sf.gridarta.textedit.scripteditor.ScriptEditControlInstance; import net.sf.japi.swing.ActionFactory; import org.apache.log4j.Logger; @@ -381,7 +381,7 @@ frame.setVisible(false); // close dialog // open new script file - ScriptEditControl.getInstance().openScriptFile(newScriptFile.getAbsolutePath()); + ScriptEditControlInstance.getInstance().openScriptFile(newScriptFile.getAbsolutePath()); } } } Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-06-05 17:35:19 UTC (rev 4107) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-06-05 17:55:07 UTC (rev 4108) @@ -114,7 +114,7 @@ import net.sf.gridarta.spells.NumberSpell; import net.sf.gridarta.spells.Spells; import net.sf.gridarta.spells.XMLSpellLoader; -import net.sf.gridarta.textedit.scripteditor.ScriptEditControl; +import net.sf.gridarta.textedit.scripteditor.ScriptEditControlInstance; import net.sf.gridarta.treasurelist.CFTreasureListTree; import net.sf.gridarta.treasurelist.TreasureListsParser; import net.sf.gridarta.treasurelist.TreasureLocation; @@ -305,7 +305,7 @@ MultiPositionData.init(getConfigurationDirectory()); // initialize the script-editor pad - ScriptEditControl.init(globalSettings.getMapDefaultFolder(), this); + ScriptEditControlInstance.init(globalSettings.getMapDefaultFolder(), this); // load the list with archtype-data from "types.xml" final XmlHelper xmlHelper; @@ -609,7 +609,7 @@ /** Create and open a new script. */ @ActionMethod public void newScript() { - ScriptEditControl.getInstance().openScriptNew(); + ScriptEditControlInstance.getInstance().openScriptNew(); } /** Edit an existing script. */ @@ -769,7 +769,7 @@ final boolean isScriptFile = file.getName().toLowerCase().endsWith(".lua"); if (file.isFile()) { if (isScriptFile) { - ScriptEditControl.getInstance().openScriptFile(file.getAbsolutePath()); + ScriptEditControlInstance.getInstance().openScriptFile(file.getAbsolutePath()); } else { globalSettings.setCurrentDir(dir); getMapManager().openMapFileWithView(file, null); @@ -777,7 +777,7 @@ } else if (!file.exists()) { if (isScriptFile) { // TODO: pass filename - ScriptEditControl.getInstance().openScriptNew(); + ScriptEditControlInstance.getInstance().openScriptNew(); } else { newLevelWanted(file.getName()); } @@ -795,14 +795,14 @@ final boolean isScriptFile = filename.toLowerCase().endsWith(".lua"); if (file.isFile()) { if (isScriptFile) { - ScriptEditControl.getInstance().openScriptFile(file.getAbsolutePath()); + ScriptEditControlInstance.getInstance().openScriptFile(file.getAbsolutePath()); } else { getMapManager().openMapFileWithView(file, null); } } else if (!file.exists()) { if (isScriptFile) { // TODO: pass filename - ScriptEditControl.getInstance().openScriptNew(); + ScriptEditControlInstance.getInstance().openScriptNew(); } else { newLevelWanted(file.getName()); } @@ -948,7 +948,7 @@ /** Invoked when user wants to exit from the program. */ public void exit() { - if (ScriptEditControl.getInstance().closeAllTabs() && getMapManager().closeAll() && objectChooser.getPickmapChooserControl().canExit()) { + if (ScriptEditControlInstance.getInstance().closeAllTabs() && getMapManager().closeAll() && objectChooser.getPickmapChooserControl().canExit()) { doExit(); } } @@ -957,7 +957,7 @@ public void doExit() { mainView.setEnabled(false); appExitNotify(); - ScriptEditControl.getInstance().appExitNotify(); + ScriptEditControlInstance.getInstance().appExitNotify(); final Thread thread = new Thread() { /** {@inheritDoc} */ public void run() { Modified: trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchEditor.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchEditor.java 2008-06-05 17:35:19 UTC (rev 4107) +++ trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchEditor.java 2008-06-05 17:55:07 UTC (rev 4108) @@ -44,7 +44,7 @@ import net.sf.gridarta.gameobject.scripts.PathButtonListener; import net.sf.gridarta.gameobject.scripts.UndefinedEventArchetypeException; import net.sf.gridarta.io.PathManager; -import net.sf.gridarta.textedit.scripteditor.ScriptEditControl; +import net.sf.gridarta.textedit.scripteditor.ScriptEditControlInstance; import net.sf.japi.swing.ActionFactory; import org.apache.log4j.Logger; @@ -381,7 +381,7 @@ frame.setVisible(false); // close dialog // open new script file - ScriptEditControl.getInstance().openScriptFile(newScriptFile.getAbsolutePath()); + ScriptEditControlInstance.getInstance().openScriptFile(newScriptFile.getAbsolutePath()); } } } Modified: trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEventEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEventEditor.java 2008-06-05 17:35:19 UTC (rev 4107) +++ trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEventEditor.java 2008-06-05 17:55:07 UTC (rev 4108) @@ -31,7 +31,7 @@ import javax.swing.JTextField; import javax.swing.WindowConstants; import net.sf.gridarta.AbstractMainControl; -import net.sf.gridarta.textedit.scripteditor.ScriptEditControl; +import net.sf.gridarta.textedit.scripteditor.ScriptEditControlInstance; import net.sf.japi.swing.ActionFactory; import org.apache.log4j.Logger; @@ -81,7 +81,7 @@ // now see if that file really exists: final File scriptFile = new File(path); if (scriptFile.exists() && scriptFile.isFile()) { - ScriptEditControl.getInstance().openScriptFile(scriptFile.getAbsolutePath()); + ScriptEditControlInstance.getInstance().openScriptFile(scriptFile.getAbsolutePath()); } else { // file does not exist! ACTION_FACTORY.showMessageDialog(AbstractMainControl.getInstance().getMainView(), "openScriptNotFound", path); Modified: trunk/src/app/net/sf/gridarta/textedit/scripteditor/CFPythonPopup.java =================================================================== --- trunk/src/app/net/sf/gridarta/textedit/scripteditor/CFPythonPopup.java 2008-06-05 17:35:19 UTC (rev 4107) +++ trunk/src/app/net/sf/gridarta/textedit/scripteditor/CFPythonPopup.java 2008-06-05 17:55:07 UTC (rev 4108) @@ -88,7 +88,7 @@ } // listener for selection events - addActionListener(new MenuActionListener(this, ScriptEditControl.getInstance())); + addActionListener(new MenuActionListener(this, ScriptEditControlInstance.getInstance())); if (menuEntries != null && menuEntries.length > 0) { isReady = true; // this menu is now ready for use Modified: trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditControl.java 2008-06-05 17:35:19 UTC (rev 4107) +++ trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditControl.java 2008-06-05 17:55:07 UTC (rev 4108) @@ -50,15 +50,9 @@ /** Action Factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta"); - // static instance of this class (there's only one controller and max. one open window) - private static ScriptEditControl instance = null; - // last active popup is stored here private static CFPythonPopup activePopup = null; - // default directory to store new scripts in. also used as starting dir for 'open' command - private static String defaultScriptDir; - private final MainControl mainControl; // gridarta main control (is null in stand-alone configuration!) private final ScriptEditView view; // view (window with textareas) @@ -68,37 +62,19 @@ /** JFileChooser for opening script files. */ private JFileChooser fileChooser = null; - /** Constructor is private, instance is created by calling 'init()' */ - private ScriptEditControl(final MainControl mainControl) { + public ScriptEditControl(final MainControl mainControl) { opened = new ArrayList<String>(); // start with empty vector this.mainControl = mainControl; view = new ScriptEditView(this, mainControl.getMainView()); // initialize window } /** - * Init method initializes static instance of this controller. Has to be - * called before once using this class. - * @param mapDefFolder map default folder - */ - public static void init(final String mapDefFolder, final MainControl mainControl) { - if (instance == null) { - instance = new ScriptEditControl(mainControl); - defaultScriptDir = mapDefFolder; // set map default folder - } - } - - /** * Must be called when the application is exiting. */ public void appExitNotify() { view.appExitNotify(); } - /** @return static instance of this class */ - public static ScriptEditControl getInstance() { - return instance; - } - /** * @return instance of gridarta main control (is null for stand-alone * configuration!) @@ -152,7 +128,7 @@ fileChooser.setFileFilter(mainControl.getScriptFileFilter()); // set default folder for new scripts - final File baseDir = new File(defaultScriptDir); + final File baseDir = new File(ScriptEditControlInstance.getDefaultScriptDir()); if (baseDir.exists() && baseDir.isDirectory()) { fileChooser.setCurrentDirectory(baseDir); } Added: trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditControlInstance.java =================================================================== --- trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditControlInstance.java (rev 0) +++ trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditControlInstance.java 2008-06-05 17:55:07 UTC (rev 4108) @@ -0,0 +1,75 @@ +/* + * Gridarta Java Editor. + * Copyright (C) 2000 Michael Toennies + * + * (code based on: Gridder. 2D grid based level editor. (C) 2000 Pasi Keränen) + * + * 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., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + */ + +package net.sf.gridarta.textedit.scripteditor; + +import net.sf.gridarta.MainControl; + +/** + * Utility class holding the singleton {@link ScriptEditControl} instance. + * @author Andreas Kirschbaum + */ +public class ScriptEditControlInstance { + + /** + * Static instance of this class (there's only one controller and max. one + * open window). + */ + private static ScriptEditControl instance = null; + + /** + * Default directory to store new scripts in. also used as starting dir for + * 'open' command. + */ + private static String defaultScriptDir = null; + + /** + * Private constructor to prevent instantiation. + */ + private ScriptEditControlInstance() { + } + + /** + * Init method initializes static instance of this controller. Has to be + * called before once using this class. + * @param mapDefFolder map default folder + */ + public static void init(final String mapDefFolder, final MainControl mainControl) { + if (instance == null) { + instance = new ScriptEditControl(mainControl); + defaultScriptDir = mapDefFolder; // set map default folder + } + } + + /** + * @return static instance of this class + */ + public static ScriptEditControl getInstance() { + return instance; + } + + public static String getDefaultScriptDir() { + return defaultScriptDir; + } + +} // class ScriptEditControlInstance Property changes on: trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditControlInstance.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/textedit/textarea/actions/Save.java =================================================================== --- trunk/src/app/net/sf/gridarta/textedit/textarea/actions/Save.java 2008-06-05 17:35:19 UTC (rev 4107) +++ trunk/src/app/net/sf/gridarta/textedit/textarea/actions/Save.java 2008-06-05 17:55:07 UTC (rev 4108) @@ -11,7 +11,7 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import net.sf.gridarta.textedit.scripteditor.ScriptEditControl; +import net.sf.gridarta.textedit.scripteditor.ScriptEditControlInstance; /** * Actionlistener for SAVE actions. @@ -24,7 +24,7 @@ * Save the currently active tab */ public void actionPerformed(final ActionEvent e) { - ScriptEditControl.getInstance().saveActiveTab(); + ScriptEditControlInstance.getInstance().saveActiveTab(); } } // class Save This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-06-05 18:08:34
|
Revision: 4110 http://gridarta.svn.sourceforge.net/gridarta/?rev=4110&view=rev Author: akirschbaum Date: 2008-06-05 11:08:35 -0700 (Thu, 05 Jun 2008) Log Message: ----------- Simplify ScriptEditControl. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditControl.java trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditControlInstance.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-06-05 17:59:05 UTC (rev 4109) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-06-05 18:08:35 UTC (rev 4110) @@ -247,7 +247,7 @@ createMapImageCache(CResourceLoader.getHomeFile("thumbnails"), SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview()); // initialize the script-editor pad - ScriptEditControlInstance.init(globalSettings.getMapDefaultFolder(), this); + ScriptEditControlInstance.init(this, new File(globalSettings.getMapDefaultFolder())); // load the list with archtype-data from "types.xml" final XmlHelper xmlHelper; Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-06-05 17:59:05 UTC (rev 4109) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-06-05 18:08:35 UTC (rev 4110) @@ -305,7 +305,7 @@ MultiPositionData.init(getConfigurationDirectory()); // initialize the script-editor pad - ScriptEditControlInstance.init(globalSettings.getMapDefaultFolder(), this); + ScriptEditControlInstance.init(this, new File(globalSettings.getMapDefaultFolder())); // load the list with archtype-data from "types.xml" final XmlHelper xmlHelper; Modified: trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditControl.java 2008-06-05 17:59:05 UTC (rev 4109) +++ trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditControl.java 2008-06-05 18:08:35 UTC (rev 4110) @@ -60,12 +60,13 @@ private final List<String> tabs; // open tabs, contains absolute filenames (or "<>") in order left to right /** JFileChooser for opening script files. */ - private JFileChooser fileChooser = null; + private final JFileChooser fileChooser; - public ScriptEditControl(final MainControl mainControl) { + public ScriptEditControl(final MainControl mainControl, final File defaultScriptDir) { tabs = new ArrayList<String>(); // start with empty vector this.mainControl = mainControl; view = new ScriptEditView(this, mainControl.getMainView()); // initialize window + fileChooser = createOpenFileChooser(defaultScriptDir); } /** @@ -119,28 +120,28 @@ } /** - * Create the JFileChooser for opening a script file. + * Creates the {@link JFileChooser} for opening a script file. + * @param defaultScriptDir the initial directory for the file chooser; will + * be ignored if invalid + * @return the file chooser */ - private void createOpenFileChooser() { - fileChooser = new JFileChooser(); + private JFileChooser createOpenFileChooser(final File defaultScriptDir) { + final JFileChooser fileChooser = new JFileChooser(); fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); fileChooser.setMultiSelectionEnabled(false); fileChooser.setFileFilter(mainControl.getScriptFileFilter()); // set default folder for new scripts - final File baseDir = new File(ScriptEditControlInstance.getDefaultScriptDir()); - if (baseDir.exists() && baseDir.isDirectory()) { - fileChooser.setCurrentDirectory(baseDir); + if (defaultScriptDir.exists() && defaultScriptDir.isDirectory()) { + fileChooser.setCurrentDirectory(defaultScriptDir); } + return fileChooser; } /** * Open a file which is chosen by the user. */ public void openUserWanted() { - if (fileChooser == null) { - createOpenFileChooser(); - } fileChooser.setDialogTitle("Open Script File"); final int returnVal = fileChooser.showOpenDialog(view); @@ -215,9 +216,6 @@ // User could switch tabs or type text in the meantime, who knows. final int tabIndex = view.getSelectedIndex(); // save tab-index of this script - if (fileChooser == null) { - createOpenFileChooser(); - } fileChooser.setDialogTitle("Save Script File As"); // if file already exists, select it Modified: trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditControlInstance.java =================================================================== --- trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditControlInstance.java 2008-06-05 17:59:05 UTC (rev 4109) +++ trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditControlInstance.java 2008-06-05 18:08:35 UTC (rev 4110) @@ -23,6 +23,7 @@ package net.sf.gridarta.textedit.scripteditor; +import java.io.File; import net.sf.gridarta.MainControl; /** @@ -38,12 +39,6 @@ private static ScriptEditControl instance = null; /** - * Default directory to store new scripts in. also used as starting dir for - * 'open' command. - */ - private static String defaultScriptDir = null; - - /** * Private constructor to prevent instantiation. */ private ScriptEditControlInstance() { @@ -52,12 +47,12 @@ /** * Init method initializes static instance of this controller. Has to be * called before once using this class. + * @param mainControl the main control instance * @param defaultScriptDir map default folder */ - public static void init(final String defaultScriptDir, final MainControl mainControl) { + public static void init(final MainControl mainControl, final File defaultScriptDir) { if (instance == null) { - instance = new ScriptEditControl(mainControl); - ScriptEditControlInstance.defaultScriptDir = defaultScriptDir; + instance = new ScriptEditControl(mainControl, defaultScriptDir); } } @@ -68,8 +63,4 @@ return instance; } - public static String getDefaultScriptDir() { - return defaultScriptDir; - } - } // class ScriptEditControlInstance This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-06-05 18:11:42
|
Revision: 4111 http://gridarta.svn.sourceforge.net/gridarta/?rev=4111&view=rev Author: akirschbaum Date: 2008-06-05 11:11:29 -0700 (Thu, 05 Jun 2008) Log Message: ----------- Whitespace changes. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchEditor.java trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchEditor.java Modified: trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchEditor.java 2008-06-05 18:08:35 UTC (rev 4110) +++ trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchEditor.java 2008-06-05 18:11:29 UTC (rev 4111) @@ -387,4 +387,5 @@ } return scriptArchData.isChanged(); } + } // class ScriptArchEditor Modified: trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchEditor.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchEditor.java 2008-06-05 18:08:35 UTC (rev 4110) +++ trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchEditor.java 2008-06-05 18:11:29 UTC (rev 4111) @@ -387,4 +387,5 @@ } return scriptArchData.isChanged(); } + } // class ScriptArchEditor This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-06-06 18:26:45
|
Revision: 4121 http://gridarta.svn.sourceforge.net/gridarta/?rev=4121&view=rev Author: akirschbaum Date: 2008-06-06 11:26:51 -0700 (Fri, 06 Jun 2008) Log Message: ----------- Remove FaceObject.getFilename(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java trunk/crossfire/src/cfeditor/gameobject/face/FaceObject.java trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java trunk/daimonin/src/daieditor/gameobject/face/FaceObject.java trunk/src/app/net/sf/gridarta/gameobject/face/FaceObject.java Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2008-06-06 18:22:52 UTC (rev 4120) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2008-06-06 18:26:51 UTC (rev 4121) @@ -169,7 +169,7 @@ // TODO log.error("Error:", e); } catch (final DuplicateFaceException e) { - ACTION_FACTORY.showMessageDialog(mainControl.getMainView(), "loadDuplicateFace", e.getDuplicate().getFaceName(), e.getDuplicate().getFilename(), e.getExisting().getFilename()); + ACTION_FACTORY.showMessageDialog(mainControl.getMainView(), "loadDuplicateFace", e.getDuplicate().getFaceName(), e.getDuplicate().getOriginalFilename(), e.getExisting().getOriginalFilename()); } } @@ -292,7 +292,7 @@ try { mainControl.getFaceObjects().addFaceObject(facename, originalPathname.substring(0, slashPos + 1) + facename, null, filename, 0, (int) new File(filename).length()); } catch (final DuplicateFaceException e) { - ACTION_FACTORY.showMessageDialog(mainControl.getMainView(), "loadDuplicateFace", e.getDuplicate().getFaceName(), e.getDuplicate().getFilename(), e.getExisting().getFilename()); + ACTION_FACTORY.showMessageDialog(mainControl.getMainView(), "loadDuplicateFace", e.getDuplicate().getFaceName(), e.getDuplicate().getOriginalFilename(), e.getExisting().getOriginalFilename()); } } Modified: trunk/crossfire/src/cfeditor/gameobject/face/FaceObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/face/FaceObject.java 2008-06-06 18:22:52 UTC (rev 4120) +++ trunk/crossfire/src/cfeditor/gameobject/face/FaceObject.java 2008-06-06 18:26:51 UTC (rev 4121) @@ -82,11 +82,6 @@ return getFace(); } - /** {@inheritDoc} */ - public String getFilename() { - return getOriginalFilename(); - } - @Nullable public ImageIcon getFace() { return loadFace(); } Modified: trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2008-06-06 18:22:52 UTC (rev 4120) +++ trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2008-06-06 18:26:51 UTC (rev 4121) @@ -324,7 +324,7 @@ // TODO log.error("Error:", e); } catch (final DuplicateFaceException e) { - ACTION_FACTORY.showMessageDialog(mainControl.getMainView(), "loadDuplicateFace", e.getDuplicate().getFaceName(), e.getDuplicate().getFilename(), e.getExisting().getFilename()); + ACTION_FACTORY.showMessageDialog(mainControl.getMainView(), "loadDuplicateFace", e.getDuplicate().getFaceName(), e.getDuplicate().getOriginalFilename(), e.getExisting().getOriginalFilename()); } } @@ -447,7 +447,7 @@ try { mainControl.getFaceObjects().addFaceObject(facename, filename.substring(stripPath, filename.length() - 4).replace('\\', '/'), filename, 0, (int) new File(filename).length()); } catch (final DuplicateFaceException e) { - ACTION_FACTORY.showMessageDialog(mainControl.getMainView(), "loadDuplicateFace", e.getDuplicate().getFaceName(), e.getDuplicate().getFilename(), e.getExisting().getFilename()); + ACTION_FACTORY.showMessageDialog(mainControl.getMainView(), "loadDuplicateFace", e.getDuplicate().getFaceName(), e.getDuplicate().getOriginalFilename(), e.getExisting().getOriginalFilename()); } } Modified: trunk/daimonin/src/daieditor/gameobject/face/FaceObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/face/FaceObject.java 2008-06-06 18:22:52 UTC (rev 4120) +++ trunk/daimonin/src/daieditor/gameobject/face/FaceObject.java 2008-06-06 18:26:51 UTC (rev 4121) @@ -94,11 +94,6 @@ return FaceObjectProviders.normal.getImageIconForFacename(getFaceName()); } - /** {@inheritDoc} */ - public String getFilename() { - return getOriginalFilename(); - } - /** * Get the offset of this face in the actualFilename. * @return offset of this face in the actual file Modified: trunk/src/app/net/sf/gridarta/gameobject/face/FaceObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/face/FaceObject.java 2008-06-06 18:22:52 UTC (rev 4120) +++ trunk/src/app/net/sf/gridarta/gameobject/face/FaceObject.java 2008-06-06 18:26:51 UTC (rev 4121) @@ -40,10 +40,4 @@ */ String getOriginalFilename(); - /** - * Get the filename of this face. - * @return filename of this face, actual filename if set, otherwise original filename - */ - String getFilename(); - } // interface FaceObject This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-06-06 19:37:40
|
Revision: 4126 http://gridarta.svn.sourceforge.net/gridarta/?rev=4126&view=rev Author: akirschbaum Date: 2008-06-06 12:37:02 -0700 (Fri, 06 Jun 2008) Log Message: ----------- Move FaceObject.offset and FaceObject.size to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/face/FaceObject.java trunk/daimonin/src/daieditor/gameobject/face/FaceObject.java trunk/src/app/net/sf/gridarta/gameobject/face/AbstractFaceObject.java Modified: trunk/crossfire/src/cfeditor/gameobject/face/FaceObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/face/FaceObject.java 2008-06-06 19:33:34 UTC (rev 4125) +++ trunk/crossfire/src/cfeditor/gameobject/face/FaceObject.java 2008-06-06 19:37:02 UTC (rev 4126) @@ -42,18 +42,6 @@ private Reference<ImageIcon> face = null; - /** - * The offset in the file the face was loaded from. - * Only valid if <code>{@link #actualFilename} != null</code>. - */ - private final int offset; - - /** - * The size in the file the face was loaded from. - * Only valid if <code>{@link #actualFilename} != null</code>. - */ - private final int size; - private final String resourceName; private final String resourceDirectory; @@ -69,11 +57,9 @@ * @param size size in the file denoted by <var>actualFilename</var>, e.g. <samp>567</samp>, */ public FaceObject(final String faceName, final String originalFilename, final String resourceDirectory, final String resourceName, final int offset, final int size) { - super(faceName, originalFilename, originalFilename); + super(faceName, originalFilename, originalFilename, offset, size); this.resourceDirectory = resourceDirectory; this.resourceName = resourceName; - this.offset = offset; - this.size = size; } /** {@inheritDoc} */ @@ -81,22 +67,6 @@ return FaceObjectProviders.normal.getImageIconForFacename(getFaceName()); } - /** - * Get the offset of this face in the actualFilename. - * @return offset of this face in the actual file - */ - public int getOffset() { - return offset; - } - - /** - * Get the size of this face in the actualFilename. - * @return size of this face in the actual file - */ - public int getSize() { - return size; - } - public void setFace(final ImageIcon face) { this.face = new SoftReference<ImageIcon>(face); } Modified: trunk/daimonin/src/daieditor/gameobject/face/FaceObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/face/FaceObject.java 2008-06-06 19:33:34 UTC (rev 4125) +++ trunk/daimonin/src/daieditor/gameobject/face/FaceObject.java 2008-06-06 19:37:02 UTC (rev 4126) @@ -47,18 +47,6 @@ private final String actualFilename; /** - * The offset in the file the face was loaded from. - * Only valid if <code>{@link #actualFilename} != null</code>. - */ - private final int offset; - - /** - * The size in the file the face was loaded from. - * Only valid if <code>{@link #actualFilename} != null</code>. - */ - private final int size; - - /** * Whether this face is a "double" face. * @see "Usage FACE_FLAG_DOUBLE in client/src/client.c, client/src/map.c defined by client/src/include/main.h" */ @@ -80,10 +68,8 @@ * @param size size in the file denoted by <var>actualFilename</var>, e.g. <samp>567</samp>, */ public FaceObject(final String faceName, final String originalFilename, final String actualFilename, final int offset, final int size) { - super(faceName, originalFilename, originalFilename); + super(faceName, originalFilename, originalFilename, offset, size); this.actualFilename = actualFilename; - this.offset = offset; - this.size = size; isUp = faceName.contains(".u."); isDouble = faceName.contains(".d."); @@ -95,22 +81,6 @@ } /** - * Get the offset of this face in the actualFilename. - * @return offset of this face in the actual file - */ - public int getOffset() { - return offset; - } - - /** - * Get the size of this face in the actualFilename. - * @return size of this face in the actual file - */ - public int getSize() { - return size; - } - - /** * Return whether this face is an up face. * @return upFace */ Modified: trunk/src/app/net/sf/gridarta/gameobject/face/AbstractFaceObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/face/AbstractFaceObject.java 2008-06-06 19:33:34 UTC (rev 4125) +++ trunk/src/app/net/sf/gridarta/gameobject/face/AbstractFaceObject.java 2008-06-06 19:37:02 UTC (rev 4126) @@ -35,16 +35,32 @@ private final String originalFilename; /** + * The offset in the file the face was loaded from. + * Only valid if <code>{@link #actualFilename} != null</code>. + */ + private final int offset; + + /** + * The size in the file the face was loaded from. + * Only valid if <code>{@link #actualFilename} != null</code>. + */ + private final int size; + + /** * Create a FaceObject. * @param faceName name of face, e.g. <samp>"bug.111"</samp> * @param originalFilename original filename without .png extension, e.g. * <samp>"/system/bug.111"</samp> * @param path Path for this FaceObject. + * @param offset offset in the file denoted by <var>actualFilename</var>, e.g. <samp>148676</samp> + * @param size size in the file denoted by <var>actualFilename</var>, e.g. <samp>567</samp>, */ - protected AbstractFaceObject(final String faceName, final String originalFilename, final String path) { + protected AbstractFaceObject(final String faceName, final String originalFilename, final String path, final int offset, final int size) { super(path); this.faceName = faceName; this.originalFilename = originalFilename; + this.offset = offset; + this.size = size; } /** @@ -69,6 +85,22 @@ } /** + * Get the offset of this face in the actualFilename. + * @return offset of this face in the actual file + */ + public int getOffset() { + return offset; + } + + /** + * Get the size of this face in the actualFilename. + * @return size of this face in the actual file + */ + public int getSize() { + return size; + } + + /** * {@inheritDoc} * Overridden to sort bug.101 and bug.111 before all other faces. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-06-06 19:41:28
|
Revision: 4127 http://gridarta.svn.sourceforge.net/gridarta/?rev=4127&view=rev Author: akirschbaum Date: 2008-06-06 12:41:26 -0700 (Fri, 06 Jun 2008) Log Message: ----------- Move FaceObject.isUp() and FaceObject.isDouble() to common code base. Modified Paths: -------------- trunk/daimonin/src/daieditor/gameobject/face/FaceObject.java trunk/src/app/net/sf/gridarta/gameobject/face/AbstractFaceObject.java Modified: trunk/daimonin/src/daieditor/gameobject/face/FaceObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/face/FaceObject.java 2008-06-06 19:37:02 UTC (rev 4126) +++ trunk/daimonin/src/daieditor/gameobject/face/FaceObject.java 2008-06-06 19:41:26 UTC (rev 4127) @@ -47,18 +47,6 @@ private final String actualFilename; /** - * Whether this face is a "double" face. - * @see "Usage FACE_FLAG_DOUBLE in client/src/client.c, client/src/map.c defined by client/src/include/main.h" - */ - private final boolean isDouble; - - /** - * Whether this face is an "up" face. - * @see "Usage FACE_FLAG_UP in client/src/client.c, client/src/map.c defined by client/src/include/main.h" - */ - private final boolean isUp; - - /** * Create a FaceObject which actually was loaded from a different file than its origin. * Invoke this constructor if you loaded the face from <code>daimonin.0</code>. * @param faceName name of face, e.g. <samp>"robe.101"</samp> @@ -70,9 +58,6 @@ public FaceObject(final String faceName, final String originalFilename, final String actualFilename, final int offset, final int size) { super(faceName, originalFilename, originalFilename, offset, size); this.actualFilename = actualFilename; - isUp = faceName.contains(".u."); - isDouble = faceName.contains(".d."); - } /** {@inheritDoc} */ @@ -80,20 +65,4 @@ return FaceObjectProviders.normal.getImageIconForFacename(getFaceName()); } - /** - * Return whether this face is an up face. - * @return upFace - */ - public boolean isUp() { - return isUp; - } - - /** - * Return whether this face is a double face. - * @return doubleFace - */ - public boolean isDouble() { - return isDouble; - } - } // class FaceObject Modified: trunk/src/app/net/sf/gridarta/gameobject/face/AbstractFaceObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/face/AbstractFaceObject.java 2008-06-06 19:37:02 UTC (rev 4126) +++ trunk/src/app/net/sf/gridarta/gameobject/face/AbstractFaceObject.java 2008-06-06 19:41:26 UTC (rev 4127) @@ -47,6 +47,18 @@ private final int size; /** + * Whether this face is a "double" face. + * @see "Usage FACE_FLAG_DOUBLE in client/src/client.c, client/src/map.c defined by client/src/include/main.h" + */ + private final boolean isDouble; + + /** + * Whether this face is an "up" face. + * @see "Usage FACE_FLAG_UP in client/src/client.c, client/src/map.c defined by client/src/include/main.h" + */ + private final boolean isUp; + + /** * Create a FaceObject. * @param faceName name of face, e.g. <samp>"bug.111"</samp> * @param originalFilename original filename without .png extension, e.g. @@ -61,6 +73,8 @@ this.originalFilename = originalFilename; this.offset = offset; this.size = size; + isUp = faceName.contains(".u."); + isDouble = faceName.contains(".d."); } /** @@ -101,6 +115,22 @@ } /** + * Return whether this face is an up face. + * @return upFace + */ + public boolean isUp() { + return isUp; + } + + /** + * Return whether this face is a double face. + * @return doubleFace + */ + public boolean isDouble() { + return isDouble; + } + + /** * {@inheritDoc} * Overridden to sort bug.101 and bug.111 before all other faces. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-06-06 19:51:18
|
Revision: 4129 http://gridarta.svn.sourceforge.net/gridarta/?rev=4129&view=rev Author: akirschbaum Date: 2008-06-06 12:51:11 -0700 (Fri, 06 Jun 2008) Log Message: ----------- Remove unused code. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java trunk/crossfire/src/cfeditor/gameobject/face/FaceObject.java trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java trunk/daimonin/src/daieditor/gameobject/face/FaceObject.java trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2008-06-06 19:43:48 UTC (rev 4128) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2008-06-06 19:51:11 UTC (rev 4129) @@ -288,7 +288,7 @@ ((ArchFaceProvider) FaceObjectProviders.normal).addInfo(facename, filename); final int stripPath = new File(mainControl.getGlobalSettings().getArchDefaultFolder()).getAbsolutePath().length(); try { - mainControl.getFaceObjects().addFaceObject(facename, originalPathname.substring(0, slashPos + 1) + facename, null, filename, 0, (int) new File(filename).length()); + mainControl.getFaceObjects().addFaceObject(facename, originalPathname.substring(0, slashPos + 1) + facename, 0, (int) new File(filename).length()); } catch (final DuplicateFaceException e) { ACTION_FACTORY.showMessageDialog(mainControl.getMainView(), "loadDuplicateFace", e.getDuplicate().getFaceName(), e.getDuplicate().getOriginalFilename(), e.getExisting().getOriginalFilename()); } Modified: trunk/crossfire/src/cfeditor/gameobject/face/FaceObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/face/FaceObject.java 2008-06-06 19:43:48 UTC (rev 4128) +++ trunk/crossfire/src/cfeditor/gameobject/face/FaceObject.java 2008-06-06 19:51:11 UTC (rev 4129) @@ -20,7 +20,6 @@ package cfeditor.gameobject.face; import java.lang.ref.Reference; -import java.lang.ref.SoftReference; import javax.swing.ImageIcon; import net.sf.gridarta.gameobject.face.AbstractFaceObject; import net.sf.gridarta.gameobject.face.FaceObjectProviders; @@ -42,24 +41,16 @@ private Reference<ImageIcon> face = null; - private final String resourceName; - - private final String resourceDirectory; - /** * Creates a FaceObject along with information used for lazy loading. * @param faceName name of face, e.g. <samp>"bug.111"</samp> * @param originalFilename original filename, e.g. * <samp>"/system/bug.111"</samp> - * @param resourceDirectory Directory to load data from. - * @param resourceName Name of the file to load data from. * @param offset offset in the file denoted by <var>actualFilename</var>, e.g. <samp>148676</samp> * @param size size in the file denoted by <var>actualFilename</var>, e.g. <samp>567</samp>, */ - public FaceObject(final String faceName, final String originalFilename, final String resourceDirectory, final String resourceName, final int offset, final int size) { + public FaceObject(final String faceName, final String originalFilename, final int offset, final int size) { super(faceName, originalFilename, originalFilename, offset, size); - this.resourceDirectory = resourceDirectory; - this.resourceName = resourceName; } /** {@inheritDoc} */ Modified: trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java 2008-06-06 19:43:48 UTC (rev 4128) +++ trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java 2008-06-06 19:51:11 UTC (rev 4129) @@ -80,14 +80,12 @@ * Adds a new face object. * @param faceName name of face, e.g. <samp>"robe.101"</samp> * @param originalFilename original filename, e.g. <samp>"arch/objects/misc/robe.101.png"</samp> - * @param resourceDirectory directory of the resource, e.g. <samp>"resource/conf"</samp> - * @param resourceName actual filename, e.g. <samp>"crossfire.0"</samp> * @param offset offset in the file denoted by <var>actualFilename</var>, e.g. <samp>148676</samp> * @param size size in the file denoted by <var>actualFilename</var>, e.g. <samp>567</samp>, * @throws DuplicateFaceException in case the face was not unique */ - public void addFaceObject(final String faceName, final String originalFilename, final String resourceDirectory, final String resourceName, final int offset, final int size) throws DuplicateFaceException { - final FaceObject faceObject = new FaceObject(faceName, originalFilename, resourceDirectory, resourceName, offset, size); + public void addFaceObject(final String faceName, final String originalFilename, final int offset, final int size) throws DuplicateFaceException { + final FaceObject faceObject = new FaceObject(faceName, originalFilename, offset, size); final FaceObject otherFaceObject = get(faceName); if (otherFaceObject != null) { throw new DuplicateFaceException(faceObject, otherFaceObject); @@ -162,7 +160,7 @@ } try { - addFaceObject(faceName, faceName, baseDir + "/" + IGUIConstants.PNG_FILE, actualFilename, offset, size); // XXX: originalFilename is incorrect: it missed the path + addFaceObject(faceName, faceName, offset, size); // XXX: originalFilename is incorrect: it misses the path } catch (final DuplicateFaceException ex) { log.warn("Duplicate face " + faceName); } Modified: trunk/daimonin/src/daieditor/gameobject/face/FaceObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/face/FaceObject.java 2008-06-06 19:43:48 UTC (rev 4128) +++ trunk/daimonin/src/daieditor/gameobject/face/FaceObject.java 2008-06-06 19:51:11 UTC (rev 4129) @@ -43,21 +43,16 @@ /** The serial version UID. */ private static final long serialVersionUID = 1; - /** The filename the face actually was loaded from or <code>null</code> when it was loaded from its origin location. */ - private final String actualFilename; - /** * Create a FaceObject which actually was loaded from a different file than its origin. * Invoke this constructor if you loaded the face from <code>daimonin.0</code>. * @param faceName name of face, e.g. <samp>"robe.101"</samp> * @param originalFilename original filename, e.g. <samp>"arch/objects/misc/robe.101.png"</samp> - * @param actualFilename actual filename, e.g. <samp>"arch/daimonin.0"</samp> * @param offset offset in the file denoted by <var>actualFilename</var>, e.g. <samp>148676</samp> * @param size size in the file denoted by <var>actualFilename</var>, e.g. <samp>567</samp>, */ - public FaceObject(final String faceName, final String originalFilename, final String actualFilename, final int offset, final int size) { + public FaceObject(final String faceName, final String originalFilename, final int offset, final int size) { super(faceName, originalFilename, originalFilename, offset, size); - this.actualFilename = actualFilename; } /** {@inheritDoc} */ Modified: trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java 2008-06-06 19:43:48 UTC (rev 4128) +++ trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java 2008-06-06 19:51:11 UTC (rev 4129) @@ -78,7 +78,7 @@ * @throws DuplicateFaceException in case the face was not unique */ public void addFaceObject(final String faceName, final String originalFilename, final String actualFilename, final int offset, final int size) throws DuplicateFaceException { - final FaceObject faceObject = new FaceObject(faceName, originalFilename, actualFilename, offset, size); + final FaceObject faceObject = new FaceObject(faceName, originalFilename, offset, size); final FaceObject otherFaceObject = get(faceName); if (otherFaceObject != null) { throw new DuplicateFaceException(faceObject, otherFaceObject); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-06-06 19:56:07
|
Revision: 4132 http://gridarta.svn.sourceforge.net/gridarta/?rev=4132&view=rev Author: akirschbaum Date: 2008-06-06 12:56:01 -0700 (Fri, 06 Jun 2008) Log Message: ----------- Move FaceObject.getDisplayIcon() to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/face/FaceObject.java trunk/daimonin/src/daieditor/gameobject/face/FaceObject.java trunk/src/app/net/sf/gridarta/gameobject/face/AbstractFaceObject.java Modified: trunk/crossfire/src/cfeditor/gameobject/face/FaceObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/face/FaceObject.java 2008-06-06 19:52:54 UTC (rev 4131) +++ trunk/crossfire/src/cfeditor/gameobject/face/FaceObject.java 2008-06-06 19:56:01 UTC (rev 4132) @@ -19,10 +19,7 @@ package cfeditor.gameobject.face; -import javax.swing.ImageIcon; import net.sf.gridarta.gameobject.face.AbstractFaceObject; -import net.sf.gridarta.gameobject.face.FaceObjectProviders; -import org.jetbrains.annotations.Nullable; /** * A FaceObject represents a single graphical image called face. @@ -46,11 +43,6 @@ super(faceName, originalFilename, originalFilename, offset, size); } - /** {@inheritDoc} */ - @Nullable public ImageIcon getDisplayIcon() { - return FaceObjectProviders.normal.getImageIconForFacename(getFaceName()); - } - @Override public String getPath() { return getOriginalFilename(); } Modified: trunk/daimonin/src/daieditor/gameobject/face/FaceObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/face/FaceObject.java 2008-06-06 19:52:54 UTC (rev 4131) +++ trunk/daimonin/src/daieditor/gameobject/face/FaceObject.java 2008-06-06 19:56:01 UTC (rev 4132) @@ -19,10 +19,7 @@ package daieditor.gameobject.face; -import javax.swing.ImageIcon; import net.sf.gridarta.gameobject.face.AbstractFaceObject; -import net.sf.gridarta.gameobject.face.FaceObjectProviders; -import org.jetbrains.annotations.Nullable; /** * A FaceObject stores information and meta information about a face and provides methods for accessing these. @@ -55,9 +52,4 @@ super(faceName, originalFilename, originalFilename, offset, size); } - /** {@inheritDoc} */ - @Nullable public ImageIcon getDisplayIcon() { - return FaceObjectProviders.normal.getImageIconForFacename(getFaceName()); - } - } // class FaceObject Modified: trunk/src/app/net/sf/gridarta/gameobject/face/AbstractFaceObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/face/AbstractFaceObject.java 2008-06-06 19:52:54 UTC (rev 4131) +++ trunk/src/app/net/sf/gridarta/gameobject/face/AbstractFaceObject.java 2008-06-06 19:56:01 UTC (rev 4132) @@ -19,8 +19,10 @@ package net.sf.gridarta.gameobject.face; +import javax.swing.ImageIcon; import net.sf.gridarta.data.AbstractNamedObject; import net.sf.gridarta.data.NamedObject; +import org.jetbrains.annotations.Nullable; /** * Abstract base implementation of {@link FaceObject}. @@ -130,6 +132,11 @@ return isDouble; } + /** {@inheritDoc} */ + @Nullable public ImageIcon getDisplayIcon() { + return FaceObjectProviders.normal.getImageIconForFacename(getFaceName()); + } + /** * {@inheritDoc} * Overridden to sort bug.101 and bug.111 before all other faces. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-06-06 20:11:47
|
Revision: 4135 http://gridarta.svn.sourceforge.net/gridarta/?rev=4135&view=rev Author: akirschbaum Date: 2008-06-06 13:11:34 -0700 (Fri, 06 Jun 2008) Log Message: ----------- Move FaceObject to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java trunk/src/app/net/sf/gridarta/gameobject/face/AbstractFaceObject.java trunk/src/app/net/sf/gridarta/gameobject/face/FaceObject.java Removed Paths: ------------- trunk/crossfire/src/cfeditor/gameobject/face/FaceObject.java trunk/daimonin/src/daieditor/gameobject/face/FaceObject.java Deleted: trunk/crossfire/src/cfeditor/gameobject/face/FaceObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/face/FaceObject.java 2008-06-06 20:06:33 UTC (rev 4134) +++ trunk/crossfire/src/cfeditor/gameobject/face/FaceObject.java 2008-06-06 20:11:34 UTC (rev 4135) @@ -1,46 +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.face; - -import net.sf.gridarta.gameobject.face.AbstractFaceObject; - -/** - * A FaceObject represents a single graphical image called face. - * FaceObjects may be loaded lazily, which means the underlying graphics data is only loaded when it's really needed. - * @author <a href="mailto:mic...@no...">Michael Toennies</a> - */ -public final class FaceObject extends AbstractFaceObject { - - /** The serial version UID. */ - private static final long serialVersionUID = 1; - - /** - * Creates a FaceObject along with information used for lazy loading. - * @param faceName name of face, e.g. <samp>"bug.111"</samp> - * @param originalFilename original filename, e.g. - * <samp>"/system/bug.111"</samp> - * @param offset offset in the file denoted by <var>actualFilename</var>, e.g. <samp>148676</samp> - * @param size size in the file denoted by <var>actualFilename</var>, e.g. <samp>567</samp>, - */ - public FaceObject(final String faceName, final String originalFilename, final int offset, final int size) { - super(faceName, originalFilename, originalFilename, offset, size); - } - -} // class FaceObject Modified: trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java 2008-06-06 20:06:33 UTC (rev 4134) +++ trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java 2008-06-06 20:11:34 UTC (rev 4135) @@ -33,10 +33,12 @@ import java.io.PrintStream; import java.nio.channels.FileChannel; import net.sf.gridarta.MainControl; +import net.sf.gridarta.gameobject.face.AbstractFaceObject; import net.sf.gridarta.gameobject.face.AbstractFaceObjects; import net.sf.gridarta.gameobject.face.ArchFaceProvider; import net.sf.gridarta.gameobject.face.CollectedFaceProvider; import net.sf.gridarta.gameobject.face.DuplicateFaceException; +import net.sf.gridarta.gameobject.face.FaceObject; import net.sf.gridarta.gameobject.face.FaceObjectProviders; import net.sf.gridarta.io.IOUtils; import net.sf.gridarta.utils.ArrayUtils; @@ -85,7 +87,7 @@ * @throws DuplicateFaceException in case the face was not unique */ public void addFaceObject(final String faceName, final String originalFilename, final int offset, final int size) throws DuplicateFaceException { - final FaceObject faceObject = new FaceObject(faceName, originalFilename, offset, size); + final FaceObject faceObject = new AbstractFaceObject(faceName, originalFilename, originalFilename, offset, size); final FaceObject otherFaceObject = get(faceName); if (otherFaceObject != null) { throw new DuplicateFaceException(faceObject, otherFaceObject); Deleted: trunk/daimonin/src/daieditor/gameobject/face/FaceObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/face/FaceObject.java 2008-06-06 20:06:33 UTC (rev 4134) +++ trunk/daimonin/src/daieditor/gameobject/face/FaceObject.java 2008-06-06 20:11:34 UTC (rev 4135) @@ -1,55 +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.face; - -import net.sf.gridarta.gameobject.face.AbstractFaceObject; - -/** - * A FaceObject stores information and meta information about a face and provides methods for accessing these. - * Mainly this is: - * <ul> - * <li>Face name</li> - * <li>Weakly referenced Image Icon for different appearances of the face</li> - * <li>File name of file where the face originally came from</li> - * <li>File name where the face actually was loaded from (may be the same or different from the previous one)</li> - * <li>File offset in the file name</li> - * <li>File size</li> - * </ul> - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - * @todo think how this class could be serialized because size, offset etc. are not serializable. - */ -public final class FaceObject extends AbstractFaceObject { - - /** The serial version UID. */ - private static final long serialVersionUID = 1; - - /** - * Create a FaceObject which actually was loaded from a different file than its origin. - * Invoke this constructor if you loaded the face from <code>daimonin.0</code>. - * @param faceName name of face, e.g. <samp>"robe.101"</samp> - * @param originalFilename original filename, e.g. <samp>"arch/objects/misc/robe.101.png"</samp> - * @param offset offset in the file denoted by <var>actualFilename</var>, e.g. <samp>148676</samp> - * @param size size in the file denoted by <var>actualFilename</var>, e.g. <samp>567</samp>, - */ - public FaceObject(final String faceName, final String originalFilename, final int offset, final int size) { - super(faceName, originalFilename, originalFilename, offset, size); - } - -} // class FaceObject Modified: trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java 2008-06-06 20:06:33 UTC (rev 4134) +++ trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java 2008-06-06 20:11:34 UTC (rev 4135) @@ -34,10 +34,12 @@ import java.io.OutputStreamWriter; import java.io.PrintStream; import java.nio.channels.FileChannel; +import net.sf.gridarta.gameobject.face.AbstractFaceObject; import net.sf.gridarta.gameobject.face.AbstractFaceObjects; import net.sf.gridarta.gameobject.face.ArchFaceProvider; import net.sf.gridarta.gameobject.face.CollectedFaceProvider; import net.sf.gridarta.gameobject.face.DuplicateFaceException; +import net.sf.gridarta.gameobject.face.FaceObject; import net.sf.gridarta.gameobject.face.FaceObjectProviders; import net.sf.gridarta.utils.ArrayUtils; import net.sf.japi.swing.ActionFactory; @@ -78,7 +80,7 @@ * @throws DuplicateFaceException in case the face was not unique */ public void addFaceObject(final String faceName, final String originalFilename, final String actualFilename, final int offset, final int size) throws DuplicateFaceException { - final FaceObject faceObject = new FaceObject(faceName, originalFilename, offset, size); + final FaceObject faceObject = new AbstractFaceObject(faceName, originalFilename, originalFilename, offset, size); final FaceObject otherFaceObject = get(faceName); if (otherFaceObject != null) { throw new DuplicateFaceException(faceObject, otherFaceObject); Modified: trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java 2008-06-06 20:06:33 UTC (rev 4134) +++ trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java 2008-06-06 20:11:34 UTC (rev 4135) @@ -24,7 +24,6 @@ import daieditor.MultiPositionData; import daieditor.gameobject.Archetype; import daieditor.gameobject.GameObject; -import daieditor.gameobject.face.FaceObject; import daieditor.map.MapArchObject; import java.awt.Color; import java.awt.Dimension; @@ -38,6 +37,7 @@ import java.util.Map; import javax.swing.ImageIcon; import net.sf.gridarta.Size2D; +import net.sf.gridarta.gameobject.face.FaceObject; import net.sf.gridarta.gui.SystemIcons; import net.sf.gridarta.gui.map.AbstractLevelRenderer; import net.sf.gridarta.gui.map.MapGrid; Modified: trunk/src/app/net/sf/gridarta/gameobject/face/AbstractFaceObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/face/AbstractFaceObject.java 2008-06-06 20:06:33 UTC (rev 4134) +++ trunk/src/app/net/sf/gridarta/gameobject/face/AbstractFaceObject.java 2008-06-06 20:11:34 UTC (rev 4135) @@ -38,7 +38,7 @@ * @author <a href="mailto:ch...@ri...">Christian Hujer</a> * @todo think how this class could be serialized because size, offset etc. are not serializable. */ -public abstract class AbstractFaceObject extends AbstractNamedObject implements FaceObject { +public class AbstractFaceObject extends AbstractNamedObject implements FaceObject { /** The face name. */ private final String faceName; @@ -79,7 +79,7 @@ * @param offset offset in the file denoted by <var>actualFilename</var>, e.g. <samp>148676</samp> * @param size size in the file denoted by <var>actualFilename</var>, e.g. <samp>567</samp>, */ - protected AbstractFaceObject(final String faceName, final String originalFilename, final String path, final int offset, final int size) { + public AbstractFaceObject(final String faceName, final String originalFilename, final String path, final int offset, final int size) { super(path); this.faceName = faceName; this.originalFilename = originalFilename; @@ -126,18 +126,12 @@ return size; } - /** - * Return whether this face is an up face. - * @return upFace - */ + /** {@inheritDoc} */ public boolean isUp() { return isUp; } - /** - * Return whether this face is a double face. - * @return doubleFace - */ + /** {@inheritDoc} */ public boolean isDouble() { return isDouble; } Modified: trunk/src/app/net/sf/gridarta/gameobject/face/FaceObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/face/FaceObject.java 2008-06-06 20:06:33 UTC (rev 4134) +++ trunk/src/app/net/sf/gridarta/gameobject/face/FaceObject.java 2008-06-06 20:11:34 UTC (rev 4135) @@ -40,4 +40,16 @@ */ String getOriginalFilename(); + /** + * Return whether this face is an up face. + * @return upFace + */ + boolean isUp(); + + /** + * Return whether this face is a double face. + * @return doubleFace + */ + boolean isDouble(); + } // interface FaceObject This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-06-06 20:40:20
|
Revision: 4139 http://gridarta.svn.sourceforge.net/gridarta/?rev=4139&view=rev Author: akirschbaum Date: 2008-06-06 13:40:24 -0700 (Fri, 06 Jun 2008) Log Message: ----------- Issue more detailed information while collection. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java trunk/src/app/net/sf/gridarta/gameobject/face/AbstractFaceObjects.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 Modified: trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java 2008-06-06 20:22:23 UTC (rev 4138) +++ trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java 2008-06-06 20:40:24 UTC (rev 4139) @@ -222,6 +222,8 @@ @Override protected void collectTreeFile(@NotNull final Progress progress, @NotNull final File dir) throws IOException { final BufferedWriter treeFile = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(dir, IGUIConstants.FACETREE_FILE)), "us-ascii")); try { + final int numOfFaceObjects = size(); + progress.setLabel(ACTION_FACTORY.getString("archCollectTree"), numOfFaceObjects); int i = 0; for (final FaceObject faceObject : this) { final String face = faceObject.getFaceName(); @@ -231,6 +233,7 @@ progress.setValue(i); } } + progress.setValue(numOfFaceObjects); } finally { treeFile.close(); } Modified: trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java 2008-06-06 20:22:23 UTC (rev 4138) +++ trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java 2008-06-06 20:40:24 UTC (rev 4139) @@ -182,6 +182,8 @@ final FileChannel outChannel = fout.getChannel(); final PrintStream binFile = new PrintStream(fout); try { + final int numOfFaceObjects = size(); + progress.setLabel(ACTION_FACTORY.getString("archCollectImages"), numOfFaceObjects); int i = 0; for (final FaceObject faceObject : this) { final String face = faceObject.getFaceName(); @@ -210,6 +212,8 @@ progress.setValue(i); } } + progress.setValue(size()); // finished + progress.finished(); //getArchetypeCount(), faceListCount); } finally { binFile.close(); } @@ -220,6 +224,8 @@ final int stripPath = dir.getAbsolutePath().length(); final BufferedWriter treeFile = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(dir, IGUIConstants.FACETREE_FILE)), "us-ascii")); try { + final int numOfFaceObjects = size(); + progress.setLabel(ACTION_FACTORY.getString("archCollectTree"), numOfFaceObjects); int i = 0; for (final FaceObject faceObject : this) { final String face = faceObject.getFaceName(); @@ -229,6 +235,7 @@ progress.setValue(i); } } + progress.setValue(numOfFaceObjects); } finally { treeFile.close(); } Modified: trunk/src/app/net/sf/gridarta/gameobject/face/AbstractFaceObjects.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/face/AbstractFaceObjects.java 2008-06-06 20:22:23 UTC (rev 4138) +++ trunk/src/app/net/sf/gridarta/gameobject/face/AbstractFaceObjects.java 2008-06-06 20:40:24 UTC (rev 4139) @@ -73,12 +73,9 @@ * But the Java image encoder isn't as good as that of gimp in many cases (yet much better as the old visualtek's). */ public void collect(@NotNull final Progress progress, @NotNull final File dir) throws IOException { - final int numOfFaceObjects = size(); - progress.setLabel(ACTION_FACTORY.getString("archCollectImages"), numOfFaceObjects); collectTreeFile(progress, dir); collectBmapsFile(progress, dir); collectImageFile(progress, dir); - progress.setValue(numOfFaceObjects); } /** @@ -106,6 +103,8 @@ protected void collectBmapsFile(@NotNull final Progress progress, @NotNull final File dir) throws IOException { final PrintWriter textFile = new PrintWriter(new BufferedWriter(new FileWriter(new File(dir, CommonConstants.BMAPS_FILE))), false); try { + final int numOfFaceObjects = size(); + progress.setLabel(ACTION_FACTORY.getString("archCollectBmaps"), numOfFaceObjects); int i = 0; for (final FaceObject faceObject : this) { final String face = faceObject.getFaceName(); @@ -114,6 +113,7 @@ progress.setValue(i); } } + progress.setValue(numOfFaceObjects); } finally { textFile.close(); } Modified: trunk/src/app/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages.properties 2008-06-06 20:22:23 UTC (rev 4138) +++ trunk/src/app/net/sf/gridarta/messages.properties 2008-06-06 20:40:24 UTC (rev 4139) @@ -24,6 +24,8 @@ archCollectTitle=Collect... archCollectArches=Collecting Arches... archCollectImages=Collecting Images... +archCollectTree=Collecting Images Tree... +archCollectBmaps=Collecting Image Numbers... archCollectErrorIOException.title=Collect Error archCollectErrorIOException.message=Collect Error: An I/O Exception occurred on file {0}:\n{1} nameOfAnimationObject=Animation Modified: trunk/src/app/net/sf/gridarta/messages_de.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_de.properties 2008-06-06 20:22:23 UTC (rev 4138) +++ trunk/src/app/net/sf/gridarta/messages_de.properties 2008-06-06 20:40:24 UTC (rev 4139) @@ -24,6 +24,8 @@ archCollectTitle=Sammeln... archCollectArches=Sammle Archetypen... archCollectImages=Sammle Bilder... +archCollectTree=Sammle Bilder (Baum)... +archCollectBmaps=Collecting Bilder (Nummern)... archCollectErrorIOException.title=Fehler beim Sammeln archCollectErrorIOException.message=Fehler beim Sammeln: In {0} ist ein Ein-/Ausgabefehler ist aufgetreten:\n{1} nameOfAnimationObject=Animation Modified: trunk/src/app/net/sf/gridarta/messages_fr.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_fr.properties 2008-06-06 20:22:23 UTC (rev 4138) +++ trunk/src/app/net/sf/gridarta/messages_fr.properties 2008-06-06 20:40:24 UTC (rev 4139) @@ -24,6 +24,8 @@ #archCollectTitle= #archCollectArches= #archCollectImages= +#archCollectTree= +#archCollectBmaps= #archCollectErrorIOException.title= #archCollectErrorIOException.message= #nameOfAnimationObject= Modified: trunk/src/app/net/sf/gridarta/messages_sv.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_sv.properties 2008-06-06 20:22:23 UTC (rev 4138) +++ trunk/src/app/net/sf/gridarta/messages_sv.properties 2008-06-06 20:40:24 UTC (rev 4139) @@ -24,6 +24,8 @@ #archCollectTitle= archCollectArches=Sammanst\xE4ller arketyper... archCollectImages=Sammanst\xE4ller bilder... +#archCollectTree= +#archCollectBmaps= archCollectErrorIOException.title=Fel under sammanst\xE4llning archCollectErrorIOException.message=Fel under sammanst\xE4llning: ett I/O-fel intr\xE4ffade f\xF6r filen {0}:\n{1} nameOfAnimationObject=animation This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-06-06 20:50:23
|
Revision: 4140 http://gridarta.svn.sourceforge.net/gridarta/?rev=4140&view=rev Author: akirschbaum Date: 2008-06-06 13:50:03 -0700 (Fri, 06 Jun 2008) Log Message: ----------- Move FaceObjects.addFaceObject() to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java trunk/src/app/net/sf/gridarta/gameobject/face/AbstractFaceObjects.java Modified: trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java 2008-06-06 20:40:24 UTC (rev 4139) +++ trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java 2008-06-06 20:50:03 UTC (rev 4140) @@ -79,24 +79,6 @@ } /** - * Adds a new face object. - * @param faceName name of face, e.g. <samp>"robe.101"</samp> - * @param originalFilename original filename, e.g. <samp>"arch/objects/misc/robe.101.png"</samp> - * @param actualFilename actual filename, e.g. <samp>"arch/daimonin.0"</samp> - * @param offset offset in the file denoted by <var>actualFilename</var>, e.g. <samp>148676</samp> - * @param size size in the file denoted by <var>actualFilename</var>, e.g. <samp>567</samp>, - * @throws DuplicateFaceException in case the face was not unique - */ - public void addFaceObject(final String faceName, final String originalFilename, final String actualFilename, final int offset, final int size) throws DuplicateFaceException { - final FaceObject faceObject = new AbstractFaceObject(faceName, originalFilename, actualFilename, offset, size); - final FaceObject otherFaceObject = get(faceName); - if (otherFaceObject != null) { - throw new DuplicateFaceException(faceObject, otherFaceObject); - } - put(faceObject); - } - - /** * Loads all faces from a png collection file. * @param faceFile file to load faces from * @param treeFile file to load tree information from Modified: trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java 2008-06-06 20:40:24 UTC (rev 4139) +++ trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java 2008-06-06 20:50:03 UTC (rev 4140) @@ -71,24 +71,6 @@ } /** - * Adds a new face object. - * @param faceName name of face, e.g. <samp>"robe.101"</samp> - * @param originalFilename original filename, e.g. <samp>"arch/objects/misc/robe.101.png"</samp> - * @param actualFilename actual filename, e.g. <samp>"arch/daimonin.0"</samp> - * @param offset offset in the file denoted by <var>actualFilename</var>, e.g. <samp>148676</samp> - * @param size size in the file denoted by <var>actualFilename</var>, e.g. <samp>567</samp>, - * @throws DuplicateFaceException in case the face was not unique - */ - public void addFaceObject(final String faceName, final String originalFilename, final String actualFilename, final int offset, final int size) throws DuplicateFaceException { - final FaceObject faceObject = new AbstractFaceObject(faceName, originalFilename, actualFilename, offset, size); - final FaceObject otherFaceObject = get(faceName); - if (otherFaceObject != null) { - throw new DuplicateFaceException(faceObject, otherFaceObject); - } - put(faceObject); - } - - /** * Loads all faces from a png collection file. * @param faceFile file to load faces from * @param treeFile file to load tree information from Modified: trunk/src/app/net/sf/gridarta/gameobject/face/AbstractFaceObjects.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/face/AbstractFaceObjects.java 2008-06-06 20:40:24 UTC (rev 4139) +++ trunk/src/app/net/sf/gridarta/gameobject/face/AbstractFaceObjects.java 2008-06-06 20:50:03 UTC (rev 4140) @@ -119,4 +119,22 @@ } } + /** + * Adds a new face object. + * @param faceName name of face, e.g. <samp>"robe.101"</samp> + * @param originalFilename original filename, e.g. <samp>"arch/objects/misc/robe.101.png"</samp> + * @param actualFilename actual filename, e.g. <samp>"arch/daimonin.0"</samp> + * @param offset offset in the file denoted by <var>actualFilename</var>, e.g. <samp>148676</samp> + * @param size size in the file denoted by <var>actualFilename</var>, e.g. <samp>567</samp>, + * @throws DuplicateFaceException in case the face was not unique + */ + public void addFaceObject(final String faceName, final String originalFilename, final String actualFilename, final int offset, final int size) throws DuplicateFaceException { + final FaceObject faceObject = new AbstractFaceObject(faceName, originalFilename, actualFilename, offset, size); + final FaceObject otherFaceObject = get(faceName); + if (otherFaceObject != null) { + throw new DuplicateFaceException(faceObject, otherFaceObject); + } + put((E) faceObject); + } + } // class AbstractFaceObjects This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-06-06 20:54:44
|
Revision: 4142 http://gridarta.svn.sourceforge.net/gridarta/?rev=4142&view=rev Author: akirschbaum Date: 2008-06-06 13:54:25 -0700 (Fri, 06 Jun 2008) Log Message: ----------- Remove unused import statements. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java Modified: trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java 2008-06-06 20:52:52 UTC (rev 4141) +++ trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java 2008-06-06 20:54:25 UTC (rev 4142) @@ -33,7 +33,6 @@ import java.io.PrintStream; import java.nio.channels.FileChannel; import net.sf.gridarta.MainControl; -import net.sf.gridarta.gameobject.face.AbstractFaceObject; import net.sf.gridarta.gameobject.face.AbstractFaceObjects; import net.sf.gridarta.gameobject.face.ArchFaceProvider; import net.sf.gridarta.gameobject.face.CollectedFaceProvider; Modified: trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java 2008-06-06 20:52:52 UTC (rev 4141) +++ trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java 2008-06-06 20:54:25 UTC (rev 4142) @@ -34,7 +34,6 @@ import java.io.OutputStreamWriter; import java.io.PrintStream; import java.nio.channels.FileChannel; -import net.sf.gridarta.gameobject.face.AbstractFaceObject; import net.sf.gridarta.gameobject.face.AbstractFaceObjects; import net.sf.gridarta.gameobject.face.ArchFaceProvider; import net.sf.gridarta.gameobject.face.CollectedFaceProvider; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-06-06 20:59:20
|
Revision: 4145 http://gridarta.svn.sourceforge.net/gridarta/?rev=4145&view=rev Author: akirschbaum Date: 2008-06-06 13:59:06 -0700 (Fri, 06 Jun 2008) Log Message: ----------- Remove unneeded type parameters. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java trunk/src/app/net/sf/gridarta/gameobject/face/AbstractFaceObjects.java trunk/src/app/net/sf/gridarta/gameobject/face/FaceObjects.java Modified: trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java 2008-06-06 20:56:22 UTC (rev 4144) +++ trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java 2008-06-06 20:59:06 UTC (rev 4145) @@ -50,7 +50,7 @@ * This class manages the FaceObjects. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public final class FaceObjects extends AbstractFaceObjects<FaceObject> { +public final class FaceObjects extends AbstractFaceObjects { /** Size of the image buffer. */ private static final int IMAGE_BUFFER_SIZE = 50 * 1024; Modified: trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java 2008-06-06 20:56:22 UTC (rev 4144) +++ trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java 2008-06-06 20:59:06 UTC (rev 4145) @@ -50,7 +50,7 @@ * This class manages the FaceObjects. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public final class FaceObjects extends AbstractFaceObjects<FaceObject> { +public final class FaceObjects extends AbstractFaceObjects { /** The Logger for printing log messages. */ private static final Logger log = Logger.getLogger(FaceObjects.class); Modified: trunk/src/app/net/sf/gridarta/gameobject/face/AbstractFaceObjects.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/face/AbstractFaceObjects.java 2008-06-06 20:56:22 UTC (rev 4144) +++ trunk/src/app/net/sf/gridarta/gameobject/face/AbstractFaceObjects.java 2008-06-06 20:59:06 UTC (rev 4145) @@ -36,7 +36,7 @@ * Abstract base implementation of {@link FaceObjects}. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public abstract class AbstractFaceObjects <E extends FaceObject> extends AbstractNamedObjects<E> implements FaceObjects<E> { +public abstract class AbstractFaceObjects extends AbstractNamedObjects<FaceObject> implements FaceObjects { /** Action Factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta"); @@ -134,7 +134,7 @@ if (otherFaceObject != null) { throw new DuplicateFaceException(faceObject, otherFaceObject); } - put((E) faceObject); + put(faceObject); } } // class AbstractFaceObjects Modified: trunk/src/app/net/sf/gridarta/gameobject/face/FaceObjects.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/face/FaceObjects.java 2008-06-06 20:56:22 UTC (rev 4144) +++ trunk/src/app/net/sf/gridarta/gameobject/face/FaceObjects.java 2008-06-06 20:59:06 UTC (rev 4145) @@ -26,6 +26,6 @@ * FaceObjects is a container for {@link FaceObject}s. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public interface FaceObjects<E extends FaceObject> extends Collectable, NamedObjects<E> { +public interface FaceObjects extends Collectable, NamedObjects<FaceObject> { } // interface FaceObjects This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-06-06 21:09:08
|
Revision: 4146 http://gridarta.svn.sourceforge.net/gridarta/?rev=4146&view=rev Author: akirschbaum Date: 2008-06-06 14:08:37 -0700 (Fri, 06 Jun 2008) Log Message: ----------- Move GameObjectAttributesDialog.buildInvSpellBox() to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/GameObjectAttributesDialog.java trunk/daimonin/src/daieditor/gui/GameObjectAttributesDialog.java trunk/src/app/net/sf/gridarta/gui/AbstractGameObjectAttributesDialog.java Modified: trunk/crossfire/src/cfeditor/gui/GameObjectAttributesDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/GameObjectAttributesDialog.java 2008-06-06 20:59:06 UTC (rev 4145) +++ trunk/crossfire/src/cfeditor/gui/GameObjectAttributesDialog.java 2008-06-06 21:08:37 UTC (rev 4146) @@ -134,68 +134,6 @@ return comboBox; } - /** {@inheritDoc} */ - @Override protected JComboBox buildInvSpellBox(final CFArchAttrib attr) { - final boolean isOptionalSpell = attr.getDataType() == ArchAttribType.INV_SPELL_OPTIONAL; - final Vector<String> content = new Vector<String>(); - final int selectedIndex; - final String title; - switch (gameObject.countInvObjects()) { - case 0: - selectedIndex = mainControl.getGameObjectSpells().size(); - title = isOptionalSpell ? null : "<none>"; - break; - - default: - selectedIndex = mainControl.getGameObjectSpells().size() + (isOptionalSpell ? 1 : 0); - title = "<multiple>"; - break; - - case 1: - final GameObject invObject = gameObject.iterator().next(); - final String invObjectArchetypeName = invObject.getArchetype().getArchetypeName(); - int index = 0; - boolean found = false; - String tmpTitle = "<customized spell>"; - for (final GameObjectSpell<GameObject, MapArchObject, Archetype> spellObject : mainControl.getGameObjectSpells()) { - if (invObjectArchetypeName.equals(spellObject.getArchetypeName())) { - if (invObject.isDefaultGameObject()) { - tmpTitle = null; - } else { - tmpTitle = spellObject.getName() + " <customized>"; - } - found = true; - break; - } - index++; - } - if (tmpTitle != null) { - selectedIndex = mainControl.getGameObjectSpells().size() + (isOptionalSpell ? 1 : 0); - } else { - selectedIndex = index; - } - title = tmpTitle; - break; - } - - for (final Spell spell : mainControl.getGameObjectSpells()) { - content.add(spell.getName()); - } - if (isOptionalSpell) { - content.add("<none>"); - } - if (title != null) { - content.add(title); - } - - final JComboBox comboBox = new JComboBox(content); - comboBox.setSelectedIndex(selectedIndex); - comboBox.setMaximumRowCount(10); - comboBox.setKeySelectionManager(new StringKeyManager(comboBox)); - comboBox.setName(attr.getNameNew()); - return comboBox; - } - /** * Return the spell index for a spell number. * Modified: trunk/daimonin/src/daieditor/gui/GameObjectAttributesDialog.java =================================================================== --- trunk/daimonin/src/daieditor/gui/GameObjectAttributesDialog.java 2008-06-06 20:59:06 UTC (rev 4145) +++ trunk/daimonin/src/daieditor/gui/GameObjectAttributesDialog.java 2008-06-06 21:08:37 UTC (rev 4146) @@ -40,7 +40,6 @@ import net.sf.gridarta.gameobject.ArchAttribType; import net.sf.gridarta.gui.AbstractGameObjectAttributesDialog; import net.sf.gridarta.gui.map.TilePanel; -import net.sf.gridarta.spells.GameObjectSpell; import net.sf.gridarta.spells.NumberSpell; import net.sf.gridarta.spells.Spell; import net.sf.gridarta.spells.Spells; @@ -134,68 +133,6 @@ return comboBox; } - /** {@inheritDoc} */ - @Override protected JComboBox buildInvSpellBox(final CFArchAttrib attr) { - final boolean isOptionalSpell = attr.getDataType() == ArchAttribType.INV_SPELL_OPTIONAL; - final Vector<String> content = new Vector<String>(); - final int selectedIndex; - final String title; - switch (gameObject.countInvObjects()) { - case 0: - selectedIndex = mainControl.getGameObjectSpells().size(); - title = isOptionalSpell ? null : "<none>"; - break; - - default: - selectedIndex = mainControl.getGameObjectSpells().size() + (isOptionalSpell ? 1 : 0); - title = "<multiple>"; - break; - - case 1: - final GameObject invObject = gameObject.iterator().next(); - final String invObjectArchetypeName = invObject.getArchetype().getArchetypeName(); - int index = 0; - boolean found = false; - String tmpTitle = "<customized spell>"; - for (final GameObjectSpell<GameObject, MapArchObject, Archetype> spellObject : mainControl.getGameObjectSpells()) { - if (invObjectArchetypeName.equals(spellObject.getArchetypeName())) { - if (invObject.isDefaultGameObject()) { - tmpTitle = null; - } else { - tmpTitle = spellObject.getName() + " <customized>"; - } - found = true; - break; - } - index++; - } - if (tmpTitle != null) { - selectedIndex = mainControl.getGameObjectSpells().size() + (isOptionalSpell ? 1 : 0); - } else { - selectedIndex = index; - } - title = tmpTitle; - break; - } - - for (final Spell spell : mainControl.getGameObjectSpells()) { - content.add(spell.getName()); - } - if (isOptionalSpell) { - content.add("<none>"); - } - if (title != null) { - content.add(title); - } - - final JComboBox comboBox = new JComboBox(content); - comboBox.setSelectedIndex(selectedIndex); - comboBox.setMaximumRowCount(10); - comboBox.setKeySelectionManager(new StringKeyManager(comboBox)); - comboBox.setName(attr.getNameNew()); - return comboBox; - } - /** * Return the spell index for a spell number. * Modified: trunk/src/app/net/sf/gridarta/gui/AbstractGameObjectAttributesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/AbstractGameObjectAttributesDialog.java 2008-06-06 20:59:06 UTC (rev 4145) +++ trunk/src/app/net/sf/gridarta/gui/AbstractGameObjectAttributesDialog.java 2008-06-06 21:08:37 UTC (rev 4146) @@ -44,6 +44,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Vector; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.BorderFactory; @@ -95,6 +96,8 @@ import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapModel; import net.sf.gridarta.map.MapSquare; +import net.sf.gridarta.spells.GameObjectSpell; +import net.sf.gridarta.spells.Spell; import net.sf.gridarta.textedit.textarea.JEditTextArea; import net.sf.gridarta.textedit.textarea.SyntaxDocument; import net.sf.gridarta.textedit.textarea.tokenmarker.TokenMarkerFactory; @@ -275,8 +278,67 @@ * @param attr spell attribute * @return the completed <code>JComboBox</code> */ - protected abstract JComboBox buildInvSpellBox(final CFArchAttrib attr); + private JComboBox buildInvSpellBox(final CFArchAttrib attr) { + final boolean isOptionalSpell = attr.getDataType() == ArchAttribType.INV_SPELL_OPTIONAL; + final Vector<String> content = new Vector<String>(); + final int selectedIndex; + final String title; + switch (gameObject.countInvObjects()) { + case 0: + selectedIndex = mainControl.getGameObjectSpells().size(); + title = isOptionalSpell ? null : "<none>"; + break; + default: + selectedIndex = mainControl.getGameObjectSpells().size() + (isOptionalSpell ? 1 : 0); + title = "<multiple>"; + break; + + case 1: + final G invObject = gameObject.iterator().next(); + final String invObjectArchetypeName = invObject.getArchetype().getArchetypeName(); + int index = 0; + boolean found = false; + String tmpTitle = "<customized spell>"; + for (final GameObjectSpell<G, A, R> spellObject : mainControl.getGameObjectSpells()) { + if (invObjectArchetypeName.equals(spellObject.getArchetypeName())) { + if (invObject.isDefaultGameObject()) { + tmpTitle = null; + } else { + tmpTitle = spellObject.getName() + " <customized>"; + } + found = true; + break; + } + index++; + } + if (tmpTitle != null) { + selectedIndex = mainControl.getGameObjectSpells().size() + (isOptionalSpell ? 1 : 0); + } else { + selectedIndex = index; + } + title = tmpTitle; + break; + } + + for (final Spell spell : mainControl.getGameObjectSpells()) { + content.add(spell.getName()); + } + if (isOptionalSpell) { + content.add("<none>"); + } + if (title != null) { + content.add(title); + } + + final JComboBox comboBox = new JComboBox(content); + comboBox.setSelectedIndex(selectedIndex); + comboBox.setMaximumRowCount(10); + comboBox.setKeySelectionManager(new StringKeyManager(comboBox)); + comboBox.setName(attr.getNameNew()); + return comboBox; + } + /** * Construct the Combo box for arrays of "list data" (this is used for ArchAttribType.LIST). * @param attr list attribute This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-06-06 21:11:28
|
Revision: 4147 http://gridarta.svn.sourceforge.net/gridarta/?rev=4147&view=rev Author: akirschbaum Date: 2008-06-06 14:11:34 -0700 (Fri, 06 Jun 2008) Log Message: ----------- Move GameObjectAttributesDialog.getFace() to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/GameObjectAttributesDialog.java trunk/daimonin/src/daieditor/gui/GameObjectAttributesDialog.java trunk/src/app/net/sf/gridarta/gui/AbstractGameObjectAttributesDialog.java Modified: trunk/crossfire/src/cfeditor/gui/GameObjectAttributesDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/GameObjectAttributesDialog.java 2008-06-06 21:08:37 UTC (rev 4146) +++ trunk/crossfire/src/cfeditor/gui/GameObjectAttributesDialog.java 2008-06-06 21:11:34 UTC (rev 4147) @@ -25,7 +25,6 @@ import cfeditor.map.MapArchObject; import java.util.List; import java.util.Vector; -import javax.swing.ImageIcon; import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JDialog; @@ -152,11 +151,6 @@ } /** {@inheritDoc} */ - @Override protected ImageIcon getFace(@NotNull final GameObject gameObject) { - return mainControl.getArchetypeSet().getFace(gameObject); - } - - /** {@inheritDoc} */ @Override protected String getFaceName(@NotNull final GameObject gameObject) { if (gameObject.getFaceName() != null && gameObject.getFaceName().length() > 0) { return gameObject.getFaceName(); Modified: trunk/daimonin/src/daieditor/gui/GameObjectAttributesDialog.java =================================================================== --- trunk/daimonin/src/daieditor/gui/GameObjectAttributesDialog.java 2008-06-06 21:08:37 UTC (rev 4146) +++ trunk/daimonin/src/daieditor/gui/GameObjectAttributesDialog.java 2008-06-06 21:11:34 UTC (rev 4147) @@ -25,7 +25,6 @@ import daieditor.map.MapArchObject; import java.util.List; import java.util.Vector; -import javax.swing.ImageIcon; import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JDialog; @@ -151,11 +150,6 @@ } /** {@inheritDoc} */ - @Override protected ImageIcon getFace(@NotNull final GameObject gameObject) { - return mainControl.getArchetypeSet().getFace(gameObject); - } - - /** {@inheritDoc} */ @Override protected String getFaceName(@NotNull final GameObject gameObject) { if (gameObject.getFaceName() != null && gameObject.getFaceName().length() > 0) { return gameObject.getFaceName(); Modified: trunk/src/app/net/sf/gridarta/gui/AbstractGameObjectAttributesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/AbstractGameObjectAttributesDialog.java 2008-06-06 21:08:37 UTC (rev 4146) +++ trunk/src/app/net/sf/gridarta/gui/AbstractGameObjectAttributesDialog.java 2008-06-06 21:11:34 UTC (rev 4147) @@ -374,7 +374,9 @@ * @param gameObject GameObject to return face for. * @return Face for the supplied GameObject. */ - protected abstract ImageIcon getFace(@NotNull final G gameObject); + private ImageIcon getFace(@NotNull final G gameObject) { + return mainControl.getArchetypeSet().getFace(gameObject); + } /** * Returns the name of a face for a GameObject. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-06-06 21:13:28
|
Revision: 4148 http://gridarta.svn.sourceforge.net/gridarta/?rev=4148&view=rev Author: akirschbaum Date: 2008-06-06 14:13:25 -0700 (Fri, 06 Jun 2008) Log Message: ----------- Move GameObjectAttributesDialog.getFaceName() to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/GameObjectAttributesDialog.java trunk/daimonin/src/daieditor/gui/GameObjectAttributesDialog.java trunk/src/app/net/sf/gridarta/gui/AbstractGameObjectAttributesDialog.java Modified: trunk/crossfire/src/cfeditor/gui/GameObjectAttributesDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/GameObjectAttributesDialog.java 2008-06-06 21:11:34 UTC (rev 4147) +++ trunk/crossfire/src/cfeditor/gui/GameObjectAttributesDialog.java 2008-06-06 21:13:25 UTC (rev 4148) @@ -150,15 +150,6 @@ return -1; } - /** {@inheritDoc} */ - @Override protected String getFaceName(@NotNull final GameObject gameObject) { - if (gameObject.getFaceName() != null && gameObject.getFaceName().length() > 0) { - return gameObject.getFaceName(); - } else { - return gameObject.getArchetype().getFaceName(); - } - } - /** * This method is called when the "apply"-button has been * pressed. All the settings from the dialog get Modified: trunk/daimonin/src/daieditor/gui/GameObjectAttributesDialog.java =================================================================== --- trunk/daimonin/src/daieditor/gui/GameObjectAttributesDialog.java 2008-06-06 21:11:34 UTC (rev 4147) +++ trunk/daimonin/src/daieditor/gui/GameObjectAttributesDialog.java 2008-06-06 21:13:25 UTC (rev 4148) @@ -149,15 +149,6 @@ return -1; } - /** {@inheritDoc} */ - @Override protected String getFaceName(@NotNull final GameObject gameObject) { - if (gameObject.getFaceName() != null && gameObject.getFaceName().length() > 0) { - return gameObject.getFaceName(); - } else { - return gameObject.getArchetype().getFaceName(); - } - } - /** * This method is called when the "apply"-button has been * pressed. All the settings from the dialog get Modified: trunk/src/app/net/sf/gridarta/gui/AbstractGameObjectAttributesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/AbstractGameObjectAttributesDialog.java 2008-06-06 21:11:34 UTC (rev 4147) +++ trunk/src/app/net/sf/gridarta/gui/AbstractGameObjectAttributesDialog.java 2008-06-06 21:13:25 UTC (rev 4148) @@ -383,8 +383,15 @@ * @param gameObject GameObject to return face name for. * @return Name of the GameObject's face. */ - protected abstract String getFaceName(@NotNull final G gameObject); + private String getFaceName(@NotNull final G gameObject) { + if (gameObject.getFaceName() != null && gameObject.getFaceName().length() > 0) { + return gameObject.getFaceName(); + } else { + return gameObject.getArchetype().getFaceName(); + } + } + /** * Construct the upper left part of the attribute dialog, * containing name, type, archetype name and face. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-06-06 21:33:57
|
Revision: 4154 http://gridarta.svn.sourceforge.net/gridarta/?rev=4154&view=rev Author: akirschbaum Date: 2008-06-06 14:34:04 -0700 (Fri, 06 Jun 2008) Log Message: ----------- Move AbstractGameObjectAttributesDialog into separate package. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/GameObjectAttributesDialog.java trunk/daimonin/src/daieditor/gui/GameObjectAttributesDialog.java trunk/src/app/net/sf/gridarta/CAttribBitmask.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialog.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/gui/AbstractGameObjectAttributesDialog.java Modified: trunk/crossfire/src/cfeditor/gui/GameObjectAttributesDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/GameObjectAttributesDialog.java 2008-06-06 21:29:36 UTC (rev 4153) +++ trunk/crossfire/src/cfeditor/gui/GameObjectAttributesDialog.java 2008-06-06 21:34:04 UTC (rev 4154) @@ -37,7 +37,7 @@ import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; import net.sf.gridarta.gameobject.ArchAttribType; -import net.sf.gridarta.gui.AbstractGameObjectAttributesDialog; +import net.sf.gridarta.gui.gameobjectattributesdialog.AbstractGameObjectAttributesDialog; import net.sf.gridarta.gui.map.TilePanel; import net.sf.gridarta.spells.GameObjectSpell; import net.sf.gridarta.spells.NumberSpell; Modified: trunk/daimonin/src/daieditor/gui/GameObjectAttributesDialog.java =================================================================== --- trunk/daimonin/src/daieditor/gui/GameObjectAttributesDialog.java 2008-06-06 21:29:36 UTC (rev 4153) +++ trunk/daimonin/src/daieditor/gui/GameObjectAttributesDialog.java 2008-06-06 21:34:04 UTC (rev 4154) @@ -37,7 +37,7 @@ import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; import net.sf.gridarta.gameobject.ArchAttribType; -import net.sf.gridarta.gui.AbstractGameObjectAttributesDialog; +import net.sf.gridarta.gui.gameobjectattributesdialog.AbstractGameObjectAttributesDialog; import net.sf.gridarta.gui.map.TilePanel; import net.sf.gridarta.spells.NumberSpell; import net.sf.gridarta.spells.Spell; Modified: trunk/src/app/net/sf/gridarta/CAttribBitmask.java =================================================================== --- trunk/src/app/net/sf/gridarta/CAttribBitmask.java 2008-06-06 21:29:36 UTC (rev 4153) +++ trunk/src/app/net/sf/gridarta/CAttribBitmask.java 2008-06-06 21:34:04 UTC (rev 4154) @@ -31,7 +31,7 @@ import javax.swing.JPanel; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathExpressionException; -import net.sf.gridarta.gui.AbstractGameObjectAttributesDialog; +import net.sf.gridarta.gui.gameobjectattributesdialog.AbstractGameObjectAttributesDialog; import net.sf.japi.xml.NodeListIterator; import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; Deleted: trunk/src/app/net/sf/gridarta/gui/AbstractGameObjectAttributesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/AbstractGameObjectAttributesDialog.java 2008-06-06 21:29:36 UTC (rev 4153) +++ trunk/src/app/net/sf/gridarta/gui/AbstractGameObjectAttributesDialog.java 2008-06-06 21:34:04 UTC (rev 4154) @@ -1,1575 +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 net.sf.gridarta.gui; - -import java.awt.BorderLayout; -import java.awt.CardLayout; -import java.awt.Color; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.GridLayout; -import java.awt.Insets; -import java.awt.Rectangle; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.FocusEvent; -import java.awt.event.FocusListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.io.File; -import java.text.NumberFormat; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Vector; -import javax.swing.AbstractAction; -import javax.swing.Action; -import javax.swing.BorderFactory; -import javax.swing.Box; -import javax.swing.BoxLayout; -import javax.swing.ComboBoxModel; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JComboBox; -import javax.swing.JComponent; -import javax.swing.JDialog; -import javax.swing.JFormattedTextField; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JSplitPane; -import javax.swing.JTabbedPane; -import javax.swing.JTextArea; -import javax.swing.JTextField; -import javax.swing.JTextPane; -import javax.swing.JViewport; -import javax.swing.ScrollPaneConstants; -import javax.swing.SwingConstants; -import javax.swing.WindowConstants; -import javax.swing.text.BadLocationException; -import javax.swing.text.DefaultFormatterFactory; -import javax.swing.text.Document; -import javax.swing.text.JTextComponent; -import javax.swing.text.NumberFormatter; -import javax.swing.text.Style; -import javax.swing.text.StyleConstants; -import javax.swing.text.StyleContext; -import net.sf.gridarta.CAttribBitmask; -import net.sf.gridarta.CFArchAttrib; -import net.sf.gridarta.CFArchType; -import net.sf.gridarta.CFArchTypeList; -import net.sf.gridarta.CommonConstants; -import net.sf.gridarta.MainControl; -import net.sf.gridarta.data.NamedObject; -import net.sf.gridarta.data.NamedObjects; -import net.sf.gridarta.gameobject.ArchAttribType; -import net.sf.gridarta.gameobject.Archetype; -import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.gui.map.TilePanel; -import net.sf.gridarta.help.Help; -import net.sf.gridarta.map.MapArchObject; -import net.sf.gridarta.map.MapModel; -import net.sf.gridarta.map.MapSquare; -import net.sf.gridarta.spells.GameObjectSpell; -import net.sf.gridarta.spells.Spell; -import net.sf.gridarta.textedit.textarea.JEditTextArea; -import net.sf.gridarta.textedit.textarea.SyntaxDocument; -import net.sf.gridarta.textedit.textarea.tokenmarker.TokenMarkerFactory; -import net.sf.gridarta.treasurelist.CFTreasureListTree; -import net.sf.japi.swing.ActionFactory; -import org.apache.log4j.Logger; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * Common base class for game object attributes dialogs. - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - */ -public abstract class AbstractGameObjectAttributesDialog<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends JOptionPane implements FocusListener { - - /** The Logger for printing log messages. */ - private static final Logger log = Logger.getLogger(AbstractGameObjectAttributesDialog.class); - - /** Action Factory. */ - private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta"); - - /** - * The width (columns) for input fields like textfields or JChooseBoxes. - */ - public static final int TEXTFIELD_COLUMNS = 18; - - /** Reference to the list of CFArchTypes. */ - protected final CFArchTypeList archTypeList; - - /** Reference to MainControl. */ - protected final MainControl<G, A, R, ?> mainControl; - - @NotNull private final CFTreasureListTree<G, A, R> treasureListTree; - - protected final List<DialogAttrib<?>> dialogAttribs = new ArrayList<DialogAttrib<?>>(); - - private JComboBox typesel; // selection box for type - - protected JLabel imagePanel; // panel for object's face (png) - - /** The game object being modified. */ - @NotNull protected final G gameObject; - - protected final Archetype<G, A, R> archetype; - - protected CFArchType type; // reference to the type data - - // this differs from the GameObject if the type is undefined - private int listNr; // the position of this type in the type list - - /** The CardLayout for toggling between edit and summary. */ - private final CardLayout cardLayout = new CardLayout(); - - /** The Action for switching to the summary. */ - private final Action summaryAction = ACTION_FACTORY.createAction(false, "attribSummary", this); - - /** The Action for switching to the edit. */ - private final Action editAction = ACTION_FACTORY.createAction(false, "attribEdit", this); - - /** The Button for toggling the summary. */ - private JButton summaryEditButton; - - /** The Button for cancel. */ - private JButton cancelButton; - - /** The Button for ok. */ - protected JButton okButton; - - /** Central tabbed pane (the place where all the attribute tabs are). */ - private JTabbedPane tabbedPane; - - /** Central pane, this is the parent component of above tabbed pane. */ - private final JPanel centerPane; - - /** Text pane where the summary is displayed. */ - private final JTextPane summaryTP; - - /** The gameObject objects that already are shown, to avoid opening a dialog twice. */ - protected static final Map<GameObject<?, ?, ?>, JDialog> dialogs = new HashMap<GameObject<?, ?, ?>, JDialog>(); - - /** - * Create an AbstractGameObjectAttributesDialog. - * @param archTypeList Reference to the list of CFArchTypes. - * @param gameObject GameObject to show dialog for. - * @param mainControl MainControl, for retrieving AnimationObjects, FaceObjects etc.. - * @param treasureListTree the treasure list tree - */ - protected AbstractGameObjectAttributesDialog(final CFArchTypeList archTypeList, @NotNull final G gameObject, @NotNull final MainControl<G, A, R, ?> mainControl, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { - this.archTypeList = archTypeList; - this.gameObject = gameObject.getHead(); - this.mainControl = mainControl; - this.treasureListTree = treasureListTree; - archetype = this.gameObject.getArchetype(); - - type = archTypeList.getType(gameObject); - listNr = archTypeList.getArchTypeIndex(type); - - // first split top-left and -right - final JComponent leftPane = buildHeader(); - final JScrollPane rightPane = buildInv(); - - //Create a split pane with the two scroll panes in it. - final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftPane, rightPane); - - // Now split horizontally - //JScrollPane centerPane = buildAttr(); - centerPane = new JPanel(cardLayout); - centerPane.add("edit", buildAttr()); - summaryTP = new JTextPane(); - summaryTP.setEditable(false); - summaryTP.setBorder(BorderFactory.createEmptyBorder(3, 15, 0, 0)); - centerPane.add("summary", new JScrollPane(summaryTP)); - final Dimension size = centerPane.getPreferredSize(); - size.height = 256; - centerPane.setMinimumSize(size); - centerPane.setPreferredSize(size); - - final JPanel contentPanel = new JPanel(new GridBagLayout()); - final GridBagConstraints gbc = new GridBagConstraints(); - gbc.weightx = 1.0; - gbc.fill = GridBagConstraints.BOTH; - gbc.gridwidth = GridBagConstraints.REMAINDER; - gbc.weighty = 0.0; - contentPanel.add(splitPane, gbc); - gbc.weighty = 1.0; - contentPanel.add(centerPane, gbc); - - setOptions(buildOptions()); - - setMessage(contentPanel); - } - - /** {@inheritDoc} */ - @Override public void setValue(final Object newValue) { - super.setValue(newValue); - if (newValue != UNINITIALIZED_VALUE) { - dialogs.remove(gameObject).dispose(); - } - } - - /** - * Construct the Combo box of the available archetypes. - * @return a <code>JComponent</code> with the combo box in it - */ - private JComponent buildTypesBox() { - final String[] namelist = new String[archTypeList.getLength()]; // list of typenames - - // read all type names - int i = 0; - for (final CFArchType tmp : archTypeList) { - namelist[i++] = " " + tmp.getTypeName(); - } - - // the active type appears selected in the box - final int selection = listNr; // position of selected type in the list - - typesel = new JComboBox(namelist); // set "content" - typesel.setSelectedIndex(selection); // set active selection - - //typesel.setKeySelectionManager(new StringKeyManager(typesel)); - - typesel.setName("Types"); - - // the listener: - typesel.addItemListener(new TypesBoxAL(this, gameObject)); - return typesel; - } - - /** - * Construct the Combo box of the available spells. - * @param attr spell attribute - * @return the completed <code>JComboBox</code> - */ - protected abstract JComboBox buildSpellBox(final CFArchAttrib attr); - - /** - * Construct the Combo box of the available spells. - * @param attr spell attribute - * @return the completed <code>JComboBox</code> - */ - private JComboBox buildInvSpellBox(final CFArchAttrib attr) { - final boolean isOptionalSpell = attr.getDataType() == ArchAttribType.INV_SPELL_OPTIONAL; - final Vector<String> content = new Vector<String>(); - final int selectedIndex; - final String title; - switch (gameObject.countInvObjects()) { - case 0: - selectedIndex = mainControl.getGameObjectSpells().size(); - title = isOptionalSpell ? null : "<none>"; - break; - - default: - selectedIndex = mainControl.getGameObjectSpells().size() + (isOptionalSpell ? 1 : 0); - title = "<multiple>"; - break; - - case 1: - final G invObject = gameObject.iterator().next(); - final String invObjectArchetypeName = invObject.getArchetype().getArchetypeName(); - int index = 0; - String tmpTitle = "<customized spell>"; - for (final GameObjectSpell<G, A, R> spellObject : mainControl.getGameObjectSpells()) { - if (invObjectArchetypeName.equals(spellObject.getArchetypeName())) { - if (invObject.isDefaultGameObject()) { - tmpTitle = null; - } else { - tmpTitle = spellObject.getName() + " <customized>"; - } - break; - } - index++; - } - if (tmpTitle != null) { - selectedIndex = mainControl.getGameObjectSpells().size() + (isOptionalSpell ? 1 : 0); - } else { - selectedIndex = index; - } - title = tmpTitle; - break; - } - - for (final Spell spell : mainControl.getGameObjectSpells()) { - content.add(spell.getName()); - } - if (isOptionalSpell) { - content.add("<none>"); - } - if (title != null) { - content.add(title); - } - - final JComboBox comboBox = new JComboBox(content); - comboBox.setSelectedIndex(selectedIndex); - comboBox.setMaximumRowCount(10); - comboBox.setKeySelectionManager(new StringKeyManager(comboBox)); - comboBox.setName(attr.getNameNew()); - return comboBox; - } - - /** - * Construct the Combo box for arrays of "list data" (this is used for ArchAttribType.LIST). - * @param attr list attribute - * @param listData List with list items and corresponding values, that means the types are altering: String,Integer - * @return the completed <code>JComboBox</code> - */ - private JComboBox buildArrayBox(final CFArchAttrib attr, final List<?> listData) { - // build the array of list-items - final String[] array = new String[(int) (listData.size() / 2.0)]; - boolean hasSelection = false; - int active = gameObject.getAttributeInt(attr.getNameOld()); - for (int i = 0; i < array.length; i++) { - array[i] = (String) listData.get(i * 2 + 1); // put string to array - if (!hasSelection && (Integer) listData.get(i * 2) == active) { - hasSelection = true; // the selection is valid - active = i; // set selection to this index in the array - } - } - // if there is no valid pre-selection, show first element of list - if (!hasSelection) { - active = 0; - } - final JComboBox arraysel = new JComboBox(array); // set "content" - arraysel.setSelectedIndex(active); // set active selection - arraysel.setMaximumRowCount(10); - arraysel.setKeySelectionManager(new StringKeyManager(arraysel)); - arraysel.setName(attr.getNameNew()); - return arraysel; - } - - /** - * Returns the face for a GameObject. - * @param gameObject GameObject to return face for. - * @return Face for the supplied GameObject. - */ - private ImageIcon getFace(@NotNull final G gameObject) { - return mainControl.getArchetypeSet().getFace(gameObject); - } - - /** - * Construct the upper left part of the attribute dialog, - * containing name, type, archetype name and face. - * @return a <code>JScrollPane</code> with the upper left part of the dialog window - */ - private JComponent buildHeader() { - final JPanel header = new JPanel(new GridBagLayout()); // the final thing, in a panel - final GridBagConstraints gbc = new GridBagConstraints(); - gbc.fill = GridBagConstraints.BOTH; - gbc.insets = new Insets(2, 2, 2, 2); - gbc.gridx = 1; - gbc.gridy = 1; - gbc.weightx = 0.0; - gbc.weighty = 3.0; - gbc.gridheight = 3; - imagePanel = new JLabel(getFace(gameObject)); - imagePanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); - header.add(imagePanel, gbc); - gbc.gridheight = 1; - gbc.weighty = 1.0; - gbc.fill = GridBagConstraints.HORIZONTAL; - - gbc.weightx = 0.0; - gbc.gridx = 2; - gbc.gridy = 1; - header.add(new JLabel("Name: ", SwingConstants.TRAILING), gbc); // create label - gbc.gridy++; - header.add(new JLabel("Type: ", SwingConstants.TRAILING), gbc); - gbc.gridy++; - header.add(new JLabel("Archetype: ", SwingConstants.TRAILING), gbc); // create label - - gbc.gridx = 3; - gbc.gridy = 1; - gbc.weightx = 1.0; - final JTextField nameTF; - if (gameObject.getObjName() != null && gameObject.getObjName().length() > 0) { - nameTF = new JTextField(gameObject.getObjName(), 16); - } else if (archetype.getObjName() != null && archetype.getObjName().length() > 0) { - nameTF = new JTextField(archetype.getObjName(), 16); - } else { - nameTF = new JTextField(archetype.getArchetypeName(), 16); - } - nameTF.setEditable(false); - header.add(nameTF, gbc); - gbc.gridy++; - header.add(buildTypesBox(), gbc); // build type-selection box - gbc.gridy++; - final JTextField archetypeTF=new JTextField(archetype.getArchetypeName(), 16); - archetypeTF.setEditable(false); - header.add(archetypeTF, gbc); - - return header; - } - - /** - * Construct the upper right part of the attribute dialog, - * containing the object's inventory. - * @return a <code>JScrollPane</code> with the upper right part of the dialog window - */ - private static JScrollPane buildInv() { - final JPanel inv = new JPanel(); // the final thing, in a panel - inv.add(new JLabel("Inventory:")); // create label - - final JScrollPane scrollPane = new JScrollPane(inv); - scrollPane.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); - scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); - scrollPane.setSize(80, 70); - - return scrollPane; - } - - /** - * Construct the central part of the attribute dialog, containing the - * object's gameObject attributes. - * @return When this method is called the first time: a <code>JScrollPane</code> - * with the central part of the dialog window. - * All further calls rebuild the existing tabbedpane and return null. - */ - @Nullable JComponent buildAttr() { - boolean initialCall = false; - - if (tabbedPane == null) { - tabbedPane = new JTabbedPane(); - initialCall = true; - } - - for (int i = 0; i < type.getSectionNum(); i++) { - final Component panel1 = makeAttribPanel(i); - if (panel1 != null) { - tabbedPane.addTab(getSectionName(i), null, panel1); - } - } - - // set selected tab - tabbedPane.setSelectedIndex(0); - - if (initialCall) { - return tabbedPane; - } else { - return null; - } - } - - /** - * This method creates an attribute panel for one section of attributes. If - * the section is empty, null is returned. - * @param secId the identifier of the section - * @return a <code>Component</code> containing the attribute panel - * (currently always a JScrollPane) - * @todo I'm still 263 lines long, please make me shorter. - */ - @Nullable private Component makeAttribPanel(final int secId) { - int number = 0; // number of attributes in this section - boolean hasBitmask = false; // true if this section contains a bitmask attribute - - // first we check how many attribs this section has - for (int i = 0; type.getAttr().length > i; i++) { - if (type.getAttr()[i].getSecId() == secId) { - // count number of attributes - if (type.getAttr()[i].getDataType() != ArchAttribType.FIXED) { - number++; - } - // check for bitmask attributes - if (!hasBitmask && type.getAttr()[i].getDataType() == ArchAttribType.BITMASK) { - hasBitmask = true; - } - } - } - if (number == 0) { - return null; - } - - // All attribute-"lines" go into this panel: - final JPanel panel = new JPanel(new GridBagLayout()); - final Insets gbcInsets = new Insets(2, 2, 2, 2); - - final GridBagConstraints gbc = new GridBagConstraints(); - gbc.insets = gbcInsets; - final Object helpGbc = gbc.clone(); - gbc.fill = GridBagConstraints.HORIZONTAL; - final Object labelGbc = gbc.clone(); - gbc.weightx = 1.0; - gbc.gridwidth = GridBagConstraints.REMAINDER; - final Object compGbc = gbc.clone(); - gbc.anchor = GridBagConstraints.WEST; - final Object rowGbc = gbc.clone(); - gbc.fill = GridBagConstraints.BOTH; - gbc.weighty = 1.0; - boolean isText = false; - final Object glueGbc = gbc.clone(); - - final CFArchAttrib[] attribs = type.getAttr(); - // now add the entrys, line by line - for (int i = 0; attribs.length > i; i++) { - final CFArchAttrib attrib = attribs[i]; - final ArchAttribType dType = attrib.getDataType(); // data type of the attribute - if (attrib.getSecId() == secId && dType != ArchAttribType.FIXED) { - final String nameOld = attrib.getNameOld(); - final JButton helpButton = new JButton("?"); - helpButton.setMargin(new Insets(0, 5, 0, 5)); - panel.add(helpButton, helpGbc); - helpButton.addFocusListener(this); - - JComponent cLabel = null; - JComponent cComp = null; - JComponent cRow = null; - JComponent cGlue = null; - - // now create the attribute-GUI-instance - final DialogAttrib<?> newAttr; - - switch (dType) { - case TEXT: { - isText = true; // text section (need special embedding without additional scrollbars) - String text = ""; - if (nameOld.equalsIgnoreCase("msg")) { - if (archetype.getMsgText() != null && archetype.getMsgText().length() > 0 && (gameObject.getMsgText() == null || gameObject.getMsgText().trim().length() == 0)) { - text = archetype.getMsgText(); - } else { - text = gameObject.getMsgText(); - } - } - final JEditTextArea input = new JEditTextArea(); - input.setDocument(new SyntaxDocument()); - input.getDocument().setTokenMarker(TokenMarkerFactory.createTokenMarker(attrib.getMisc()[0])); - input.setText(text); - input.setCaretPosition(0); - input.setBorder(BorderFactory.createEmptyBorder(3, 7, 0, 0)); - input.getPainter().setInvalidLinesPainted(false); - newAttr = new DialogAttrib<JEditTextArea>(attrib, input); - cGlue = input; - } - break; - case BOOL: - case BOOL_SPEC: { - final JCheckBox input; - switch (dType) { - case BOOL: - // normal bool - input = new JCheckBox(attrib.getNameNew(), gameObject.getAttributeInt(nameOld) == 1); - break; - case BOOL_SPEC: { - // parse values for customized bool - final String trueVal = attrib.getMisc()[0]; - if (trueVal.equals("0")) { - final String attrString = gameObject.getAttributeString(nameOld); - input = new JCheckBox(attrib.getNameNew(), attrString.length() == 0 || attrString.equals("0")); - } else { - input = new JCheckBox(attrib.getNameNew(), gameObject.getAttributeString(nameOld).equals(trueVal)); - } - } - break; - default: - assert false; - input = null; - break; - } - newAttr = new DialogAttrib<JCheckBox>(attrib, input); - cRow = input; - } - break; - case INT: - case LONG: - case FLOAT: { - cLabel = new JLabel(attrib.getNameNew() + ": "); - cLabel.setForeground(dType == ArchAttribType.FLOAT ? CommonConstants.FLOAT_COLOR : CommonConstants.INT_COLOR); - final int fieldLength = attrib.getInputLength() == 0 ? TEXTFIELD_COLUMNS : attrib.getInputLength(); - final NumberFormat format; - switch (dType) { - case INT: - case LONG: - format = NumberFormat.getIntegerInstance(); - break; - case FLOAT: - format = NumberFormat.getInstance(); - format.setMaximumFractionDigits(10); - break; - default: - assert false; - format = null; - break; - } - format.setGroupingUsed(false); - final NumberFormatter formatter = new NumberFormatter(format); - final DefaultFormatterFactory factory = new DefaultFormatterFactory(formatter); - // parse value from gameObject - final Number value; - switch (dType) { - case INT: - value = gameObject.getAttributeInt(nameOld); - break; - case LONG: - value = gameObject.getAttributeLong(nameOld); - break; - case FLOAT: - value = gameObject.getAttributeDouble(nameOld); - break; - default: - value = null; - assert false; - break; - } - final JFormattedTextField input = new JFormattedTextField(factory, value); - input.setColumns(fieldLength); - cComp = input; - newAttr = new DialogAttrib<JFormattedTextField>(attrib, input); - } - break; - case STRING: - case FACENAME: - case ANIMNAME: { - final String dtxt; - if (nameOld.equalsIgnoreCase("name")) { - if (!isSpecialNameHandling()) { - dtxt = gameObject.getObjName(); - } else if (gameObject.getObjName() != null && gameObject.getObjName().length() > 0) { - dtxt = gameObject.getObjName(); - } else if (archetype.getObjName() != null && archetype.getObjName().length() > 0) { - dtxt = archetype.getObjName(); - } else { - dtxt = archetype.getArchetypeName(); - } - } else if (nameOld.equalsIgnoreCase("face")) { - dtxt = gameObject.getEffectiveFaceName(); - } else { - dtxt = gameObject.getAttributeString(nameOld); - } - final JTextField input = new JTextField(dtxt, TEXTFIELD_COLUMNS); - switch (dType) { - case STRING: - cLabel = new JLabel(attrib.getNameNew() + ": "); - break; - case FACENAME: - case ANIMNAME: - switch (dType) { - case FACENAME: - cLabel = new JButton(new TreeChooseAction(attrib.getNameNew() + ": ", input, mainControl.getFaceObjects())); - break; - case ANIMNAME: - cLabel = new JButton(new TreeChooseAction(attrib.getNameNew() + ": ", input, mainControl.getAnimationObjects())); - break; - default: - assert false; - cLabel = null; - break; - } - break; - default: - assert false; - break; - } - cComp = input; - newAttr = new DialogAttrib<JTextField>(attrib, input); - } - break; - case MAP_PATH: - case SCRIPT_FILE: { - cLabel = new JLabel(attrib.getNameNew() + ": "); - final TilePanel tilePanel = new TilePanel(dType == ArchAttribType.MAP_PATH ? mainControl.getMapFileFilter() : mainControl.getScriptFileFilter()); - tilePanel.setAbsoluteReference(dType == ArchAttribType.MAP_PATH ? mainControl.getGlobalSettings().getMapDir() : mainControl.getGlobalSettings().getMapDir()); - tilePanel.setOriginal(gameObject.getAttributeString(nameOld)); - File relativeReference; - if (dType == ArchAttribType.MAP_PATH) { - relativeReference = gameObject.getMapSquare().getModel().getMapControl().getMapFile(); - if (relativeReference == null) { - relativeReference = new File(mainControl.getGlobalSettings().getMapDir(), "dummy"); - } - } else { - relativeReference = new File(mainControl.getGlobalSettings().getMapDir(), "dummy"); - } - tilePanel.setRelativeReference(relativeReference); - cComp = tilePanel; - newAttr = new DialogAttrib<TilePanel>(attrib, tilePanel); - } - break; - case SPELL: - case ZSPELL: - case INV_SPELL: - case INV_SPELL_OPTIONAL: - case LIST: { - cLabel = new JLabel(attrib.getNameNew() + ": "); - cLabel.setForeground(CommonConstants.INT_COLOR); - // create ComboBox with parsed selection - final JComboBox input; - switch (dType) { - case SPELL: - case ZSPELL: - input = buildSpellBox(attrib); - break; - case INV_SPELL: - case INV_SPELL_OPTIONAL: - input = buildInvSpellBox(attrib); - break; - case LIST: - if (attrib.getMisc() != null && archTypeList.getListTable().containsKey(attrib.getMisc()[0])) { - // build the list from vector data - input = buildArrayBox(attrib, archTypeList.getListTable().get(attrib.getMisc()[0])); - } else { - // error: list data is missing or corrupt - cComp = new JLabel("Error: Undefined List"); - input = null; - } - break; - default: - assert false; - input = null; - break; - } - if (input != null) { - cComp = input; - } - newAttr = new DialogAttrib<JComboBox>(attrib, input); - } - break; - case DBLLIST: { - final JPanel compo = new JPanel(new BorderLayout()); - cLabel = new JLabel(attrib.getNameNew() + ": "); - cLabel.setForeground(CommonConstants.INT_COLOR); - // create ComboBox with parsed selection - final JComboBox[] inputs = new JComboBox[2]; - if (attrib.getMisc() != null && archTypeList.getListTable().containsKey(attrib.getMisc()[0]) && archTypeList.getListTable().containsKey(attrib.getMisc()[1])) { - // Hack to set preselected if available - final int active = gameObject.getAttributeInt(nameOld); - final int[] activepart = {active & 0x0F, active & 0xF0}; - // build the lists from vector data - for (int j = 0; j < 2; j++) { - final List<?> listData = archTypeList.getListTable().get(attrib.getMisc()[j]); - inputs[j] = buildArrayBox(attrib, listData); - for (int k = 0; (double) k < listData.size() / 2.0; k++) { - if ((Integer) listData.get(k * 2) == activepart[j]) { - inputs[j].setSelectedIndex(k); // set active selection - break; - } - } - } - compo.add(inputs[0], BorderLayout.NORTH); - compo.add(inputs[1], BorderLayout.SOUTH); - cComp = compo; - } else { - // error: list data is missing or corrupt - cComp = new JLabel("Error: Undefined List"); - } - newAttr = new DialogAttrib<JComboBox[]>(attrib, inputs); - } - break; - case BITMASK: { - final JTextArea input = new JTextArea(); - final BitmaskAttrib tmpAttr = new BitmaskAttrib(attrib, input); - if (attrib.getMisc() != null && archTypeList.getBitmaskTable().containsKey(attrib.getMisc()[0])) { - // fetch the bitmask data, then build the attribute panel - final CAttribBitmask bitmask = archTypeList.getBitmaskTable().get(attrib.getMisc()[0]); - tmpAttr.bitmask = bitmask; - cLabel = new JButton(new MaskChangeAL(attrib.getNameNew() + ":", tmpAttr)); - input.setBackground(getBackground()); - input.setEditable(false); - input.setBorder(BorderFactory.createLineBorder(Color.gray)); - input.setText(bitmask.getText(tmpAttr.getValue())); - cComp = input; - tmpAttr.setEncodedValue(gameObject.getAttributeString(nameOld)); - } else { - cRow = new JLabel("Error: Undefined Bitmask"); - } - newAttr = tmpAttr; - } - break; - case TREASURE: { - // textfield (no direct input, text is set by the treasurelist dialog) - String treasureName = gameObject.getAttributeString(nameOld); - if (treasureName.trim().length() == 0 || treasureName.trim().equalsIgnoreCase("none")) { - treasureName = CFTreasureListTree.NONE_SYM; - } - final JTextField input = new JTextField(" " + treasureName, TEXTFIELD_COLUMNS); - input.setEditable(false); - final DialogAttrib<JTextField> tmpAttr = new DialogAttrib<JTextField>(attrib, input); - cLabel = new JButton(new ViewTreasurelistAL<G, A, R>(tmpAttr, this, treasureListTree)); - cComp = input; - newAttr = tmpAttr; - } - break; - default: - newAttr = null; - assert false; - break; - } // switch (dType) - - assert newAttr != null; - dialogAttribs.add(newAttr); - helpButton.addActionListener(new HelpActionListener(newAttr.ref)); - if (cLabel != null) { - panel.add(cLabel, labelGbc); - cLabel.addFocusListener(this); - } - if (cComp != null) { - panel.add(cComp, compGbc); - cComp.addFocusListener(this); - } - if (cRow != null) { - panel.add(cRow, rowGbc); - cRow.addFocusListener(this); - } - if (cGlue != null) { - panel.add(cGlue, glueGbc); - cGlue.addFocusListener(this); - } - } - } - - if (!isText) { - // if the component does not already have glue, put glue inside to align its contents to the top. - panel.add(Box.createGlue(), glueGbc); - } - final JScrollPane panelReturn = new JScrollPane(panel); - panelReturn.getVerticalScrollBar().setUnitIncrement(8); - return panelReturn; - } - - /** - * Determine if the "name" attribute should inherit its default value from - * the archetype name. - * - * @return <code>true</code> if the archetype name should be used for an - * empty "name" attribute, or <code>false</code> if an empty name should be - * used - */ - protected boolean isSpecialNameHandling() { - return true; - } - - /** - * Looks up the section name from the ID. - * @param secId ID of the section - * @return name of that section - */ - private String getSectionName(final int secId) { - for (int i = 0; type.getAttr().length > i; i++) { - if (type.getAttr()[i].getSecId() == secId) { - // we've got the string, now capitalize the first letter - String s = type.getAttr()[i].getSecName(); - if (s.length() > 1) { - s = s.substring(0, 1).toUpperCase() + s.substring(1); - } - return s; - } - } - - return "???"; - } - - /** - * Construct the dialog options: help, default, okay, apply, cancel. - * @return Object[] with dialog options - */ - private Object[] buildOptions() { - return new Object[] { - new JButton(ACTION_FACTORY.createAction(false, "attribHelp", this)), - summaryEditButton = new JButton(summaryAction), - Box.createHorizontalStrut(32), - okButton = new JButton(ACTION_FACTORY.createAction(false, "attribOk", this)), - new JButton(ACTION_FACTORY.createAction(false, "attribApply", this)), - cancelButton = new JButton(ACTION_FACTORY.createAction(false, "attribCancel", this)), - }; - } - - /** - * Action method for help. - */ - public void attribHelp() { - new Help(/* XXX */ mainControl.getMainView(), type.createHtmlDocu()).setVisible(true); - } - - /** - * Action method for ok. - */ - public void attribOk() { - if (applySettings()) { - setValue(okButton); - } - } - - /** - * Action method for apply. - */ - public void attribApply() { - applySettings(); - } - - /** - * Action method for cancel. - */ - public void attribCancel() { - setValue(cancelButton); - } - - /** - * Action method for summary. Switches the cardlayout to the summary list - * of all nonzero attributes. - */ - public void attribSummary() { - // interface is displayed, switch to summary - final Document doc = summaryTP.getDocument(); - - try { - // clear document - if (doc.getLength() > 0) { - doc.remove(0, doc.getLength()); - } - - final Style docStyle = summaryTP.getStyle(StyleContext.DEFAULT_STYLE); - StyleConstants.setForeground(docStyle, Color.black); - - // now loop through all attributes and write out nonzero ones - for (final DialogAttrib<?> attr : dialogAttribs) { - switch (attr.ref.getDataType()) { - case BOOL: - case BOOL_SPEC: { - final boolean value = ((DialogAttrib<JCheckBox>) attr).input.isSelected(); // true/false - if (value) { - doc.insertString(doc.getLength(), "<" + attr.ref.getNameNew() + ">\n", docStyle); - } - } - break; - case INT: - case LONG: - case FLOAT: { - final String value = ((DialogAttrib<JFormattedTextField>) attr).input.getText(); // the attrib value - if (value != null && value.length() > 0 && !value.equals("0")) { - doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + "\n", docStyle); - } - } - break; - case STRING: - case FACENAME: - case ANIMNAME: { - final String value = ((DialogAttrib<JTextField>) attr).input.getText(); // the attrib value - if (value != null && value.length() > 0) { - doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + "\n", docStyle); - } - } - break; - case MAP_PATH: - case SCRIPT_FILE: { - final String value = ((DialogAttrib<TilePanel>) attr).input.getText(); // the attrib value - if (value != null && value.length() > 0) { - doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + "\n", docStyle); - } - } - break; - case SPELL: - case ZSPELL: - case LIST: - case INV_SPELL: - case INV_SPELL_OPTIONAL: { - final String value = ((DialogAttrib<JComboBox>) attr).input.getSelectedItem().toString().trim(); // the attrib value - if (value != null && value.length() > 0 && !value.startsWith("<")) { - doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + "\n", docStyle); - } - } - break; - case DBLLIST: { - final String value1 = ((DialogAttrib<JComboBox[]>) attr).input[0].getSelectedItem().toString().trim(); - final String value2 = ((DialogAttrib<JComboBox[]>) attr).input[1].getSelectedItem().toString().trim(); - final StringBuilder out = new StringBuilder(); - if (value1 != null && value1.length() > 0 && !value1.startsWith("<")) { - out.append(value1); - } - if (value2 != null && value2.length() > 0 && !value2.startsWith("<")) { - if (out.length() != 0) { - out.append(" / "); - } - out.append(value2); - } - if (out.length() > 0) { - doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + out + "\n", docStyle); - } - } - break; - case BITMASK: { - final String value = ((DialogAttrib<JTextComponent>) attr).getInput().getText().trim(); - if (value != null && value.length() > 0 && !value.startsWith("<")) { - doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + "\n", docStyle); - } - } - break; - case TREASURE: { - final String value = ((DialogAttrib<JTextField>) attr).input.getText().trim(); // the attrib value - if (value != null && value.length() > 0 && !value.equals(CFTreasureListTree.NONE_SYM)) { - doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + "\n", docStyle); - } - } - break; - case TEXT: - /* Nothing to do. */ - break; - default: - assert false : "Unknown type: " + attr.ref.getDataType(); - break; - } - } - } catch (final BadLocationException e) { - log.error("toggleSummary: Bad Location in Document!", e); - } - - summaryTP.setCaretPosition(0); // this prevents the document from scrolling down - summaryEditButton.setAction(editAction); - cardLayout.show(centerPane, "summary"); - } - - /** - * Turns the summary off. - * Switches to the input-interface for all attributes and the summary list of all nonzero attributes. - */ - public void attribEdit() { - summaryEditButton.setAction(summaryAction); - cardLayout.show(centerPane, "edit"); - } - - /** - * This method is called when the "apply"-button has been - * pressed. All the settings from the dialog get - * written into the GameObject. - * @return true if the settings were applied, false if error occurred - */ - private boolean applySettings() { - final MapSquare<G, A, R> mapSquare = gameObject.getMapSquare(); - assert mapSquare != null; - final MapModel<G, A, R> mapModel = mapSquare.getModel(); - mapModel.beginTransaction("Change object attributes"); - try { - return applySettings2(); - } finally { - mapModel.endTransaction(); - } - } - - /** - * This method is called when the "apply"-button has been - * pressed. All the settings from the dialog get - * written into the GameObject. - * @return true if the settings were applied, false if error occurred - */ - protected abstract boolean applySettings2(); - - /** {@inheritDoc} */ - public void focusGained(final FocusEvent e) { - final JComponent c = (JComponent) e.getComponent(); - final JPanel p = (JPanel) c.getParent(); - final Rectangle r = c.getBounds(); - p.scrollRectToVisible(r); - } - - /** {@inheritDoc} */ - public void focusLost(final FocusEvent e) { - } - - /** - * Spawns a popup-message to display the help text of an attribute. - * @param title name of attribute - * @param msg message text - */ - protected final void popupHelp(final String title, final String msg) { - showMessageDialog(this, msg, "Help: " + title, PLAIN_MESSAGE); - } - - /** - * Open a popup dialog and ask the user to confirm (or modify) - * the encountered syntax errors. - * If the user chooses to keep any errors, these get attached - * to the archtext by the actionlistener (<code>ConfirmErrorsAL</code>). - * <p/> - * Note that this method does not fork off with a new thread. - * It freezes the parent frames (and threads) until the popup - * window is closed, which mimics non-event-driven behaviour. - * @param errors a textual list of the encountered errors - */ - protected void askConfirmErrors(final String errors) { - final JDialog frame = new JDialog((JFrame) null, "Syntax Errors", true); // dialog freezes parents - frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); // closing is handled by listener - - final JPanel mainPanel = new JPanel(); - mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); - final JPanel headerPanel = new JPanel(new GridLayout(2, 1)); - final JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); - - // create header labels - final JLabel header1 = new JLabel("The following lines from the archtext appear to be wrong."); - final JLabel header2 = new JLabel("They do not match the type definitions:"); - headerPanel.add(header1); - headerPanel.add(header2); - - // create textarea for showing errors - final JTextArea textarea = new JTextArea(errors, 7, 25); - textarea.setBorder(BorderFactory.createEmptyBorder(1, 4, 0, 0)); - final JScrollPane scrollPane = new JScrollPane(textarea); - scrollPane.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); - - // create buttons - final JButton dumpButton = new JButton("Dump All Errors"); - final JButton keepButton = new JButton("Keep Above Text"); - buttonPanel.add(dumpButton); - buttonPanel.add(keepButton); - - // attach actionlistener to the buttons (and the frame) - final ConfirmErrorsAL listener = new ConfirmErrorsAL(frame, gameObject, errors, keepButton, textarea); - keepButton.addActionListener(listener); - dumpButton.addActionListener(listener); - frame.addWindowListener(listener); - - // stick panels together - mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); - mainPanel.add(headerPanel); - mainPanel.add(Box.createVerticalStrut(10)); - mainPanel.add(scrollPane); - mainPanel.add(Box.createVerticalStrut(10)); - mainPanel.add(buttonPanel); - - frame.getContentPane().add(mainPanel); - - // pack, position and show the popup - frame.pack(); - frame.setLocationRelativeTo(this); - frame.setVisible(true); - } - - /** A single Attribute, combining the CFArchAttrib with its input component(s). */ - public static class DialogAttrib<T> { - - /** Input component(s). */ - @NotNull private final T input; - - /** Reference to the attribute data. */ - @NotNull public final CFArchAttrib ref; // reference to the attribute data - - /** - * Create a DialogAttrib. - * @param ref reference to the attribute data - * @param input Input ui component for editing the value. - */ - public DialogAttrib(@NotNull final CFArchAttrib ref, @NotNull final T input) { - this.ref = ref; - this.input = input; - } - - /** - * Returns the component for input of this dialog attribute. - * @return The component for input. - */ - @NotNull public T getInput() { - return input; - } - - } // class DialogAttrib - - /** DialogAttrib for types with bitmasks to choose from. */ - public static final class BitmaskAttrib extends DialogAttrib<JTextComponent> { - - /** Active bitmask value. */ - private int value; - - /** Reference to the bitmask data. */ - private CAttribBitmask bitmask; - - /** - * Create a BitmaskAttrib. - * @param ref reference to the attribute data - * @param input Input ui component for editing the value. - */ - public BitmaskAttrib(@NotNull final CFArchAttrib ref, @NotNull final JTextComponent input) { - super(ref, input); - } - - /** - * Get the active bitmask value. - * @return active bitmask value - */ - public int getValue() { - return value; - } - - /** - * Get the active bitmask value in external file representation. - * @return active bitmask value in external file representation - */ - public String getEncodedValue() { - return bitmask.encodeValue(value); - } - - /** - * Set the active bitmask value. - * @param value new active bitmask value - */ - public void setValue(final int value) { - this.value = value; - if (bitmask != null) { - getInput().setText(bitmask.getText(value)); - } else { - System.err.println("null bitmask"); - } - } - - /** - * Set the active bitmask value in external file representation. - * @param encodedValue new active bitmask value in external file - * representation - */ - public void setEncodedValue(final String encodedValue) { - assert bitmask != null; - setValue(bitmask.decodeValue(encodedValue)); - } - - } // class BitmaskAttrib - - /** ActionListener for help-buttons. */ - public final class HelpActionListener implements ActionListener { - - /** CFArchAttrib which contains help information. */ - private final CFArchAttrib attrib; // attribute structure - - /** - * Constructor. - * @param a the gameObject attribute where this help button belongs to - */ - public HelpActionListener(final CFArchAttrib a) { - if (a == null) { - throw new NullPointerException("HelpActionListener without context"); - } - attrib = a; - } - - /** {@inheritDoc} */ - public void actionPerformed(final ActionEvent e) { - if (attrib != null) { - popupHelp(attrib.getNameNew(), attrib.getText()); - } else { - assert false; - log.warn("Help without help context!"); - } - } - - } // class HelpActionListener - - /** - * ActionListener for the buttons in the ConfirmErrors popup dialog and - * also WindowListener for the closebox of the dialog (which would equal a - * "keep all" button). - */ - protected static final class ConfirmErrorsAL extends WindowAdapter implements ActionListener { - - /** The popup dialog. */ - private JDialog dialog; - - /** The button to keep what's in the textfield. */ - private final JButton keepButton; - - /** The textfield containing the error text to keep. */ - private final JTextArea text; - - /** The affected GameObject. */ - private final GameObject gameObject; - - /** List of all errors. */ - private final String allErrors; - - /** - * Constructor. - * @param dialog the popup dialog - * @param gameObject the gameObject which has the error to be added - * @param errors list of all errors (= initial content of the textarea) - * @param keepB button "keep what is in the textfield" - * @param textNew textfield containing the error-text to keep - */ - @SuppressWarnings({"PublicConstructorInNonPublicClass"}) - public ConfirmErrorsAL(final JDialog dialog, final GameObject gameObject, final String errors, final JButton keepB, final JTextArea textNew) { - this.gameObject = gameObject; - keepButton = keepB; - text = textNew; - this.dialog = dialog; - allErrors = errors; - } - - /** {@inheritDoc} */ - public void actionPerformed(final ActionEvent e) { - //noinspection ObjectEquality - if (e.getSource() == keepButton) { - // the user pressed "keep", so we append the contents - // of the textfield to the archtext - if (text.getText() != null && text.getText().trim().length() > 0) { - gameObject.addObjectText(text.getText().trim()); - } - } - - // nuke the popup dialog - dialog.dispose(); - dialog = nu... [truncated message content] |
From: <aki...@us...> - 2008-06-06 21:44:43
|
Revision: 4155 http://gridarta.svn.sourceforge.net/gridarta/?rev=4155&view=rev Author: akirschbaum Date: 2008-06-06 14:44:27 -0700 (Fri, 06 Jun 2008) Log Message: ----------- Move inner classes of AbstractGameObjectAttributesDialog to top-level. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/GameObjectAttributesDialog.java trunk/daimonin/src/daieditor/gui/GameObjectAttributesDialog.java trunk/src/app/net/sf/gridarta/CAttribBitmask.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialog.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/BitmaskAttrib.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ConfirmErrorsAL.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttrib.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/MaskChangeAL.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/StringKeyManager.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/TreeChooseAction.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ViewTreasurelistAL.java Modified: trunk/crossfire/src/cfeditor/gui/GameObjectAttributesDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/GameObjectAttributesDialog.java 2008-06-06 21:34:04 UTC (rev 4154) +++ trunk/crossfire/src/cfeditor/gui/GameObjectAttributesDialog.java 2008-06-06 21:44:27 UTC (rev 4155) @@ -38,6 +38,9 @@ import net.sf.gridarta.MapManager; import net.sf.gridarta.gameobject.ArchAttribType; import net.sf.gridarta.gui.gameobjectattributesdialog.AbstractGameObjectAttributesDialog; +import net.sf.gridarta.gui.gameobjectattributesdialog.BitmaskAttrib; +import net.sf.gridarta.gui.gameobjectattributesdialog.DialogAttrib; +import net.sf.gridarta.gui.gameobjectattributesdialog.StringKeyManager; import net.sf.gridarta.gui.map.TilePanel; import net.sf.gridarta.spells.GameObjectSpell; import net.sf.gridarta.spells.NumberSpell; Modified: trunk/daimonin/src/daieditor/gui/GameObjectAttributesDialog.java =================================================================== --- trunk/daimonin/src/daieditor/gui/GameObjectAttributesDialog.java 2008-06-06 21:34:04 UTC (rev 4154) +++ trunk/daimonin/src/daieditor/gui/GameObjectAttributesDialog.java 2008-06-06 21:44:27 UTC (rev 4155) @@ -38,6 +38,9 @@ import net.sf.gridarta.MapManager; import net.sf.gridarta.gameobject.ArchAttribType; import net.sf.gridarta.gui.gameobjectattributesdialog.AbstractGameObjectAttributesDialog; +import net.sf.gridarta.gui.gameobjectattributesdialog.BitmaskAttrib; +import net.sf.gridarta.gui.gameobjectattributesdialog.DialogAttrib; +import net.sf.gridarta.gui.gameobjectattributesdialog.StringKeyManager; import net.sf.gridarta.gui.map.TilePanel; import net.sf.gridarta.spells.NumberSpell; import net.sf.gridarta.spells.Spell; Modified: trunk/src/app/net/sf/gridarta/CAttribBitmask.java =================================================================== --- trunk/src/app/net/sf/gridarta/CAttribBitmask.java 2008-06-06 21:34:04 UTC (rev 4154) +++ trunk/src/app/net/sf/gridarta/CAttribBitmask.java 2008-06-06 21:44:27 UTC (rev 4155) @@ -31,7 +31,7 @@ import javax.swing.JPanel; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathExpressionException; -import net.sf.gridarta.gui.gameobjectattributesdialog.AbstractGameObjectAttributesDialog; +import net.sf.gridarta.gui.gameobjectattributesdialog.BitmaskAttrib; import net.sf.japi.xml.NodeListIterator; import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; @@ -330,7 +330,7 @@ * @param guiAttr Bitmask attribute to update * @return Integer with new value or <code>null</code> if the user cancelled the dialog */ - @Nullable public Integer showBitmaskDialog(final Component parentComponent, final AbstractGameObjectAttributesDialog.BitmaskAttrib guiAttr) { + @Nullable public Integer showBitmaskDialog(final Component parentComponent, final BitmaskAttrib guiAttr) { final String title = "Choose " + guiAttr.ref.getNameNew().substring(0, 1).toUpperCase() + guiAttr.ref.getNameNew().substring(1); final JPanel gridPanel = new JPanel(new GridLayout(0, 2, 3, 3)); final JCheckBox[] checkbox = new JCheckBox[number]; Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialog.java 2008-06-06 21:34:04 UTC (rev 4154) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialog.java 2008-06-06 21:44:27 UTC (rev 4155) @@ -36,8 +36,6 @@ import java.awt.event.FocusListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; import java.io.File; import java.text.NumberFormat; import java.util.ArrayList; @@ -45,12 +43,10 @@ import java.util.List; import java.util.Map; import java.util.Vector; -import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.BorderFactory; import javax.swing.Box; import javax.swing.BoxLayout; -import javax.swing.ComboBoxModel; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JCheckBox; @@ -86,8 +82,6 @@ import net.sf.gridarta.CFArchTypeList; import net.sf.gridarta.CommonConstants; import net.sf.gridarta.MainControl; -import net.sf.gridarta.data.NamedObject; -import net.sf.gridarta.data.NamedObjects; import net.sf.gridarta.gameobject.ArchAttribType; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -788,7 +782,7 @@ if (attrib.getMisc() != null && archTypeList.getBitmaskTable().containsKey(attrib.getMisc()[0])) { // fetch the bitmask data, then build the attribute panel final CAttribBitmask bitmask = archTypeList.getBitmaskTable().get(attrib.getMisc()[0]); - tmpAttr.bitmask = bitmask; + tmpAttr.setBitmask(bitmask); cLabel = new JButton(new MaskChangeAL(attrib.getNameNew() + ":", tmpAttr)); input.setBackground(getBackground()); input.setEditable(false); @@ -952,7 +946,7 @@ switch (attr.ref.getDataType()) { case BOOL: case BOOL_SPEC: { - final boolean value = ((DialogAttrib<JCheckBox>) attr).input.isSelected(); // true/false + final boolean value = ((DialogAttrib<JCheckBox>) attr).getInput().isSelected(); // true/false if (value) { doc.insertString(doc.getLength(), "<" + attr.ref.getNameNew() + ">\n", docStyle); } @@ -961,7 +955,7 @@ case INT: case LONG: case FLOAT: { - final String value = ((DialogAttrib<JFormattedTextField>) attr).input.getText(); // the attrib value + final String value = ((DialogAttrib<JFormattedTextField>) attr).getInput().getText(); // the attrib value if (value != null && value.length() > 0 && !value.equals("0")) { doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + "\n", docStyle); } @@ -970,7 +964,7 @@ case STRING: case FACENAME: case ANIMNAME: { - final String value = ((DialogAttrib<JTextField>) attr).input.getText(); // the attrib value + final String value = ((DialogAttrib<JTextField>) attr).getInput().getText(); // the attrib value if (value != null && value.length() > 0) { doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + "\n", docStyle); } @@ -978,7 +972,7 @@ break; case MAP_PATH: case SCRIPT_FILE: { - final String value = ((DialogAttrib<TilePanel>) attr).input.getText(); // the attrib value + final String value = ((DialogAttrib<TilePanel>) attr).getInput().getText(); // the attrib value if (value != null && value.length() > 0) { doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + "\n", docStyle); } @@ -989,15 +983,15 @@ case LIST: case INV_SPELL: case INV_SPELL_OPTIONAL: { - final String value = ((DialogAttrib<JComboBox>) attr).input.getSelectedItem().toString().trim(); // the attrib value + final String value = ((DialogAttrib<JComboBox>) attr).getInput().getSelectedItem().toString().trim(); // the attrib value if (value != null && value.length() > 0 && !value.startsWith("<")) { doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + "\n", docStyle); } } break; case DBLLIST: { - final String value1 = ((DialogAttrib<JComboBox[]>) attr).input[0].getSelectedItem().toString().trim(); - final String value2 = ((DialogAttrib<JComboBox[]>) attr).input[1].getSelectedItem().toString().trim(); + final String value1 = ((DialogAttrib<JComboBox[]>) attr).getInput()[0].getSelectedItem().toString().trim(); + final String value2 = ((DialogAttrib<JComboBox[]>) attr).getInput()[1].getSelectedItem().toString().trim(); final StringBuilder out = new StringBuilder(); if (value1 != null && value1.length() > 0 && !value1.startsWith("<")) { out.append(value1); @@ -1021,7 +1015,7 @@ } break; case TREASURE: { - final String value = ((DialogAttrib<JTextField>) attr).input.getText().trim(); // the attrib value + final String value = ((DialogAttrib<JTextField>) attr).getInput().getText().trim(); // the attrib value if (value != null && value.length() > 0 && !value.equals(CFTreasureListTree.NONE_SYM)) { doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + "\n", docStyle); } @@ -1160,94 +1154,6 @@ frame.setVisible(true); } - /** A single Attribute, combining the CFArchAttrib with its input component(s). */ - public static class DialogAttrib<T> { - - /** Input component(s). */ - @NotNull private final T input; - - /** Reference to the attribute data. */ - @NotNull public final CFArchAttrib ref; // reference to the attribute data - - /** - * Create a DialogAttrib. - * @param ref reference to the attribute data - * @param input Input ui component for editing the value. - */ - public DialogAttrib(@NotNull final CFArchAttrib ref, @NotNull final T input) { - this.ref = ref; - this.input = input; - } - - /** - * Returns the component for input of this dialog attribute. - * @return The component for input. - */ - @NotNull public T getInput() { - return input; - } - - } // class DialogAttrib - - /** DialogAttrib for types with bitmasks to choose from. */ - public static final class BitmaskAttrib extends DialogAttrib<JTextComponent> { - - /** Active bitmask value. */ - private int value; - - /** Reference to the bitmask data. */ - private CAttribBitmask bitmask; - - /** - * Create a BitmaskAttrib. - * @param ref reference to the attribute data - * @param input Input ui component for editing the value. - */ - public BitmaskAttrib(@NotNull final CFArchAttrib ref, @NotNull final JTextComponent input) { - super(ref, input); - } - - /** - * Get the active bitmask value. - * @return active bitmask value - */ - public int getValue() { - return value; - } - - /** - * Get the active bitmask value in external file representation. - * @return active bitmask value in external file representation - */ - public String getEncodedValue() { - return bitmask.encodeValue(value); - } - - /** - * Set the active bitmask value. - * @param value new active bitmask value - */ - public void setValue(final int value) { - this.value = value; - if (bitmask != null) { - getInput().setText(bitmask.getText(value)); - } else { - System.err.println("null bitmask"); - } - } - - /** - * Set the active bitmask value in external file representation. - * @param encodedValue new active bitmask value in external file - * representation - */ - public void setEncodedValue(final String encodedValue) { - assert bitmask != null; - setValue(bitmask.decodeValue(encodedValue)); - } - - } // class BitmaskAttrib - /** ActionListener for help-buttons. */ public final class HelpActionListener implements ActionListener { @@ -1277,230 +1183,6 @@ } // class HelpActionListener - /** - * ActionListener for the buttons in the ConfirmErrors popup dialog and - * also WindowListener for the closebox of the dialog (which would equal a - * "keep all" button). - */ - protected static final class ConfirmErrorsAL extends WindowAdapter implements ActionListener { - - /** The popup dialog. */ - private JDialog dialog; - - /** The button to keep what's in the textfield. */ - private final JButton keepButton; - - /** The textfield containing the error text to keep. */ - private final JTextArea text; - - /** The affected GameObject. */ - private final GameObject gameObject; - - /** List of all errors. */ - private final String allErrors; - - /** - * Constructor. - * @param dialog the popup dialog - * @param gameObject the gameObject which has the error to be added - * @param errors list of all errors (= initial content of the textarea) - * @param keepB button "keep what is in the textfield" - * @param textNew textfield containing the error-text to keep - */ - @SuppressWarnings({"PublicConstructorInNonPublicClass"}) - public ConfirmErrorsAL(final JDialog dialog, final GameObject gameObject, final String errors, final JButton keepB, final JTextArea textNew) { - this.gameObject = gameObject; - keepButton = keepB; - text = textNew; - this.dialog = dialog; - allErrors = errors; - } - - /** {@inheritDoc} */ - public void actionPerformed(final ActionEvent e) { - //noinspection ObjectEquality - if (e.getSource() == keepButton) { - // the user pressed "keep", so we append the contents - // of the textfield to the archtext - if (text.getText() != null && text.getText().trim().length() > 0) { - gameObject.addObjectText(text.getText().trim()); - } - } - - // nuke the popup dialog - dialog.dispose(); - dialog = null; - } - - /** {@inheritDoc} */ - @Override public void windowClosing(final WindowEvent e) { - gameObject.addObjectText(allErrors.trim()); - dialog.dispose(); - dialog = null; - } - - } // class ConfirmErrorsAL - - /** - * KeySelectionManager to manage the select-per-keystroke in a JComboBox - * (The default KeySelectionManager fails because all strings start with - * whitespace ' '). - * <p/> - * Unfortunately, this class cannot be used anymore because it does not - * work together with the listener <code>TypesBoxAL</code> - */ - protected static final class StringKeyManager implements JComboBox.KeySelectionManager { - - /** JComboBox reference. */ - private final JComboBox box; - - /** - * Create a StringKeyManager. - * @param box JComboBox to create StringKeyManager for - */ - @SuppressWarnings({"PublicConstructorInNonPublicClass"}) - public StringKeyManager(final JComboBox box) { - this.box = box; - } - - /** {@inheritDoc} */ - public int selectionForKey(final char aKey, final ComboBoxModel aModel) { - for (int i = 0; i < aModel.getSize(); i++) { - if (((String) aModel.getElementAt(i)).toLowerCase().charAt(1) == aKey) { - //typeListener.ignoreEvent = true; - box.setSelectedIndex(i); // should happen automatically, but doesn't - //typeListener.ignoreEvent = false; - //typeListener.listenAction = true; - return i; - } - } - return -1; // no match found - } - - } // class StringKeyManager - - /** Action for choosing a face or animation. */ - protected static final class TreeChooseAction extends AbstractAction { - - /** The serial version UID. */ - private static final long serialVersionUID = 1; - - /** JTextField to update upon tree selection. */ - private final JTextField textField; - - /** Objects providing the tree. */ - private final NamedObjects<? extends NamedObject> objects; - - /** - * Create a TreeChooseAction. - * @param text text for label / button - * @param textField JTextField to update upon tree selection - * @param objects NamedObjects that provide the tree - */ - @SuppressWarnings({"PublicConstructorInNonPublicClass"}) - public TreeChooseAction(final String text, final JTextField textField, final NamedObjects<? extends NamedObject> objects) { - super(text); - this.textField = textField; - this.objects = objects; - } - - /** {@inheritDoc} */ - public void actionPerformed(final ActionEvent e) { - String initial = textField.getText(); - final NamedObject selected = objects.get(initial); - if (selected != null) { - initial = selected.getPath(); - } - final String newValue = objects.showNodeChooserDialog(textField, initial); - if (newValue != null) { - textField.setText(newValue); - } - } - - /** {@inheritDoc} */ - @Override protected Object clone() throws CloneNotSupportedException { - return super.clone(); - } - - } // class TreeChooseAction - - /** ActionListener for the change buttons of bitmasks. */ - private static final class MaskChangeAL extends AbstractAction { - - /** The serial version UID. */ - private static final long serialVersionUID = 1; - - private final BitmaskAttrib bmAttr; // attribute structure - - /** - * Constructor. - * @param label Name of this Action. - * @param newAttr the GUI-bitmask attribute where the change button belongs to - */ - private MaskChangeAL(final String label, final BitmaskAttrib newAttr) { - super(label); - bmAttr = newAttr; - } - - /** {@inheritDoc} */ - public void actionPerformed(final ActionEvent e) { - if (bmAttr != null) { - final Integer newValue = bmAttr.bitmask.showBitmaskDialog(bmAttr.getInput(), bmAttr); - if (newValue != null) { - bmAttr.setValue(newValue); - } - } - } - - /** {@inheritDoc} */ - @Override protected Object clone() throws CloneNotSupportedException { - return super.clone(); - } - - } // class MaskChangeAL - - /** - * ActionListener for the buttons on treasurelists. When such a button is - * pressed, the dialog with treasurelists pops up. - */ - private static final class ViewTreasurelistAL<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractAction { - - /** The serial version UID. */ - private static final long serialVersionUID = 1; - - private final CFTreasureListTree<G, A, R> treasureListTree; - - private final DialogAttrib<JTextField> strAttr; // attribute structure - - private final AbstractGameObjectAttributesDialog<G, A, R> dialog; // reference to this dialog instance - - /** - * Constructor. - * @param attr the GUI-string attribute where the treasurelist button belongs to - * @param treasureListTree the treasure list tree to use - * @param dialog Parent component to show on. - */ - private ViewTreasurelistAL(final DialogAttrib<JTextField> attr, final AbstractGameObjectAttributesDialog<G, A, R> dialog, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { - super("treasurelist:"); - this.treasureListTree = treasureListTree; - strAttr = attr; - this.dialog = dialog; - } - - /** {@inheritDoc} */ - public void actionPerformed(final ActionEvent e) { - if (strAttr != null) { - treasureListTree.showDialog(strAttr.input, dialog); - } - } - - /** {@inheritDoc} */ - @Override protected Object clone() throws CloneNotSupportedException { - return super.clone(); - } - - } // class ViewTreasurelistAL - /** ItemListener for the type-selection box on the attribute-dialog. */ private final class TypesBoxAL implements ItemListener { Added: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/BitmaskAttrib.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/BitmaskAttrib.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/BitmaskAttrib.java 2008-06-06 21:44:27 UTC (rev 4155) @@ -0,0 +1,76 @@ +package net.sf.gridarta.gui.gameobjectattributesdialog; + +import javax.swing.text.JTextComponent; +import net.sf.gridarta.CAttribBitmask; +import net.sf.gridarta.CFArchAttrib; +import org.jetbrains.annotations.NotNull; + +/** + * DialogAttrib for types with bitmasks to choose from. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public final class BitmaskAttrib extends DialogAttrib<JTextComponent> { + + /** Active bitmask value. */ + private int value; + + /** Reference to the bitmask data. */ + private CAttribBitmask bitmask; + + /** + * Create a BitmaskAttrib. + * @param ref reference to the attribute data + * @param input Input ui component for editing the value. + */ + public BitmaskAttrib(@NotNull final CFArchAttrib ref, @NotNull final JTextComponent input) { + super(ref, input); + } + + /** + * Get the active bitmask value. + * @return active bitmask value + */ + public int getValue() { + return value; + } + + /** + * Get the active bitmask value in external file representation. + * @return active bitmask value in external file representation + */ + public String getEncodedValue() { + return bitmask.encodeValue(value); + } + + /** + * Set the active bitmask value. + * @param value new active bitmask value + */ + public void setValue(final int value) { + this.value = value; + if (bitmask != null) { + getInput().setText(bitmask.getText(value)); + } else { + System.err.println("null bitmask"); + } + } + + /** + * Set the active bitmask value in external file representation. + * @param encodedValue new active bitmask value in external file + * representation + */ + public void setEncodedValue(final String encodedValue) { + assert bitmask != null; + setValue(bitmask.decodeValue(encodedValue)); + } + + public CAttribBitmask getBitmask() { + return bitmask; + } + + public void setBitmask(final CAttribBitmask bitmask) { + this.bitmask = bitmask; + } + +} // class BitmaskAttrib Property changes on: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/BitmaskAttrib.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ConfirmErrorsAL.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ConfirmErrorsAL.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ConfirmErrorsAL.java 2008-06-06 21:44:27 UTC (rev 4155) @@ -0,0 +1,75 @@ +package net.sf.gridarta.gui.gameobjectattributesdialog; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JTextArea; +import net.sf.gridarta.gameobject.GameObject; + +/** + * ActionListener for the buttons in the ConfirmErrors popup dialog and + * also WindowListener for the closebox of the dialog (which would equal a + * "keep all" button). + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public final class ConfirmErrorsAL extends WindowAdapter implements ActionListener { + + /** The popup dialog. */ + private JDialog dialog; + + /** The button to keep what's in the textfield. */ + private final JButton keepButton; + + /** The textfield containing the error text to keep. */ + private final JTextArea text; + + /** The affected GameObject. */ + private final GameObject gameObject; + + /** List of all errors. */ + private final String allErrors; + + /** + * Constructor. + * @param dialog the popup dialog + * @param gameObject the gameObject which has the error to be added + * @param errors list of all errors (= initial content of the textarea) + * @param keepB button "keep what is in the textfield" + * @param textNew textfield containing the error-text to keep + */ + @SuppressWarnings({"PublicConstructorInNonPublicClass"}) + public ConfirmErrorsAL(final JDialog dialog, final GameObject gameObject, final String errors, final JButton keepB, final JTextArea textNew) { + this.gameObject = gameObject; + keepButton = keepB; + text = textNew; + this.dialog = dialog; + allErrors = errors; + } + + /** {@inheritDoc} */ + public void actionPerformed(final ActionEvent e) { + //noinspection ObjectEquality + if (e.getSource() == keepButton) { + // the user pressed "keep", so we append the contents + // of the textfield to the archtext + if (text.getText() != null && text.getText().trim().length() > 0) { + gameObject.addObjectText(text.getText().trim()); + } + } + + // nuke the popup dialog + dialog.dispose(); + dialog = null; + } + + /** {@inheritDoc} */ + @Override public void windowClosing(final WindowEvent e) { + gameObject.addObjectText(allErrors.trim()); + dialog.dispose(); + dialog = null; + } + +} // class ConfirmErrorsAL Property changes on: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ConfirmErrorsAL.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttrib.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttrib.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttrib.java 2008-06-06 21:44:27 UTC (rev 4155) @@ -0,0 +1,36 @@ +package net.sf.gridarta.gui.gameobjectattributesdialog; + +import net.sf.gridarta.CFArchAttrib; +import org.jetbrains.annotations.NotNull; + +/** + * A single Attribute, combining the CFArchAttrib with its input component(s). + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public class DialogAttrib<T> { + + /** Input component(s). */ + @NotNull private final T input; + + /** Reference to the attribute data. */ + @NotNull public final CFArchAttrib ref; // reference to the attribute data + + /** + * Create a DialogAttrib. + * @param ref reference to the attribute data + * @param input Input ui component for editing the value. + */ + public DialogAttrib(@NotNull final CFArchAttrib ref, @NotNull final T input) { + this.ref = ref; + this.input = input; + } + + /** + * Returns the component for input of this dialog attribute. + * @return The component for input. + */ + @NotNull public T getInput() { + return input; + } + +} // class DialogAttrib Property changes on: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttrib.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/MaskChangeAL.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/MaskChangeAL.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/MaskChangeAL.java 2008-06-06 21:44:27 UTC (rev 4155) @@ -0,0 +1,42 @@ +package net.sf.gridarta.gui.gameobjectattributesdialog; + +import java.awt.event.ActionEvent; +import javax.swing.AbstractAction; + +/** + * ActionListener for the change buttons of bitmasks. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public final class MaskChangeAL extends AbstractAction { + + /** The serial version UID. */ + private static final long serialVersionUID = 1; + + private final BitmaskAttrib bmAttr; // attribute structure + + /** + * Constructor. + * @param label Name of this Action. + * @param newAttr the GUI-bitmask attribute where the change button belongs to + */ + public MaskChangeAL(final String label, final BitmaskAttrib newAttr) { + super(label); + bmAttr = newAttr; + } + + /** {@inheritDoc} */ + public void actionPerformed(final ActionEvent e) { + if (bmAttr != null) { + final Integer newValue = bmAttr.getBitmask().showBitmaskDialog(bmAttr.getInput(), bmAttr); + if (newValue != null) { + bmAttr.setValue(newValue); + } + } + } + + /** {@inheritDoc} */ + @Override protected Object clone() throws CloneNotSupportedException { + return super.clone(); + } + +} // class MaskChangeAL Property changes on: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/MaskChangeAL.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/StringKeyManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/StringKeyManager.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/StringKeyManager.java 2008-06-06 21:44:27 UTC (rev 4155) @@ -0,0 +1,43 @@ +package net.sf.gridarta.gui.gameobjectattributesdialog; + +import javax.swing.ComboBoxModel; +import javax.swing.JComboBox; + +/** + * KeySelectionManager to manage the select-per-keystroke in a JComboBox + * (The default KeySelectionManager fails because all strings start with + * whitespace ' '). + * <p/> + * Unfortunately, this class cannot be used anymore because it does not + * work together with the listener <code>TypesBoxAL</code> + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public final class StringKeyManager implements JComboBox.KeySelectionManager { + + /** JComboBox reference. */ + private final JComboBox box; + + /** + * Create a StringKeyManager. + * @param box JComboBox to create StringKeyManager for + */ + @SuppressWarnings({"PublicConstructorInNonPublicClass"}) + public StringKeyManager(final JComboBox box) { + this.box = box; + } + + /** {@inheritDoc} */ + public int selectionForKey(final char aKey, final ComboBoxModel aModel) { + for (int i = 0; i < aModel.getSize(); i++) { + if (((String) aModel.getElementAt(i)).toLowerCase().charAt(1) == aKey) { + //typeListener.ignoreEvent = true; + box.setSelectedIndex(i); // should happen automatically, but doesn't + //typeListener.ignoreEvent = false; + //typeListener.listenAction = true; + return i; + } + } + return -1; // no match found + } + +} // class StringKeyManager Property changes on: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/StringKeyManager.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/TreeChooseAction.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/TreeChooseAction.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/TreeChooseAction.java 2008-06-06 21:44:27 UTC (rev 4155) @@ -0,0 +1,55 @@ +package net.sf.gridarta.gui.gameobjectattributesdialog; + +import java.awt.event.ActionEvent; +import javax.swing.AbstractAction; +import javax.swing.JTextField; +import net.sf.gridarta.data.NamedObject; +import net.sf.gridarta.data.NamedObjects; + +/** + * Action for choosing a face or animation. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public final class TreeChooseAction extends AbstractAction { + + /** The serial version UID. */ + private static final long serialVersionUID = 1; + + /** JTextField to update upon tree selection. */ + private final JTextField textField; + + /** Objects providing the tree. */ + private final NamedObjects<? extends NamedObject> objects; + + /** + * Create a TreeChooseAction. + * @param text text for label / button + * @param textField JTextField to update upon tree selection + * @param objects NamedObjects that provide the tree + */ + @SuppressWarnings({"PublicConstructorInNonPublicClass"}) + public TreeChooseAction(final String text, final JTextField textField, final NamedObjects<? extends NamedObject> objects) { + super(text); + this.textField = textField; + this.objects = objects; + } + + /** {@inheritDoc} */ + public void actionPerformed(final ActionEvent e) { + String initial = textField.getText(); + final NamedObject selected = objects.get(initial); + if (selected != null) { + initial = selected.getPath(); + } + final String newValue = objects.showNodeChooserDialog(textField, initial); + if (newValue != null) { + textField.setText(newValue); + } + } + + /** {@inheritDoc} */ + @Override protected Object clone() throws CloneNotSupportedException { + return super.clone(); + } + +} // class TreeChooseAction Property changes on: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/TreeChooseAction.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ViewTreasurelistAL.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ViewTreasurelistAL.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ViewTreasurelistAL.java 2008-06-06 21:44:27 UTC (rev 4155) @@ -0,0 +1,53 @@ +package net.sf.gridarta.gui.gameobjectattributesdialog; + +import java.awt.event.ActionEvent; +import javax.swing.AbstractAction; +import javax.swing.JTextField; +import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.map.MapArchObject; +import net.sf.gridarta.treasurelist.CFTreasureListTree; +import org.jetbrains.annotations.NotNull; + +/** + * ActionListener for the buttons on treasurelists. When such a button is + * pressed, the dialog with treasurelists pops up. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public final class ViewTreasurelistAL<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractAction { + + /** The serial version UID. */ + private static final long serialVersionUID = 1; + + private final CFTreasureListTree<G, A, R> treasureListTree; + + private final DialogAttrib<JTextField> strAttr; // attribute structure + + private final AbstractGameObjectAttributesDialog<G, A, R> dialog; // reference to this dialog instance + + /** + * Constructor. + * @param attr the GUI-string attribute where the treasurelist button belongs to + * @param treasureListTree the treasure list tree to use + * @param dialog Parent component to show on. + */ + public ViewTreasurelistAL(final DialogAttrib<JTextField> attr, final AbstractGameObjectAttributesDialog<G, A, R> dialog, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { + super("treasurelist:"); + this.treasureListTree = treasureListTree; + strAttr = attr; + this.dialog = dialog; + } + + /** {@inheritDoc} */ + public void actionPerformed(final ActionEvent e) { + if (strAttr != null) { + treasureListTree.showDialog(strAttr.getInput(), dialog); + } + } + + /** {@inheritDoc} */ + @Override protected Object clone() throws CloneNotSupportedException { + return super.clone(); + } + +} // class ViewTreasurelistAL Property changes on: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ViewTreasurelistAL.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: 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-06-07 06:37:41
|
Revision: 4162 http://gridarta.svn.sourceforge.net/gridarta/?rev=4162&view=rev Author: akirschbaum Date: 2008-06-06 23:37:49 -0700 (Fri, 06 Jun 2008) Log Message: ----------- Unify text resources. Modified Paths: -------------- trunk/crossfire/src/cfeditor/messages.properties trunk/crossfire/src/cfeditor/messages_de.properties trunk/daimonin/src/daieditor/messages_de.properties Modified: trunk/crossfire/src/cfeditor/messages.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages.properties 2008-06-07 06:33:14 UTC (rev 4161) +++ trunk/crossfire/src/cfeditor/messages.properties 2008-06-07 06:37:49 UTC (rev 4162) @@ -46,7 +46,7 @@ openFileLoadMap.title=Cannot open map openFileLoadMap.message=An I/O error occurred while loading {0}:\n{1} openFileOutOfMapBoundsDeleted.title=Loading mapfile {0} -openFileOutOfMapBoundsDeleted.message=Deleted {1} game objects outside map bounds:{2} +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? Modified: trunk/crossfire/src/cfeditor/messages_de.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_de.properties 2008-06-07 06:33:14 UTC (rev 4161) +++ trunk/crossfire/src/cfeditor/messages_de.properties 2008-06-07 06:37:49 UTC (rev 4162) @@ -43,7 +43,7 @@ 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={1} Objekte wurden gel\xF6scht, da sie nicht innerhalb der Katenfl\xE4che liegen:{2} +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? Modified: trunk/daimonin/src/daieditor/messages_de.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_de.properties 2008-06-07 06:33:14 UTC (rev 4161) +++ trunk/daimonin/src/daieditor/messages_de.properties 2008-06-07 06:37:49 UTC (rev 4162) @@ -44,7 +44,7 @@ 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={1} Objekte wurden gel\xF6scht, da sie nicht innerhalb der Katenfl\xE4che liegen:{2} +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? This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-06-07 12:57:10
|
Revision: 4167 http://gridarta.svn.sourceforge.net/gridarta/?rev=4167&view=rev Author: akirschbaum Date: 2008-06-07 05:57:16 -0700 (Sat, 07 Jun 2008) Log Message: ----------- Simplify expressions. 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-06-07 12:55:24 UTC (rev 4166) +++ trunk/crossfire/src/cfeditor/MapActions.java 2008-06-07 12:57:16 UTC (rev 4167) @@ -326,7 +326,7 @@ } newMapView.getView().setCursorPosition(exitPos); - if (newMapView != null && JOptionPane.YES_OPTION == ACTION_FACTORY.showOnetimeConfirmDialog(mainControl.getMainView(), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, "enterExitClose")) { + if (JOptionPane.YES_OPTION == ACTION_FACTORY.showOnetimeConfirmDialog(mainControl.getMainView(), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, "enterExitClose")) { // only close current level if a new file was opened and user wants to close it mapManager.closeView(currentMapView); } @@ -417,7 +417,7 @@ newMapView.getView().setViewPosition(calculateNewViewPosition(currentMapView.getView(), newMapView.getView(), direction)); - if (newMapView != null && JOptionPane.YES_OPTION == ACTION_FACTORY.showOnetimeConfirmDialog(mainControl.getMainView(), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, "enterExitClose")) { + if (JOptionPane.YES_OPTION == ACTION_FACTORY.showOnetimeConfirmDialog(mainControl.getMainView(), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, "enterExitClose")) { // only close current level if a new file was opened and user wants to close it mapManager.closeView(currentMapView); } Modified: trunk/daimonin/src/daieditor/MapActions.java =================================================================== --- trunk/daimonin/src/daieditor/MapActions.java 2008-06-07 12:55:24 UTC (rev 4166) +++ trunk/daimonin/src/daieditor/MapActions.java 2008-06-07 12:57:16 UTC (rev 4167) @@ -388,7 +388,7 @@ destinationPoint.y = currentMap.getMapModel().getMapArchObject().getEnterY(); } newMapView.getView().setCursorPosition(destinationPoint); - if (newMapView != null && JOptionPane.YES_OPTION == ACTION_FACTORY.showOnetimeConfirmDialog(mainControl.getMainView(), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, "enterExitClose")) { + if (JOptionPane.YES_OPTION == ACTION_FACTORY.showOnetimeConfirmDialog(mainControl.getMainView(), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, "enterExitClose")) { // only close current level if a new file was opened and user wants to close it mapManager.closeView(currentMapView); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-06-07 13:00:47
|
Revision: 4168 http://gridarta.svn.sourceforge.net/gridarta/?rev=4168&view=rev Author: akirschbaum Date: 2008-06-07 06:00:10 -0700 (Sat, 07 Jun 2008) Log Message: ----------- Rewrite expressions. 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-06-07 12:57:16 UTC (rev 4167) +++ trunk/crossfire/src/cfeditor/MapActions.java 2008-06-07 13:00:10 UTC (rev 4168) @@ -326,7 +326,7 @@ } newMapView.getView().setCursorPosition(exitPos); - if (JOptionPane.YES_OPTION == ACTION_FACTORY.showOnetimeConfirmDialog(mainControl.getMainView(), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, "enterExitClose")) { + if (ACTION_FACTORY.showOnetimeConfirmDialog(mainControl.getMainView(), 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); } @@ -417,7 +417,7 @@ newMapView.getView().setViewPosition(calculateNewViewPosition(currentMapView.getView(), newMapView.getView(), direction)); - if (JOptionPane.YES_OPTION == ACTION_FACTORY.showOnetimeConfirmDialog(mainControl.getMainView(), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, "enterExitClose")) { + if (ACTION_FACTORY.showOnetimeConfirmDialog(mainControl.getMainView(), 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); } Modified: trunk/daimonin/src/daieditor/MapActions.java =================================================================== --- trunk/daimonin/src/daieditor/MapActions.java 2008-06-07 12:57:16 UTC (rev 4167) +++ trunk/daimonin/src/daieditor/MapActions.java 2008-06-07 13:00:10 UTC (rev 4168) @@ -388,7 +388,7 @@ destinationPoint.y = currentMap.getMapModel().getMapArchObject().getEnterY(); } newMapView.getView().setCursorPosition(destinationPoint); - if (JOptionPane.YES_OPTION == ACTION_FACTORY.showOnetimeConfirmDialog(mainControl.getMainView(), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, "enterExitClose")) { + if (ACTION_FACTORY.showOnetimeConfirmDialog(mainControl.getMainView(), 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); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-06-08 12:55:08
|
Revision: 4176 http://gridarta.svn.sourceforge.net/gridarta/?rev=4176&view=rev Author: akirschbaum Date: 2008-06-08 05:54:13 -0700 (Sun, 08 Jun 2008) Log Message: ----------- Unify code. Modified Paths: -------------- trunk/crossfire/src/cfeditor/io/MapArchObjectParser.java trunk/crossfire/src/cfeditor/map/MapArchObject.java trunk/daimonin/src/daieditor/io/MapArchObjectParser.java trunk/daimonin/src/daieditor/map/MapArchObject.java trunk/src/app/net/sf/gridarta/map/AbstractMapArchObject.java Modified: trunk/crossfire/src/cfeditor/io/MapArchObjectParser.java =================================================================== --- trunk/crossfire/src/cfeditor/io/MapArchObjectParser.java 2008-06-08 12:38:14 UTC (rev 4175) +++ trunk/crossfire/src/cfeditor/io/MapArchObjectParser.java 2008-06-08 12:54:13 UTC (rev 4176) @@ -134,7 +134,7 @@ if (mapArchObject.getSky() != 0) { format.format("sky %d\n", mapArchObject.getSky()); } - for (int i = 0; i < MapArchObject.MAX_TILE; i++) { + for (int i = 0; i < 8; i++) { if (mapArchObject.getTilePath(i).length() > 0) { format.format("tile_path_%d %s\n", i + 1, mapArchObject.getTilePath(i)); } Modified: trunk/crossfire/src/cfeditor/map/MapArchObject.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapArchObject.java 2008-06-08 12:38:14 UTC (rev 4175) +++ trunk/crossfire/src/cfeditor/map/MapArchObject.java 2008-06-08 12:54:13 UTC (rev 4176) @@ -38,8 +38,6 @@ @SuppressWarnings({"HardcodedLineSeparator"}) public final class MapArchObject extends AbstractMapArchObject<MapArchObject> { - public static final int MAX_TILE = 4; - private final StringBuilder loreText = new StringBuilder(); // lore text buffer /** If set, this entire map is unique. */ @@ -95,7 +93,6 @@ * All fields will be set to reasonable default values. */ public MapArchObject() { - super(MAX_TILE); } /** Modified: trunk/daimonin/src/daieditor/io/MapArchObjectParser.java =================================================================== --- trunk/daimonin/src/daieditor/io/MapArchObjectParser.java 2008-06-08 12:38:14 UTC (rev 4175) +++ trunk/daimonin/src/daieditor/io/MapArchObjectParser.java 2008-06-08 12:54:13 UTC (rev 4176) @@ -101,7 +101,7 @@ if (mapArchObject.isPvp()) { appendable.append("pvp 1\n"); } - for (int i = 0; i < MapArchObject.MAX_TILE; i++) { + for (int i = 0; i < 8; i++) { if (mapArchObject.getTilePath(i).length() > 0) { format.format("tile_path_%d %s\n", i + 1, mapArchObject.getTilePath(i)); } Modified: trunk/daimonin/src/daieditor/map/MapArchObject.java =================================================================== --- trunk/daimonin/src/daieditor/map/MapArchObject.java 2008-06-08 12:38:14 UTC (rev 4175) +++ trunk/daimonin/src/daieditor/map/MapArchObject.java 2008-06-08 12:54:13 UTC (rev 4176) @@ -43,8 +43,6 @@ /** Serial Version. */ private static final long serialVersionUID = 1L; - public static final int MAX_TILE = 8; - /** No save map. */ private boolean noSave = false; @@ -92,7 +90,6 @@ * All fields will be set to reasonable default values. */ public MapArchObject() { - super(MAX_TILE); } /** Modified: trunk/src/app/net/sf/gridarta/map/AbstractMapArchObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/AbstractMapArchObject.java 2008-06-08 12:38:14 UTC (rev 4175) +++ trunk/src/app/net/sf/gridarta/map/AbstractMapArchObject.java 2008-06-08 12:54:13 UTC (rev 4176) @@ -99,7 +99,7 @@ * 0 = north, 1 = east, 2 = south, 3 = west. * 4 = northeast, 5 = southeast, 6 = southwest, 7 = northwest */ - private final String[] tilePaths; + private final String[] tilePaths = new String[8]; /** The registered event listeners. */ private final EventListenerList listenerList = new EventListenerList(); @@ -130,13 +130,9 @@ /** * Create an AbstractMapArchObject. - * @param maxTile The number of tile paths. */ - protected AbstractMapArchObject(final int maxTile) { - tilePaths = new String[maxTile]; - for (int i = 0; i < tilePaths.length; i++) { - tilePaths[i] = ""; - } + protected AbstractMapArchObject() { + Arrays.fill(tilePaths, ""); } /** @@ -156,7 +152,6 @@ difficulty = mapArchObject.difficulty; fixedReset = mapArchObject.fixedReset; darkness = mapArchObject.darkness; - tilePaths = new String[mapArchObject.tilePaths.length]; System.arraycopy(mapArchObject.tilePaths, 0, tilePaths, 0, mapArchObject.tilePaths.length); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-06-12 08:49:57
|
Revision: 4178 http://gridarta.svn.sourceforge.net/gridarta/?rev=4178&view=rev Author: akirschbaum Date: 2008-06-12 01:49:07 -0700 (Thu, 12 Jun 2008) Log Message: ----------- Remove error message dialog; print a console warning instead. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.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 Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-06-08 13:01:00 UTC (rev 4177) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-06-12 08:49:07 UTC (rev 4178) @@ -165,7 +165,7 @@ private final AnimationObjects animationObjects; /** The Face Objects. */ - private final FaceObjects faceObjects; + private final FaceObjects faceObjects = new FaceObjects(this); /** The Spells. */ private final Spells<NumberSpell> numberSpells = new Spells<NumberSpell>(); @@ -297,7 +297,6 @@ mapActions.updateMenuState(); scriptControl.getView().setMenu((JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "plugins")); archetypeParser = new ArchetypeParser(this, objectChooser.getArchetypeChooserControl(), animationObjects); - faceObjects = new FaceObjects(mainView, this); archetypeSet.loadArchetypes(archetypeParser); if (globalSettings.isAutoPopupDocu()) { Modified: trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java 2008-06-08 13:01:00 UTC (rev 4177) +++ trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java 2008-06-12 08:49:07 UTC (rev 4178) @@ -64,16 +64,11 @@ /** The main control. */ @NotNull private final MainControl<?, ?, ?, ?> mainControl; - /** The parent component for error messages. */ - @NotNull private final Component parent; - /** * Creates a new instance. - * @param parent the parent component for error messages * @param mainControl the main control */ - public FaceObjects(@NotNull final Component parent, @NotNull final MainControl<?, ?, ?, ?> mainControl) { - this.parent = parent; + public FaceObjects(@NotNull final MainControl<?, ?, ?, ?> mainControl) { this.mainControl = mainControl; } Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-06-08 13:01:00 UTC (rev 4177) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-06-12 08:49:07 UTC (rev 4178) @@ -206,7 +206,7 @@ private final AnimationObjects animationObjects; /** The Face Objects. */ - private final FaceObjects faceObjects; + private final FaceObjects faceObjects = new FaceObjects(); /** The Spells. */ private final daieditor.spells.Spells numberSpells = new daieditor.spells.Spells(); @@ -353,7 +353,6 @@ mainView.init(gameObjectAttributesPanel, selectedSquareControl.getSelectedSquareView(), typeList, mapTileListBottom, gameObjectMatchers); mapActions.updateMenuState(); archetypeParser = new ArchetypeParser(this, objectChooser.getArchetypeChooserControl(), animationObjects); - faceObjects = new FaceObjects(mainView); archetypeSet.loadArchetypes(archetypeParser); if (globalSettings.isAutoPopupDocu()) { Modified: trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java 2008-06-08 13:01:00 UTC (rev 4177) +++ trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java 2008-06-12 08:49:07 UTC (rev 4178) @@ -58,15 +58,10 @@ /** Action Factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("daieditor"); - /** The parent component for error messages. */ - @NotNull private final Component parent; - /** * Creates a new instance. - * @param parent the parent component for error messages */ - public FaceObjects(@NotNull final Component parent) { - this.parent = parent; + public FaceObjects() { } /** @@ -104,7 +99,7 @@ //noinspection IOResourceOpenedButNotSafelyClosed treeIn = new BufferedReader(new InputStreamReader(new FileInputStream(treeFile), "us-ascii")); } catch (final FileNotFoundException e) { - ACTION_FACTORY.showMessageDialog(parent, "errCantLoadFaceTree"); + log.warn(ACTION_FACTORY.getString("logCantLoadFaceTree")); } final byte[] tag = "IMAGE ".getBytes(); // this is the starting string for a new png final StringBuilder faceB = new StringBuilder(); // face name of png Modified: trunk/daimonin/src/daieditor/messages.properties =================================================================== --- trunk/daimonin/src/daieditor/messages.properties 2008-06-08 13:01:00 UTC (rev 4177) +++ trunk/daimonin/src/daieditor/messages.properties 2008-06-12 08:49:07 UTC (rev 4178) @@ -61,9 +61,6 @@ openScriptNotFound.title=Script file not found openScriptNotFound.message=The file ''{0}'' does not exist.\nPlease correct the path. -errCantLoadFaceTree.title=Cannot load face tree -errCantLoadFaceTree.message=<html>Can''t load face tree.<br>You won''t be able to easily choose faces from a tree.<br>To change this, you need either a version of <code>arch/</code> that contains <code>arch/dev/editor/conf/facetree</code>,<br>or you have to collect arches yourself.</html> - loadDuplicateFace.title=Error: Duplicate face loadDuplicateFace.message=Warning!\n\nDuplicate face: ''{0}''\nFiles: ''{1}''\nand ''{2}''\nI will ignore this duplicate. @@ -467,6 +464,7 @@ logDefArchWithInvalidTypeNr=Arch {0} has an invalid type nr: {1} logDefArchWithInvalidDirection=Arch {0} has an invalid direction: {1} logDefArchWithInvalidMpartNr=Arch part {0} has mpart_nr {2}, but head part {1} has mpart_nr {3} +logCantLoadFaceTree.message=Can''t load face tree. You won''t be able to easily choose faces from a tree. To change this, you need either a version of <code>arch/</code> that contains <code>arch/dev/editor/conf/facetree</code>, or you have to collect arches yourself. ################ Modified: trunk/daimonin/src/daieditor/messages_de.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_de.properties 2008-06-08 13:01:00 UTC (rev 4177) +++ trunk/daimonin/src/daieditor/messages_de.properties 2008-06-12 08:49:07 UTC (rev 4178) @@ -61,9 +61,6 @@ openScriptNotFound.title=Script-Datei nicht gefunden openScriptNotFound.message=Die Datei ''{0}'' existiert nicht.\nBitte geben sie einen g\xFCltigen Dateinamen an. -#errCantLoadFaceTree.title= -#errCantLoadFaceTree.message= - loadDuplicateFace.title=Fehler: doppelte Grafik loadDuplicateFace.message=Warning!\n\nDopplete Grafik: ''{0}''\nDateien: ''{1}''\nund ''{2}''\nDie doppelte Grafik wird ignoriert. Modified: trunk/daimonin/src/daieditor/messages_fr.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_fr.properties 2008-06-08 13:01:00 UTC (rev 4177) +++ trunk/daimonin/src/daieditor/messages_fr.properties 2008-06-12 08:49:07 UTC (rev 4178) @@ -61,9 +61,6 @@ #openScriptNotFound.title= #openScriptNotFound.message= -#errCantLoadFaceTree.title= -#errCantLoadFaceTree.message= - #loadDuplicateFace.title= #loadDuplicateFace.message= Modified: trunk/daimonin/src/daieditor/messages_sv.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_sv.properties 2008-06-08 13:01:00 UTC (rev 4177) +++ trunk/daimonin/src/daieditor/messages_sv.properties 2008-06-12 08:49:07 UTC (rev 4178) @@ -61,9 +61,6 @@ openScriptNotFound.title=Kunde inte hitta scriptfil openScriptNotFound.message=Filen ''{0}'' finns inte.\nV\xE4r v\xE4nlig korrigera s\xF6kv\xE4gen. -errCantLoadFaceTree.title=Kan inte \xF6ppna bildtr\xE4det -errCantLoadFaceTree.message=<html>Kan inte \xF6ppna bildtr\xE4det. <br>Du kommer inte att kunna anv\xE4nda det smidigare gr\xE4nssnittet f\xF6r att v\xE4lja bilder till objekt.<br>F\xF6r att l\xF6sa detta beh\xF6ver du antingen en version <code>arch/</code> som inneh\xE5ller <code>arch/dev/editor/conf/facetree</code>,<br>eller s\xE5 m\xE5ste du sammanst\xE4lla arketyper sj\xE4lv.</html> - loadDuplicateFace.title=Fel: duplicerad bild loadDuplicateFace.message=Varning!\n\nDuplicerad bild: ''{0}''\nFiler: ''{1}''\noch ''{2}''\nJag kommer att ignorera detta duplikat. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-06-12 09:23:06
|
Revision: 4179 http://gridarta.svn.sourceforge.net/gridarta/?rev=4179&view=rev Author: akirschbaum Date: 2008-06-12 02:22:43 -0700 (Thu, 12 Jun 2008) Log Message: ----------- Remove MainControl.getFaceObjects(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java trunk/crossfire/src/cfeditor/gui/GameObjectAttributesDialog.java trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java trunk/crossfire/src/cfeditor/gui/map/MapRenderer.java trunk/crossfire/src/cfeditor/gui/map/PickmapRenderer.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java trunk/daimonin/src/daieditor/gui/GameObjectAttributesDialog.java trunk/daimonin/src/daieditor/gui/map/CMapViewBasic.java trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java trunk/daimonin/src/daieditor/gui/map/MapRenderer.java trunk/daimonin/src/daieditor/gui/map/PickmapRenderer.java trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java trunk/src/app/net/sf/gridarta/MainControl.java trunk/src/app/net/sf/gridarta/gameobject/face/AbstractFaceObjects.java trunk/src/app/net/sf/gridarta/gameobject/face/FaceObjects.java trunk/src/app/net/sf/gridarta/gui/MainActions.java trunk/src/app/net/sf/gridarta/gui/MainView.java trunk/src/app/net/sf/gridarta/gui/StatusBar.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialog.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-06-12 08:49:07 UTC (rev 4178) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-06-12 09:22:43 UTC (rev 4179) @@ -203,7 +203,7 @@ private final MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapCursorControl; /** Actions used by this instance. */ - private final MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, ACTION_FACTORY); + private final MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, ACTION_FACTORY, faceObjects); /** JFileChooser for opening a file. */ private JFileChooser fileChooser; @@ -227,9 +227,10 @@ */ public CMainControl() { super(new CrossfireObjectsFactory(), "cfeditor"); + getGridartaObjectsFactory().setFaceObjects(faceObjects); instance = this; animationObjects = new AnimationObjects(); - archetypeSet = new ArchetypeSet(this, animationObjects); + archetypeSet = new ArchetypeSet(this, animationObjects, faceObjects); scriptControl = new ScriptController(this); mapCursorControl = new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("cfeditor", this, getMapManager()); ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "zoom", "gc", "onlineHelp", "tod", "about"); @@ -237,7 +238,7 @@ globalSettings.readGlobalSettings(); PathManager.setGlobalSettings(globalSettings); objectChooser = new ObjectChooser(newMapDialogFactory, this, new File(globalSettings.getMapDir(), IGUIConstants.PICKMAP_DIR)); - mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction()); + mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), faceObjects); new About("cfeditor", mainView); undoControl = new UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); updaterManager = new UpdaterManager("cfeditor", this, mainView, "CrossfireEditor.jar"); @@ -444,11 +445,6 @@ return animationObjects; } - /** {@inheritDoc} */ - public FaceObjects getFaceObjects() { - return faceObjects; - } - /** * {@inheritDoc} */ @@ -650,7 +646,7 @@ // types.xml is missing! ACTION_FACTORY.showMessageDialog(mainView, "openAttrDialogNoTypes"); } else if (gameObject != null && !gameObject.hasUndefinedArchetype()) { - GameObjectAttributesDialog.showAttribDialog(typeList, gameObject, this, getMapManager(), treasureListTree); + GameObjectAttributesDialog.showAttribDialog(typeList, gameObject, this, getMapManager(), treasureListTree, faceObjects); } else { ACTION_FACTORY.showMessageDialog(mainView, "openAttrDialogNoDefaultArch"); } Modified: trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-06-12 08:49:07 UTC (rev 4178) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-06-12 09:22:43 UTC (rev 4179) @@ -36,6 +36,7 @@ import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.ArchetypeSet; +import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gameobject.match.GameObjectMatchers; import net.sf.gridarta.gui.map.LevelRenderer; import net.sf.gridarta.gui.map.MapView; @@ -61,6 +62,9 @@ /** Preferences. */ private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); + /** The {@link FaceObjects} instance to use. */ + private FaceObjects faceObjects = null; + /** {@inheritDoc} */ @NotNull public GameObject newGameObject() { return new GameObject(); @@ -112,7 +116,12 @@ /** {@inheritDoc} */ @NotNull public MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapView(@NotNull final MapControl mapControl, @Nullable final Point viewPosition, final int viewCounter) { - return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>(AbstractMainControl.getInstance(), mapControl, viewCounter, new CMapViewBasic(CMainControl.getInstance(), mapControl, viewPosition), ACTION_FACTORY); + return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>(AbstractMainControl.getInstance(), mapControl, viewCounter, new CMapViewBasic(CMainControl.getInstance(), mapControl, viewPosition, faceObjects), ACTION_FACTORY); } + /** {@inheritDoc} */ + public void setFaceObjects(final FaceObjects faceObjects) { + this.faceObjects = faceObjects; + } + } // class CrossfireObjectsFactory Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2008-06-12 08:49:07 UTC (rev 4178) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2008-06-12 09:22:43 UTC (rev 4179) @@ -41,6 +41,7 @@ import net.sf.gridarta.gameobject.face.ArchFaceProvider; import net.sf.gridarta.gameobject.face.DuplicateFaceException; import net.sf.gridarta.gameobject.face.FaceObjectProviders; +import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gui.SystemIcons; import net.sf.gridarta.io.IOUtils; import net.sf.japi.swing.ActionFactory; @@ -67,15 +68,20 @@ @NotNull private final AnimationObjects animationObjects; + /** The FaceObjects instance to use. */ + @NotNull private final FaceObjects faceObjects; + /** * Create the ArchetypeSet. * @param mainControl reference to CMainControl * @param animationObjects the animations to use + * @param faceObjects the FaceObjects instance to use */ - public ArchetypeSet(final CMainControl mainControl, @NotNull final AnimationObjects animationObjects) { + public ArchetypeSet(final CMainControl mainControl, @NotNull final AnimationObjects animationObjects, @NotNull final FaceObjects faceObjects) { super(mainControl.getGridartaObjectsFactory()); this.mainControl = mainControl; this.animationObjects = animationObjects; + this.faceObjects = faceObjects; } /** @@ -161,7 +167,7 @@ } finally { stream.close(); } - mainControl.getFaceObjects().loadFacesCollection(new File(baseDir, IGUIConstants.PNG_FILE), new File(mainControl.getConfigurationDirectory(), IGUIConstants.FACETREE_FILE)); + faceObjects.loadFacesCollection(new File(baseDir, IGUIConstants.PNG_FILE), new File(mainControl.getConfigurationDirectory(), IGUIConstants.FACETREE_FILE)); } catch (final IOException e) { // TODO log.error("Error:", e); @@ -288,7 +294,7 @@ ((ArchFaceProvider) FaceObjectProviders.normal).addInfo(facename, filename); final int stripPath = new File(mainControl.getGlobalSettings().getArchDefaultFolder()).getAbsolutePath().length(); try { - mainControl.getFaceObjects().addFaceObject(facename, originalPathname.substring(0, slashPos + 1) + facename, filename, 0, (int) new File(filename).length()); + faceObjects.addFaceObject(facename, originalPathname.substring(0, slashPos + 1) + facename, filename, 0, (int) new File(filename).length()); } catch (final DuplicateFaceException e) { ACTION_FACTORY.showMessageDialog(mainControl.getMainView(), "loadDuplicateFace", e.getDuplicate().getFaceName(), e.getDuplicate().getOriginalFilename(), e.getExisting().getOriginalFilename()); } Modified: trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java 2008-06-12 08:49:07 UTC (rev 4178) +++ trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java 2008-06-12 09:22:43 UTC (rev 4179) @@ -20,7 +20,6 @@ package cfeditor.gameobject.face; import cfeditor.IGUIConstants; -import java.awt.Component; import java.io.BufferedWriter; import java.io.ByteArrayOutputStream; import java.io.File; @@ -72,14 +71,7 @@ this.mainControl = mainControl; } - /** - * Loads all faces from a png collection file. - * @param faceFile file to load faces from - * @param treeFile file to load tree information from - * @throws IOException in case of I/O errors - * @throws FileNotFoundException in case the file couldn't be opened - * @throws DuplicateFaceException in case a face was not unique - */ + /** {@inheritDoc} */ public void loadFacesCollection(final File faceFile, final File treeFile) throws IOException, FileNotFoundException, DuplicateFaceException { FaceObjectProviders.setNormal(new CollectedFaceProvider(faceFile)); final String actualFilename = faceFile.toString(); Modified: trunk/crossfire/src/cfeditor/gui/GameObjectAttributesDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/GameObjectAttributesDialog.java 2008-06-12 08:49:07 UTC (rev 4178) +++ trunk/crossfire/src/cfeditor/gui/GameObjectAttributesDialog.java 2008-06-12 09:22:43 UTC (rev 4179) @@ -37,6 +37,7 @@ import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; import net.sf.gridarta.gameobject.ArchAttribType; +import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gui.gameobjectattributesdialog.AbstractGameObjectAttributesDialog; import net.sf.gridarta.gui.gameobjectattributesdialog.BitmaskAttrib; import net.sf.gridarta.gui.gameobjectattributesdialog.DialogAttrib; @@ -75,13 +76,14 @@ * @param gameObject the GameObject to be displayed by this dialog * @param mainControl main control * @param mapManager the map manager + * @param faceObjects the FaceObjects instance to use */ - public static void showAttribDialog(final CFArchTypeList archTypeList, final GameObject gameObject, final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree) { + public static void showAttribDialog(final CFArchTypeList archTypeList, final GameObject gameObject, final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects) { synchronized (dialogs) { if (dialogs.containsKey(gameObject)) { dialogs.get(gameObject).toFront(); } else { - final GameObjectAttributesDialog pane = new GameObjectAttributesDialog(archTypeList, gameObject, mainControl, mapManager, treasureListTree); + final GameObjectAttributesDialog pane = new GameObjectAttributesDialog(archTypeList, gameObject, mainControl, mapManager, treasureListTree, faceObjects); final JDialog dialog = pane.createDialog(mainControl.getMainView(), ACTION_FACTORY.getString("attribTitle")); dialog.getRootPane().setDefaultButton(pane.okButton); dialog.setResizable(true); @@ -99,9 +101,10 @@ * @param mainControl main control * @param mapManager the map manager * @param treasureListTree the treasure list tree + * @param faceObjects the FaceObjects instance to use */ - private GameObjectAttributesDialog(final CFArchTypeList archTypeList, @NotNull final GameObject gameObject, final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree) { - super(archTypeList, gameObject, mainControl, treasureListTree); + private GameObjectAttributesDialog(final CFArchTypeList archTypeList, @NotNull final GameObject gameObject, final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects) { + super(archTypeList, gameObject, mainControl, treasureListTree, faceObjects); this.mapManager = mapManager; } Modified: trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java 2008-06-12 08:49:07 UTC (rev 4178) +++ trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java 2008-06-12 09:22:43 UTC (rev 4179) @@ -28,6 +28,7 @@ import java.util.HashMap; import java.util.Map; import javax.swing.JViewport; +import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gui.map.LevelRenderer; import net.sf.gridarta.gui.map.MapCursor; import net.sf.gridarta.gui.map.MapCursorEvent; @@ -94,8 +95,9 @@ * @param mapControl the controller of this view * @param initial the initial view position to show; null=show top left * corner + * @param faceObjects the FaceObjects instance to use */ - public CMapViewBasic(@NotNull final CMainControl mainControl, @NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, @Nullable final Point initial) { + public CMapViewBasic(@NotNull final CMainControl mainControl, @NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, @Nullable final Point initial, @NotNull final FaceObjects faceObjects) { super(mapControl); this.mapControl = mapControl; mapModel = mapControl.getMapModel(); @@ -105,7 +107,7 @@ } this.mainControl = mainControl; - renderer = mapControl.isPickmap() ? new PickmapRenderer(mainControl, mapControl, mapGrid) : new MapRenderer(mainControl, mapControl, mapGrid); + renderer = mapControl.isPickmap() ? new PickmapRenderer(mainControl, mapControl, mapGrid, faceObjects) : new MapRenderer(mainControl, mapControl, mapGrid, faceObjects); setViewportView(renderer); getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2008-06-12 08:49:07 UTC (rev 4178) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2008-06-12 09:22:43 UTC (rev 4179) @@ -32,6 +32,7 @@ import java.awt.image.BufferedImage; import java.util.Map; import net.sf.gridarta.Size2D; +import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gui.SystemIcons; import net.sf.gridarta.gui.map.AbstractLevelRenderer; import net.sf.gridarta.gui.map.MapGrid; @@ -67,6 +68,8 @@ private final MapGrid mapGrid; + @NotNull private final FaceObjects faceObjects; + /** Set if the grid should be rendered. */ private boolean gridVisible = false; @@ -163,11 +166,13 @@ * @param mapControl MapControl of the map to render * @param mapGrid Grid to render * @param borderSize the size of the map borders in pixel + * @param faceObjects the FaceObjects instance to use */ - protected DefaultLevelRenderer(final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final MapGrid mapGrid, final int borderSize) { + protected DefaultLevelRenderer(final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final MapGrid mapGrid, final int borderSize, @NotNull final FaceObjects faceObjects) { mapModel = mapControl.getMapModel(); mapSize = mapModel.getMapSize(); this.mapGrid = mapGrid; + this.faceObjects = faceObjects; setToolTipText("dummy"); setFocusable(true); Modified: trunk/crossfire/src/cfeditor/gui/map/MapRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/MapRenderer.java 2008-06-12 08:49:07 UTC (rev 4178) +++ trunk/crossfire/src/cfeditor/gui/map/MapRenderer.java 2008-06-12 09:22:43 UTC (rev 4179) @@ -33,10 +33,12 @@ import java.awt.image.BufferedImage; import java.lang.ref.SoftReference; import javax.swing.ImageIcon; +import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gui.SystemIcons; import net.sf.gridarta.gui.map.MapGrid; import net.sf.gridarta.map.MapControl; import org.apache.log4j.Logger; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** @@ -78,9 +80,10 @@ * @param mainControl MainControl, used for getting icons and similar * @param mapControl MapControl of the map to render * @param mapGrid Grid to render + * @param faceObjects the FaceObjects instance to use */ - public MapRenderer(final CMainControl mainControl, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final MapGrid mapGrid) { - super(mapControl, mapGrid, 32); + public MapRenderer(final CMainControl mainControl, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final MapGrid mapGrid, @NotNull final FaceObjects faceObjects) { + super(mapControl, mapGrid, 32, faceObjects); filter = mainControl.getFilterControl(); this.mainControl = mainControl; archetypeSet = mainControl.getArchetypeSet(); Modified: trunk/crossfire/src/cfeditor/gui/map/PickmapRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/PickmapRenderer.java 2008-06-12 08:49:07 UTC (rev 4178) +++ trunk/crossfire/src/cfeditor/gui/map/PickmapRenderer.java 2008-06-12 09:22:43 UTC (rev 4179) @@ -31,8 +31,10 @@ import java.awt.Rectangle; import javax.swing.ImageIcon; import net.sf.gridarta.CommonConstants; +import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gui.map.MapGrid; import net.sf.gridarta.map.MapControl; +import org.jetbrains.annotations.NotNull; /** * A {@link DefaultLevelRenderer} to render map files. @@ -51,9 +53,10 @@ * @param mainControl MainControl, used for getting icons and similar * @param mapControl MapControl of the map to render * @param mapGrid Grid to render + * @param faceObjects the FaceObjects instance to use */ - public PickmapRenderer(final CMainControl mainControl, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final MapGrid mapGrid) { - super(mapControl, mapGrid, 0); + public PickmapRenderer(final CMainControl mainControl, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final MapGrid mapGrid, @NotNull final FaceObjects faceObjects) { + super(mapControl, mapGrid, 0, faceObjects); archetypeSet = mainControl.getArchetypeSet(); init(); } Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-06-12 08:49:07 UTC (rev 4178) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-06-12 09:22:43 UTC (rev 4179) @@ -260,7 +260,7 @@ private final MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapCursorControl; /** Actions used by this instance. */ - private final MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, ACTION_FACTORY); + private final MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, ACTION_FACTORY, faceObjects); /** JFileChooser for opening a file. */ private JFileChooser fileChooser; @@ -281,9 +281,10 @@ */ public CMainControl() { super(new DaimoninObjectsFactory(), "daieditor"); + getGridartaObjectsFactory().setFaceObjects(faceObjects); instance = this; animationObjects = new AnimationObjects(); - archetypeSet = new ArchetypeSet(this, animationObjects); + archetypeSet = new ArchetypeSet(this, animationObjects, faceObjects); mapCursorControl = new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("daieditor", this, getMapManager()); ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "controlServer", "controlClient", "cleanCompletelyBlockedSquares", "zoom", "gc", "onlineHelp", "tod", "about"); ACTION_FACTORY.createToggles(true, this, "drawDouble"); @@ -292,7 +293,7 @@ globalSettings.readGlobalSettings(); PathManager.setGlobalSettings(globalSettings); objectChooser = new ObjectChooser(newMapDialogFactory, this, new File(globalSettings.getArchDefaultFolder(), IGUIConstants.PICKMAP_DIR)); - mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction()); + mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), faceObjects); new About("daieditor", mainView); undoControl = new UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); updaterManager = new UpdaterManager("daieditor", this, mainView, "DaimoninEditor.jar"); @@ -551,11 +552,6 @@ return animationObjects; } - /** {@inheritDoc} */ - public FaceObjects getFaceObjects() { - return faceObjects; - } - /** Control the server. */ @ActionMethod public void controlServer() { if (controlServer == null) { @@ -815,7 +811,7 @@ // types.xml is missing! ACTION_FACTORY.showMessageDialog(mainView, "openAttrDialogNoTypes"); } else if (gameObject != null && !gameObject.hasUndefinedArchetype()) { - GameObjectAttributesDialog.showAttribDialog(typeList, gameObject, this, getMapManager(), treasureListTree); + GameObjectAttributesDialog.showAttribDialog(typeList, gameObject, this, getMapManager(), treasureListTree, faceObjects); } else { ACTION_FACTORY.showMessageDialog(mainView, "openAttrDialogNoDefaultArch"); } Modified: trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-06-12 08:49:07 UTC (rev 4178) +++ trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-06-12 09:22:43 UTC (rev 4179) @@ -36,6 +36,7 @@ import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.ArchetypeSet; +import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gameobject.match.GameObjectMatchers; import net.sf.gridarta.gui.map.LevelRenderer; import net.sf.gridarta.gui.map.MapView; @@ -61,6 +62,9 @@ /** Preferences. */ private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); + /** The {@link FaceObjects} instance to use. */ + private FaceObjects faceObjects = null; + /** {@inheritDoc} */ @NotNull public GameObject newGameObject() { return new GameObject(); @@ -112,7 +116,12 @@ /** {@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>(AbstractMainControl.getInstance(), mapControl, viewCounter, new CMapViewBasic(CMainControl.getInstance(), mapControl, viewPosition), ACTION_FACTORY); + return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>(AbstractMainControl.getInstance(), mapControl, viewCounter, new CMapViewBasic(CMainControl.getInstance(), mapControl, viewPosition, faceObjects), ACTION_FACTORY); } + /** {@inheritDoc} */ + public void setFaceObjects(final FaceObjects faceObjects) { + this.faceObjects = faceObjects; + } + } // class DaimoninObjectsFactory Modified: trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2008-06-12 08:49:07 UTC (rev 4178) +++ trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2008-06-12 09:22:43 UTC (rev 4179) @@ -44,6 +44,7 @@ import net.sf.gridarta.gameobject.face.ArchFaceProvider; import net.sf.gridarta.gameobject.face.DuplicateFaceException; import net.sf.gridarta.gameobject.face.FaceObjectProviders; +import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gui.SystemIcons; import net.sf.gridarta.io.IOUtils; import net.sf.japi.swing.ActionFactory; @@ -70,6 +71,9 @@ @NotNull private final AnimationObjects animationObjects; + /** The FaceObjects instance to use. */ + @NotNull private final FaceObjects faceObjects; + /** * The animation files. * This variable is only used during arch collection from files. @@ -80,11 +84,13 @@ * Create the ArchetypeSet. * @param mainControl reference to CMainControl * @param animationObjects the animations to use + * @param faceObjects the FaceObjects instance to use */ - public ArchetypeSet(final CMainControl mainControl, @NotNull final AnimationObjects animationObjects) { + public ArchetypeSet(final CMainControl mainControl, @NotNull final AnimationObjects animationObjects, @NotNull final FaceObjects faceObjects) { super(mainControl.getGridartaObjectsFactory()); this.mainControl = mainControl; this.animationObjects = animationObjects; + this.faceObjects = faceObjects; } /** @@ -319,7 +325,7 @@ } finally { stream.close(); } - mainControl.getFaceObjects().loadFacesCollection(new File(baseDir, IGUIConstants.PNG_FILE), new File(mainControl.getConfigurationDirectory(), IGUIConstants.FACETREE_FILE)); + faceObjects.loadFacesCollection(new File(baseDir, IGUIConstants.PNG_FILE), new File(mainControl.getConfigurationDirectory(), IGUIConstants.FACETREE_FILE)); } catch (final IOException e) { // TODO log.error("Error:", e); @@ -445,7 +451,7 @@ ((ArchFaceProvider) FaceObjectProviders.normal).addInfo(facename, filename); final int stripPath = new File(mainControl.getCollectedDirectory()).getAbsolutePath().length(); try { - mainControl.getFaceObjects().addFaceObject(facename, filename.substring(stripPath, filename.length() - 4).replace('\\', '/'), filename, 0, (int) new File(filename).length()); + faceObjects.addFaceObject(facename, filename.substring(stripPath, filename.length() - 4).replace('\\', '/'), filename, 0, (int) new File(filename).length()); } catch (final DuplicateFaceException e) { ACTION_FACTORY.showMessageDialog(mainControl.getMainView(), "loadDuplicateFace", e.getDuplicate().getFaceName(), e.getDuplicate().getOriginalFilename(), e.getExisting().getOriginalFilename()); } Modified: trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java 2008-06-12 08:49:07 UTC (rev 4178) +++ trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java 2008-06-12 09:22:43 UTC (rev 4179) @@ -20,7 +20,6 @@ package daieditor.gameobject.face; import daieditor.IGUIConstants; -import java.awt.Component; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.ByteArrayOutputStream; @@ -64,14 +63,7 @@ public FaceObjects() { } - /** - * Loads all faces from a png collection file. - * @param faceFile file to load faces from - * @param treeFile file to load tree information from - * @throws IOException in case of I/O errors - * @throws FileNotFoundException in case the file couldn't be opened - * @throws DuplicateFaceException in case a face was not unique - */ + /** {@inheritDoc} */ public void loadFacesCollection(final File faceFile, final File treeFile) throws IOException, FileNotFoundException, DuplicateFaceException { FaceObjectProviders.setNormal(new CollectedFaceProvider(faceFile)); final String actualFilename = faceFile.toString(); Modified: trunk/daimonin/src/daieditor/gui/GameObjectAttributesDialog.java =================================================================== --- trunk/daimonin/src/daieditor/gui/GameObjectAttributesDialog.java 2008-06-12 08:49:07 UTC (rev 4178) +++ trunk/daimonin/src/daieditor/gui/GameObjectAttributesDialog.java 2008-06-12 09:22:43 UTC (rev 4179) @@ -37,6 +37,7 @@ import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; import net.sf.gridarta.gameobject.ArchAttribType; +import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gui.gameobjectattributesdialog.AbstractGameObjectAttributesDialog; import net.sf.gridarta.gui.gameobjectattributesdialog.BitmaskAttrib; import net.sf.gridarta.gui.gameobjectattributesdialog.DialogAttrib; @@ -74,13 +75,14 @@ * @param gameObject the GameObject to be displayed by this dialog * @param mainControl main control * @param mapManager the map manager + * @param faceObjects the FaceObjects instance to use */ - public static void showAttribDialog(final CFArchTypeList archTypeList, final GameObject gameObject, final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree) { + public static void showAttribDialog(final CFArchTypeList archTypeList, final GameObject gameObject, final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects) { synchronized (dialogs) { if (dialogs.containsKey(gameObject)) { dialogs.get(gameObject).toFront(); } else { - final GameObjectAttributesDialog pane = new GameObjectAttributesDialog(archTypeList, gameObject, mainControl, mapManager, treasureListTree); + final GameObjectAttributesDialog pane = new GameObjectAttributesDialog(archTypeList, gameObject, mainControl, mapManager, treasureListTree, faceObjects); final JDialog dialog = pane.createDialog(mainControl.getMainView(), ACTION_FACTORY.getString("attribTitle")); dialog.getRootPane().setDefaultButton(pane.okButton); dialog.setResizable(true); @@ -98,9 +100,10 @@ * @param mainControl main control * @param mapManager the map manager * @param treasureListTree the treasure list tree + * @param faceObjects the FaceObjects instance to use */ - private GameObjectAttributesDialog(final CFArchTypeList archTypeList, @NotNull final GameObject gameObject, final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree) { - super(archTypeList, gameObject, mainControl, treasureListTree); + private GameObjectAttributesDialog(final CFArchTypeList archTypeList, @NotNull final GameObject gameObject, final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects) { + super(archTypeList, gameObject, mainControl, treasureListTree, faceObjects); this.mapManager = mapManager; } Modified: trunk/daimonin/src/daieditor/gui/map/CMapViewBasic.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/CMapViewBasic.java 2008-06-12 08:49:07 UTC (rev 4178) +++ trunk/daimonin/src/daieditor/gui/map/CMapViewBasic.java 2008-06-12 09:22:43 UTC (rev 4179) @@ -29,6 +29,7 @@ import java.util.HashMap; import java.util.Map; import javax.swing.JViewport; +import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gui.map.LevelRenderer; import net.sf.gridarta.gui.map.MapCursor; import net.sf.gridarta.gui.map.MapCursorEvent; @@ -95,8 +96,9 @@ * @param mapControl the controller of this view * @param initial the initial view position to show; null=show top left * corner + * @param faceObjects the FaceObjects instance to use */ - public CMapViewBasic(@NotNull final CMainControl mainControl, @NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, @Nullable final Point initial) { + public CMapViewBasic(@NotNull final CMainControl mainControl, @NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, @Nullable final Point initial, @NotNull final FaceObjects faceObjects) { super(mapControl); this.mapControl = mapControl; mapModel = mapControl.getMapModel(); @@ -106,7 +108,7 @@ } this.mainControl = mainControl; - renderer = mapControl.isPickmap() ? new PickmapRenderer(mainControl, mapControl, mapGrid) : new MapRenderer(mainControl, mapControl, mapGrid); + renderer = mapControl.isPickmap() ? new PickmapRenderer(mainControl, mapControl, mapGrid, faceObjects) : new MapRenderer(mainControl, mapControl, mapGrid, faceObjects); setViewportView(renderer); getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); Modified: trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java 2008-06-12 08:49:07 UTC (rev 4178) +++ trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java 2008-06-12 09:22:43 UTC (rev 4179) @@ -38,6 +38,7 @@ import javax.swing.ImageIcon; import net.sf.gridarta.Size2D; import net.sf.gridarta.gameobject.face.FaceObject; +import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gui.SystemIcons; import net.sf.gridarta.gui.map.AbstractLevelRenderer; import net.sf.gridarta.gui.map.MapGrid; @@ -82,6 +83,8 @@ private final MapGrid mapGrid; + @NotNull private final FaceObjects faceObjects; + /** Set if the grid should be rendered. */ private boolean gridVisible = false; @@ -137,14 +140,16 @@ * @param mainControl MainControl, used for getting icons and similar * @param mapControl MapControl of the map to render * @param mapGrid Grid to render + * @param faceObjects the FaceObjects instance to use */ - protected DefaultLevelRenderer(final CMainControl mainControl, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final MapGrid mapGrid, final int borderOffsetX, final int borderOffsetY) { + protected DefaultLevelRenderer(final CMainControl mainControl, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final MapGrid mapGrid, final int borderOffsetX, final int borderOffsetY, @NotNull final FaceObjects faceObjects) { borderOffset = new Point(borderOffsetX, borderOffsetY); this.mainControl = mainControl; drawDoubleFaces = mainControl.isDrawDouble(); mapModel = mapControl.getMapModel(); mapSize = mapModel.getMapSize(); this.mapGrid = mapGrid; + this.faceObjects = faceObjects; setToolTipText("dummy"); setFocusable(true); @@ -388,7 +393,7 @@ } img.paintIcon(this, grfx, xstart - xoff, ystart - yoff); if (drawDoubleFaces) { - final FaceObject fo = mainControl.getFaceObjects().get(node.getFaceObjName()); + final FaceObject fo = faceObjects.get(node.getFaceObjName()); if (fo != null && fo.isDouble()) { img.paintIcon(this, grfx, xstart - xoff, ystart - yoff - IGUIConstants.TILE_ISO_YLEN + 1); } Modified: trunk/daimonin/src/daieditor/gui/map/MapRenderer.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapRenderer.java 2008-06-12 08:49:07 UTC (rev 4178) +++ trunk/daimonin/src/daieditor/gui/map/MapRenderer.java 2008-06-12 09:22:43 UTC (rev 4179) @@ -26,6 +26,7 @@ import daieditor.map.MapArchObject; import java.awt.Graphics2D; import javax.swing.ImageIcon; +import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gui.SystemIcons; import net.sf.gridarta.gui.map.MapGrid; import net.sf.gridarta.map.MapControl; @@ -51,9 +52,10 @@ * @param mainControl MainControl, used for getting icons and similar * @param mapControl MapControl of the map to render * @param mapGrid Grid to render + * @param faceObjects the FaceObjects instance to use */ - public MapRenderer(final CMainControl mainControl, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final MapGrid mapGrid) { - super(mainControl, mapControl, mapGrid, IGUIConstants.TILE_ISO_XLEN, 2 * IGUIConstants.TILE_ISO_YLEN); + public MapRenderer(final CMainControl mainControl, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final MapGrid mapGrid, @NotNull final FaceObjects faceObjects) { + super(mainControl, mapControl, mapGrid, IGUIConstants.TILE_ISO_XLEN, 2 * IGUIConstants.TILE_ISO_YLEN, faceObjects); this.mainControl = mainControl; addMouseMotionListener(mainControl.getMainView().getStatusBar()); } Modified: trunk/daimonin/src/daieditor/gui/map/PickmapRenderer.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/PickmapRenderer.java 2008-06-12 08:49:07 UTC (rev 4178) +++ trunk/daimonin/src/daieditor/gui/map/PickmapRenderer.java 2008-06-12 09:22:43 UTC (rev 4179) @@ -26,6 +26,7 @@ import daieditor.map.MapArchObject; import java.awt.Graphics; import net.sf.gridarta.CommonConstants; +import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gui.map.MapGrid; import net.sf.gridarta.map.MapControl; import org.jetbrains.annotations.NotNull; @@ -45,9 +46,10 @@ * @param mainControl MainControl, used for getting icons and similar * @param mapControl MapControl of the map to render * @param mapGrid Grid to render + * @param faceObjects the FaceObjects instance to use */ - public PickmapRenderer(final CMainControl mainControl, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final MapGrid mapGrid) { - super(mainControl, mapControl, mapGrid, 0, IGUIConstants.TILE_ISO_YLEN); + public PickmapRenderer(final CMainControl mainControl, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final MapGrid mapGrid, @NotNull final FaceObjects faceObjects) { + super(mainControl, mapControl, mapGrid, 0, IGUIConstants.TILE_ISO_YLEN, faceObjects); setBackground(CommonConstants.BG_COLOR); } Modified: trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-06-12 08:49:07 UTC (rev 4178) +++ trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-06-12 09:22:43 UTC (rev 4179) @@ -26,6 +26,7 @@ import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gui.map.LevelRenderer; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; @@ -134,4 +135,10 @@ */ @NotNull MapView<G, A, R, V> newMapView(@NotNull MapControl<G, A, R, V> mapControl, @Nullable Point viewPosition, int viewCounter); + /** + * Sets the {@link FaceObjects} instance to use. + * @param faceObjects the FaceObjects instance + */ + void setFaceObjects(final FaceObjects faceObjects); + } // interface GridartaObjectsFactory Modified: trunk/src/app/net/sf/gridarta/MainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/MainControl.java 2008-06-12 08:49:07 UTC (rev 4178) +++ trunk/src/app/net/sf/gridarta/MainControl.java 2008-06-12 09:22:43 UTC (rev 4179) @@ -27,7 +27,6 @@ import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gameobject.anim.AbstractAnimationObjects; -import net.sf.gridarta.gameobject.face.AbstractFaceObjects; import net.sf.gridarta.gui.MainActions; import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.ObjectChooser; @@ -106,12 +105,6 @@ ArchetypeParser<G, A, R> getArchetypeParser(); /** - * Get the FaceObjects for the available Faces. - * @return FaceObjects - */ - AbstractFaceObjects getFaceObjects(); - - /** * Get the AnimationObjects for the available Animations. * @return AnimationObjects */ Modified: trunk/src/app/net/sf/gridarta/gameobject/face/AbstractFaceObjects.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/face/AbstractFaceObjects.java 2008-06-12 08:49:07 UTC (rev 4178) +++ trunk/src/app/net/sf/gridarta/gameobject/face/AbstractFaceObjects.java 2008-06-12 09:22:43 UTC (rev 4179) @@ -119,15 +119,7 @@ } } - /** - * Adds a new face object. - * @param faceName name of face, e.g. <samp>"robe.101"</samp> - * @param originalFilename original filename, e.g. <samp>"arch/objects/misc/robe.101.png"</samp> - * @param actualFilename actual filename, e.g. <samp>"arch/daimonin.0"</samp> - * @param offset offset in the file denoted by <var>actualFilename</var>, e.g. <samp>148676</samp> - * @param size size in the file denoted by <var>actualFilename</var>, e.g. <samp>567</samp>, - * @throws DuplicateFaceException in case the face was not unique - */ + /** {@inheritDoc} */ public void addFaceObject(final String faceName, final String originalFilename, final String actualFilename, final int offset, final int size) throws DuplicateFaceException { final FaceObject faceObject = new DefaultFaceObject(faceName, originalFilename, actualFilename, offset, size); final FaceObject otherFaceObject = get(faceName); Modified: trunk/src/app/net/sf/gridarta/gameobject/face/FaceObjects.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/face/FaceObjects.java 2008-06-12 08:49:07 UTC (rev 4178) +++ trunk/src/app/net/sf/gridarta/gameobject/face/FaceObjects.java 2008-06-12 09:22:43 UTC (rev 4179) @@ -19,6 +19,9 @@ package net.sf.gridarta.gameobject.face; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; import net.sf.gridarta.data.NamedObjects; import net.sf.gridarta.gameobject.Collectable; @@ -28,4 +31,25 @@ */ public interface FaceObjects extends Collectable, NamedObjects<FaceObject> { + /** + * Loads all faces from a png collection file. + * @param faceFile file to load faces from + * @param treeFile file to load tree information from + * @throws java.io.IOException in case of I/O errors + * @throws java.io.FileNotFoundException in case the file couldn't be opened + * @throws DuplicateFaceException in case a face was not unique + */ + void loadFacesCollection(File faceFile, File treeFile) throws IOException, FileNotFoundException, DuplicateFaceException; + + /** + * Adds a new face object. + * @param faceName name of face, e.g. <samp>"robe.101"</samp> + * @param originalFilename original filename, e.g. <samp>"arch/objects/misc/robe.101.png"</samp> + * @param actualFilename actual filename, e.g. <samp>"arch/daimonin.0"</samp> + * @param offset offset in the file denoted by <var>actualFilename</var>, e.g. <samp>148676</samp> + * @param size size in the file denoted by <var>actualFilename</var>, e.g. <samp>567</samp>, + * @throws DuplicateFaceException in case the face was not unique + */ + void addFaceObject(String faceName, String originalFilename, String actualFilename, int offset, int size) throws DuplicateFaceException; + } // interface FaceObjects Modified: trunk/src/app/net/sf/gridarta/gui/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MainActions.java 2008-06-12 08:49:07 UTC (rev 4178) +++ trunk/src/app/net/sf/gridarta/gui/MainActions.java 2008-06-12 09:22:43 UTC (rev 4179) @@ -33,6 +33,7 @@ import net.sf.gridarta.gameobject.Collectable; import net.sf.gridarta.gameobject.Collector; import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gui.map.MapCursorEvent; import net.sf.gridarta.gui.map.MapCursorListener; import net.sf.gridarta.gui.map.MapGrid; @@ -64,6 +65,9 @@ /** The ActionFactory. */ @NotNull private final ActionFactory actionFactory; + /** The FaceObjects instance to use. */ + @NotNull private final FaceObjects faceObjects; + /** Action called for "clear". */ private final Action aClear; @@ -272,10 +276,13 @@ * @param mainControl the MainControl * * @param actionFactory The action factory to create actions. + * + * @param faceObjects the FaceObjects instance to use */ - public MainActions(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final ActionFactory actionFactory) { + public MainActions(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final ActionFactory actionFactory, @NotNull final FaceObjects faceObjects) { this.mainControl = mainControl; this.actionFactory = actionFactory; + this.faceObjects = faceObjects; aClear = actionFactory.createAction(true, "clear", this); aCut = actionFactory.createAction(true, "cut", this); aCopy = actionFactory.createAction(true, "copy", this); @@ -584,7 +591,7 @@ collector = new Collector(collectArches); collectables.add(mainControl.getArchetypeSet()); collectables.add(mainControl.getAnimationObjects()); - collectables.add(mainControl.getFaceObjects()); + collectables.add(faceObjects); collector.setCollectables(collectables); collector.setDestDir(new File(mainControl.getCollectedDirectory())); collector.start(); Modified: trunk/src/app/net/sf/gridarta/gui/MainView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MainView.java 2008-06-12 08:49:07 UTC (rev 4178) +++ trunk/src/app/net/sf/gridarta/gui/MainView.java 2008-06-12 09:22:43 UTC (rev 4179) @@ -48,6 +48,7 @@ import net.sf.gridarta.MapManager; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gameobject.match.GameObjectMatchers; import net.sf.gridarta.gui.map.MapFileActions; import net.sf.gridarta.gui.map.MapView; @@ -232,12 +233,13 @@ * @param mapManager the map manager * @param actionFactory the action factory to use * @param aCloseAll the action "close all map windows" + * @param faceObjects the FaceObjects instance to use */ - public MainView(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final AbstractObjectChooser<G, A, R, V> objectChooser, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final ActionFactory actionFactory, @NotNull final Action aCloseAll) { + public MainView(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final AbstractObjectChooser<G, A, R, V> objectChooser, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final ActionFactory actionFactory, @NotNull final Action aCloseAll, @NotNull final FaceObjects faceObjects) { super(actionFactory.format("mainWindow.title", AbstractMainControl.getBuildNumberAsString())); this.mapManager = mapManager; mapFileAction = new MapFileActions<G, A, R, V>(mainControl, mapManager, null); - statusBar = new StatusBar(mainControl); + statusBar = new StatusBar(mainControl, faceObjects); add(statusBar, BorderLayout.SOUTH); setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { Modified: trunk/src/app/net/sf/gridarta/gui/StatusBar.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/StatusBar.java 2008-06-12 08:49:07 UTC (rev 4178) +++ trunk/src/app/net/sf/gridarta/gui/StatusBar.java 2008-06-12 09:22:43 UTC (rev 4179) @@ -35,7 +35,7 @@ import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManagerListener; import net.sf.gridarta.gameobject.ArchetypeSet; -import net.sf.gridarta.gameobject.face.AbstractFaceObjects; +import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gui.map.LevelRenderer; import net.sf.gridarta.gui.map.MapCursor; import net.sf.gridarta.gui.map.MapCursorEvent; @@ -68,6 +68,9 @@ /** Controller of this statusbar view. */ private final MainControl mainControl; + /** The FaceObjects instance to use. */ + @NotNull private final FaceObjects faceObjects; + /** The label that shows the mouse. */ private final JLabel mouse; @@ -154,8 +157,7 @@ final ArchetypeSet archetypeSet = mainControl.getArchetypeSet(); final int archetypeCount = archetypeSet == null ? 0 : archetypeSet.getArchetypeCount(); - final AbstractFaceObjects faceObjects = mainControl.getFaceObjects(); - final int faceObjectsCount = faceObjects == null ? 0 : faceObjects.size(); + final int faceObjectsCount = faceObjects.size(); final Runtime runtime = Runtime.getRuntime(); final long freeMem = runtime.freeMemory(); @@ -171,9 +173,11 @@ * Constructs a statusbar that has the given main controller object set * as its controller. * @param mainControl The MainControl for statistical data. + * @param faceObjects the FaceObjects instance to use */ - public StatusBar(final MainControl mainControl) { + public StatusBar(final MainControl mainControl, @NotNull final FaceObjects faceObjects) { this.mainControl = mainControl; + this.faceObjects = faceObjects; setLayout(new GridBagLayout()); setBorder(new BevelBorder(BevelBorder.LOWERED)); Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialog.java 2008-06-12 08:49:07 UTC (rev 4178) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialog.java 2008-06-12 09:22:43 UTC (rev 4179) @@ -83,6 +83,7 @@ import net.sf.gridarta.gameobject.ArchAttribType; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gui.map.TilePanel; import net.sf.gridarta.help.Help; import net.sf.gridarta.map.MapArchObject; @@ -124,6 +125,9 @@ @NotNull private final CFTreasureListTree<G, A, R> treasureListTree; + /** The FaceObjects instance to use. */ + @NotNull private final FaceObjects faceObjects; + protected final List<DialogAttrib<?>> dialogAttribs = new ArrayList<DialogAttrib<?>>(); private JComboBox typesel; // selection box for type @@ -177,11 +181,12 @@ * @param mainControl MainControl, for retrieving AnimationObjects, FaceObjects etc.. * @param treasureListTree the treasure list tree */ - protected AbstractGameObjectAttributesDialog(final CFArchTypeList archTypeList, @NotNull final G gameObject, @NotNull final MainControl<G, A, R, ?> mainControl, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { + protected AbstractGameObjectAttributesDialog(final CFArchTypeList archTypeList, @NotNull final G gameObject, @NotNull final MainControl<G, A, R, ?> mainControl, @NotNull final CFTreasureListTree<G, A, R> treasureListTree, @NotNull final FaceObjects faceObjects) { this.archTypeList = archTypeList; this.gameObject = gameObject.getHead(); this.mainControl = mainControl; this.treasureListTree = treasureListTree; + this.faceObjects = faceObjects; archetype = this.gameObject.getArchetype(); type = archTypeList.getType(gameObject); @@ -665,7 +670,7 @@ case ANIMNAME: switch (dType) { case FACENAME: - cLabel = new JButton(new TreeChooseAction(attrib.getNameNew() + ": ", input, mainControl.getFaceObjects())); + cLabel = new JButton(new TreeChooseAction(attrib.getNameNew() + ": ", input, faceObjects)); break; case ANIMNAME: cLabel = new JButton(new TreeChooseAction(attrib.getNameNew() + ": ", input, mainControl.getAnimationObjects())); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |