From: <aki...@us...> - 2008-11-12 23:48:06
|
Revision: 5741 http://gridarta.svn.sourceforge.net/gridarta/?rev=5741&view=rev Author: akirschbaum Date: 2008-11-12 23:48:01 +0000 (Wed, 12 Nov 2008) Log Message: ----------- Replace String with File. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSetLoader.java trunk/daimonin/src/daieditor/gameobject/ArchetypeSetLoader.java trunk/src/app/net/sf/gridarta/gameobject/face/DefaultFaceObjects.java trunk/src/app/net/sf/gridarta/gui/errorview/DefaultErrorView.java trunk/src/app/net/sf/gridarta/gui/errorview/ErrorViewCollector.java Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeSetLoader.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSetLoader.java 2008-11-12 23:40:45 UTC (rev 5740) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeSetLoader.java 2008-11-12 23:48:01 UTC (rev 5741) @@ -184,7 +184,7 @@ try { animationObjects.loadAnimTree(collectedDirectory, IGUIConstants.ANIMTREE_FILE); } catch (final IOException ex) { - errorView.addWarning(new File(collectedDirectory, IGUIConstants.ANIMTREE_FILE).getPath(), "can't load file: "+ ex.getMessage()); + errorView.addWarning(new File(collectedDirectory, IGUIConstants.ANIMTREE_FILE), "can't load file: "+ ex.getMessage()); } loadAnimationsFromCollect(errorView); try { @@ -197,7 +197,7 @@ stream.close(); } } catch (final IOException ex) { - errorView.addError(new File(collectedDirectory, IGUIConstants.ARCH_FILE).getPath(), ex.getMessage()); + errorView.addError(new File(collectedDirectory, IGUIConstants.ARCH_FILE), ex.getMessage()); } faceObjects.loadFacesCollection(errorView, collectedDirectory, IGUIConstants.PNG_FILE, IGUIConstants.FACETREE_FILE); } Modified: trunk/daimonin/src/daieditor/gameobject/ArchetypeSetLoader.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/ArchetypeSetLoader.java 2008-11-12 23:40:45 UTC (rev 5740) +++ trunk/daimonin/src/daieditor/gameobject/ArchetypeSetLoader.java 2008-11-12 23:48:01 UTC (rev 5741) @@ -204,7 +204,7 @@ try { animationObjects.loadAnimTree(collectedDirectory, IGUIConstants.ANIMTREE_FILE); } catch (final IOException ex) { - errorView.addError(new File(collectedDirectory, IGUIConstants.ANIMTREE_FILE).getPath(), "can't load file: " + ex.getMessage()); + errorView.addError(new File(collectedDirectory, IGUIConstants.ANIMTREE_FILE), "can't load file: " + ex.getMessage()); } loadAnimationsFromCollect(errorView); try { @@ -217,7 +217,7 @@ stream.close(); } } catch (final IOException ex) { - errorView.addError(new File(collectedDirectory, IGUIConstants.ARCH_FILE).getPath(), "can't load file: " + ex.getMessage()); + errorView.addError(new File(collectedDirectory, IGUIConstants.ARCH_FILE), "can't load file: " + ex.getMessage()); } faceObjects.loadFacesCollection(errorView, collectedDirectory, IGUIConstants.PNG_FILE, IGUIConstants.FACETREE_FILE); } Modified: trunk/src/app/net/sf/gridarta/gameobject/face/DefaultFaceObjects.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/face/DefaultFaceObjects.java 2008-11-12 23:40:45 UTC (rev 5740) +++ trunk/src/app/net/sf/gridarta/gameobject/face/DefaultFaceObjects.java 2008-11-12 23:48:01 UTC (rev 5741) @@ -265,7 +265,7 @@ try { tmpFaceFile = IOUtils.getFile(collectedDirectory, faceFile); } catch (final IOException ex) { - errorView.addError(new File(collectedDirectory, faceFile).getPath(), "can't load file: " + ex.getMessage()); + errorView.addError(new File(collectedDirectory, faceFile), "can't load file: " + ex.getMessage()); return; } final ErrorViewCollector faceFileErrorViewCollector = new ErrorViewCollector(errorView, tmpFaceFile); Modified: trunk/src/app/net/sf/gridarta/gui/errorview/DefaultErrorView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/errorview/DefaultErrorView.java 2008-11-12 23:40:45 UTC (rev 5740) +++ trunk/src/app/net/sf/gridarta/gui/errorview/DefaultErrorView.java 2008-11-12 23:48:01 UTC (rev 5741) @@ -20,6 +20,7 @@ package net.sf.gridarta.gui.errorview; import java.awt.Component; +import java.io.File; import java.util.IdentityHashMap; import java.util.Map; import javax.swing.JButton; @@ -58,7 +59,7 @@ * Maps category name to child node. */ @NotNull - private final Map<String, ErrorEntry> categories = new IdentityHashMap<String, ErrorEntry>(); + private final Map<File, ErrorEntry> categories = new IdentityHashMap<File, ErrorEntry>(); /** * The parent component for showing the error dialog. @@ -103,7 +104,7 @@ * @param categoryName the error category * @param message the error message */ - public void addError(@NotNull final String categoryName, @NotNull final String message) { + public void addError(@NotNull final File categoryName, @NotNull final String message) { final ErrorEntry category = getCategory(categoryName); final ErrorEntry errorEntry = new ErrorEntry(treeModel, message, false); category.add(errorEntry); @@ -116,7 +117,7 @@ * @param categoryName the warning category * @param message the warning message */ - public void addWarning(@NotNull final String categoryName, @NotNull final String message) { + public void addWarning(@NotNull final File categoryName, @NotNull final String message) { final ErrorEntry category = getCategory(categoryName); final ErrorEntry errorEntry = new ErrorEntry(treeModel, "Warning: " + message, false); category.add(errorEntry); @@ -129,13 +130,13 @@ * @return the node */ @NotNull - private ErrorEntry getCategory(@NotNull final String category) { + private ErrorEntry getCategory(@NotNull final File category) { final ErrorEntry existingErrorEntry = categories.get(category); if (existingErrorEntry != null) { return existingErrorEntry; } - final ErrorEntry errorEntry = new ErrorEntry(treeModel, category, true); + final ErrorEntry errorEntry = new ErrorEntry(treeModel, category.getPath(), true); categories.put(category, errorEntry); treeRoot.add(errorEntry); return errorEntry; Modified: trunk/src/app/net/sf/gridarta/gui/errorview/ErrorViewCollector.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/errorview/ErrorViewCollector.java 2008-11-12 23:40:45 UTC (rev 5740) +++ trunk/src/app/net/sf/gridarta/gui/errorview/ErrorViewCollector.java 2008-11-12 23:48:01 UTC (rev 5741) @@ -39,7 +39,7 @@ * The category name for error messages. */ @NotNull - private final String category; + private final File category; /** * Creates a new instance. @@ -48,7 +48,7 @@ */ public ErrorViewCollector(@NotNull final DefaultErrorView errorView, @NotNull final File category) { this.errorView = errorView; - this.category = category.getPath(); + this.category = category; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-11-13 19:57:10
|
Revision: 5744 http://gridarta.svn.sourceforge.net/gridarta/?rev=5744&view=rev Author: akirschbaum Date: 2008-11-13 19:57:06 +0000 (Thu, 13 Nov 2008) Log Message: ----------- Merge duplicated code. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gameobject/match/GameObjectMatcherParser.java trunk/src/app/net/sf/gridarta/gui/prefs/GUIPrefs.java trunk/src/app/net/sf/gridarta/utils/StringUtils.java Modified: trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java 2008-11-13 19:28:42 UTC (rev 5743) +++ trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java 2008-11-13 19:57:06 UTC (rev 5744) @@ -38,6 +38,7 @@ import net.sf.gridarta.MainControl; import net.sf.gridarta.gui.GUIConstants; import net.sf.gridarta.io.PathManager; +import net.sf.gridarta.utils.StringUtils; import net.sf.japi.swing.ActionFactory; import net.sf.japi.swing.misc.JFileField; import net.sf.japi.swing.prefs.AbstractPrefs; @@ -203,7 +204,7 @@ private Component buildImageSetBox() { final Box lineLayout = Box.createHorizontalBox(); - final String[] imageSetNames = ACTION_FACTORY.getString("availableImageSets").split("\\s+"); + final String[] imageSetNames = StringUtils.patternWhitespace.split(ACTION_FACTORY.getString("availableImageSets"), 0); Arrays.sort(imageSetNames); imageSets = new String[imageSetNames.length + 1]; imageSets[0] = "disabled"; Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-11-13 19:28:42 UTC (rev 5743) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-11-13 19:57:06 UTC (rev 5744) @@ -129,6 +129,7 @@ import net.sf.gridarta.treasurelist.CFTreasureListTree; import net.sf.gridarta.treasurelist.TreasureLocation; import net.sf.gridarta.treasurelist.TreasureTreeNode; +import net.sf.gridarta.utils.StringUtils; import net.sf.japi.io.args.ArgParser; import net.sf.japi.swing.ActionFactory; import net.sf.japi.swing.ActionMethod; @@ -353,7 +354,7 @@ final File libs = new File(System.getProperty("user.dir"), "lib"); final String libsString = ACTION_FACTORY.getString("oldLibs.okayLibs"); assert libsString != null; - final String[] patterns = libsString.split("\\s+"); + final String[] patterns = StringUtils.patternWhitespace.split(libsString, 0); final File[] libFiles = libs.listFiles(Factory.not(new GlobFileFilter(patterns))); if (libFiles != null) { Arrays.sort(libFiles); Modified: trunk/src/app/net/sf/gridarta/gameobject/match/GameObjectMatcherParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/match/GameObjectMatcherParser.java 2008-11-13 19:28:42 UTC (rev 5743) +++ trunk/src/app/net/sf/gridarta/gameobject/match/GameObjectMatcherParser.java 2008-11-13 19:57:06 UTC (rev 5744) @@ -23,10 +23,10 @@ import java.util.Collection; import java.util.List; import java.util.Locale; -import java.util.regex.Pattern; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpressionException; +import net.sf.gridarta.utils.StringUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.w3c.dom.Element; @@ -42,9 +42,6 @@ /** {@link XPath} to use. */ private final XPath xpath; - /** Pattern that matches spaces. */ - private static final Pattern patternSpaces = Pattern.compile("\\s+"); - /** * Creates a <code>GameObjectMatcherParser</code>. * @param xpath the <code>XPath</code> to use @@ -184,7 +181,7 @@ */ private static TypeNrsGameObjectMatcher createTypeNrsArchObjectMatcher(final Element el) throws ParsingException { final String numbers = el.getAttribute("numbers"); - final String[] typeNrs = patternSpaces.split(numbers, 0); + final String[] typeNrs = StringUtils.patternWhitespace.split(numbers, 0); final int[] types = new int[typeNrs.length]; for (int i = 0; i < types.length; i++) { try { Modified: trunk/src/app/net/sf/gridarta/gui/prefs/GUIPrefs.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/prefs/GUIPrefs.java 2008-11-13 19:28:42 UTC (rev 5743) +++ trunk/src/app/net/sf/gridarta/gui/prefs/GUIPrefs.java 2008-11-13 19:57:06 UTC (rev 5744) @@ -33,6 +33,7 @@ import net.sf.gridarta.MainControl; import net.sf.gridarta.gui.GUIConstants; import net.sf.gridarta.gui.MainView; +import net.sf.gridarta.utils.StringUtils; import net.sf.japi.swing.ActionFactory; import net.sf.japi.swing.misc.LocaleListCellRenderer; import net.sf.japi.swing.prefs.AbstractPrefs; @@ -135,7 +136,7 @@ final Box lineLayout = Box.createHorizontalBox(); final String availableLocales = ACTION_FACTORY.getString("availableLocales"); - final String[] locNames = availableLocales != null ? availableLocales.split("\\s+") : new String[0]; + final String[] locNames = availableLocales != null ? StringUtils.patternWhitespace.split(availableLocales, 0) : new String[0]; locales = new Locale[locNames.length + 1]; // locales[0] is intentionally null. It will be displayed as default and always get sorted to the top. for (int i = 0; i < locNames.length; i++) { Modified: trunk/src/app/net/sf/gridarta/utils/StringUtils.java =================================================================== --- trunk/src/app/net/sf/gridarta/utils/StringUtils.java 2008-11-13 19:28:42 UTC (rev 5743) +++ trunk/src/app/net/sf/gridarta/utils/StringUtils.java 2008-11-13 19:57:06 UTC (rev 5744) @@ -42,6 +42,11 @@ */ public static final Pattern patternEndOfLine = Pattern.compile("\\s*\n"); + /** + * The pattern to match whitespace. + */ + public static final Pattern patternWhitespace = Pattern.compile("\\s+"); + /** Private constructor to prevent instantiation. */ private StringUtils() { } @@ -83,7 +88,7 @@ * @todo perhaps we should include here a real white space test */ public static boolean isNonwhitespaceText(final String text) { - return text.replaceAll("\\s+", "").length() > 0; + return patternWhitespace.matcher(text).replaceAll("").length() > 0; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-11-13 20:17:18
|
Revision: 5747 http://gridarta.svn.sourceforge.net/gridarta/?rev=5747&view=rev Author: akirschbaum Date: 2008-11-13 20:17:15 +0000 (Thu, 13 Nov 2008) Log Message: ----------- Add line number to some errors. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSetLoader.java trunk/daimonin/src/daieditor/gameobject/ArchetypeSetLoader.java trunk/src/app/net/sf/gridarta/gameobject/AbstractArchetypeSetLoader.java trunk/src/app/net/sf/gridarta/gui/errorview/DefaultErrorView.java trunk/src/app/net/sf/gridarta/gui/errorview/ErrorViewCollector.java Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeSetLoader.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSetLoader.java 2008-11-13 20:07:17 UTC (rev 5746) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeSetLoader.java 2008-11-13 20:17:15 UTC (rev 5747) @@ -269,7 +269,7 @@ } catch (final IOException ex) { errorViewCollector.addWarning("can't read file: " + ex.getMessage()); } catch (final AnimationParseException ex) { - errorViewCollector.addWarning("parsing error: " + ex.getMessage()); + errorViewCollector.addWarning(ex.getLineNumber(), "parsing error: " + ex.getMessage()); } } Modified: trunk/daimonin/src/daieditor/gameobject/ArchetypeSetLoader.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/ArchetypeSetLoader.java 2008-11-13 20:07:17 UTC (rev 5746) +++ trunk/daimonin/src/daieditor/gameobject/ArchetypeSetLoader.java 2008-11-13 20:17:15 UTC (rev 5747) @@ -408,7 +408,7 @@ } catch (final IOException ex) { errorViewCollector.addWarning(animFile + ": can't read file: " + ex.getMessage()); } catch (final AnimationParseException ex) { - errorViewCollector.addWarning(animFile + ": parsing error: " + ex.getMessage()); + errorViewCollector.addWarning(ex.getLineNumber(), animFile + ": parsing error: " + ex.getMessage()); } } animFiles = null; Modified: trunk/src/app/net/sf/gridarta/gameobject/AbstractArchetypeSetLoader.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/AbstractArchetypeSetLoader.java 2008-11-13 20:07:17 UTC (rev 5746) +++ trunk/src/app/net/sf/gridarta/gameobject/AbstractArchetypeSetLoader.java 2008-11-13 20:17:15 UTC (rev 5747) @@ -94,7 +94,7 @@ } catch (final IOException ex) { errorViewCollector.addError("can't load file: " + ex.getMessage()); } catch (final AnimationParseException ex) { - errorViewCollector.addError("parsing error: " + ex.getMessage()); + errorViewCollector.addError(ex.getLineNumber(), "parsing error: " + ex.getMessage()); } } Modified: trunk/src/app/net/sf/gridarta/gui/errorview/DefaultErrorView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/errorview/DefaultErrorView.java 2008-11-13 20:07:17 UTC (rev 5746) +++ trunk/src/app/net/sf/gridarta/gui/errorview/DefaultErrorView.java 2008-11-13 20:17:15 UTC (rev 5747) @@ -105,21 +105,48 @@ * @param message the error message */ public void addError(@NotNull final File categoryName, @NotNull final String message) { - final ErrorEntry category = getCategory(categoryName); - final ErrorEntry errorEntry = new ErrorEntry(treeModel, message, false); - category.add(errorEntry); - showDialog(category, errorEntry); + addEntry(categoryName, message); errors = true; } /** + * Adds an error message. + * @param categoryName the error category + * @param lineNo the line number of the error message + * @param message the error message + */ + public void addError(@NotNull final File categoryName, final int lineNo, @NotNull final String message) { + addEntry(categoryName, lineNo + ": " + message); + errors = true; + } + + /** * Adds a warning message. * @param categoryName the warning category * @param message the warning message */ public void addWarning(@NotNull final File categoryName, @NotNull final String message) { + addEntry(categoryName, "Warning: " + message); + } + + /** + * Adds a warning message. + * @param categoryName the warning category + * @param lineNo the line number of the error message + * @param message the warning message + */ + public void addWarning(@NotNull final File categoryName, final int lineNo, @NotNull final String message) { + addEntry(categoryName, "Warning: line " + lineNo + ": " + message); + } + + /** + * Adds a text message. + * @param categoryName the category to add to + * @param message the message to add + */ + private void addEntry(final File categoryName, final String message) { final ErrorEntry category = getCategory(categoryName); - final ErrorEntry errorEntry = new ErrorEntry(treeModel, "Warning: " + message, false); + final ErrorEntry errorEntry = new ErrorEntry(treeModel, message, false); category.add(errorEntry); showDialog(category, errorEntry); } Modified: trunk/src/app/net/sf/gridarta/gui/errorview/ErrorViewCollector.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/errorview/ErrorViewCollector.java 2008-11-13 20:07:17 UTC (rev 5746) +++ trunk/src/app/net/sf/gridarta/gui/errorview/ErrorViewCollector.java 2008-11-13 20:17:15 UTC (rev 5747) @@ -60,6 +60,15 @@ } /** + * Adds a warning message. + * @param lineNo the line number + * @param message the message + */ + public void addWarning(final int lineNo, @NotNull final String message) { + errorView.addWarning(category, lineNo, message); + } + + /** * Adds an error message. * @param message the message */ @@ -67,4 +76,13 @@ errorView.addError(category, message); } + /** + * Adds an error message. + * @param lineNo the line number + * @param message the message + */ + public void addError(final int lineNo, @NotNull final String message) { + errorView.addError(category, lineNo, message); + } + } // class ErrorViewCollector This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-11-13 20:34:12
|
Revision: 5748 http://gridarta.svn.sourceforge.net/gridarta/?rev=5748&view=rev Author: akirschbaum Date: 2008-11-13 20:34:04 +0000 (Thu, 13 Nov 2008) Log Message: ----------- Partially implement #1627422 (Check box option to avoid startup warnings): Use it for plugin script related errors. Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/src/app/net/sf/gridarta/AbstractMainControl.java trunk/src/app/net/sf/gridarta/gui/script/ScriptView.java trunk/src/app/net/sf/gridarta/script/ScriptController.java Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2008-11-13 20:17:15 UTC (rev 5747) +++ trunk/crossfire/ChangeLog 2008-11-13 20:34:04 UTC (rev 5748) @@ -1,3 +1,8 @@ +2008-11-13 Andreas Kirschbaum + + * Partially implement #1627422 (Check box option to avoid startup + warnings): Use it for plugin script related errors. + 2008-11-12 Andreas Kirschbaum * Partially implement #1627422 (Check box option to avoid startup Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2008-11-13 20:17:15 UTC (rev 5747) +++ trunk/daimonin/ChangeLog 2008-11-13 20:34:04 UTC (rev 5748) @@ -1,3 +1,8 @@ +2008-11-13 Andreas Kirschbaum + + * Partially implement #1627422 (Check box option to avoid startup + warnings): Use it for plugin script related errors. + 2008-11-12 Andreas Kirschbaum * Partially implement #1627422 (Check box option to avoid startup Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-11-13 20:17:15 UTC (rev 5747) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-11-13 20:34:04 UTC (rev 5748) @@ -509,7 +509,7 @@ if (menuAnalyze != null) { filterControl.createMenuEntries(menuAnalyze); } - scriptControl.loadScripts(new File(globalSettings.getMapDir(), scriptsDir)); + scriptControl.loadScripts(errorView, new File(globalSettings.getMapDir(), scriptsDir)); archetypeChooserControl.getArchetypeChooserView().finishBuildProcess(); autojoinLists.loadList(archetypeSet, globalSettings.getConfigurationDirectory()); if (archetypeSet.getLoadStatus() == ArchetypeSet.LoadStatus.EMPTY) { Modified: trunk/src/app/net/sf/gridarta/gui/script/ScriptView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/ScriptView.java 2008-11-13 20:17:15 UTC (rev 5747) +++ trunk/src/app/net/sf/gridarta/gui/script/ScriptView.java 2008-11-13 20:34:04 UTC (rev 5748) @@ -26,6 +26,7 @@ import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; +import java.io.IOException; import javax.swing.Action; import javax.swing.JComponent; import javax.swing.JDialog; @@ -53,6 +54,7 @@ import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import org.jdom.JDOMException; /** * View for Scripts. @@ -181,7 +183,13 @@ final JFileChooser choose = new JFileChooser(); choose.setDialogTitle("import script"); if (choose.showOpenDialog(parent) == JFileChooser.APPROVE_OPTION) { - scriptController.importXML(choose.getSelectedFile(), true); + try { + scriptController.importXML(choose.getSelectedFile(), true); + } catch (final IOException ex) { + log.warn("can't load script: " + ex.getMessage()); + } catch (final JDOMException ex) { + log.warn("can't parse script: " + ex.getMessage()); + } } } Modified: trunk/src/app/net/sf/gridarta/script/ScriptController.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/ScriptController.java 2008-11-13 20:17:15 UTC (rev 5747) +++ trunk/src/app/net/sf/gridarta/script/ScriptController.java 2008-11-13 20:34:04 UTC (rev 5748) @@ -39,6 +39,7 @@ import net.sf.gridarta.filter.FilterControl; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gui.errorview.DefaultErrorView; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.script.ScriptManagerFactory; import net.sf.gridarta.gui.script.ScriptView; @@ -108,14 +109,15 @@ /** * Load all files as scripts from the given directory. + * @param errorView the error view for reporting errors * @param scriptsDir The directory to load. */ - public void loadScripts(@NotNull final File scriptsDir) { + public void loadScripts(@NotNull final DefaultErrorView errorView, @NotNull final File scriptsDir) { this.scriptsDir = scriptsDir; final File[] files = scriptsDir.listFiles(); if (files == null) { - log.warn("Scripts directory not readable: " + scriptsDir); + errorView.addWarning(scriptsDir, "directory not readable"); return; } @@ -123,7 +125,13 @@ for (final File scriptFile : files) { final String name = scriptFile.getName(); if (!name.startsWith(".") && !name.endsWith("~") && scriptFile.isFile()) { - importXML(scriptFile, false); + try { + importXML(scriptFile, false); + } catch (final IOException ex) { + errorView.addWarning(scriptFile, "can't load script: " + ex.getMessage()); + } catch (final JDOMException ex) { + errorView.addWarning(scriptFile, "can't parse script: " + ex.getMessage()); + } } } if (log.isInfoEnabled()) { @@ -131,48 +139,36 @@ } } - public void importXML(@NotNull final File script, final boolean override) { + public void importXML(@NotNull final File script, final boolean override) throws IOException, JDOMException { final SAXBuilder builder = new SAXBuilder(false); /*non validating*/ - try { - final Document d = builder.build(script); - importXML(d, script, override); - } catch (final JDOMException ex) { - log.warn(script + ": " + ex.getMessage()); - } catch (final IOException ex) { - log.warn(script + ": " + ex.getMessage()); - } + final Document d = builder.build(script); + importXML(d, script, override); } - private void importXML(final Document doc, @Nullable final File file, final boolean override) { - try { - if (!doc.hasRootElement()) { - log.info("No script found."); - return; - } + private void importXML(final Document doc, @Nullable final File file, final boolean override) throws IOException { + if (!doc.hasRootElement()) { + throw new IOException("script file is empty"); + } - final Element elt = doc.getRootElement(); - if ((!elt.getName().equalsIgnoreCase("script"))) { - log.warn("Problem reading xml scripts, need a root element named \"script\""); - return; - } + final Element elt = doc.getRootElement(); + if ((!elt.getName().equalsIgnoreCase("script"))) { + throw new IOException("missing root element named \"script\""); + } - final Script script = ScriptModelParser.fromXML(elt); - script.setFile(file); - log.debug("script: " + script.getName()); - if (override || scriptModel.getScript(script.getName()) == null) { - if (log.isDebugEnabled()) { - log.debug("storing with code " + script.getCode()); - } + final Script script = ScriptModelParser.fromXML(elt); + script.setFile(file); + log.debug("script: " + script.getName()); - unRegister(script.getName()); - scriptModel.addScript(script); - register(script.getName()); - } else { - log.warn(file + ": ignoring duplicate script '" + script.getName() + "'"); - } - } catch (final Exception e) { - e.printStackTrace(); + if (!override && scriptModel.getScript(script.getName()) != null) { + throw new IOException("duplicate script '" + script.getName() + "'"); } + + if (log.isDebugEnabled()) { + log.debug("storing with code " + script.getCode()); + } + unRegister(script.getName()); + scriptModel.addScript(script); + register(script.getName()); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-11-13 20:40:36
|
Revision: 5749 http://gridarta.svn.sourceforge.net/gridarta/?rev=5749&view=rev Author: akirschbaum Date: 2008-11-13 20:40:33 +0000 (Thu, 13 Nov 2008) Log Message: ----------- Partially implement #1627422 (Check box option to avoid startup warnings): Use it for autojoin related errors. Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/src/app/net/sf/gridarta/AbstractMainControl.java trunk/src/app/net/sf/gridarta/autojoin/AutojoinLists.java Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2008-11-13 20:34:04 UTC (rev 5748) +++ trunk/crossfire/ChangeLog 2008-11-13 20:40:33 UTC (rev 5749) @@ -1,7 +1,7 @@ 2008-11-13 Andreas Kirschbaum * Partially implement #1627422 (Check box option to avoid startup - warnings): Use it for plugin script related errors. + warnings): Use it for plugin script and autojoin related errors. 2008-11-12 Andreas Kirschbaum Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2008-11-13 20:34:04 UTC (rev 5748) +++ trunk/daimonin/ChangeLog 2008-11-13 20:40:33 UTC (rev 5749) @@ -1,7 +1,7 @@ 2008-11-13 Andreas Kirschbaum * Partially implement #1627422 (Check box option to avoid startup - warnings): Use it for plugin script related errors. + warnings): Use it for plugin script and autojoin related errors. 2008-11-12 Andreas Kirschbaum Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-11-13 20:34:04 UTC (rev 5748) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-11-13 20:40:33 UTC (rev 5749) @@ -511,7 +511,7 @@ } scriptControl.loadScripts(errorView, new File(globalSettings.getMapDir(), scriptsDir)); archetypeChooserControl.getArchetypeChooserView().finishBuildProcess(); - autojoinLists.loadList(archetypeSet, globalSettings.getConfigurationDirectory()); + autojoinLists.loadList(errorView, archetypeSet, globalSettings.getConfigurationDirectory()); if (archetypeSet.getLoadStatus() == ArchetypeSet.LoadStatus.EMPTY) { ACTION_FACTORY.showMessageDialog(mainView, "loadArchesNoArchfiles"); } else { Modified: trunk/src/app/net/sf/gridarta/autojoin/AutojoinLists.java =================================================================== --- trunk/src/app/net/sf/gridarta/autojoin/AutojoinLists.java 2008-11-13 20:34:04 UTC (rev 5748) +++ trunk/src/app/net/sf/gridarta/autojoin/AutojoinLists.java 2008-11-13 20:40:33 UTC (rev 5749) @@ -28,6 +28,7 @@ import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gui.errorview.DefaultErrorView; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.utils.IOUtils; import org.apache.log4j.Logger; @@ -71,15 +72,16 @@ /** * Load all the autojoin lists from the datafile. The links from the default * arches to their appropriate AutojoinLists also get set here. + * @param errorView the error view for reporting errors * @param archstack the stack of default arches * @param baseDir the configuration directory to load autojoin info from. */ - public void loadList(final ArchetypeSet<G, A, R> archstack, @NotNull final File baseDir) { + public void loadList(@NotNull final DefaultErrorView errorView, final ArchetypeSet<G, A, R> archstack, @NotNull final File baseDir) { + final File file = new File(baseDir, FILENAME); try { // open the resource file final BufferedReader stream = IOUtils.createReader(baseDir, FILENAME); try { - // read the file boolean sectionFlag = false; // true while section (start ... end) read final String[] nbuf = new String[16]; // buffer for archetype names of 16 arches @@ -103,9 +105,9 @@ new AutojoinList<G, A, R>(archstack, nbuf, this); } else if (count > 16) { - log.warn("In file " + FILENAME + ": List with more than 16 valid entries!"); + errorView.addError(file, "list with more than 16 valid entries"); } else if (archstack.getArchetypeCount() >= 1) { - log.warn("In file " + FILENAME + ": List with less than 16 valid entries!"); + errorView.addError(file, "list with less than 16 valid entries"); } sectionFlag = false; } else if (count < 16) { @@ -118,12 +120,12 @@ if (!archetype.isMulti()) { count++; // no multipart, this one's okay } else { - log.warn("In file " + FILENAME + ": Arch '" + line + "' is a multipart."); + errorView.addError(file, "archetype '" + line + "' is a multipart"); } } else { // (If no arches exist at all, errormessages are suppressed here) if (archstack.getArchetypeCount() >= 1) { - log.warn("In file " + FILENAME + ": Arch '" + line + "' not found."); + errorView.addError(file, "archetype '" + line + "' not found"); } } } else { @@ -135,12 +137,10 @@ } finally { stream.close(); } - } catch (final FileNotFoundException e) { - if (log.isInfoEnabled()) { - log.info("Autojoin definitions file '" + FILENAME + "' not found."); - } - } catch (final IOException e) { - log.warn("Read error in file '" + FILENAME + "'."); + } catch (final FileNotFoundException ex) { + errorView.addWarning(file, "can't open file: " + ex.getMessage()); + } catch (final IOException ex) { + errorView.addWarning(file, "can't load file: " + ex.getMessage()); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-11-13 20:56:53
|
Revision: 5751 http://gridarta.svn.sourceforge.net/gridarta/?rev=5751&view=rev Author: akirschbaum Date: 2008-11-13 20:56:50 +0000 (Thu, 13 Nov 2008) Log Message: ----------- Partially implement #1627422 (Check box option to avoid startup warnings): Use it for pickmap related errors. Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/src/app/net/sf/gridarta/AbstractMainControl.java trunk/src/app/net/sf/gridarta/mapfiles/Loader.java Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2008-11-13 20:48:34 UTC (rev 5750) +++ trunk/crossfire/ChangeLog 2008-11-13 20:56:50 UTC (rev 5751) @@ -1,7 +1,8 @@ 2008-11-13 Andreas Kirschbaum * Partially implement #1627422 (Check box option to avoid startup - warnings): Use it for plugin script and autojoin related errors. + warnings): Use it for plugin script, autojoin, and pickmap related + errors. 2008-11-12 Andreas Kirschbaum Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2008-11-13 20:48:34 UTC (rev 5750) +++ trunk/daimonin/ChangeLog 2008-11-13 20:56:50 UTC (rev 5751) @@ -1,7 +1,8 @@ 2008-11-13 Andreas Kirschbaum * Partially implement #1627422 (Check box option to avoid startup - warnings): Use it for plugin script and autojoin related errors. + warnings): Use it for plugin script, autojoin, and pickmap related + errors. 2008-11-12 Andreas Kirschbaum Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-11-13 20:48:34 UTC (rev 5750) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-11-13 20:56:50 UTC (rev 5751) @@ -516,7 +516,7 @@ if (archetypeSet.getLoadStatus() == ArchetypeSet.LoadStatus.EMPTY) { ACTION_FACTORY.showMessageDialog(mainView, "loadArchesNoArchfiles"); } else { - new Loader<G, A, R, V>(mapFolderTree, mapControlFactory, mainView).load(); + new Loader<G, A, R, V>(errorView, mapFolderTree, mapControlFactory, mainView).load(); if (!pickmapChooserControl.isEmpty()) { objectChooser.movePickmapChooserToFront(); } Modified: trunk/src/app/net/sf/gridarta/mapfiles/Loader.java =================================================================== --- trunk/src/app/net/sf/gridarta/mapfiles/Loader.java 2008-11-13 20:48:34 UTC (rev 5750) +++ trunk/src/app/net/sf/gridarta/mapfiles/Loader.java 2008-11-13 20:56:50 UTC (rev 5751) @@ -24,6 +24,8 @@ import java.util.Arrays; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gui.errorview.DefaultErrorView; +import net.sf.gridarta.gui.errorview.ErrorViewCollector; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapControlFactory; @@ -40,6 +42,12 @@ /** The Logger for printing log messages. */ private static final Logger log = Logger.getLogger(Loader.class); + /** + * The {@link DefaultErrorView} for reporting errors. + */ + @NotNull + private final DefaultErrorView errorView; + /** The model to add the loaded pickmaps to. */ @NotNull private final MapFolderTree<G, A, R, V> mapFolderTree; @@ -59,12 +67,14 @@ /** * Creates a new instance. + * @param errorView the error view for reporting error messages * @param mapFolderTree the model to add the loaded pickmaps to * @param mapControlFactory the map control instance to use * @param parent the parent component for error messages * instance to use for loading pickmap files */ - public Loader(@NotNull final MapFolderTree<G, A, R, V> mapFolderTree, @NotNull final MapControlFactory<G, A, R, V> mapControlFactory, @NotNull final Component parent) { + public Loader(@NotNull final DefaultErrorView errorView, @NotNull final MapFolderTree<G, A, R, V> mapFolderTree, @NotNull final MapControlFactory<G, A, R, V> mapControlFactory, @NotNull final Component parent) { + this.errorView = errorView; this.mapFolderTree = mapFolderTree; this.mapControlFactory = mapControlFactory; this.parent = parent; @@ -89,9 +99,10 @@ private MapFolder<G, A, R, V> load(@Nullable final MapFolder<G, A, R, V> parent, @NotNull final String folderName) { final File baseDir = mapFolderTree.getBaseDir(); final File dir = parent == null ? baseDir : new File(parent.getDir(), folderName); + final ErrorViewCollector errorViewCollector = new ErrorViewCollector(errorView, dir); final File[] files = dir.listFiles(); if (files == null) { - log.warn("cannot read directory " + dir); + errorViewCollector.addWarning("cannot read directory"); return null; } @@ -99,13 +110,13 @@ try { mapFolder = new MapFolder<G, A, R, V>(parent, folderName, baseDir); } catch (final InvalidNameException ex) { - log.warn("ignoring pickmap folder with invalid name: " + folderName); + errorViewCollector.addWarning("ignoring pickmap folder with invalid name: " + folderName); return null; } try { mapFolderTree.addMapFolder(mapFolder); } catch (final DuplicateMapFolderException ex) { - log.warn("cannot add folder: " + ex.getMessage()); + errorViewCollector.addWarning("cannot add folder: " + ex.getMessage()); return null; } @@ -116,7 +127,7 @@ try { mapFolder.addPickmap(file.getName(), mapControlFactory, this.parent); } catch (final InvalidNameException ex) { - log.warn("ignoring pickmap with invalid name: " + file); + errorViewCollector.addWarning("ignoring pickmap with invalid name: " + file); } } else if (file.isDirectory()) { if (!file.getName().startsWith(".")) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-11-13 21:23:36
|
Revision: 5753 http://gridarta.svn.sourceforge.net/gridarta/?rev=5753&view=rev Author: akirschbaum Date: 2008-11-13 21:23:32 +0000 (Thu, 13 Nov 2008) Log Message: ----------- Remove dialog window for internal error while inserting game objects into maps. Modified Paths: -------------- trunk/crossfire/src/cfeditor/map/DefaultMapControlFactory.java trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java trunk/src/app/net/sf/gridarta/AbstractMainControl.java trunk/src/app/net/sf/gridarta/CopyBuffer.java trunk/src/app/net/sf/gridarta/DefaultMapManager.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java trunk/src/app/net/sf/gridarta/map/AbstractMapControlFactory.java trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java trunk/src/app/net/sf/gridarta/map/DefaultMapModel.java trunk/src/app/net/sf/gridarta/map/MapControlFactory.java trunk/src/app/net/sf/gridarta/mapfiles/Loader.java trunk/src/app/net/sf/gridarta/mapfiles/MapFile.java trunk/src/app/net/sf/gridarta/mapfiles/MapFolder.java trunk/src/app/net/sf/gridarta/messages.properties trunk/src/app/net/sf/gridarta/messages_de.properties trunk/src/app/net/sf/gridarta/messages_fr.properties trunk/src/app/net/sf/gridarta/messages_sv.properties trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/map/DefaultMapControlFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapControlFactory.java 2008-11-13 21:05:11 UTC (rev 5752) +++ trunk/crossfire/src/cfeditor/map/DefaultMapControlFactory.java 2008-11-13 21:23:32 UTC (rev 5753) @@ -22,7 +22,6 @@ import cfeditor.gameobject.Archetype; import cfeditor.gameobject.GameObject; import cfeditor.gui.map.CMapViewBasic; -import java.awt.Component; import java.io.File; import java.util.List; import net.sf.gridarta.EditTypes; @@ -151,8 +150,8 @@ /** {@inheritDoc} */ @NotNull - public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@NotNull final Component parent, @Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final String mapName, @Nullable final File file) { - final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapViewFactory, mapArchObjectParserFactory, gameObjectParser, rendererFactory, parent, autojoinLists, mapImageCache, objects, mapArchObject, false, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions, editTypes.getEditType()); + public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final String mapName, @Nullable final File file) { + final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapViewFactory, mapArchObjectParserFactory, gameObjectParser, rendererFactory, autojoinLists, mapImageCache, objects, mapArchObject, false, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions, editTypes.getEditType()); mapControl.setMapFile(file); mapControl.setMapFileName(mapName); return mapControl; @@ -160,11 +159,11 @@ /** {@inheritDoc} */ @NotNull - public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@NotNull final Component parent, @NotNull final Size2D mapSize, @NotNull final String pickmapName, @NotNull final File file) { + public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@NotNull final Size2D mapSize, @NotNull final String pickmapName, @NotNull final File file) { final MapArchObject mapArchObject = mapArchObjectFactory.newMapArchObject(true); mapArchObject.setMapSize(mapSize); mapArchObject.setMapName(pickmapName); - final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapViewFactory, mapArchObjectParserFactory, gameObjectParser, rendererFactory, parent, autojoinLists, mapImageCache, null, mapArchObject, true, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions, editTypes.getEditType()); + final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapViewFactory, mapArchObjectParserFactory, gameObjectParser, rendererFactory, autojoinLists, mapImageCache, null, mapArchObject, true, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions, editTypes.getEditType()); mapControl.setMapFile(file); mapControl.setMapFileName(file.getPath()); mapControl.resetModified(); @@ -173,8 +172,8 @@ /** {@inheritDoc} */ @NotNull - public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@NotNull final Component parent, @Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final File file) { - final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapViewFactory, mapArchObjectParserFactory, gameObjectParser, rendererFactory, parent, autojoinLists, mapImageCache, objects, mapArchObject, true, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions, editTypes.getEditType()); + public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final File file) { + final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapViewFactory, mapArchObjectParserFactory, gameObjectParser, rendererFactory, autojoinLists, mapImageCache, objects, mapArchObject, true, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions, editTypes.getEditType()); mapControl.setMapFile(file); mapControl.setMapFileName(file.getPath()); mapControl.resetModified(); Modified: trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java =================================================================== --- trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java 2008-11-13 21:05:11 UTC (rev 5752) +++ trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java 2008-11-13 21:23:32 UTC (rev 5753) @@ -22,7 +22,6 @@ import daieditor.gameobject.Archetype; import daieditor.gameobject.GameObject; import daieditor.gui.map.CMapViewBasic; -import java.awt.Component; import java.io.File; import java.util.List; import net.sf.gridarta.EditTypes; @@ -151,8 +150,8 @@ /** {@inheritDoc} */ @NotNull - public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@NotNull final Component parent, @Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final String mapName, @Nullable final File file) { - final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapViewFactory, mapArchObjectParserFactory, gameObjectParser, rendererFactory, parent, autojoinLists, mapImageCache, objects, mapArchObject, false, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions, editTypes.getEditType()); + public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final String mapName, @Nullable final File file) { + final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapViewFactory, mapArchObjectParserFactory, gameObjectParser, rendererFactory, autojoinLists, mapImageCache, objects, mapArchObject, false, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions, editTypes.getEditType()); mapControl.setMapFile(file); mapControl.setMapFileName(mapName); return mapControl; @@ -160,12 +159,12 @@ /** {@inheritDoc} */ @NotNull - public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@NotNull final Component parent, @NotNull final Size2D mapSize, @NotNull final String pickmapName, @NotNull final File file) { + public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@NotNull final Size2D mapSize, @NotNull final String pickmapName, @NotNull final File file) { final MapArchObject mapArchObject = mapArchObjectFactory.newMapArchObject(true); mapArchObject.setMapSize(mapSize); mapArchObject.setMapName(pickmapName); mapArchObject.setDifficulty(1); - final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapViewFactory, mapArchObjectParserFactory, gameObjectParser, rendererFactory, parent, autojoinLists, mapImageCache, null, mapArchObject, true, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions, editTypes.getEditType()); + final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapViewFactory, mapArchObjectParserFactory, gameObjectParser, rendererFactory, autojoinLists, mapImageCache, null, mapArchObject, true, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions, editTypes.getEditType()); mapControl.setMapFile(file); mapControl.setMapFileName(file.getPath()); mapControl.resetModified(); @@ -174,9 +173,9 @@ /** {@inheritDoc} */ @NotNull - public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@NotNull final Component parent, @Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final File file) { + public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final File file) { mapArchObject.setDifficulty(1); - final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapViewFactory, mapArchObjectParserFactory, gameObjectParser, rendererFactory, parent, autojoinLists, mapImageCache, objects, mapArchObject, true, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions, editTypes.getEditType()); + final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapViewFactory, mapArchObjectParserFactory, gameObjectParser, rendererFactory, autojoinLists, mapImageCache, objects, mapArchObject, true, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions, editTypes.getEditType()); mapControl.setMapFile(file); mapControl.setMapFileName(file.getPath()); mapControl.resetModified(); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-11-13 21:05:11 UTC (rev 5752) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-11-13 21:23:32 UTC (rev 5753) @@ -480,7 +480,7 @@ final MapViewFactory<G, A, R, V> mapViewFactory = newMapViewFactory(mapViewSettings, faceObjects, selectedSquareView, this, mainView, editTypes, mapImageCache, toolPalette, filterControl); rendererFactory = newRendererFactory(); mapControlFactory.init(mapViewFactory, gameObjectParser, rendererFactory, mapActions, archetypeChooserModel, mapImageCache, autojoinLists, exitMatcher); - copyBuffer.init(mainView); + copyBuffer.init(); final ScriptedEventFactory<G> scriptedEventFactory = newScriptedEventFactory(scriptArchUtils); final ScriptArchEditor<G> scriptArchEditor = newScriptArchEditor(scriptedEventFactory, scriptExtension, scriptName, scriptArchUtils.createEventTypeBox(), scriptFileFilter, globalSettings, mapManager); scriptArchEditor.initEventTypeBoxes(scriptArchUtils); @@ -516,7 +516,7 @@ if (archetypeSet.getLoadStatus() == ArchetypeSet.LoadStatus.EMPTY) { ACTION_FACTORY.showMessageDialog(mainView, "loadArchesNoArchfiles"); } else { - new Loader<G, A, R, V>(errorView, mapFolderTree, mapControlFactory, mainView).load(); + new Loader<G, A, R, V>(errorView, mapFolderTree, mapControlFactory).load(); if (!pickmapChooserControl.isEmpty()) { objectChooser.movePickmapChooserToFront(); } Modified: trunk/src/app/net/sf/gridarta/CopyBuffer.java =================================================================== --- trunk/src/app/net/sf/gridarta/CopyBuffer.java 2008-11-13 21:05:11 UTC (rev 5752) +++ trunk/src/app/net/sf/gridarta/CopyBuffer.java 2008-11-13 21:23:32 UTC (rev 5753) @@ -19,7 +19,6 @@ package net.sf.gridarta; -import java.awt.Component; import java.awt.Point; import java.awt.Rectangle; import java.util.HashSet; @@ -96,12 +95,11 @@ /** * Must be called after object creation. - * @param parent the parent component for dialog windows */ @Deprecated - public void init(@NotNull final Component parent) { + public void init() { assert copyMapCtrl == null; - copyMapCtrl = mapControlFactory.newMapControl(parent, null, mapArch, "cb", null); + copyMapCtrl = mapControlFactory.newMapControl(null, mapArch, "cb", null); } /** Modified: trunk/src/app/net/sf/gridarta/DefaultMapManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/DefaultMapManager.java 2008-11-13 21:05:11 UTC (rev 5752) +++ trunk/src/app/net/sf/gridarta/DefaultMapManager.java 2008-11-13 21:23:32 UTC (rev 5753) @@ -151,7 +151,7 @@ } private MapControl<G, A, R, V> newMap(@Nullable final List<G> objects, @NotNull final A mapArchObject, @Nullable final File file, @NotNull final String mapFileName) { - final MapControl<G, A, R, V> mapControl = mapControlFactory.newMapControl(parent, objects, mapArchObject, mapFileName, file); + final MapControl<G, A, R, V> mapControl = mapControlFactory.newMapControl(objects, mapArchObject, mapFileName, file); levels.add(mapControl); fireMapCreatedEvent(mapControl); setCurrentLevel(mapControl); @@ -293,7 +293,7 @@ return null; } - return mapControlFactory.newMapControl(parent, decoder.getGameObjects(), decoder.getMapArchObject(), file.getPath(), file); + return mapControlFactory.newMapControl(decoder.getGameObjects(), decoder.getMapArchObject(), file.getPath(), file); } /** Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java 2008-11-13 21:05:11 UTC (rev 5752) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java 2008-11-13 21:23:32 UTC (rev 5753) @@ -267,12 +267,12 @@ } } - final MapControl<G, A, R, V> mapControl = mapControlFactory.newPickmapControl(parent, mapSize, pickmapName, file); + final MapControl<G, A, R, V> mapControl = mapControlFactory.newPickmapControl(mapSize, pickmapName, file); mapControl.save(); final MapFile<G, A, R, V> mapFile; try { - mapFile = activeMapFolder.addPickmap(pickmapName, mapControlFactory, parent); + mapFile = activeMapFolder.addPickmap(pickmapName, mapControlFactory); } catch (final InvalidNameException ex) { throw new AssertionError(); // the name has been checked before } Modified: trunk/src/app/net/sf/gridarta/map/AbstractMapControlFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/AbstractMapControlFactory.java 2008-11-13 21:05:11 UTC (rev 5752) +++ trunk/src/app/net/sf/gridarta/map/AbstractMapControlFactory.java 2008-11-13 21:23:32 UTC (rev 5753) @@ -19,7 +19,6 @@ package net.sf.gridarta.map; -import java.awt.Component; import java.io.File; import java.io.IOException; import net.sf.gridarta.gameobject.Archetype; @@ -51,7 +50,7 @@ /** {@inheritDoc} */ @NotNull - public MapControl<G, A, R, V> newPickmapControl(@NotNull final Component parent, @NotNull final File file) throws IOException { + public MapControl<G, A, R, V> newPickmapControl(@NotNull final File file) throws IOException { final MapReader<G, A> decoder = mapReaderFactory.newMapReader(file); try { decoder.decodeMapFile(false); @@ -59,7 +58,7 @@ decoder.close(); } - return newPickmapControl(parent, decoder.getGameObjects(), decoder.getMapArchObject(), file); + return newPickmapControl(decoder.getGameObjects(), decoder.getMapArchObject(), file); } } // class AbstractMapControlFactory Modified: trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java 2008-11-13 21:05:11 UTC (rev 5752) +++ trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java 2008-11-13 21:23:32 UTC (rev 5753) @@ -19,7 +19,6 @@ package net.sf.gridarta.map; -import java.awt.Component; import java.awt.Point; import java.io.File; import java.io.IOException; @@ -158,7 +157,6 @@ * instance * @param gameObjectParser the game object parser instance * @param rendererFactory the renderer factory - * @param parent the parent component for error messages * @param autojoinLists the autojoin lists instance to use * @param mapImageCache the map image cache instance * @param objects the game objects to insert; my be <code>null</code> @@ -169,7 +167,7 @@ * @param mapActions the map actions to use * @param activeEditType the active edit types */ - public DefaultMapControl(@NotNull final MapViewFactory<G, A, R, V> mapViewFactory, @NotNull final MapArchObjectParserFactory<A> mapArchObjectParserFactory, @NotNull final GameObjectParser<G, A, R> gameObjectParser, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final Component parent, @NotNull final AutojoinLists<G, A, R> autojoinLists, @NotNull final MapImageCache<G, A, R, V> mapImageCache, @Nullable final List<G> objects, @NotNull final A mapArchObject, final boolean isPickmap, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher, @NotNull final ArchetypeChooserModel<G, A, R, V> archetypeChooserModel, @NotNull final MapActions mapActions, final int activeEditType) { + public DefaultMapControl(@NotNull final MapViewFactory<G, A, R, V> mapViewFactory, @NotNull final MapArchObjectParserFactory<A> mapArchObjectParserFactory, @NotNull final GameObjectParser<G, A, R> gameObjectParser, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final AutojoinLists<G, A, R> autojoinLists, @NotNull final MapImageCache<G, A, R, V> mapImageCache, @Nullable final List<G> objects, @NotNull final A mapArchObject, final boolean isPickmap, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher, @NotNull final ArchetypeChooserModel<G, A, R, V> archetypeChooserModel, @NotNull final MapActions mapActions, final int activeEditType) { this.mapViewFactory = mapViewFactory; this.mapArchObjectParserFactory = mapArchObjectParserFactory; this.gameObjectParser = gameObjectParser; @@ -177,7 +175,7 @@ this.mapImageCache = mapImageCache; this.isPickmap = isPickmap; // we create model (= data) - mapModel = new DefaultMapModel<G, A, R>(parent, autojoinLists, this, objects, mapArchObject, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions, activeEditType); + mapModel = new DefaultMapModel<G, A, R>(autojoinLists, this, objects, mapArchObject, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions, activeEditType); mapModel.addMapModelListener(mapModelListener); } Modified: trunk/src/app/net/sf/gridarta/map/DefaultMapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/DefaultMapModel.java 2008-11-13 21:05:11 UTC (rev 5752) +++ trunk/src/app/net/sf/gridarta/map/DefaultMapModel.java 2008-11-13 21:23:32 UTC (rev 5753) @@ -19,7 +19,6 @@ package net.sf.gridarta.map; -import java.awt.Component; import java.awt.Point; import java.util.HashSet; import java.util.Iterator; @@ -78,13 +77,7 @@ @NotNull private final A mapArchObject; - /** - * The parent component for error messages. - */ @NotNull - private final Component parent; - - @NotNull private final AutojoinLists<G, A, R> autojoinLists; @NotNull @@ -159,7 +152,6 @@ /** * Create an DefaultMapModel. - * @param parent the parent component for error messages * @param autojoinLists the autojoin lists instance to use * @param mapControl MapControl to associate with this model. * @param objects the <code>GameObject</code> list of this map or @@ -170,10 +162,9 @@ * @param mapActions the map actions to use * @param activeEditType the active edit types */ - public DefaultMapModel(@NotNull final Component parent, @NotNull final AutojoinLists<G, A, R> autojoinLists, @NotNull final MapControl<G, A, R, ?> mapControl, @Nullable final List<G> objects, @NotNull final A mapArchObject, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher, @NotNull final ArchetypeChooserModel<G, A, R, ?> archetypeChooserModel, @NotNull final MapActions mapActions, final int activeEditType) { + public DefaultMapModel(@NotNull final AutojoinLists<G, A, R> autojoinLists, @NotNull final MapControl<G, A, R, ?> mapControl, @Nullable final List<G> objects, @NotNull final A mapArchObject, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher, @NotNull final ArchetypeChooserModel<G, A, R, ?> archetypeChooserModel, @NotNull final MapActions mapActions, final int activeEditType) { this.mapControl = mapControl; this.mapArchObject = mapArchObject; - this.parent = parent; this.autojoinLists = autojoinLists; this.archetypeChooserModel = archetypeChooserModel; this.exitTypeGameObjectMatcher = exitTypeGameObjectMatcher; @@ -836,10 +827,7 @@ final int mapx = gameObject.getMapX(); final int mapy = gameObject.getMapY(); if (!isPointValid(new Point(mapx, mapy))) { - // TODO: - // Think about how this could be handled via an exception and caught much earlier, perhaps already while reading the map, not after it - // already has been read. - ACTION_FACTORY.showMessageDialog(parent, "mapErrorArchOutOfGrid"); + log.error("addGameObjectToMap: trying to insert game object out of map bounds at " + mapx + "/" + mapy + ", map bounds is " + mapSize); return; } Modified: trunk/src/app/net/sf/gridarta/map/MapControlFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/MapControlFactory.java 2008-11-13 21:05:11 UTC (rev 5752) +++ trunk/src/app/net/sf/gridarta/map/MapControlFactory.java 2008-11-13 21:23:32 UTC (rev 5753) @@ -19,7 +19,6 @@ package net.sf.gridarta.map; -import java.awt.Component; import java.io.File; import java.io.IOException; import java.util.List; @@ -61,7 +60,6 @@ /** * Create a new map control instance. - * @param parent the parent component for error messages * @param objects the objects to insert into the new map * @param mapArchObject the map arch object to use for the new map * @param mapName the map name @@ -69,39 +67,36 @@ * @return the new map control instance */ @NotNull - MapControl<G, A, R, V> newMapControl(@NotNull Component parent, @Nullable List<G> objects, @NotNull A mapArchObject, @NotNull String mapName, @Nullable File file); + MapControl<G, A, R, V> newMapControl(@Nullable List<G> objects, @NotNull A mapArchObject, @NotNull String mapName, @Nullable File file); /** * Create a new pickmap map control instance. - * @param parent the parent component for error messages * @param mapSize the pickmap size in tiles * @param pickmapName the pickmap name * @param file the associated file * @return the new pickmap map control instance */ @NotNull - MapControl<G, A, R, V> newPickmapControl(@NotNull Component parent, @NotNull Size2D mapSize, @NotNull String pickmapName, @NotNull File file); + MapControl<G, A, R, V> newPickmapControl(@NotNull Size2D mapSize, @NotNull String pickmapName, @NotNull File file); /** * Create a new pickmap map control instance. - * @param parent the parent component for error messages * @param objects the objects to insert into the new pickmap * @param mapArchObject the map arch object to use for the new pickmap * @param file the associated file * @return the new pickmap map control instance */ @NotNull - MapControl<G, A, R, V> newPickmapControl(@NotNull Component parent, @Nullable List<G> objects, @NotNull A mapArchObject, @NotNull File file); + MapControl<G, A, R, V> newPickmapControl(@Nullable List<G> objects, @NotNull A mapArchObject, @NotNull File file); /** * Creates a new pickmap map control instanace by loading a file. - * @param parent the parent component for error messages * @param file the file to load * @return the new pickmap map control instance * @throws IOException if the file cannot be loaded */ @NotNull - MapControl<G, A, R, V> newPickmapControl(@NotNull Component parent, @NotNull File file) throws IOException; + MapControl<G, A, R, V> newPickmapControl(@NotNull File file) throws IOException; @Deprecated void setEditTypes(final EditTypes editTypes); Modified: trunk/src/app/net/sf/gridarta/mapfiles/Loader.java =================================================================== --- trunk/src/app/net/sf/gridarta/mapfiles/Loader.java 2008-11-13 21:05:11 UTC (rev 5752) +++ trunk/src/app/net/sf/gridarta/mapfiles/Loader.java 2008-11-13 21:23:32 UTC (rev 5753) @@ -19,7 +19,6 @@ package net.sf.gridarta.mapfiles; -import java.awt.Component; import java.io.File; import java.util.Arrays; import net.sf.gridarta.gameobject.Archetype; @@ -56,24 +55,15 @@ private final MapControlFactory<G, A, R, V> mapControlFactory; /** - * The parent component for error messages. - */ - @NotNull - private final Component parent; - - /** * Creates a new instance. * @param errorView the error view for reporting error messages * @param mapFolderTree the model to add the loaded pickmaps to * @param mapControlFactory the map control instance to use - * @param parent the parent component for error messages - * instance to use for loading pickmap files */ - public Loader(@NotNull final DefaultErrorView errorView, @NotNull final MapFolderTree<G, A, R, V> mapFolderTree, @NotNull final MapControlFactory<G, A, R, V> mapControlFactory, @NotNull final Component parent) { + public Loader(@NotNull final DefaultErrorView errorView, @NotNull final MapFolderTree<G, A, R, V> mapFolderTree, @NotNull final MapControlFactory<G, A, R, V> mapControlFactory) { this.errorView = errorView; this.mapFolderTree = mapFolderTree; this.mapControlFactory = mapControlFactory; - this.parent = parent; } /** Loads all pickmap files from a directory and its subdirectories. */ @@ -121,7 +111,7 @@ for (final File file : files) { if (file.isFile()) { try { - mapFolder.addPickmap(file.getName(), mapControlFactory, this.parent); + mapFolder.addPickmap(file.getName(), mapControlFactory); } catch (final InvalidNameException ex) { errorViewCollector.addWarning("ignoring pickmap with invalid name: " + file); } Modified: trunk/src/app/net/sf/gridarta/mapfiles/MapFile.java =================================================================== --- trunk/src/app/net/sf/gridarta/mapfiles/MapFile.java 2008-11-13 21:05:11 UTC (rev 5752) +++ trunk/src/app/net/sf/gridarta/mapfiles/MapFile.java 2008-11-13 21:23:32 UTC (rev 5753) @@ -19,7 +19,6 @@ package net.sf.gridarta.mapfiles; -import java.awt.Component; import java.io.File; import java.io.IOException; import java.util.Collection; @@ -57,12 +56,6 @@ private final MapControlFactory<G, A, R, V> mapControlFactory; /** - * The parent component for error messages. - */ - @NotNull - private final Component parent; - - /** * The {@link MapControl} instance representing the map file, or * <code>null</code> if the map file is not loaded. */ @@ -81,10 +74,9 @@ * @param mapFolder the folder ths pickmap is part of * @param name the underlying map file name * @param mapControlFactory the map control instance - * @param parent the parent component for error messages * @throws InvalidNameException if <code>name</code> is not valid */ - public MapFile(@NotNull final MapFolder<G, A, R, V> mapFolder, @NotNull final String name, @NotNull final MapControlFactory<G, A, R, V> mapControlFactory, @NotNull final Component parent) throws InvalidNameException { + public MapFile(@NotNull final MapFolder<G, A, R, V> mapFolder, @NotNull final String name, @NotNull final MapControlFactory<G, A, R, V> mapControlFactory) throws InvalidNameException { if (!isValidPickmapName(name)) { throw new InvalidNameException(name); } @@ -92,7 +84,6 @@ this.mapFolder = mapFolder; this.name = name; this.mapControlFactory = mapControlFactory; - this.parent = parent; } /** @@ -144,7 +135,7 @@ return; } - pickmap = mapControlFactory.newPickmapControl(parent, getFile()); + pickmap = mapControlFactory.newPickmapControl(getFile()); pickmapView = pickmap.createView(null); } Modified: trunk/src/app/net/sf/gridarta/mapfiles/MapFolder.java =================================================================== --- trunk/src/app/net/sf/gridarta/mapfiles/MapFolder.java 2008-11-13 21:05:11 UTC (rev 5752) +++ trunk/src/app/net/sf/gridarta/mapfiles/MapFolder.java 2008-11-13 21:23:32 UTC (rev 5753) @@ -19,7 +19,6 @@ package net.sf.gridarta.mapfiles; -import java.awt.Component; import java.io.File; import java.util.ArrayList; import java.util.Collection; @@ -118,12 +117,11 @@ * Adds a new {@link MapFile} to this folder. * @param name the map file name * @param mapControlFactory the map control factory instance - * @param parent the parent component for error messages * @return the newly created pickmap * @throws InvalidNameException if the pickmap name is invalid */ - public synchronized MapFile<G, A, R, V> addPickmap(@NotNull final String name, @NotNull final MapControlFactory<G, A, R, V> mapControlFactory, @NotNull final Component parent) throws InvalidNameException { - final MapFile<G, A, R, V> mapFile = new MapFile<G, A, R, V>(this, name, mapControlFactory, parent); + public synchronized MapFile<G, A, R, V> addPickmap(@NotNull final String name, @NotNull final MapControlFactory<G, A, R, V> mapControlFactory) throws InvalidNameException { + final MapFile<G, A, R, V> mapFile = new MapFile<G, A, R, V>(this, name, mapControlFactory); mapFiles.add(mapFile); for (final MapFolderListener<G, A, R, V> listenerMap : listeners.getListeners(MapFolderListener.class)) { listenerMap.pickmapAdded(mapFile); Modified: trunk/src/app/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages.properties 2008-11-13 21:05:11 UTC (rev 5752) +++ trunk/src/app/net/sf/gridarta/messages.properties 2008-11-13 21:23:32 UTC (rev 5753) @@ -449,8 +449,6 @@ mapTileChoose.shortdescription=Choose path to tile map mapTileChoose.text= mapTilePathMode.shortdescription=Switch between relative and absolute path -mapErrorArchOutOfGrid.title=Arch out of map -mapErrorArchOutOfGrid.message=Removing arch out of map bounds # Other Strings mapWidth=Width @@ -1280,4 +1278,4 @@ # Error View errorViewTitle=Errors -errorViewOk.text=OK +errorViewOk.tex=OK Modified: trunk/src/app/net/sf/gridarta/messages_de.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_de.properties 2008-11-13 21:05:11 UTC (rev 5752) +++ trunk/src/app/net/sf/gridarta/messages_de.properties 2008-11-13 21:23:32 UTC (rev 5753) @@ -431,8 +431,6 @@ mapTileChoose.shortdescription=Pfad w\xE4hlen mapTileChoose.text= mapTilePathMode.shortdescription=Zwischen relativem und absoluten Pfad wechseln -mapErrorArchOutOfGrid.title=Archetyp au\xDFerhalb Karte -mapErrorArchOutOfGrid.message=Entferne Archetypen au\xDFerhalb der Karte # Other Strings mapWidth=Breite Modified: trunk/src/app/net/sf/gridarta/messages_fr.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_fr.properties 2008-11-13 21:05:11 UTC (rev 5752) +++ trunk/src/app/net/sf/gridarta/messages_fr.properties 2008-11-13 21:23:32 UTC (rev 5753) @@ -430,8 +430,6 @@ #mapTileChoose.shortdescription= mapTileChoose.text= #mapTilePathMode.shortdescription= -#mapErrorArchOutOfGrid.title= -#mapErrorArchOutOfGrid.message= # Other Strings #mapWidth= Modified: trunk/src/app/net/sf/gridarta/messages_sv.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_sv.properties 2008-11-13 21:05:11 UTC (rev 5752) +++ trunk/src/app/net/sf/gridarta/messages_sv.properties 2008-11-13 21:23:32 UTC (rev 5753) @@ -434,8 +434,6 @@ mapTileChoose.shortdescription=V\xE4lj s\xF6kv\xE4g till n\xE4rliggande karta mapTileChoose.text= mapTilePathMode.shortdescription=V\xE4xla mellan relativ och absolut s\xF6kv\xE4g -mapErrorArchOutOfGrid.title=Objekt utanf\xF6r kartan -mapErrorArchOutOfGrid.message=Avl\xE4gsnar objekt utanf\xF6r kartan # Other Strings mapWidth=Bredd Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-11-13 21:05:11 UTC (rev 5752) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-11-13 21:23:32 UTC (rev 5753) @@ -19,7 +19,6 @@ package test.net.sf.gridarta.map; -import java.awt.Component; import java.awt.Frame; import java.awt.Point; import java.awt.image.BufferedImage; @@ -31,7 +30,6 @@ import java.util.TreeSet; import javax.swing.ImageIcon; import javax.swing.JList; -import javax.swing.JPanel; import net.sf.gridarta.DefaultMapManager; import net.sf.gridarta.EditTypes; import net.sf.gridarta.GlobalSettings; @@ -419,8 +417,8 @@ final GameObjectFactory<TestGameObject, TestMapArchObject, TestArchetype> gameObjectFactory = new TestGameObjectFactory(); final GameObjectParser<TestGameObject, TestMapArchObject, TestArchetype> gameObjectParser = new TestGameObjectParser(gameObjectFactory); final MapViewFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapViewFactory = new TestMapViewFactory(); - final MapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapControl = new DefaultMapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(mapViewFactory, mapArchObjectParserFactory, gameObjectParser, rendererFactory, new JPanel(), autojoinLists, mapImageCache, null, mapArchObject, false, null, archetypeChooserModel, mapActions, 0); - mapModel = new DefaultMapModel<TestGameObject, TestMapArchObject, TestArchetype>(new JPanel(), autojoinLists, mapControl, null, mapArchObject, null, archetypeChooserModel, mapActions, 0); + final MapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapControl = new DefaultMapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(mapViewFactory, mapArchObjectParserFactory, gameObjectParser, rendererFactory, autojoinLists, mapImageCache, null, mapArchObject, false, null, archetypeChooserModel, mapActions, 0); + mapModel = new DefaultMapModel<TestGameObject, TestMapArchObject, TestArchetype>(autojoinLists, mapControl, null, mapArchObject, null, archetypeChooserModel, mapActions, 0); result.setLength(0); mapModel.addMapModelListener(mapModelListener); @@ -923,19 +921,19 @@ /** {@inheritDoc} */ @NotNull - public MapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> newMapControl(@NotNull final Component parent, @Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject, @NotNull final String mapName, @Nullable final File file) { + public MapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> newMapControl(@Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject, @NotNull final String mapName, @Nullable final File file) { throw new AssertionError(); } /** {@inheritDoc} */ @NotNull - public MapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> newPickmapControl(@NotNull final Component parent, @NotNull final Size2D mapSize, @NotNull final String pickmapName, @NotNull final File file) { + public MapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> newPickmapControl(@NotNull final Size2D mapSize, @NotNull final String pickmapName, @NotNull final File file) { throw new AssertionError(); } /** {@inheritDoc} */ @NotNull - public MapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> newPickmapControl(@NotNull final Component parent, @Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject, @NotNull final File file) { + public MapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> newPickmapControl(@Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject, @NotNull final File file) { throw new AssertionError(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-11-21 17:41:29
|
Revision: 5835 http://gridarta.svn.sourceforge.net/gridarta/?rev=5835&view=rev Author: akirschbaum Date: 2008-11-21 17:41:19 +0000 (Fri, 21 Nov 2008) Log Message: ----------- Do not crash when loading maps referencing undefined faces. Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/src/app/net/sf/gridarta/gameobject/face/CollectedFaceProvider.java Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2008-11-15 21:31:02 UTC (rev 5834) +++ trunk/crossfire/ChangeLog 2008-11-21 17:41:19 UTC (rev 5835) @@ -1,3 +1,7 @@ +2008-11-21 Andreas Kirschbaum + + * Do not crash when loading maps referencing undefined faces. + 2008-11-13 Andreas Kirschbaum * Partially implement #1627422 (Check box option to avoid startup Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2008-11-15 21:31:02 UTC (rev 5834) +++ trunk/daimonin/ChangeLog 2008-11-21 17:41:19 UTC (rev 5835) @@ -1,3 +1,7 @@ +2008-11-21 Andreas Kirschbaum + + * Do not crash when loading maps referencing undefined faces. + 2008-11-13 Andreas Kirschbaum * Partially implement #1627422 (Check box option to avoid startup Modified: trunk/src/app/net/sf/gridarta/gameobject/face/CollectedFaceProvider.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/face/CollectedFaceProvider.java 2008-11-15 21:31:02 UTC (rev 5834) +++ trunk/src/app/net/sf/gridarta/gameobject/face/CollectedFaceProvider.java 2008-11-21 17:41:19 UTC (rev 5835) @@ -85,15 +85,20 @@ @Nullable @Override protected ImageIcon createImage(@NotNull final String faceName) { + final Long position = positions.get(faceName); + if (position == null) { + return null; + } + final long posI = position; + final byte[] buf; try { - final long posI = positions.get(faceName); file.seek(posI >> 32); - final byte[] buf = new byte[(int) posI]; + buf = new byte[(int) posI]; file.readFully(buf); - return new ImageIcon(buf); } catch (final IOException e) { return null; } + return new ImageIcon(buf); } } // class CollectedFaceProvider This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-11-23 15:07:24
|
Revision: 5838 http://gridarta.svn.sourceforge.net/gridarta/?rev=5838&view=rev Author: akirschbaum Date: 2008-11-23 15:07:21 +0000 (Sun, 23 Nov 2008) Log Message: ----------- Add map validator "Undefined face": checks that the referenced face or animation does exist. Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/ChangeLog trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gameobject/GameObject.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 Added Paths: ----------- trunk/src/app/net/sf/gridarta/map/validation/checks/UndefinedAnimError.java trunk/src/app/net/sf/gridarta/map/validation/checks/UndefinedFaceChecker.java trunk/src/app/net/sf/gridarta/map/validation/checks/UndefinedFaceError.java Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2008-11-23 14:05:52 UTC (rev 5837) +++ trunk/crossfire/ChangeLog 2008-11-23 15:07:21 UTC (rev 5838) @@ -1,3 +1,8 @@ +2008-11-23 Andreas Kirschbaum + + * Add map validator "Undefined face": checks that the referenced + face or animation does exist. + 2008-11-21 Andreas Kirschbaum * Do not crash when loading maps referencing undefined faces. Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-11-23 14:05:52 UTC (rev 5837) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-11-23 15:07:21 UTC (rev 5838) @@ -108,6 +108,7 @@ import net.sf.gridarta.map.validation.checks.MapDifficultyChecker; import net.sf.gridarta.map.validation.checks.TilePathsChecker; import net.sf.gridarta.map.validation.checks.UndefinedArchetypeChecker; +import net.sf.gridarta.map.validation.checks.UndefinedFaceChecker; import net.sf.gridarta.map.validation.checks.UnsetSlayingChecker; import net.sf.gridarta.treasurelist.CFTreasureListTree; import net.sf.gridarta.treasurelist.TreasureLocation; @@ -382,6 +383,7 @@ new ExitChecker(globalSettings.getMapDir(), Archetype.TYPE_EXIT), new MapDifficultyChecker<GameObject, MapArchObject, Archetype>(), new TilePathsChecker(globalSettings.getMapDir(), 4), + new UndefinedFaceChecker<GameObject, MapArchObject, Archetype>(), new UndefinedArchetypeChecker<GameObject, MapArchObject, Archetype>(), unsetSlayingChecker ); Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2008-11-23 14:05:52 UTC (rev 5837) +++ trunk/daimonin/ChangeLog 2008-11-23 15:07:21 UTC (rev 5838) @@ -1,3 +1,8 @@ +2008-11-23 Andreas Kirschbaum + + * Add map validator "Undefined face": checks that the referenced + face or animation does exist. + 2008-11-21 Andreas Kirschbaum * Do not crash when loading maps referencing undefined faces. Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-11-23 14:05:52 UTC (rev 5837) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-11-23 15:07:21 UTC (rev 5838) @@ -124,6 +124,7 @@ import net.sf.gridarta.map.validation.checks.SysObjectNotOnLayerZeroChecker; import net.sf.gridarta.map.validation.checks.TilePathsChecker; import net.sf.gridarta.map.validation.checks.UndefinedArchetypeChecker; +import net.sf.gridarta.map.validation.checks.UndefinedFaceChecker; import net.sf.gridarta.map.validation.checks.UnsetSlayingChecker; import net.sf.gridarta.spells.SpellsUtils; import net.sf.gridarta.treasurelist.CFTreasureListTree; @@ -506,6 +507,7 @@ new SysObjectNotOnLayerZeroChecker<GameObject, MapArchObject, Archetype>(), new TilePathsChecker(globalSettings.getMapDir(), 8), new UndefinedArchetypeChecker<GameObject, MapArchObject, Archetype>(), + new UndefinedFaceChecker<GameObject, MapArchObject, Archetype>(), new UnsetSlayingChecker<GameObject, MapArchObject, Archetype>(Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_DETECTOR, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER) ); return mapValidators; Modified: trunk/src/app/net/sf/gridarta/gameobject/GameObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2008-11-23 14:05:52 UTC (rev 5837) +++ trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2008-11-23 15:07:21 UTC (rev 5838) @@ -29,6 +29,7 @@ import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.gameobject.anim.AnimationObject; import net.sf.gridarta.gameobject.anim.AnimationObjects; +import net.sf.gridarta.gameobject.face.FaceObjectProviders; import net.sf.gridarta.gameobject.match.GameObjectMatchers; import net.sf.gridarta.gameobject.scripts.ScriptArchData; import net.sf.gridarta.gameobject.scripts.ScriptArchEditor; @@ -1792,12 +1793,7 @@ setFaceObjName(effectiveFaceObjName); - if (effectiveFaceObjName != null) { - // TODO: Find out whether the face is defined - // if (face not defined) { - // faceObjSource = FaceSource.FACE_NOT_FOUND; - // } - } else { + if (effectiveFaceObjName == null || FaceObjectProviders.normal == null || FaceObjectProviders.normal.getImageIconForFacename(effectiveFaceObjName) == null) { faceObjSource = FaceSource.FACE_NOT_FOUND; } if (!isArchetype() && archetypeSet != null) { Added: trunk/src/app/net/sf/gridarta/map/validation/checks/UndefinedAnimError.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/validation/checks/UndefinedAnimError.java (rev 0) +++ trunk/src/app/net/sf/gridarta/map/validation/checks/UndefinedAnimError.java 2008-11-23 15:07:21 UTC (rev 5838) @@ -0,0 +1,59 @@ +/* + * 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.map.validation.checks; + +import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.map.MapArchObject; +import net.sf.gridarta.map.validation.GameObjectValidationError; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * A {@link GameObjectValidationError} indicating a game object references an + * undefined animation. + * @author Andreas Kirschbaum + */ +public class UndefinedAnimError<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends GameObjectValidationError<G, A, R> { + + /** + * The invalid animation name. + */ + @NotNull + private final String animationName; + + /** + * Creates a new instance. + * @param gameObject the invalid game object + * @param animationName the invalid animation name + */ + public UndefinedAnimError(@NotNull final G gameObject, @NotNull final String animationName) { + super(gameObject); + this.animationName = animationName; + } + + /** {@inheritDoc} */ + @Nullable + @Override + public String getParameter(final int id) { + return id == 0 ? animationName : null; + } + +} // class UnsetSlayingError Property changes on: trunk/src/app/net/sf/gridarta/map/validation/checks/UndefinedAnimError.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/src/app/net/sf/gridarta/map/validation/checks/UndefinedFaceChecker.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/validation/checks/UndefinedFaceChecker.java (rev 0) +++ trunk/src/app/net/sf/gridarta/map/validation/checks/UndefinedFaceChecker.java 2008-11-23 15:07:21 UTC (rev 5838) @@ -0,0 +1,54 @@ +/* + * 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.map.validation.checks; + +import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gameobject.FaceSource; +import net.sf.gridarta.map.MapArchObject; +import net.sf.gridarta.map.validation.AbstractValidator; +import net.sf.gridarta.map.validation.ErrorCollector; +import net.sf.gridarta.map.validation.GameObjectValidator; + +/** + * Checks that a game object does not reference an undefined face. + * @author Andreas Kirschbaum + */ +public class UndefinedFaceChecker<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractValidator implements GameObjectValidator<G, A, R> { + + /** + * Creates a new instance. + */ + public UndefinedFaceChecker() { + } + + /** {@inheritDoc} */ + public void validate(final G gameObject, final ErrorCollector<G, A, R> errorCollector) { + if (gameObject.getFaceObjSource() == FaceSource.FACE_NOT_FOUND) { + final String animName = gameObject.getAnimName(); + if (animName != null && !animName.equals("NONE")) { + errorCollector.collect(new UndefinedAnimError<G, A, R>(gameObject, animName)); + } else { + errorCollector.collect(new UndefinedFaceError<G, A, R>(gameObject, gameObject.getFaceObjName())); + } + } + } + +} // class UnsetSlayingChecker Property changes on: trunk/src/app/net/sf/gridarta/map/validation/checks/UndefinedFaceChecker.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/src/app/net/sf/gridarta/map/validation/checks/UndefinedFaceError.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/validation/checks/UndefinedFaceError.java (rev 0) +++ trunk/src/app/net/sf/gridarta/map/validation/checks/UndefinedFaceError.java 2008-11-23 15:07:21 UTC (rev 5838) @@ -0,0 +1,59 @@ +/* + * 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.map.validation.checks; + +import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.map.MapArchObject; +import net.sf.gridarta.map.validation.GameObjectValidationError; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * A {@link GameObjectValidationError} indicating a game object references an + * undefined face. + * @author Andreas Kirschbaum + */ +public class UndefinedFaceError<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends GameObjectValidationError<G, A, R> { + + /** + * The invalid face name. + */ + @Nullable + private final String faceName; + + /** + * Creates a new instance. + * @param gameObject the invalid game object + * @param faceName the invalid face name + */ + public UndefinedFaceError(@NotNull final G gameObject, @Nullable final String faceName) { + super(gameObject); + this.faceName = faceName; + } + + /** {@inheritDoc} */ + @Nullable + @Override + public String getParameter(final int id) { + return id == 0 ? faceName : null; + } + +} // class UnsetSlayingError Property changes on: trunk/src/app/net/sf/gridarta/map/validation/checks/UndefinedFaceError.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages.properties 2008-11-23 14:05:52 UTC (rev 5837) +++ trunk/src/app/net/sf/gridarta/messages.properties 2008-11-23 15:07:21 UTC (rev 5838) @@ -946,6 +946,7 @@ prefs.Validator.SysObjectNotOnLayerZero=Whether this map validator check is is enabled. prefs.Validator.TilePaths=Whether this map validator check is is enabled. prefs.Validator.UndefinedArchetype=Whether this map validator check is is enabled. +prefs.Validator.UndefinedFace=Whether this map validator check is is enabled. prefs.Validator.UnsetSlaying=Whether this map validator check is is enabled. prefs.WindowState=Main windows''s state (maximized, iconized, etc.) prefs.appClient=Filename of client executable. @@ -1119,10 +1120,17 @@ Validator.TilePaths.title=Tile path invalid Validator.TilePaths.msg=<html><h3>{0}</h3><p>This map has invalid tile paths.<br>Go to the map properties dialog and change the map tile paths. +Validator.UndefinedAnim.title=Undefined animation +Validator.UndefinedAnim.msg=<html><h3>{0}</h3><p>The animation "{4}" does not exist.</p><p>Sie could:</p><ul><li>Change the animation attribute</li></ul> + Validator.UndefinedArchetype.default=true Validator.UndefinedArchetype.title=Undefined archetype Validator.UndefinedArchetype.msg=<html><h3>{0}</h3><p>This object references an undefined archetype.<br>Every object is created by copying an archetype.<br>If this archetype does not exist the object cannot be created by the server.</p><p>You could:</p><ul><li>Remove the object</li></ul> +Validator.UndefinedFace.default=true +Validator.UndefinedFace.title=Undefined face +Validator.UndefinedFace.msg=<html><h3>{0}</h3><p>The face "{4}" does not exist.</p><p>Sie could:</p><ul><li>Change the face attribute</li></ul> + Validator.UnsetSlaying.default=true Validator.UnsetSlaying.title=Invalid key string Validator.UnsetSlaying.msg=<html><h3>{0}</h3><p>This object does not define a unique key string.<br>This could be exploited by players by mixing keys and doors appearing in different map sets.</p><p>You could:</p><ul><li>Ignore this</li><li>Set a unique key value</li></ul> Modified: trunk/src/app/net/sf/gridarta/messages_de.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_de.properties 2008-11-23 14:05:52 UTC (rev 5837) +++ trunk/src/app/net/sf/gridarta/messages_de.properties 2008-11-23 15:07:21 UTC (rev 5838) @@ -966,9 +966,15 @@ Validator.TilePaths.title=\xDCng\xFCltiger Kartenverbindungspfad Validator.TilePaths.msg=<html><h3>{0}</h3><p>Diese Karte besitzt einen ung\xFCltigen Kartenverbindungspfad.<br>\xC4ndern Sie den Kartenverbindungspfad in den Karteneigenschaften. +Validator.UndefinedAnim.title=Ung\xFCltige Animation +Validator.UndefinedAnim.msg=<html><h3>{0}</h3><p>Die Animation "{4}" existiert nicht.</p><p>Sie k\xF6nnen:</p><ul><li>Das Attribut "animation" \xE4ndern</li></ul> + Validator.UndefinedArchetype.title=Ung\xFCltiger Archetyp Validator.UndefinedArchetype.msg=<html><h3>{0}</h3><p>Dieses Objekt verwendet ein Archetyp, der nicht existiert.<br>Der Server erzeugt Objekte als Kopie von Archetypen.<br>Daher ist es nicht m\xF6glich, einen nicht-vohandenen Archetypen zu verwenden.</p><p>Sie k\xF6nnen:</p><ul><li>Das Objekt l\xF6schen</li></ul> +Validator.UndefinedFace.title=Ung\xFCltiges Bild +Validator.UndefinedFace.msg=<html><h3>{0}</h3><p>Das Bild "{4}" existiert nicht.</p><p>Sie k\xF6nnen:</p><ul><li>Das Attribut "face" \xE4ndern</li></ul> + Validator.UnsetSlaying.title=Ung\xFCltiger "key string" Validator.UnsetSlaying.msg=<html><h3>{0}</h3><p>Dieses Objekt setzt keinen "key string".<br>Spieler k\xF6nnen dieses Problem ausnutzen, indem sie Schl\xFCssel<br>und T\xFCren unterschiedlichen Karten zusammen verwenden.</p><p>Sie k\xF6nnen:</p><ul><li>Dieses Problem ignorieren</li><li>Einen "key string" setzen</li></ul> Modified: trunk/src/app/net/sf/gridarta/messages_fr.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_fr.properties 2008-11-23 14:05:52 UTC (rev 5837) +++ trunk/src/app/net/sf/gridarta/messages_fr.properties 2008-11-23 15:07:21 UTC (rev 5838) @@ -965,9 +965,15 @@ #Validator.TilePaths.title= #Validator.TilePaths.msg= +#Validator.UndefinedAnim.title= +#Validator.UndefinedAnim.msg= + #Validator.UndefinedArchetype.title= #Validator.UndefinedArchetype.msg= +#Validator.UndefinedFace.title= +#Validator.UndefinedFace.msg= + #Validator.UnsetSlaying.title= #Validator.UnsetSlaying.msg= Modified: trunk/src/app/net/sf/gridarta/messages_sv.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_sv.properties 2008-11-23 14:05:52 UTC (rev 5837) +++ trunk/src/app/net/sf/gridarta/messages_sv.properties 2008-11-23 15:07:21 UTC (rev 5838) @@ -970,9 +970,15 @@ #Validator.TilePaths.title= #Validator.TilePaths.msg= +#Validator.UndefinedAnim.title= +#Validator.UndefinedAnim.msg= + #Validator.UndefinedArchetype.title= #Validator.UndefinedArchetype.msg= +#Validator.UndefinedFace.title= +#Validator.UndefinedFace.msg= + #Validator.UnsetSlaying.title= #Validator.UnsetSlaying.msg= This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-12-12 20:27:40
|
Revision: 5846 http://gridarta.svn.sourceforge.net/gridarta/?rev=5846&view=rev Author: akirschbaum Date: 2008-12-12 20:27:30 +0000 (Fri, 12 Dec 2008) Log Message: ----------- Remove support for obsolete color_fg/color_bg archetype fields. Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java trunk/daimonin/ChangeLog trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2008-12-12 19:18:19 UTC (rev 5845) +++ trunk/crossfire/ChangeLog 2008-12-12 20:27:30 UTC (rev 5846) @@ -1,5 +1,7 @@ 2008-12-12 Andreas Kirschbaum + * Remove support for obsolete color_fg/color_bg archetype fields. + * Update archetypes. 2008-11-26 Andreas Kirschbaum Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java 2008-12-12 19:18:19 UTC (rev 5845) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java 2008-12-12 20:27:30 UTC (rev 5846) @@ -293,14 +293,6 @@ if (log.isDebugEnabled()) { log.debug("Remove magicmap: " + archetype.getArchetypeName()); } - } else if (thisLine.startsWith("color_fg ")) { - if (log.isDebugEnabled()) { - log.debug("Remove color_fg: " + archetype.getArchetypeName()); - } - } else if (thisLine.startsWith("color_bg ")) { - if (log.isDebugEnabled()) { - log.debug("Remove color_bg: " + archetype.getArchetypeName()); - } } else if (thisLine.startsWith("x ")) { if (!archmore && !archetype.getArchetypeName().equals(STARTARCH_NAME)) { log.warn(ACTION_FACTORY.format("logFoundCoordInDefArchSingleTileOrHead", "x", archetype.getArchetypeName())); Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2008-12-12 19:18:19 UTC (rev 5845) +++ trunk/daimonin/ChangeLog 2008-12-12 20:27:30 UTC (rev 5846) @@ -1,3 +1,7 @@ +2008-12-12 Andreas Kirschbaum + + * Remove support for obsolete color_fg/color_bg archetype fields. + 2008-11-23 Andreas Kirschbaum * Add map validator "Undefined face": checks that the referenced Modified: trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java 2008-12-12 19:18:19 UTC (rev 5845) +++ trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java 2008-12-12 20:27:30 UTC (rev 5846) @@ -271,14 +271,6 @@ if (log.isDebugEnabled()) { log.debug("Remove magicmap: " + archetype.getArchetypeName()); } - } else if (thisLine.startsWith("color_fg ")) { - if (log.isDebugEnabled()) { - log.debug("Remove color_fg: " + archetype.getArchetypeName()); - } - } else if (thisLine.startsWith("color_bg ")) { - if (log.isDebugEnabled()) { - log.debug("Remove color_bg: " + archetype.getArchetypeName()); - } } else if (thisLine.startsWith("x ")) { if (!archmore && !archetype.getArchetypeName().equals(STARTARCH_NAME)) { log.warn(ACTION_FACTORY.format("logFoundCoordInDefArchSingleTileOrHead", "x", archetype.getArchetypeName())); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-12-13 10:20:00
|
Revision: 5847 http://gridarta.svn.sourceforge.net/gridarta/?rev=5847&view=rev Author: akirschbaum Date: 2008-12-13 10:19:56 +0000 (Sat, 13 Dec 2008) Log Message: ----------- Remove obsolete commented code. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java 2008-12-12 20:27:30 UTC (rev 5846) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java 2008-12-13 10:19:56 UTC (rev 5847) @@ -278,7 +278,6 @@ archetype.addObjectText(thisLine); final String animName = thisLine.substring(10).trim(); archetype.setAnimName(animName); - //arch.setAnimNr(animationObjects.findAnimObject(animName)); // probably not needed, but better not delete it yet } else if (thisLine.equals("anim")) { animflag = true; animText = new StringBuilder(); Modified: trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java 2008-12-12 20:27:30 UTC (rev 5846) +++ trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java 2008-12-13 10:19:56 UTC (rev 5847) @@ -259,7 +259,6 @@ archetype.addObjectText(thisLine); final String animName = thisLine.substring(10).trim(); archetype.setAnimName(animName); - //arch.setAnimNr(animationObjects.findAnimObject(animName)); // probably not needed, but better not delete it yet } else if (thisLine.equals("anim")) { animflag = true; animText = new StringBuilder(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-12-21 22:40:45
|
Revision: 5848 http://gridarta.svn.sourceforge.net/gridarta/?rev=5848&view=rev Author: akirschbaum Date: 2008-12-21 22:40:42 +0000 (Sun, 21 Dec 2008) Log Message: ----------- Do not abort build process if svnversion executable does not exist. Modified Paths: -------------- trunk/crossfire/build.xml trunk/daimonin/build.xml Modified: trunk/crossfire/build.xml =================================================================== --- trunk/crossfire/build.xml 2008-12-13 10:19:56 UTC (rev 5847) +++ trunk/crossfire/build.xml 2008-12-21 22:40:42 UTC (rev 5848) @@ -62,7 +62,8 @@ <property name="javac.args" value="-Xlint:all,-path,-unchecked,-fallthrough,-serial" /> <property name="javac.fork" value="no" /> <tstamp><format property="build.tstamp" pattern="yyyy-MM-dd HH:mm:ss z" timezone="UTC"/></tstamp> - <exec executable="svnversion" outputproperty="build.number" /> + <exec executable="svnversion" outputproperty="build.number" failifexecutionfails="false" /> + <property name="build.number" value="unknown" /> <echoproperties destfile="build.properties"> <propertyset> <propertyref prefix="build.developer"/> Modified: trunk/daimonin/build.xml =================================================================== --- trunk/daimonin/build.xml 2008-12-13 10:19:56 UTC (rev 5847) +++ trunk/daimonin/build.xml 2008-12-21 22:40:42 UTC (rev 5848) @@ -65,7 +65,8 @@ <property name="javac.args" value="-Xlint:all,-path,-unchecked,-fallthrough,-serial" /> <property name="javac.fork" value="no" /> <tstamp><format property="build.tstamp" pattern="yyyy-MM-dd HH:mm:ss z" timezone="UTC"/></tstamp> - <exec executable="svnversion" outputproperty="build.number" /> + <exec executable="svnversion" outputproperty="build.number" failifexecutionfails="false" /> + <property name="build.number" value="unknown" /> <echoproperties destfile="build.properties"> <propertyset negate="true"> <propertyref prefix="user.ftp"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2009-01-07 17:27:01
|
Revision: 5852 http://gridarta.svn.sourceforge.net/gridarta/?rev=5852&view=rev Author: akirschbaum Date: 2009-01-07 17:26:54 +0000 (Wed, 07 Jan 2009) Log Message: ----------- Fix object choice display for pickmap chooser. Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/src/app/net/sf/gridarta/gui/objectchoicedisplay/ObjectChoiceDisplay.java Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2009-01-07 17:23:33 UTC (rev 5851) +++ trunk/crossfire/ChangeLog 2009-01-07 17:26:54 UTC (rev 5852) @@ -1,3 +1,7 @@ +2009-01-07 Andreas Kirschbaum + + * Fix object choice display for pickmap chooser. + 2009-01-06 Andreas Kirschbaum * Fix #2430130 (NPC changes to guildmaster when modifying NPC Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2009-01-07 17:23:33 UTC (rev 5851) +++ trunk/daimonin/ChangeLog 2009-01-07 17:26:54 UTC (rev 5852) @@ -1,3 +1,7 @@ +2009-01-07 Andreas Kirschbaum + + * Fix object choice display for pickmap chooser. + 2008-12-12 Andreas Kirschbaum * Remove support for obsolete color_fg/color_bg archetype fields. Modified: trunk/src/app/net/sf/gridarta/gui/objectchoicedisplay/ObjectChoiceDisplay.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/objectchoicedisplay/ObjectChoiceDisplay.java 2009-01-07 17:23:33 UTC (rev 5851) +++ trunk/src/app/net/sf/gridarta/gui/objectchoicedisplay/ObjectChoiceDisplay.java 2009-01-07 17:26:54 UTC (rev 5852) @@ -326,11 +326,10 @@ activePickmapView.removeMapCursorListener(mapCursorListener); } activeMapFile = mapFile; + updateActivePickmap(); if (activePickmapView != null) { activePickmapView.addMapCursorListener(mapCursorListener); } - - updateActivePickmap(); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2009-01-07 19:40:22
|
Revision: 5860 http://gridarta.svn.sourceforge.net/gridarta/?rev=5860&view=rev Author: akirschbaum Date: 2009-01-07 19:40:18 +0000 (Wed, 07 Jan 2009) Log Message: ----------- Move most of GameObject.postParseGameObject() to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/GameObject.java trunk/daimonin/src/daieditor/gameobject/GameObject.java trunk/src/app/net/sf/gridarta/gameobject/GameObject.java Modified: trunk/crossfire/src/cfeditor/gameobject/GameObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2009-01-07 19:35:11 UTC (rev 5859) +++ trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2009-01-07 19:40:18 UTC (rev 5860) @@ -189,45 +189,4 @@ // ignore "scriptArchData" } - /** {@inheritDoc} */ - @Override - public void postParseGameObject(final int editType) { - final String text = getObjectText(); - final Archetype archetype = getArchetype(); - - resetObjectText(); - for (final String line : StringUtils.patternEndOfLine.split(text)) { - if (line.length() > 0) { - if (line.startsWith("name ")) { - setObjName(line.substring(5)); - } else if (line.startsWith("animation ")) { - setAnimName(line.substring(10)); - addObjectText(line); - } else { - // this is an unparsed arch attribute, it has to stay in the archtext - addObjectText(line); - } - } - } - - if (getDirection() == -1) { // still the invalid direction! - setDirection(archetype.getDirection()); - } - setRealFace(getFaceName()); - // if the type is still unset, then we take the default one - if (getTypeNo() == TYPE_NO_UNSET) { - setTypeNo(archetype.getTypeNo()); - } - - setMultiX(archetype.getMultiX()); - setMultiY(archetype.getMultiY()); - - // setEditType(archetype.getEditType()); - - // validate the ScriptedEvents - validateAllEvents(); - - updateEditType(editType); - } - } // class GameObject Modified: trunk/daimonin/src/daieditor/gameobject/GameObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/GameObject.java 2009-01-07 19:35:11 UTC (rev 5859) +++ trunk/daimonin/src/daieditor/gameobject/GameObject.java 2009-01-07 19:40:18 UTC (rev 5860) @@ -22,7 +22,6 @@ import daieditor.map.MapArchObject; import javax.swing.ImageIcon; import net.sf.gridarta.gameobject.ArchetypeSet; -import net.sf.gridarta.utils.StringUtils; import org.jetbrains.annotations.NotNull; /** @@ -236,34 +235,9 @@ /** {@inheritDoc} */ @Override public void postParseGameObject(final int editType) { - final String text = getObjectText(); + super.postParseGameObject(editType); final Archetype archetype = getArchetype(); - - resetObjectText(); - for (final String line : StringUtils.patternEndOfLine.split(text)) { - if (line.length() > 0) { - if (line.startsWith("name ")) { - setObjName(line.substring(5)); - } else if (line.startsWith("animation ")) { - setAnimName(line.substring(10)); - addObjectText(line); - } else { - // this is an unparsed arch attribute, it has to stay in the archtext - addObjectText(line); - } - } - } - - if (getDirection() == -1) { // still the invalid direction! - setDirection(archetype.getDirection()); - } - setRealFace(getFaceName()); // if the type is still unset, then we take the default one - if (getTypeNo() == TYPE_NO_UNSET) { - setTypeNo(archetype.getTypeNo()); - } - - // if the type is still unset, then we take the default one if (archetype.getMultiShapeID() > 0 && getMultiShapeID() == 0) { setMultiShapeID(archetype.getMultiShapeID()); } @@ -271,16 +245,6 @@ multiPartNr = archetype.getMultiPartNr(); } isLowestPart = archetype.isLowestPart(); - - setMultiX(archetype.getMultiX()); - setMultiY(archetype.getMultiY()); - - // setEditType(archetype.getEditType()); - - // validate the ScriptedEvents - validateAllEvents(); - - updateEditType(editType); } } // class GameObject Modified: trunk/src/app/net/sf/gridarta/gameobject/GameObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2009-01-07 19:35:11 UTC (rev 5859) +++ trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2009-01-07 19:40:18 UTC (rev 5860) @@ -1595,8 +1595,44 @@ * @param editType edit type(s) to be calculated for the gameObject * @todo improve this stupid comment */ - public abstract void postParseGameObject(int editType); + public void postParseGameObject(final int editType) { + final String text = getObjectText(); + resetObjectText(); + for (final String line : StringUtils.patternEndOfLine.split(text)) { + if (line.length() > 0) { + if (line.startsWith("name ")) { + setObjName(line.substring(5)); + } else if (line.startsWith("animation ")) { + setAnimName(line.substring(10)); + addObjectText(line); + } else { + // this is an unparsed arch attribute, it has to stay in the archtext + addObjectText(line); + } + } + } + + if (direction == -1) { // still the invalid direction! + setDirection(archetype.getDirection()); + } + setRealFace(faceName); + // if the type is still unset, then we take the default one + if (typeNo == TYPE_NO_UNSET) { + setTypeNo(archetype.getTypeNo()); + } + + multiX = archetype.getMultiX(); + multiY = archetype.getMultiY(); + + // setEditType(archetype.getEditType()); + + // validate the ScriptedEvents + validateAllEvents(); + + updateEditType(editType); + } + /** * Returns the name of a face for a game object. * @return the name of the game object's face This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2009-01-07 20:09:16
|
Revision: 5862 http://gridarta.svn.sourceforge.net/gridarta/?rev=5862&view=rev Author: akirschbaum Date: 2009-01-07 20:09:13 +0000 (Wed, 07 Jan 2009) Log Message: ----------- Remove GameObject.archetypeTypeSet from common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/gameobject/GameObject.java trunk/src/app/net/sf/gridarta/AbstractMainControl.java trunk/src/app/net/sf/gridarta/gameobject/GameObject.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2009-01-07 20:00:58 UTC (rev 5861) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2009-01-07 20:09:13 UTC (rev 5862) @@ -51,6 +51,7 @@ import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.MapImageCache; import net.sf.gridarta.MapManager; +import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.filter.FilterControl; import net.sf.gridarta.gameobject.AbstractArchetypeParser; import net.sf.gridarta.gameobject.AbstractArchetypeSetLoader; @@ -148,6 +149,11 @@ } /** {@inheritDoc} */ + @Override + protected void initGameObject(@NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet) { + } + + /** {@inheritDoc} */ @NotNull @Override protected FaceObjects createFaceObjects() { Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2009-01-07 20:00:58 UTC (rev 5861) +++ trunk/daimonin/src/daieditor/CMainControl.java 2009-01-07 20:09:13 UTC (rev 5862) @@ -52,6 +52,7 @@ import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.MapImageCache; import net.sf.gridarta.MapManager; +import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.filter.FilterControl; import net.sf.gridarta.gameobject.AbstractArchetypeParser; import net.sf.gridarta.gameobject.AbstractArchetypeSetLoader; @@ -183,6 +184,12 @@ } /** {@inheritDoc} */ + @Override + protected void initGameObject(@NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet) { + GameObject.initialize(archetypeTypeSet); + } + + /** {@inheritDoc} */ @NotNull @Override protected FaceObjects createFaceObjects() { Modified: trunk/daimonin/src/daieditor/gameobject/GameObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/GameObject.java 2009-01-07 20:00:58 UTC (rev 5861) +++ trunk/daimonin/src/daieditor/gameobject/GameObject.java 2009-01-07 20:09:13 UTC (rev 5862) @@ -21,6 +21,7 @@ import daieditor.map.MapArchObject; import javax.swing.ImageIcon; +import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.gameobject.ArchetypeSet; import org.jetbrains.annotations.NotNull; @@ -45,6 +46,8 @@ /** The serial version UID. */ private static final long serialVersionUID = 1; + protected static ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet = null; + private int multiPartNr = 0; /** @@ -66,6 +69,15 @@ super(archetypeName); } + /** + * Sets the {@link ArchetypeTypeSet} that should be used for finding syntax + * errors. + * @param archetypeTypeSet the archetype type set to use + */ + public static void initialize(@NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet) { + GameObject.archetypeTypeSet = archetypeTypeSet; + } + /** {@inheritDoc} */ public int getMultiShapeID() { return multi != null ? multi.getMultiShapeID() : 0; Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2009-01-07 20:00:58 UTC (rev 5861) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2009-01-07 20:09:13 UTC (rev 5862) @@ -486,7 +486,8 @@ final ScriptArchEditor<G> scriptArchEditor = newScriptArchEditor(scriptedEventFactory, scriptExtension, scriptName, scriptArchUtils.createEventTypeBox(), scriptFileFilter, globalSettings, mapManager); scriptArchEditor.initEventTypeBoxes(scriptArchUtils); final ScriptArchData<G> scriptArchData = newScriptArchData(scriptedEventFactory, scriptArchUtils, scriptArchEditor); - GameObject.initialize(archetypeSet, archetypeTypeSet, gameObjectMatchers, animationObjects, SystemIcons.getNofaceTileIcon(), scriptArchData); + GameObject.initialize(archetypeSet, gameObjectMatchers, animationObjects, SystemIcons.getNofaceTileIcon(), scriptArchData); + initGameObject(archetypeTypeSet); gameObjectAttributesControl.createTabs(mapViewManager, animationObjects, lockedItemsControl, monsterMatcher, selectedSquareView, mainView, scriptArchEditor, scriptArchData, archetypeTypeSet, mapManager); newArchetypeSetLoader(gameObjectParser, archetypeParser, editTypes, faceObjects, animationObjects, globalSettings, archetypeSet).loadArchetypes(errorView, mainView); if (spellType != 0) { @@ -533,6 +534,8 @@ waitDialog(errorView); } + protected abstract void initGameObject(@NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet); + /** * Checks whether a {@link DefaultErrorView} instance contains at least one * error. Quits the application if an error exists. Modified: trunk/src/app/net/sf/gridarta/gameobject/GameObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2009-01-07 20:00:58 UTC (rev 5861) +++ trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2009-01-07 20:09:13 UTC (rev 5862) @@ -56,9 +56,6 @@ */ protected static ArchetypeSet archetypeSet = null; - /** Static reference to the ArchetypeTypeSet (find syntax errors). */ - protected static ArchetypeTypeSet archetypeTypeSet = null; - private static GameObjectMatchers gameObjectMatchers = null; @Nullable @@ -214,15 +211,13 @@ * Sets the {@link ArchetypeTypeSet} that should be used for finding syntax * errors. * @param archetypeSet the archetype set to use - * @param archetypeTypeSet the archetype type set to use * @param gameObjectMatchers the instance to use * @param animationObjects the animation objects to use * @param noFace the image icons for game objects having no face * @param scriptArchData the script arch data instance to use */ - public static void initialize(@Nullable final ArchetypeSet<?, ?, ?> archetypeSet, final ArchetypeTypeSet archetypeTypeSet, final GameObjectMatchers gameObjectMatchers, @Nullable final AnimationObjects animationObjects, @NotNull final ImageIcon noFace, @NotNull final ScriptArchData<?> scriptArchData) { + public static void initialize(@Nullable final ArchetypeSet<?, ?, ?> archetypeSet, final GameObjectMatchers gameObjectMatchers, @Nullable final AnimationObjects animationObjects, @NotNull final ImageIcon noFace, @NotNull final ScriptArchData<?> scriptArchData) { GameObject.archetypeSet = archetypeSet; - GameObject.archetypeTypeSet = archetypeTypeSet; GameObject.gameObjectMatchers = gameObjectMatchers; GameObject.animationObjects = animationObjects; GameObject.noFace = noFace; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2009-01-07 22:11:01
|
Revision: 5865 http://gridarta.svn.sourceforge.net/gridarta/?rev=5865&view=rev Author: akirschbaum Date: 2009-01-07 21:59:57 +0000 (Wed, 07 Jan 2009) Log Message: ----------- Fix #1965884 (Display issue). Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/DefaultMapManager.java trunk/src/app/net/sf/gridarta/EditTypes.java trunk/src/app/net/sf/gridarta/MapManager.java Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2009-01-07 21:27:14 UTC (rev 5864) +++ trunk/crossfire/ChangeLog 2009-01-07 21:59:57 UTC (rev 5865) @@ -1,5 +1,7 @@ 2009-01-07 Andreas Kirschbaum + * Fix #1965884 (Display issue). + * Fix #2430127 (Lost shoprace information when editting, then saving a map). Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2009-01-07 21:27:14 UTC (rev 5864) +++ trunk/daimonin/ChangeLog 2009-01-07 21:59:57 UTC (rev 5865) @@ -1,5 +1,7 @@ 2009-01-07 Andreas Kirschbaum + * Fix #1965884 (Display issue). + * Fix object choice display for pickmap chooser. 2008-12-12 Andreas Kirschbaum Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2009-01-07 21:27:14 UTC (rev 5864) +++ trunk/daimonin/src/daieditor/CMainControl.java 2009-01-07 21:59:57 UTC (rev 5865) @@ -572,13 +572,13 @@ } else { alphaType &= ~v; } - mapManager.refreshCurrentMap(); + mapManager.refreshAllMaps(); } /** Clear the transparency. */ public void clearAlpha() { alphaType = 0; - mapManager.refreshCurrentMap(); + mapManager.refreshAllMaps(); } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/DefaultMapManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/DefaultMapManager.java 2009-01-07 21:27:14 UTC (rev 5864) +++ trunk/src/app/net/sf/gridarta/DefaultMapManager.java 2009-01-07 21:59:57 UTC (rev 5865) @@ -137,7 +137,7 @@ for (final MapControl<G, A, R, V> mapControl : levels) { mapControl.getMapModel().addActiveEditType(newType); // calculate new type } - refreshCurrentMap(); + refreshAllMaps(); } /** {@inheritDoc} */ @@ -464,13 +464,6 @@ } /** {@inheritDoc} */ - public void refreshCurrentMap() { - if (currentMap != null) { - currentMap.repaint(); - } - } - - /** {@inheritDoc} */ public void refreshAllMaps() { for (final MapControl<G, A, R, V> mapControl : levels) { mapControl.repaint(); Modified: trunk/src/app/net/sf/gridarta/EditTypes.java =================================================================== --- trunk/src/app/net/sf/gridarta/EditTypes.java 2009-01-07 21:27:14 UTC (rev 5864) +++ trunk/src/app/net/sf/gridarta/EditTypes.java 2009-01-07 21:59:57 UTC (rev 5865) @@ -69,7 +69,7 @@ } this.editType &= ~editType; - mapManager.refreshCurrentMap(); + mapManager.refreshAllMaps(); } /** Modified: trunk/src/app/net/sf/gridarta/MapManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/MapManager.java 2009-01-07 21:27:14 UTC (rev 5864) +++ trunk/src/app/net/sf/gridarta/MapManager.java 2009-01-07 21:59:57 UTC (rev 5865) @@ -174,12 +174,6 @@ void removeMapManagerListener(@NotNull MapManagerListener<G, A, R, V> listener); /** - * Refreshes all map view of the active map. Does nothing if no map is - * opened. - */ - void refreshCurrentMap(); - - /** * Refreshes all map views. Does nothing if no maps are opened. */ void refreshAllMaps(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2009-01-08 19:49:45
|
Revision: 5867 http://gridarta.svn.sourceforge.net/gridarta/?rev=5867&view=rev Author: akirschbaum Date: 2009-01-08 19:49:39 +0000 (Thu, 08 Jan 2009) Log Message: ----------- Fix part of #1842541 (File Options... Paths and Resources): always save absolute path names. Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java trunk/daimonin/ChangeLog Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2009-01-08 19:23:11 UTC (rev 5866) +++ trunk/crossfire/ChangeLog 2009-01-08 19:49:39 UTC (rev 5867) @@ -1,3 +1,8 @@ +2009-01-08 Andreas Kirschbaum + + * Fix part of #1842541 (File Options... Paths and Resources): + always save absolute path names. + 2009-01-07 Andreas Kirschbaum * Fix #1965884 (Display issue). Modified: trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java 2009-01-08 19:23:11 UTC (rev 5866) +++ trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java 2009-01-08 19:49:39 UTC (rev 5867) @@ -42,6 +42,7 @@ import net.sf.japi.swing.ActionFactory; import net.sf.japi.swing.misc.JFileField; import net.sf.japi.swing.prefs.AbstractPrefs; +import org.jetbrains.annotations.NotNull; /** * Preferences Module for resource preferences. @@ -105,9 +106,9 @@ /** {@inheritDoc} */ public void apply() { - prefs.put(ResourceFileManager.ARCH_DIR_KEY, PathManager.path(archField.getText())); - prefs.put(ResourceFileManager.MAP_DIR_KEY, PathManager.path(mapField.getText())); - prefs.put(ResourceFileManager.SCRIPT_DIR_KEY, PathManager.path(scriptField.getText())); + prefs.put(ResourceFileManager.ARCH_DIR_KEY, createPath(archField.getText())); + prefs.put(ResourceFileManager.MAP_DIR_KEY, createPath(mapField.getText())); + prefs.put(ResourceFileManager.SCRIPT_DIR_KEY, createPath(scriptField.getText())); prefs.putBoolean(GlobalSettings.LOAD_ARCH_COLL, loadArches.isSelected()); final String imageSet = (String) imageSetBox.getSelectedItem(); @@ -252,4 +253,14 @@ return imageSet.equals("none") ? "disabled" : imageSet; } + /** + * Creates an absolute path from the given path name. + * @param path the path name to convert + * @return the absolute path name + */ + @NotNull + private static String createPath(@NotNull final String path) { + return PathManager.relativeToAbsolute(System.getProperty("user.dir"), PathManager.path(path)); + } + } // class ResPrefs Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2009-01-08 19:23:11 UTC (rev 5866) +++ trunk/daimonin/ChangeLog 2009-01-08 19:49:39 UTC (rev 5867) @@ -1,3 +1,8 @@ +2009-01-08 Andreas Kirschbaum + + * Fix part of #1842541 (File Options... Paths and Resources): + always save absolute path names. + 2009-01-07 Andreas Kirschbaum * Fix #1965884 (Display issue). This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2009-01-08 20:22:49
|
Revision: 5869 http://gridarta.svn.sourceforge.net/gridarta/?rev=5869&view=rev Author: akirschbaum Date: 2009-01-08 20:22:42 +0000 (Thu, 08 Jan 2009) Log Message: ----------- Whitespace changes. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java trunk/daimonin/src/daieditor/gui/prefs/ResPrefs.java trunk/src/app/net/sf/gridarta/gui/prefs/AppPrefs.java trunk/src/app/net/sf/gridarta/gui/prefs/GUIPrefs.java trunk/src/app/net/sf/gridarta/gui/prefs/MiscPrefs.java trunk/src/app/net/sf/gridarta/gui/prefs/NetPrefs.java trunk/src/app/net/sf/gridarta/gui/prefs/UpdatePrefs.java Modified: trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java 2009-01-08 20:16:00 UTC (rev 5868) +++ trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java 2009-01-08 20:22:42 UTC (rev 5869) @@ -141,11 +141,11 @@ final String selectedimageSet = (String) imageSetBox.getSelectedItem(); final String imageSet = selectedimageSet == null ? "disabled" : selectedimageSet; return !( - archField.getText().equals(globalSettings.getArchDirectory().getPath()) - && mapField.getText().equals(globalSettings.getMapsDirectory().getPath()) - && scriptField.getText().equals(globalSettings.getScriptDirectory().getPath()) - && loadArches.isSelected() == prefs.getBoolean(GlobalSettings.LOAD_ARCH_COLL, globalSettings.isArchLoadedFromCollection()) - && imageSet.equals(getCurrentImageSet()) + archField.getText().equals(globalSettings.getArchDirectory().getPath()) && + mapField.getText().equals(globalSettings.getMapsDirectory().getPath()) && + scriptField.getText().equals(globalSettings.getScriptDirectory().getPath()) && + loadArches.isSelected() == prefs.getBoolean(GlobalSettings.LOAD_ARCH_COLL, globalSettings.isArchLoadedFromCollection()) && + imageSet.equals(getCurrentImageSet()) ); } Modified: trunk/daimonin/src/daieditor/gui/prefs/ResPrefs.java =================================================================== --- trunk/daimonin/src/daieditor/gui/prefs/ResPrefs.java 2009-01-08 20:16:00 UTC (rev 5868) +++ trunk/daimonin/src/daieditor/gui/prefs/ResPrefs.java 2009-01-08 20:22:42 UTC (rev 5869) @@ -128,11 +128,11 @@ /** {@inheritDoc} */ public boolean isChanged() { return !( - archField.getText().equals(globalSettings.getArchDirectory().getPath()) - && mapField.getText().equals(globalSettings.getMapsDirectory().getPath()) - && scriptField.getText().equals(globalSettings.getScriptDirectory().getPath()) - && mediaField.getText().equals(globalSettings.getMediaDefaultFolder().getPath()) - && loadArches.isSelected() == prefs.getBoolean(GlobalSettings.LOAD_ARCH_COLL, globalSettings.isArchLoadedFromCollection()) + archField.getText().equals(globalSettings.getArchDirectory().getPath()) && + mapField.getText().equals(globalSettings.getMapsDirectory().getPath()) && + scriptField.getText().equals(globalSettings.getScriptDirectory().getPath()) && + mediaField.getText().equals(globalSettings.getMediaDefaultFolder().getPath()) && + loadArches.isSelected() == prefs.getBoolean(GlobalSettings.LOAD_ARCH_COLL, globalSettings.isArchLoadedFromCollection()) ); } Modified: trunk/src/app/net/sf/gridarta/gui/prefs/AppPrefs.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/prefs/AppPrefs.java 2009-01-08 20:16:00 UTC (rev 5868) +++ trunk/src/app/net/sf/gridarta/gui/prefs/AppPrefs.java 2009-01-08 20:22:42 UTC (rev 5869) @@ -110,9 +110,9 @@ /** {@inheritDoc} */ public boolean isChanged() { return !( - serverField.getText().equals(appPrefsModel.getServer()) - && clientField.getText().equals(appPrefsModel.getClient()) - && editorField.getText().equals(appPrefsModel.getEditor()) + serverField.getText().equals(appPrefsModel.getServer()) && + clientField.getText().equals(appPrefsModel.getClient()) && + editorField.getText().equals(appPrefsModel.getEditor()) ); } Modified: trunk/src/app/net/sf/gridarta/gui/prefs/GUIPrefs.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/prefs/GUIPrefs.java 2009-01-08 20:16:00 UTC (rev 5868) +++ trunk/src/app/net/sf/gridarta/gui/prefs/GUIPrefs.java 2009-01-08 20:22:42 UTC (rev 5869) @@ -122,9 +122,9 @@ final String currentName = prefs.get(MainControl.PREFS_LANGUAGE, null); final Locale current = currentName != null ? new Locale(currentName) : null; return !( - (loc == null ? current == null : loc.equals(current)) - && mapPanelBottom.isSelected() == prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT) - && showMainToolbar.isSelected() == prefs.getBoolean(MainView.SHOW_MAIN_TOOLBAR_KEY, MainView.SHOW_MAIN_TOOLBAR_DEFAULT) + (loc == null ? current == null : loc.equals(current)) && + mapPanelBottom.isSelected() == prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT) && + showMainToolbar.isSelected() == prefs.getBoolean(MainView.SHOW_MAIN_TOOLBAR_KEY, MainView.SHOW_MAIN_TOOLBAR_DEFAULT) ); } Modified: trunk/src/app/net/sf/gridarta/gui/prefs/MiscPrefs.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/prefs/MiscPrefs.java 2009-01-08 20:16:00 UTC (rev 5868) +++ trunk/src/app/net/sf/gridarta/gui/prefs/MiscPrefs.java 2009-01-08 20:22:42 UTC (rev 5869) @@ -96,8 +96,8 @@ /** {@inheritDoc} */ public boolean isChanged() { return !( - userField.getText().equals(prefs.get(AbstractMainControl.PREFS_USERNAME, AbstractMainControl.PREFS_USERNAME_DEFAULT)) - && checkMaps.isSelected() == MapFileFilter.isPerformingRealChecks() + userField.getText().equals(prefs.get(AbstractMainControl.PREFS_USERNAME, AbstractMainControl.PREFS_USERNAME_DEFAULT)) && + checkMaps.isSelected() == MapFileFilter.isPerformingRealChecks() ); } Modified: trunk/src/app/net/sf/gridarta/gui/prefs/NetPrefs.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/prefs/NetPrefs.java 2009-01-08 20:16:00 UTC (rev 5868) +++ trunk/src/app/net/sf/gridarta/gui/prefs/NetPrefs.java 2009-01-08 20:22:42 UTC (rev 5869) @@ -96,9 +96,9 @@ /** {@inheritDoc} */ public boolean isChanged() { return !( - proxyType.getSelectedItem() == Proxy.Type.valueOf(PREFS.get(NET_PREFS_KEY_TYPE, "DIRECT")) - && PREFS.get(NET_PREFS_KEY_HOST, "").equals(proxyHost.getText()) - && PREFS.getInt(NET_PREFS_KEY_PORT, 3128) == (Integer) proxyPort.getValue() + proxyType.getSelectedItem() == Proxy.Type.valueOf(PREFS.get(NET_PREFS_KEY_TYPE, "DIRECT")) && + PREFS.get(NET_PREFS_KEY_HOST, "").equals(proxyHost.getText()) && + PREFS.getInt(NET_PREFS_KEY_PORT, 3128) == (Integer) proxyPort.getValue() ); } Modified: trunk/src/app/net/sf/gridarta/gui/prefs/UpdatePrefs.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/prefs/UpdatePrefs.java 2009-01-08 20:16:00 UTC (rev 5868) +++ trunk/src/app/net/sf/gridarta/gui/prefs/UpdatePrefs.java 2009-01-08 20:22:42 UTC (rev 5869) @@ -94,8 +94,8 @@ /** {@inheritDoc} */ public boolean isChanged() { return !( - autoUpdate.isSelected() == PREFS.getBoolean(UpdaterManager.AUTO_CHECK_KEY, UpdaterManager.AUTO_CHECK_DEFAULT) - && interval.getSelectedIndex() == PREFS.getInt(UpdaterManager.INTERVAL_KEY, UpdaterManager.INTERVAL_DEFAULT) + autoUpdate.isSelected() == PREFS.getBoolean(UpdaterManager.AUTO_CHECK_KEY, UpdaterManager.AUTO_CHECK_DEFAULT) && + interval.getSelectedIndex() == PREFS.getInt(UpdaterManager.INTERVAL_KEY, UpdaterManager.INTERVAL_DEFAULT) ); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2009-01-08 20:28:18
|
Revision: 5870 http://gridarta.svn.sourceforge.net/gridarta/?rev=5870&view=rev Author: akirschbaum Date: 2009-01-08 20:28:11 +0000 (Thu, 08 Jan 2009) Log Message: ----------- Fix part of #1842541 (File Options... Paths and Resources): suppress spurious "Prefs changed" dialog. Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java trunk/daimonin/ChangeLog trunk/daimonin/src/daieditor/gui/prefs/ResPrefs.java Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2009-01-08 20:22:42 UTC (rev 5869) +++ trunk/crossfire/ChangeLog 2009-01-08 20:28:11 UTC (rev 5870) @@ -1,7 +1,8 @@ 2009-01-08 Andreas Kirschbaum * Fix part of #1842541 (File Options... Paths and Resources): - always save absolute path names. + always save absolute path names; suppress spurious "Prefs changed" + dialog. 2009-01-07 Andreas Kirschbaum Modified: trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java 2009-01-08 20:22:42 UTC (rev 5869) +++ trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java 2009-01-08 20:28:11 UTC (rev 5870) @@ -141,9 +141,9 @@ final String selectedimageSet = (String) imageSetBox.getSelectedItem(); final String imageSet = selectedimageSet == null ? "disabled" : selectedimageSet; return !( - archField.getText().equals(globalSettings.getArchDirectory().getPath()) && - mapField.getText().equals(globalSettings.getMapsDirectory().getPath()) && - scriptField.getText().equals(globalSettings.getScriptDirectory().getPath()) && + createPath(archField.getText()).equals(globalSettings.getArchDirectory().getPath()) && + createPath(mapField.getText()).equals(globalSettings.getMapsDirectory().getPath()) && + createPath(scriptField.getText()).equals(globalSettings.getScriptDirectory().getPath()) && loadArches.isSelected() == prefs.getBoolean(GlobalSettings.LOAD_ARCH_COLL, globalSettings.isArchLoadedFromCollection()) && imageSet.equals(getCurrentImageSet()) ); Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2009-01-08 20:22:42 UTC (rev 5869) +++ trunk/daimonin/ChangeLog 2009-01-08 20:28:11 UTC (rev 5870) @@ -1,7 +1,8 @@ 2009-01-08 Andreas Kirschbaum * Fix part of #1842541 (File Options... Paths and Resources): - always save absolute path names. + always save absolute path names; suppress spurious "Prefs changed" + dialog. 2009-01-07 Andreas Kirschbaum Modified: trunk/daimonin/src/daieditor/gui/prefs/ResPrefs.java =================================================================== --- trunk/daimonin/src/daieditor/gui/prefs/ResPrefs.java 2009-01-08 20:22:42 UTC (rev 5869) +++ trunk/daimonin/src/daieditor/gui/prefs/ResPrefs.java 2009-01-08 20:28:11 UTC (rev 5870) @@ -128,10 +128,10 @@ /** {@inheritDoc} */ public boolean isChanged() { return !( - archField.getText().equals(globalSettings.getArchDirectory().getPath()) && - mapField.getText().equals(globalSettings.getMapsDirectory().getPath()) && - scriptField.getText().equals(globalSettings.getScriptDirectory().getPath()) && - mediaField.getText().equals(globalSettings.getMediaDefaultFolder().getPath()) && + createPath(archField.getText()).equals(globalSettings.getArchDirectory().getPath()) && + createPath(mapField.getText()).equals(globalSettings.getMapsDirectory().getPath()) && + createPath(scriptField.getText()).equals(globalSettings.getScriptDirectory().getPath()) && + createPath(mediaField.getText()).equals(globalSettings.getMediaDefaultFolder().getPath()) && loadArches.isSelected() == prefs.getBoolean(GlobalSettings.LOAD_ARCH_COLL, globalSettings.isArchLoadedFromCollection()) ); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2009-01-08 20:31:37
|
Revision: 5871 http://gridarta.svn.sourceforge.net/gridarta/?rev=5871&view=rev Author: akirschbaum Date: 2009-01-08 20:31:18 +0000 (Thu, 08 Jan 2009) Log Message: ----------- Update ChangeLog messages. Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2009-01-08 20:28:11 UTC (rev 5870) +++ trunk/crossfire/ChangeLog 2009-01-08 20:31:18 UTC (rev 5871) @@ -1,8 +1,7 @@ 2009-01-08 Andreas Kirschbaum - * Fix part of #1842541 (File Options... Paths and Resources): - always save absolute path names; suppress spurious "Prefs changed" - dialog. + * Fix #1842541 (File Options... Paths and Resources): always save + absolute path names; suppress spurious "Prefs changed" dialog. 2009-01-07 Andreas Kirschbaum Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2009-01-08 20:28:11 UTC (rev 5870) +++ trunk/daimonin/ChangeLog 2009-01-08 20:31:18 UTC (rev 5871) @@ -1,8 +1,7 @@ 2009-01-08 Andreas Kirschbaum - * Fix part of #1842541 (File Options... Paths and Resources): - always save absolute path names; suppress spurious "Prefs changed" - dialog. + * Fix #1842541 (File Options... Paths and Resources): always save + absolute path names; suppress spurious "Prefs changed" dialog. 2009-01-07 Andreas Kirschbaum This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2009-01-09 00:16:48
|
Revision: 5872 http://gridarta.svn.sourceforge.net/gridarta/?rev=5872&view=rev Author: akirschbaum Date: 2009-01-09 00:16:39 +0000 (Fri, 09 Jan 2009) Log Message: ----------- Update JAPI library. Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/crossfire/src/cfeditor/CFJavaEditor.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/action.properties trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java trunk/crossfire/src/cfeditor/gui/map/DefaultMapPropertiesDialogFactory.java trunk/crossfire/src/cfeditor/gui/map/DefaultMapViewFactory.java trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java trunk/daimonin/ChangeLog trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/DaimoninEditor.java trunk/daimonin/src/daieditor/action.properties trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java trunk/daimonin/src/daieditor/gui/map/DefaultMapPropertiesDialogFactory.java trunk/daimonin/src/daieditor/gui/map/DefaultMapViewFactory.java trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java trunk/daimonin/src/daieditor/gui/prefs/ResPrefs.java trunk/gridarta.iml trunk/src/app/net/sf/gridarta/AbstractMainControl.java trunk/src/app/net/sf/gridarta/DefaultMapManager.java trunk/src/app/net/sf/gridarta/FileControl.java trunk/src/app/net/sf/gridarta/MapImageCache.java trunk/src/app/net/sf/gridarta/ProcessRunner.java trunk/src/app/net/sf/gridarta/action.properties trunk/src/app/net/sf/gridarta/archtype/ArchetypeType.java trunk/src/app/net/sf/gridarta/archtype/ArchetypeTypeParser.java trunk/src/app/net/sf/gridarta/archtype/ArchetypeTypeSetParser.java trunk/src/app/net/sf/gridarta/archtype/CAttribBitmask.java trunk/src/app/net/sf/gridarta/data/AbstractNamedObjects.java trunk/src/app/net/sf/gridarta/data/NamedTreeNode.java trunk/src/app/net/sf/gridarta/filter/NamedGameObjectMatcherFilter.java trunk/src/app/net/sf/gridarta/gameobject/AbstractArchetypeParser.java trunk/src/app/net/sf/gridarta/gameobject/AbstractArchetypeSet.java trunk/src/app/net/sf/gridarta/gameobject/AbstractArchetypeSetLoader.java trunk/src/app/net/sf/gridarta/gameobject/Collector.java trunk/src/app/net/sf/gridarta/gameobject/anim/DefaultAnimationObjects.java trunk/src/app/net/sf/gridarta/gameobject/face/DefaultFaceObjects.java trunk/src/app/net/sf/gridarta/gameobject/match/GameObjectMatchersParser.java trunk/src/app/net/sf/gridarta/gameobject/scripts/DefaultScriptArchEditor.java trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEventEditor.java trunk/src/app/net/sf/gridarta/gui/About.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/MapFileFilter.java trunk/src/app/net/sf/gridarta/gui/MapManagerActions.java trunk/src/app/net/sf/gridarta/gui/MapPreview.java trunk/src/app/net/sf/gridarta/gui/RecentManager.java trunk/src/app/net/sf/gridarta/gui/ReplaceDialog.java trunk/src/app/net/sf/gridarta/gui/StatusBar.java trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserView.java trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java trunk/src/app/net/sf/gridarta/gui/archetypechooser/DirectionPane.java trunk/src/app/net/sf/gridarta/gui/errorview/DefaultErrorView.java trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java trunk/src/app/net/sf/gridarta/gui/findarchetypes/TableModel.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/ArchTab.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/EventsTab.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java trunk/src/app/net/sf/gridarta/gui/map/AbstractMapTilePane.java trunk/src/app/net/sf/gridarta/gui/map/DefaultMapActions.java trunk/src/app/net/sf/gridarta/gui/map/GoLocationDialog.java trunk/src/app/net/sf/gridarta/gui/map/MapCursorActions.java trunk/src/app/net/sf/gridarta/gui/map/MapFileActions.java trunk/src/app/net/sf/gridarta/gui/map/MapPreviewAccessory.java trunk/src/app/net/sf/gridarta/gui/map/MapView.java trunk/src/app/net/sf/gridarta/gui/map/ShrinkMapSizeDialog.java trunk/src/app/net/sf/gridarta/gui/map/TilePanel.java trunk/src/app/net/sf/gridarta/gui/map/ViewActions.java trunk/src/app/net/sf/gridarta/gui/map/tools/BasicAbstractTool.java trunk/src/app/net/sf/gridarta/gui/map/tools/DeletionTool.java trunk/src/app/net/sf/gridarta/gui/map/tools/InsertionTool.java trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolderTreeActions.java trunk/src/app/net/sf/gridarta/gui/newmap/AbstractMapsizeNewMapDialog.java trunk/src/app/net/sf/gridarta/gui/newmap/AbstractNewMapDialog.java trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialog.java trunk/src/app/net/sf/gridarta/gui/newmap/NewPickmapDialog.java trunk/src/app/net/sf/gridarta/gui/newmap/NewPickmapFolderDialog.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/CurrentPickmapActions.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserView.java trunk/src/app/net/sf/gridarta/gui/prefs/AppPrefs.java trunk/src/app/net/sf/gridarta/gui/prefs/DevPrefs.java trunk/src/app/net/sf/gridarta/gui/prefs/GUIPrefs.java trunk/src/app/net/sf/gridarta/gui/prefs/MapValidatorPrefs.java trunk/src/app/net/sf/gridarta/gui/prefs/MiscPrefs.java trunk/src/app/net/sf/gridarta/gui/prefs/NetPrefs.java trunk/src/app/net/sf/gridarta/gui/prefs/UpdatePrefs.java trunk/src/app/net/sf/gridarta/gui/script/ScriptManagerFactory.java trunk/src/app/net/sf/gridarta/gui/script/ScriptView.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java trunk/src/app/net/sf/gridarta/gui/undo/SwingUtils.java trunk/src/app/net/sf/gridarta/gui/undo/UndoControl.java trunk/src/app/net/sf/gridarta/io/AbstractGameObjectParser.java trunk/src/app/net/sf/gridarta/map/DefaultMapModel.java trunk/src/app/net/sf/gridarta/map/validation/AbstractValidator.java trunk/src/app/net/sf/gridarta/map/validation/ValidationError.java trunk/src/app/net/sf/gridarta/preferences/Storage.java trunk/src/app/net/sf/gridarta/script/ScriptController.java trunk/src/app/net/sf/gridarta/spells/SpellsUtils.java trunk/src/app/net/sf/gridarta/spells/XMLSpellLoader.java trunk/src/app/net/sf/gridarta/textedit/scripteditor/Actions.java trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditControl.java trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditView.java trunk/src/app/net/sf/gridarta/textedit/scripteditor/UndoActions.java trunk/src/app/net/sf/gridarta/textedit/textarea/actions/Find.java trunk/src/app/net/sf/gridarta/textedit/textarea/actions/Replace.java trunk/src/app/net/sf/gridarta/treasurelist/CFTreasureListTree.java trunk/src/app/net/sf/gridarta/treasurelist/TreasureListsParser.java trunk/src/app/net/sf/gridarta/updater/Updater.java trunk/src/app/net/sf/gridarta/updater/UpdaterManager.java trunk/textedit.iml Added Paths: ----------- trunk/lib/japi-lib-argparser-trunk-773.jar trunk/lib/japi-lib-lang-trunk-773.jar trunk/lib/japi-lib-swing-about-trunk-773.jar trunk/lib/japi-lib-swing-action-trunk-773.jar trunk/lib/japi-lib-swing-extlib-trunk-773.jar trunk/lib/japi-lib-swing-misc-trunk-773.jar trunk/lib/japi-lib-swing-prefs-trunk-773.jar trunk/lib/japi-lib-swing-tod-trunk-773.jar trunk/lib/japi-lib-util-trunk-773.jar trunk/lib/japi-lib-xml-trunk-773.jar Removed Paths: ------------- trunk/lib/japi-lib-argparser-0.1.jar trunk/lib/japi-lib-lang-0.1.jar trunk/lib/japi-lib-swing-about-0.1.jar trunk/lib/japi-lib-swing-action-0.1.jar trunk/lib/japi-lib-swing-extlib-0.1.jar trunk/lib/japi-lib-swing-misc-0.1.jar trunk/lib/japi-lib-swing-prefs-0.1.jar trunk/lib/japi-lib-swing-tod-0.1.jar trunk/lib/japi-lib-util-0.1.jar trunk/lib/japi-lib-xml-0.1.jar Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2009-01-08 20:31:18 UTC (rev 5871) +++ trunk/crossfire/ChangeLog 2009-01-09 00:16:39 UTC (rev 5872) @@ -1,3 +1,7 @@ +2009-01-09 Andreas Kirschbaum + + * Update JAPI library. + 2009-01-08 Andreas Kirschbaum * Fix #1842541 (File Options... Paths and Resources): always save Modified: trunk/crossfire/src/cfeditor/CFJavaEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/CFJavaEditor.java 2009-01-08 20:31:18 UTC (rev 5871) +++ trunk/crossfire/src/cfeditor/CFJavaEditor.java 2009-01-09 00:16:39 UTC (rev 5872) @@ -30,7 +30,8 @@ import net.sf.gridarta.io.ConfigFileUtils; import net.sf.gridarta.preferences.FilePreferencesFactory; import net.sf.gridarta.script.ScriptExecException; -import net.sf.japi.swing.ActionFactory; +import net.sf.japi.swing.ActionBuilder; +import net.sf.japi.swing.ActionBuilderFactory; import net.sf.japi.swing.tod.TipOfTheDayManager; import org.apache.log4j.Logger; @@ -63,15 +64,15 @@ */ public static void main(final String... args) { System.setProperty("net.sf.japi.swing.tod", "cfeditor.tod"); - // Make sure the locale is set before any ActionFactory is used. + // Make sure the locale is set before any ActionBuilder is used. final String locName = prefs.get(MainControl.PREFS_LANGUAGE, null); if (locName != null) { Locale.setDefault(new Locale(locName)); } - // Now add prefs to the ActionFactory. - final ActionFactory actionFactory = ActionFactory.getFactory("cfeditor"); - actionFactory.addPref(CMainControl.class); - actionFactory.addParent(ActionFactory.getFactory("net.sf.gridarta")); + // Now add prefs to the ActionBuilder. + final ActionBuilder actionBuilder = ActionBuilderFactory.getInstance().getActionBuilder("cfeditor"); + actionBuilder.addPref(CMainControl.class); + actionBuilder.addParent(ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta")); final SplashScreen splashScreen = new SplashScreen(); splashScreen.show(); final List<String> infiles = new ArrayList<String>(); // map file names to open initially Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2009-01-08 20:31:18 UTC (rev 5871) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2009-01-09 00:16:39 UTC (rev 5872) @@ -114,7 +114,8 @@ import net.sf.gridarta.treasurelist.CFTreasureListTree; import net.sf.gridarta.treasurelist.TreasureLocation; import net.sf.gridarta.treasurelist.TreasureTreeNode; -import net.sf.japi.swing.ActionFactory; +import net.sf.japi.swing.ActionBuilder; +import net.sf.japi.swing.ActionBuilderFactory; import net.sf.japi.swing.prefs.PreferencesGroup; import org.jetbrains.annotations.NotNull; @@ -128,8 +129,8 @@ */ public final class CMainControl extends AbstractMainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> { - /** Action Factory. */ - private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); + /** Action Builder. */ + private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("cfeditor"); /** Preferences default for auto validation. */ private static final boolean PREFS_VALIDATOR_AUTO_DEFAULT = true; @@ -309,7 +310,7 @@ CommonConstants.NORTH_WEST, }; final MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> mapPropertiesDialogFactory = new DefaultMapPropertiesDialogFactory(mapManager, mapArchObjectParserFactory, mapArchObjectFactory, globalSettings); - return new DefaultMapActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, getMainView(), getMainView(), globalSettings, mapManager, mapViewManager, exitMatcher, mapFileFilter, selectedSquareView, directionMap, true, mapPropertiesDialogFactory, mapViewSettings); + return new DefaultMapActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_BUILDER, getMainView(), getMainView(), globalSettings, mapManager, mapViewManager, exitMatcher, mapFileFilter, selectedSquareView, directionMap, true, mapPropertiesDialogFactory, mapViewSettings); } /** {@inheritDoc} */ Modified: trunk/crossfire/src/cfeditor/action.properties =================================================================== --- trunk/crossfire/src/cfeditor/action.properties 2009-01-08 20:31:18 UTC (rev 5871) +++ trunk/crossfire/src/cfeditor/action.properties 2009-01-09 00:16:39 UTC (rev 5872) @@ -20,7 +20,7 @@ # Warning: This file MUST be ISO-8859-1 # See http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html#encoding -ActionFactory.additionalBundles=cfeditor.messages +ActionBuilder.additionalBundles=cfeditor.messages ######## # Menus Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java 2009-01-08 20:31:18 UTC (rev 5871) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java 2009-01-09 00:16:39 UTC (rev 5872) @@ -37,7 +37,8 @@ import net.sf.gridarta.io.GameObjectParser; import net.sf.gridarta.io.PathManager; import net.sf.gridarta.utils.StringUtils; -import net.sf.japi.swing.ActionFactory; +import net.sf.japi.swing.ActionBuilder; +import net.sf.japi.swing.ActionBuilderFactory; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -56,8 +57,8 @@ /** The Logger for printing log messages. */ private static final Logger log = Logger.getLogger(ArchetypeParser.class); - /** Action Factory. */ - private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); + /** Action Builder. */ + private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("cfeditor"); /** * The game object parser instance. @@ -196,7 +197,7 @@ animText = null; } catch (final DuplicateAnimationException e) { // TODO: Report to the user - log.warn(ACTION_FACTORY.format("logDuplicateAnimation", e.getDuplicate().getAnimName())); + log.warn(ACTION_BUILDER.format("logDuplicateAnimation", e.getDuplicate().getAnimName())); } archetype.addObjectText("animation " + animationName); @@ -217,7 +218,7 @@ loreText.append(thisLine2).append("\n"); // thisLine2 allows leading whitespaces } } else if (thisLine.startsWith("Object ")) { - log.warn(ACTION_FACTORY.format("logInventoryInDefArch", thisLine)); + log.warn(ACTION_BUILDER.format("logInventoryInDefArch", thisLine)); } else if (thisLine.startsWith("arch ")) { final GameObject invObject = gameObjectParser.load(in, thisLine, invObjects); assert invObject != null; @@ -294,14 +295,14 @@ } } else if (thisLine.startsWith("x ")) { if (!archmore && !archetype.getArchetypeName().equals(STARTARCH_NAME)) { - log.warn(ACTION_FACTORY.format("logFoundCoordInDefArchSingleTileOrHead", "x", archetype.getArchetypeName())); + log.warn(ACTION_BUILDER.format("logFoundCoordInDefArchSingleTileOrHead", "x", archetype.getArchetypeName())); archetype.addObjectText(thisLine); } else { archetype.setMultiX(Integer.parseInt(thisLine.substring(2))); } } else if (thisLine.startsWith("y ")) { if (!archmore && !archetype.getArchetypeName().equals(STARTARCH_NAME)) { - log.warn(ACTION_FACTORY.format("logFoundCoordInDefArchSingleTileOrHead", "y", archetype.getArchetypeName())); + log.warn(ACTION_BUILDER.format("logFoundCoordInDefArchSingleTileOrHead", "y", archetype.getArchetypeName())); archetype.addObjectText(thisLine); } else { archetype.setMultiY(Integer.parseInt(thisLine.substring(2))); @@ -311,17 +312,17 @@ final int typeNo = Integer.parseInt(thisLine.substring(5)); archetype.setTypeNo(typeNo); if (typeNo == 0) { - log.warn(ACTION_FACTORY.format("logDefArchWithZeroType", archetype.getArchetypeName())); + log.warn(ACTION_BUILDER.format("logDefArchWithZeroType", archetype.getArchetypeName())); } } catch (final NumberFormatException e) { - log.warn(ACTION_FACTORY.format("logDefArchWithInvalidTypeNr", archetype.getArchetypeName(), thisLine.substring(5))); + log.warn(ACTION_BUILDER.format("logDefArchWithInvalidTypeNr", archetype.getArchetypeName(), thisLine.substring(5))); archetype.addObjectText(thisLine); } } else if (thisLine.startsWith("direction ")) { try { archetype.setDirection(Integer.parseInt(thisLine.substring(10))); } catch (final NumberFormatException e) { - log.warn(ACTION_FACTORY.format("logDefArchWithInvalidDirection", archetype.getArchetypeName(), thisLine.substring(10))); + log.warn(ACTION_BUILDER.format("logDefArchWithInvalidDirection", archetype.getArchetypeName(), thisLine.substring(10))); } archetype.addObjectText(thisLine); } else if (thisLine.startsWith("face ")) { Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultMapPropertiesDialogFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultMapPropertiesDialogFactory.java 2009-01-08 20:31:18 UTC (rev 5871) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultMapPropertiesDialogFactory.java 2009-01-09 00:16:39 UTC (rev 5872) @@ -33,7 +33,8 @@ import net.sf.gridarta.io.MapArchObjectParserFactory; import net.sf.gridarta.map.MapArchObjectFactory; import net.sf.gridarta.map.MapControl; -import net.sf.japi.swing.ActionFactory; +import net.sf.japi.swing.ActionBuilder; +import net.sf.japi.swing.ActionBuilderFactory; import org.jetbrains.annotations.NotNull; /** @@ -43,8 +44,8 @@ */ public class DefaultMapPropertiesDialogFactory implements MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> { - /** Action Factory. */ - private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); + /** Action Builder. */ + private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("cfeditor"); /** * The {@link MapManager} to use. @@ -88,14 +89,14 @@ /** {@inheritDoc} */ public void showDialog(@NotNull final Component parent, @NotNull final JFrame helpParent, @NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> level, @NotNull final FileFilter mapFileFilter) { final MapPropertiesDialog pane = new MapPropertiesDialog(helpParent, mapManager, mapArchObjectParserFactory, mapArchObjectFactory, globalSettings, level, mapFileFilter); - final JDialog dialog = pane.createDialog(parent, ACTION_FACTORY.format("mapTitle", level.getMapModel().getMapArchObject().getMapDisplayName(), level.getMapFileName())); + final JDialog dialog = pane.createDialog(parent, ACTION_BUILDER.format("mapTitle", level.getMapModel().getMapArchObject().getMapDisplayName(), level.getMapFileName())); pane.dialog = dialog; dialog.getRootPane().setDefaultButton(pane.okButton); dialog.setResizable(true); dialog.setModal(false); dialog.setVisible(true); if (!pane.mapTilePaneEnabled) { - ACTION_FACTORY.showOnetimeMessageDialog(dialog, JOptionPane.WARNING_MESSAGE, "mapTilesNoMapFileNoMapTilePane"); + ACTION_BUILDER.showOnetimeMessageDialog(dialog, JOptionPane.WARNING_MESSAGE, "mapTilesNoMapFileNoMapTilePane"); } } Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultMapViewFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultMapViewFactory.java 2009-01-08 20:31:18 UTC (rev 5871) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultMapViewFactory.java 2009-01-09 00:16:39 UTC (rev 5872) @@ -35,7 +35,8 @@ import net.sf.gridarta.gui.map.tools.ToolPalette; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.map.MapControl; -import net.sf.japi.swing.ActionFactory; +import net.sf.japi.swing.ActionBuilder; +import net.sf.japi.swing.ActionBuilderFactory; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -45,8 +46,8 @@ */ public class DefaultMapViewFactory implements MapViewFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> { - /** The action factory. */ - private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); + /** The action builder. */ + private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("cfeditor"); /** * The {@link MapViewSettings} instance to use. @@ -103,7 +104,7 @@ /** {@inheritDoc} */ @NotNull public MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapView(@NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, @Nullable final Point viewPosition, final int viewCounter) { - return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainView, mapControl, viewCounter, new CMapViewBasic(mapViewSettings, filterControl, editTypes, mapControl.getMapModel(), mapControl.isPickmap(), viewPosition, toolPalette, 32, 32, selectedSquareView), ACTION_FACTORY, mapImageCache); + return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainView, mapControl, viewCounter, new CMapViewBasic(mapViewSettings, filterControl, editTypes, mapControl.getMapModel(), mapControl.isPickmap(), viewPosition, toolPalette, 32, 32, selectedSquareView), ACTION_BUILDER, mapImageCache); } } // class DefaultMapViewFactory Modified: trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java 2009-01-08 20:31:18 UTC (rev 5871) +++ trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java 2009-01-09 00:16:39 UTC (rev 5872) @@ -47,7 +47,8 @@ import net.sf.gridarta.map.MapArchObjectFactory; import net.sf.gridarta.map.MapControl; import net.sf.gridarta.map.MapModel; -import net.sf.japi.swing.ActionFactory; +import net.sf.japi.swing.ActionBuilder; +import net.sf.japi.swing.ActionBuilderFactory; import org.jetbrains.annotations.NotNull; /** @@ -63,8 +64,8 @@ /** Serial version UID. */ private static final long serialVersionUID = 1L; - /** Action Factory. */ - private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); + /** Action Builder. */ + private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("cfeditor"); /** * The parent frame for help windows. @@ -155,16 +156,16 @@ private final JFormattedTextField fieldSkySetting = new JFormattedTextField(); // sky setting /** JButton for help. */ - private final JButton helpButton = new JButton(ACTION_FACTORY.createAction(false, "mapHelp", this)); + private final JButton helpButton = new JButton(ACTION_BUILDER.createAction(false, "mapHelp", this)); /** JButton for ok. */ - public final JButton okButton = new JButton(ACTION_FACTORY.createAction(false, "mapOkay", this)); + public final JButton okButton = new JButton(ACTION_BUILDER.createAction(false, "mapOkay", this)); /** JButton for restore. */ - private final JButton restoreButton = new JButton(ACTION_FACTORY.createAction(false, "mapRestore", this)); + private final JButton restoreButton = new JButton(ACTION_BUILDER.createAction(false, "mapRestore", this)); /** JButton for cancel. */ - private final JButton cancelButton = new JButton(ACTION_FACTORY.createAction(false, "mapCancel", this)); + private final JButton cancelButton = new JButton(ACTION_BUILDER.createAction(false, "mapCancel", this)); /** The MapTilePane. */ private final MapTilePane mapTilePane; @@ -210,26 +211,26 @@ tabs.setBorder(new EmptyBorder(10, 4, 4, 4)); final JPanel mapPanel = createMapPanel(map); - tabs.add(ACTION_FACTORY.getString("mapMapTabTitle"), mapPanel); + tabs.add(ACTION_BUILDER.getString("mapMapTabTitle"), mapPanel); final JPanel textPanel = createMapTextPanel(map); - tabs.add(ACTION_FACTORY.getString("mapTextTabTitle"), textPanel); + tabs.add(ACTION_BUILDER.getString("mapTextTabTitle"), textPanel); final JPanel lorePanel = createMapLorePanel(map); - tabs.add(ACTION_FACTORY.getString("mapLoreTabTitle"), lorePanel); + tabs.add(ACTION_BUILDER.getString("mapLoreTabTitle"), lorePanel); final JPanel parametersPanel = createParametersPanel(map); - tabs.add(ACTION_FACTORY.getString("mapParametersTabTitle"), parametersPanel); + tabs.add(ACTION_BUILDER.getString("mapParametersTabTitle"), parametersPanel); final JPanel shopPanel = createShopPanel(map); - tabs.add(ACTION_FACTORY.getString("mapShopTabTitle"), shopPanel); + tabs.add(ACTION_BUILDER.getString("mapShopTabTitle"), shopPanel); final JPanel weatherPanel = createWeatherPanel(map); - tabs.add(ACTION_FACTORY.getString("mapWeatherTabTitle"), weatherPanel); + tabs.add(ACTION_BUILDER.getString("mapWeatherTabTitle"), weatherPanel); mapTilePane = new MapTilePane(mapManager, mapArchObjectParserFactory, mapArchObjectFactory, globalSettings, mapControl, mapFileFilter); final JPanel tilePanel = createTilePathPanel(mapTilePane); - tabs.add(ACTION_FACTORY.getString("mapTilesTabTitle"), tilePanel); + tabs.add(ACTION_BUILDER.getString("mapTilesTabTitle"), tilePanel); mapTilePaneEnabled = mapControl.getMapFile() != null; tabs.setEnabledAt(tabs.indexOfComponent(tilePanel), mapTilePaneEnabled); @@ -394,7 +395,7 @@ private void addInputFieldLine(final JPanel panel, final JTextField textField, final int n, final String defaultText, final String labelKey) { textField.setColumns(n); textField.setText(defaultText); - panel.add(new JLabel(ACTION_FACTORY.getString(labelKey)), gbcLabel); + panel.add(new JLabel(ACTION_BUILDER.getString(labelKey)), gbcLabel); panel.add(textField, gbcTextField); } @@ -406,7 +407,7 @@ * @param labelKey the key of the label */ private void addCheckBoxLine(final JPanel panel, final JCheckBox checkBox, final boolean state, final String labelKey) { - checkBox.setText(ACTION_FACTORY.getString(labelKey)); + checkBox.setText(ACTION_BUILDER.getString(labelKey)); checkBox.setSelected(state); panel.add(checkBox, gbcCheckBox); } @@ -472,20 +473,20 @@ // Now do some sanity checks: if (width < 1 || height < 1) { - ACTION_FACTORY.showMessageDialog(this, "mapErrorIllegalSize"); + ACTION_BUILDER.showMessageDialog(this, "mapErrorIllegalSize"); return false; } mapSize = new Size2D(width, height); if (darkness < 0 || darkness > 5) { - ACTION_FACTORY.showMessageDialog(this, "mapErrorInvalidDarkness"); + ACTION_BUILDER.showMessageDialog(this, "mapErrorInvalidDarkness"); return false; } if (mapName.getText().length() == 0) { - ACTION_FACTORY.showMessageDialog(this, "mapErrorMissingMapName"); + ACTION_BUILDER.showMessageDialog(this, "mapErrorMissingMapName"); return false; } } catch (final IllegalArgumentException e) { - ACTION_FACTORY.showMessageDialog(this, "mapErrorInvalidEntry", e.getMessage()); + ACTION_BUILDER.showMessageDialog(this, "mapErrorInvalidEntry", e.getMessage()); return false; } Modified: trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java 2009-01-08 20:31:18 UTC (rev 5871) +++ trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java 2009-01-09 00:16:39 UTC (rev 5872) @@ -39,7 +39,8 @@ import net.sf.gridarta.gui.GUIConstants; import net.sf.gridarta.io.PathManager; import net.sf.gridarta.utils.StringUtils; -import net.sf.japi.swing.ActionFactory; +import net.sf.japi.swing.ActionBuilder; +import net.sf.japi.swing.ActionBuilderFactory; import net.sf.japi.swing.misc.JFileField; import net.sf.japi.swing.prefs.AbstractPrefs; import org.jetbrains.annotations.NotNull; @@ -54,8 +55,8 @@ /** The serial version UID. */ private static final long serialVersionUID = 1; - /** Action Factory. */ - private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); + /** Action Builder. */ + private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("cfeditor"); /** Preferences. */ private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); @@ -86,8 +87,8 @@ * @param globalSettings the global settings instance */ public ResPrefs(final GlobalSettingsImpl globalSettings) { - setListLabelText(ACTION_FACTORY.getString("prefsRes.title")); - setListLabelIcon(ACTION_FACTORY.getIcon("prefsRes.icon")); + setListLabelText(ACTION_BUILDER.getString("prefsRes.title")); + setListLabelIcon(ACTION_BUILDER.getIcon("prefsRes.icon")); this.globalSettings = globalSettings; add(createResourcePanel()); @@ -101,7 +102,7 @@ * @return titled border */ private static Border createTitledBorder(final String titleKey) { - return new CompoundBorder(new TitledBorder(ACTION_FACTORY.getString(titleKey)), GUIConstants.DIALOG_BORDER); + return new CompoundBorder(new TitledBorder(ACTION_BUILDER.getString(titleKey)), GUIConstants.DIALOG_BORDER); } /** {@inheritDoc} */ @@ -115,7 +116,7 @@ prefs.put(GlobalSettings.USE_IMAGESET, imageSet == null || imageSet.equals("disabled") ? "none" : imageSet); globalSettings.readGlobalSettings(); - ACTION_FACTORY.showOnetimeMessageDialog(this, JOptionPane.WARNING_MESSAGE, "optionsRestart"); + ACTION_BUILDER.showOnetimeMessageDialog(this, JOptionPane.WARNING_MESSAGE, "optionsRestart"); } /** {@inheritDoc} */ @@ -186,7 +187,7 @@ final Box globalPanel = Box.createVerticalBox(); globalPanel.setBorder(createTitledBorder("optionsGlobal")); - loadArches = new JCheckBox(ACTION_FACTORY.createToggle(false, "optionsLoadArchColl", this)); + loadArches = new JCheckBox(ACTION_BUILDER.createToggle(false, "optionsLoadArchColl", this)); loadArches.setSelected(globalSettings.isArchLoadedFromCollection()); globalPanel.add(loadArches); if (globalSettings.isArchLoadedFromCollection()) { @@ -205,13 +206,13 @@ private Component buildImageSetBox() { final Box lineLayout = Box.createHorizontalBox(); - final String[] imageSetNames = StringUtils.patternWhitespace.split(ACTION_FACTORY.getString("availableImageSets"), 0); + final String[] imageSetNames = StringUtils.patternWhitespace.split(ACTION_BUILDER.getString("availableImageSets"), 0); Arrays.sort(imageSetNames); imageSets = new String[imageSetNames.length + 1]; imageSets[0] = "disabled"; System.arraycopy(imageSetNames, 0, imageSets, 1, imageSetNames.length); - lineLayout.add(new JLabel(ACTION_FACTORY.getString("optionsImageSet"))); // create label + lineLayout.add(new JLabel(ACTION_BUILDER.getString("optionsImageSet"))); // create label imageSetBox = new JComboBox(imageSets); // set "content" imageSetBox.setSelectedIndex(linearSearch(imageSets, getCurrentImageSet())); @@ -229,8 +230,8 @@ * @return the created JTextField */ private static JFileField createFileField(final Container panel, final String key, final String initial, final int fileSelectionMode) { - final JFileField fileField = new JFileField(ACTION_FACTORY.getString(key), initial, fileSelectionMode); - final String tooltip = ACTION_FACTORY.getString(key + ".shortdescription"); + final JFileField fileField = new JFileField(ACTION_BUILDER.getString(key), initial, fileSelectionMode); + final String tooltip = ACTION_BUILDER.getString(key + ".shortdescription"); if (tooltip != null) { fileField.setToolTipText(tooltip); } Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2009-01-08 20:31:18 UTC (rev 5871) +++ trunk/daimonin/ChangeLog 2009-01-09 00:16:39 UTC (rev 5872) @@ -1,3 +1,7 @@ +2009-01-09 Andreas Kirschbaum + + * Update JAPI library. + 2009-01-08 Andreas Kirschbaum * Fix #1842541 (File Options... Paths and Resources): always save Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2009-01-08 20:31:18 UTC (rev 5871) +++ trunk/daimonin/src/daieditor/CMainControl.java 2009-01-09 00:16:39 UTC (rev 5872) @@ -133,7 +133,8 @@ import net.sf.gridarta.treasurelist.TreasureTreeNode; import net.sf.gridarta.utils.StringUtils; import net.sf.japi.io.args.ArgParser; -import net.sf.japi.swing.ActionFactory; +import net.sf.japi.swing.ActionBuilder; +import net.sf.japi.swing.ActionBuilderFactory; import net.sf.japi.swing.ActionMethod; import net.sf.japi.swing.prefs.PreferencesGroup; import net.sf.japi.util.filter.file.Factory; @@ -151,8 +152,8 @@ */ public final class CMainControl extends AbstractMainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> { - /** Action Factory. */ - private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("daieditor"); + /** Action Builder. */ + private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("daieditor"); /** The Logger for printing log messages. */ private static final Logger log = Logger.getLogger(CMainControl.class); @@ -310,7 +311,7 @@ /** {@inheritDoc} */ protected void createActions() { - ACTION_FACTORY.createActions(true, this, "cleanCompletelyBlockedSquares", "collectSpells"); + ACTION_BUILDER.createActions(true, this, "cleanCompletelyBlockedSquares", "collectSpells"); } /** {@inheritDoc} */ @@ -345,7 +346,7 @@ CommonConstants.NORTH, }; final MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> mapPropertiesDialogFactory = new DefaultMapPropertiesDialogFactory(mapManager, mapArchObjectParserFactory, mapArchObjectFactory, globalSettings); - return new DefaultMapActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, getMainView(), getMainView(), globalSettings, mapManager, mapViewManager, exitMatcher, mapFileFilter, selectedSquareView, directionMap, false, mapPropertiesDialogFactory, mapViewSettings); + return new DefaultMapActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_BUILDER, getMainView(), getMainView(), globalSettings, mapManager, mapViewManager, exitMatcher, mapFileFilter, selectedSquareView, directionMap, false, mapPropertiesDialogFactory, mapViewSettings); } /** {@inheritDoc} */ @@ -360,7 +361,7 @@ protected void deleteLibraries() { // Delete libraries. final File libs = new File(System.getProperty("user.dir"), "lib"); - final String libsString = ACTION_FACTORY.getString("oldLibs.okayLibs"); + final String libsString = ACTION_BUILDER.getString("oldLibs.okayLibs"); assert libsString != null; final String[] patterns = StringUtils.patternWhitespace.split(libsString, 0); final File[] libFiles = libs.listFiles(Factory.not(new GlobFileFilter(patterns))); @@ -372,7 +373,7 @@ } } } - if (libFiles != null && libFiles.length > 0 && ACTION_FACTORY.showOnetimeConfirmDialog(getMainView(), JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE, "oldLibsFound", libs.toString()) == JOptionPane.YES_OPTION) { + if (libFiles != null && libFiles.length > 0 && ACTION_BUILDER.showOnetimeConfirmDialog(getMainView(), JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE, "oldLibsFound", libs.toString()) == JOptionPane.YES_OPTION) { Arrays.sort(libFiles); for (final File libFile : libFiles) { libFile.delete(); Modified: trunk/daimonin/src/daieditor/DaimoninEditor.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninEditor.java 2009-01-08 20:31:18 UTC (rev 5871) +++ trunk/daimonin/src/daieditor/DaimoninEditor.java 2009-01-09 00:16:39 UTC (rev 5872) @@ -30,7 +30,8 @@ import net.sf.japi.io.args.ArgParser; import net.sf.japi.io.args.BasicCommand; import net.sf.japi.io.args.Option; -import net.sf.japi.swing.ActionFactory; +import net.sf.japi.swing.ActionBuilder; +import net.sf.japi.swing.ActionBuilderFactory; import net.sf.japi.swing.tod.TipOfTheDayManager; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; @@ -75,7 +76,7 @@ } catch (final MissingResourceException e) { log.warn("No build number found:", e); } - // Make sure the locale is set before any ActionFactory is used. + // Make sure the locale is set before any ActionBuilder is used. final String locName = prefs.get(MainControl.PREFS_LANGUAGE, null); if (locName != null) { Locale.setDefault(new Locale(locName)); @@ -111,10 +112,10 @@ public int run(@NotNull final List<String> args) throws Exception { // print jre version, for easier recognition of jre-specific problems System.err.println("Running java version " + System.getProperty("java.version")); - // Now add prefs to the ActionFactory. - final ActionFactory actionFactory = ActionFactory.getFactory("daieditor"); - actionFactory.addPref(CMainControl.class); - actionFactory.addParent(ActionFactory.getFactory("net.sf.gridarta")); + // Now add prefs to the ActionBuilder. + final ActionBuilder actionBuilder = ActionBuilderFactory.getInstance().getActionBuilder("daieditor"); + actionBuilder.addPref(CMainControl.class); + actionBuilder.addParent(ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta")); if (mode == Mode.NORMAL) { splashScreen = new SplashScreen(); splashScreen.show(); Modified: trunk/daimonin/src/daieditor/action.properties =================================================================== --- trunk/daimonin/src/daieditor/action.properties 2009-01-08 20:31:18 UTC (rev 5871) +++ trunk/daimonin/src/daieditor/action.properties 2009-01-09 00:16:39 UTC (rev 5872) @@ -20,7 +20,7 @@ # Warning: This file MUST be ISO-8859-1 # See http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html#encoding -ActionFactory.additionalBundles=daieditor.messages +ActionBuilder.additionalBundles=daieditor.messages ######## # Menus Modified: trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java 2009-01-08 20:31:18 UTC (rev 5871) +++ trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java 2009-01-09 00:16:39 UTC (rev 5872) @@ -33,7 +33,8 @@ import net.sf.gridarta.gameobject.anim.DuplicateAnimationException; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.io.PathManager; -import net.sf.japi.swing.ActionFactory; +import net.sf.japi.swing.ActionBuilder; +import net.sf.japi.swing.ActionBuilderFactory; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -52,8 +53,8 @@ /** The Logger for printing log messages. */ private static final Logger log = Logger.getLogger(ArchetypeParser.class); - /** Action Factory. */ - private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("daieditor"); + /** Action Builder. */ + private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("daieditor"); /** * The animation objects instance. @@ -179,7 +180,7 @@ animText = null; } catch (final DuplicateAnimationException e) { // TODO: Report to the user - log.warn(ACTION_FACTORY.format("logDuplicateAnimation", e.getDuplicate().getAnimName())); + log.warn(ACTION_BUILDER.format("logDuplicateAnimation", e.getDuplicate().getAnimName())); } archetype.addObjectText("animation " + animationName); @@ -192,7 +193,7 @@ animText.append(thisLine).append("\n"); } } else if (thisLine.startsWith("Object ") || thisLine.equals("Object")) { - log.warn(ACTION_FACTORY.format("logInventoryInDefArch", thisLine)); + log.warn(ACTION_BUILDER.format("logInventoryInDefArch", thisLine)); } else if (thisLine.equals("end")) { // we got full arch parsearch = false; // we write this sucker @@ -205,7 +206,7 @@ if (firstArch.getMultiRefCount() == 2) { firstArch.setMultiShapeID(multiShapeID); } else if (multiShapeID != firstArch.getMultiShapeID()) { - log.warn(ACTION_FACTORY.format("logDefArchWithInvalidMpartNr", archetype.getArchetypeName(), firstArch.getArchetypeName(), Integer.toString(multiShapeID), Integer.toString(firstArch.getMultiShapeID()))); + log.warn(ACTION_BUILDER.format("logDefArchWithInvalidMpartNr", archetype.getArchetypeName(), firstArch.getArchetypeName(), Integer.toString(multiShapeID), Integer.toString(firstArch.getMultiShapeID()))); } } else { // add arch to the archpanel - only if it is not the map arch and not in the intern folder @@ -272,14 +273,14 @@ } } else if (thisLine.startsWith("x ")) { if (!archmore && !archetype.getArchetypeName().equals(STARTARCH_NAME)) { - log.warn(ACTION_FACTORY.format("logFoundCoordInDefArchSingleTileOrHead", "x", archetype.getArchetypeName())); + log.warn(ACTION_BUILDER.format("logFoundCoordInDefArchSingleTileOrHead", "x", archetype.getArchetypeName())); archetype.addObjectText(thisLine); } else { archetype.setMultiX(Integer.parseInt(thisLine.substring(2))); } } else if (thisLine.startsWith("y ")) { if (!archmore && !archetype.getArchetypeName().equals(STARTARCH_NAME)) { - log.warn(ACTION_FACTORY.format("logFoundCoordInDefArchSingleTileOrHead", "y", archetype.getArchetypeName())); + log.warn(ACTION_BUILDER.format("logFoundCoordInDefArchSingleTileOrHead", "y", archetype.getArchetypeName())); archetype.addObjectText(thisLine); } else { archetype.setMultiY(Integer.parseInt(thisLine.substring(2))); @@ -289,17 +290,17 @@ final int typeNo = Integer.parseInt(thisLine.substring(5)); archetype.setTypeNo(typeNo); if (typeNo == 0) { - log.warn(ACTION_FACTORY.format("logDefArchWithZeroType", archetype.getArchetypeName())); + log.warn(ACTION_BUILDER.format("logDefArchWithZeroType", archetype.getArchetypeName())); } } catch (final NumberFormatException e) { - log.warn(ACTION_FACTORY.format("logDefArchWithInvalidTypeNr", archetype.getArchetypeName(), thisLine.substring(5))); + log.warn(ACTION_BUILDER.format("logDefArchWithInvalidTypeNr", archetype.getArchetypeName(), thisLine.substring(5))); archetype.addObjectText(thisLine); } } else if (thisLine.startsWith("direction ")) { try { archetype.setDirection(Integer.parseInt(thisLine.substring(10))); } catch (final NumberFormatException e) { - log.warn(ACTION_FACTORY.format("logDefArchWithInvalidDirection", archetype.getArchetypeName(), thisLine.substring(10))); + log.warn(ACTION_BUILDER.format("logDefArchWithInvalidDirection", archetype.getArchetypeName(), thisLine.substring(10))); } archetype.addObjectText(thisLine); } else if (thisLine.startsWith("face ")) { Modified: trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2009-01-08 20:31:18 UTC (rev 5871) +++ trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2009-01-09 00:16:39 UTC (rev 5872) @@ -29,7 +29,8 @@ import net.sf.gridarta.gameobject.face.FaceObjectProviders; import net.sf.gridarta.gui.SystemIcons; import net.sf.gridarta.io.GameObjectParser; -import net.sf.japi.swing.ActionFactory; +import net.sf.japi.swing.ActionBuilder; +import net.sf.japi.swing.ActionBuilderFactory; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -41,8 +42,8 @@ */ public final class ArchetypeSet extends AbstractArchetypeSet<GameObject, MapArchObject, Archetype> { - /** Action Factory. */ - private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("daieditor"); + /** Action Builder. */ + private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("daieditor"); /** * Create the ArchetypeSet. Modified: trunk/daimonin/src/daieditor/gui/map/DefaultMapPropertiesDialogFactory.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/DefaultMapPropertiesDialogFactory.java 2009-01-08 20:31:18 UTC (rev 5871) +++ trunk/daimonin/src/daieditor/gui/map/DefaultMapPropertiesDialogFactory.java 2009-01-09 00:16:39 UTC (rev 5872) @@ -33,7 +33,8 @@ import net.sf.gridarta.io.MapArchObjectParserFactory; import net.sf.gridarta.map.MapArchObjectFactory; import net.sf.gridarta.map.MapControl; -import net.sf.japi.swing.ActionFactory; +import net.sf.japi.swing.ActionBuilder; +import net.sf.japi.swing.ActionBuilderFactory; import org.jetbrains.annotations.NotNull; /** @@ -43,8 +44,8 @@ */ public class DefaultMapPropertiesDialogFactory implements MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> { - /** Action Factory. */ - private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("daieditor"); + /** Action Builder. */ + private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("daieditor"); /** * The {@link MapManager} to use. @@ -88,14 +89,14 @@ /** {@inheritDoc} */ public void showDialog(@NotNull final Component parent, @NotNull final JFrame helpParent, @NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> level, @NotNull final FileFilter mapFileFilter) { final MapPropertiesDialog pane = new MapPropertiesDialog(helpParent, mapManager, mapArchObjectParserFactory, mapArchObjectFactory, globalSettings, level, mapFileFilter); - final JDialog dialog = pane.createDialog(parent, ACTION_FACTORY.format("mapTitle", level.getMapModel().getMapArchObject().getMapDisplayName(), level.getMapFileName())); + final JDialog dialog = pane.createDialog(parent, ACTION_BUILDER.format("mapTitle", level.getMapModel().getMapArchObject().getMapDisplayName(), level.getMapFileName())); pane.dialog = dialog; dialog.getRootPane().setDefaultButton(pane.okButton); dialog.setResizable(true); dialog.setModal(false); dialog.setVisible(true); if (!pane.mapTilePaneEnabled) { - ACTION_FACTORY.showOnetimeMessageDialog(dialog, JOptionPane.WARNING_MESSAGE, "mapTilesNoMapFileNoMapTilePane"); + ACTION_BUILDER.showOnetimeMessageDialog(dialog, JOptionPane.WARNING_MESSAGE, "mapTilesNoMapFileNoMapTilePane"); } } Modified: trunk/daimonin/src/daieditor/gui/map/DefaultMapViewFactory.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/DefaultMapViewFactory.java 2009-01-08 20:31:18 UTC (rev 5871) +++ trunk/daimonin/src/daieditor/gui/map/DefaultMapViewFactory.java 2009-01-09 00:16:39 UTC (rev 5872) @@ -37,7 +37,8 @@ import net.sf.gridarta.gui.map.tools.ToolPalette; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.map.MapControl; -import net.sf.japi.swing.ActionFactory; +import net.sf.japi.swing.ActionBuilder; +import net.sf.japi.swing.ActionBuilderFactory; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -47,8 +48,8 @@ */ public class DefaultMapViewFactory implements MapViewFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> { - /** The action factory. */ - private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("daieditor"); + /** The action builder. */ + private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("daieditor"); /** The {@link MapViewSettings} instance to use. */ @NotNull @@ -112,7 +113,7 @@ /** {@inheritDoc} */ @NotNull public MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapView(@NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, @Nullable final Point viewPosition, final int viewCounter) { - return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainView, mapControl, viewCounter, new CMapViewBasic(mapViewSettings, (CMainControl) mainControl, filterControl, editTypes, mapControl.getMapModel(), mapControl.isPickmap(), viewPosition, faceObjects, toolPalette, IGUIConstants.TILE_ISO_XLEN, IGUIConstants.TILE_ISO_YLEN, selectedSquareView), ACTION_FACTORY, mapImageCache); + return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainView, mapControl, viewCounter, new CMapViewBasic(mapViewSettings, (CMainControl) mainControl, filterControl, editTypes, mapControl.getMapModel(), mapControl.isPickmap(), viewPosition, faceObjects, toolPalette, IGUIConstants.TILE_ISO_XLEN, IGUIConstants.TILE_ISO_YLEN, selectedSquareView), ACTION_BUILDER, mapImageCache); } } // class DefaultMapViewFactory Modified: trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java 2009-01-08 20:31:18 UTC (rev 5871) +++ trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java 2009-01-09 00:16:39 UTC (rev 5872) @@ -57,7 +57,8 @@ import net.sf.gridarta.map.MapArchObjectFactory; import net.sf.gridarta.map.MapControl; import net.sf.gridarta.map.MapModel; -import net.sf.japi.swing.ActionFactory; +import net.sf.japi.swing.ActionBuilder; +import net.sf.japi.swing.ActionBuilderFactory; import net.sf.japi.swing.misc.JFileChooserButton; import org.jetbrains.annotations.NotNull; @@ -74,8 +75,8 @@ /** Serial version UID. */ private static final long serialVersionUID = 1L; - /** Action Factory. */ - private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("daieditor"); + /** Action Builder. */ + private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("daieditor"); /** * The parent frame for help windows. @@ -140,16 +141,16 @@ private final JCheckBox checkboxPvp = new JCheckBox(); /** JButton for help. */ - private final JButton helpButton = new JButton(ACTION_FACTORY.createAction(false, "mapHelp", this)); + private final JButton helpButton = new JButton(ACTION_BUILDER.createAction(false, "mapHelp", this)); /** JButton for ok. */ - public final JButton okButton = new JButton(ACTION_FACTORY.createAction(false, "mapOkay", this)); + public final JButton okButton = new JButton(ACTION_BUILDER.createAction(false, "mapOkay", this)); /** JButton for restore. */ - private final JButton restoreButton = new JButton(ACTION_FACTORY.createAction(false, "mapRestore", this)); + private final JButton restoreButton = new JButton(ACTION_BUILDER.createAction(false, "mapRestore", this)); /** JButton for cancel. */ - private final JButton cancelButton = new JButton(ACTION_FACTORY.createAction(false, "mapCancel", this)); + private final JButton cancelButton = new JButton(ACTION_BUILDER.createAction(false, "mapCancel", this)); /** The MapTilePane. */ private final MapTilePane mapTilePane; @@ -181,11 +182,11 @@ tabs.setBorder(new EmptyBorder(10, 4, 4, 4)); final JPanel mainPanel = createMainPanel(map); - tabs.add(ACTION_FACTORY.getString("mapMapTabTitle"), mainPanel); + tabs.add(ACTION_BUILDER.getString("mapMapTabTitle"), mainPanel); mapTilePane = new MapTilePane(mapManager, mapArchObjectParserFactory, mapArchObjectFactory, globalSettings, mapControl, mapFileFilter); final JPanel tilePanel = createTilePathPanel(mapTilePane); - tabs.add(ACTION_FACTORY.getString("mapTilesTabTitle"), tilePanel); + tabs.add(ACTION_BUILDER.getString("mapTilesTabTitle"), tilePanel); mapTilePaneEnabled = mapControl.getMapFile() != null; tabs.setEnabledAt(tabs.indexOfComponent(tilePanel), mapTilePaneEnabled); @@ -292,12 +293,12 @@ gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.weightx = 2.0; - mapPanel.add(new JLabel(ACTION_FACTORY.getString("mapName")), labelGbc); + mapPanel.add(new JLabel(ACTION_BUILDER.getString("mapName")), labelGbc); mapName.setColumns(16); mapName.setText(map.getMapDisplayName()); mapPanel.add(mapName, gbc); - mapPanel.add(new JLabel(ACTION_FACTORY.getString("mapSound")), labelGbc); + mapPanel.add(new JLabel(ACTION_BUILDER.getString("mapSound")), labelGbc); mapSound.setColumns(16); mapSound.setText(map.getBackgroundMusic()); final JPanel mapSoundPanel = new JPanel(new BorderLayout()); @@ -305,14 +306,14 @@ mapSoundPanel.add(new JFileChooserButton(globalSettings.getMediaDefaultFolder(), mapSound, JFileChooser.FILES_ONLY), BorderLayout.EAST); mapPanel.add(mapSoundPanel, gbc); - mapPanel.add(new JLabel(ACTION_FACTORY.getString("mapWidth")), labelGbc); + mapPanel.add(new JLabel(ACTION_BUILDER.getString("mapWidth")), labelGbc); levelWidthField.setColumns(5); levelWidthField.setValue(mapControl.getMapModel().getMapSize().getWidth()); gbc.gridwidth = 1; gbc.weightx = 1.0; mapPanel.add(levelWidthField, gbc); - mapPanel.add(new JLabel(ACTION_FACTORY.getString("mapHeight")), labelGbc); + mapPanel.add(new JLabel(ACTION_BUILDER.getString("mapHeight")), labelGbc); levelHeightField.setColumns(5); levelHeightField.setValue(mapControl.getMapModel().getMapSize().getHeight()); gbc.gridwidth = GridBagConstraints.REMAINDER; @@ -381,11 +382,11 @@ /** * Creates a border to be used in dialogs to frame dialog component groups. - * @param key i18n Key to look up the l10n title using the ActionFactory + * @param key i18n Key to look up the l10n title using the ActionBuilder * @return Border */ private static Border createTitledBorder(final String key) { - return BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(ACTION_FACTORY.getString(key)), GUIConstants.DIALOG_BORDER); + return BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(ACTION_BUILDER.getString(key)), GUIConstants.DIALOG_BORDER); } /** @@ -398,7 +399,7 @@ */ private static JPanel createPanelLine(final JFormattedTextField textField, final int n, final int defaultValue, final String labelKey) { final JPanel lineLayout = new JPanel(new FlowLayout(FlowLayout.RIGHT)); - lineLayout.add(new JLabel(ACTION_FACTORY.getString(labelKey))); + lineLayout.add(new JLabel(ACTION_BUILDER.getString(labelKey))); textField.setColumns(n); textField.setValue(defaultValue); lineLayout.add(textField); @@ -416,7 +417,7 @@ final JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS)); panel.add(checkBox); - checkBox.setText(ACTION_FACTORY.getString(labelKey)); + checkBox.setText(ACTION_BUILDER.getString(labelKey)); checkBox.setSelected(state); return panel; } @@ -451,7 +452,7 @@ // Now do some sanity checks: if (width < 1 || height < 1) { - ACTION_FACTORY.showMessageDialog(this, "mapErrorIllegalSize"); + ... [truncated message content] |
From: <aki...@us...> - 2009-01-09 08:58:45
|
Revision: 5874 http://gridarta.svn.sourceforge.net/gridarta/?rev=5874&view=rev Author: akirschbaum Date: 2009-01-09 08:58:40 +0000 (Fri, 09 Jan 2009) Log Message: ----------- Add support for range checks on integer attributes in game object attributes dialog. Modified Paths: -------------- trunk/resource/system/dtd/types.dtd trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeInt.java trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeParser.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribInt.java Modified: trunk/resource/system/dtd/types.dtd =================================================================== --- trunk/resource/system/dtd/types.dtd 2009-01-09 08:40:08 UTC (rev 5873) +++ trunk/resource/system/dtd/types.dtd 2009-01-09 08:58:40 UTC (rev 5874) @@ -86,6 +86,8 @@ arch_end CDATA #IMPLIED editor CDATA #IMPLIED value CDATA #IMPLIED + min CDATA #IMPLIED + max CDATA #IMPLIED length CDATA #IMPLIED true CDATA #IMPLIED false CDATA #IMPLIED Modified: trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeInt.java =================================================================== --- trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeInt.java 2009-01-09 08:40:08 UTC (rev 5873) +++ trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeInt.java 2009-01-09 08:58:40 UTC (rev 5874) @@ -41,14 +41,28 @@ public class ArchetypeAttributeInt<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends ArchetypeAttribute<G, A, R> { /** + * The minimum allowed value. + */ + private final int minValue; + + /** + * The maximum allowed value. + */ + private final int maxValue; + + /** * Creates a new instance. * @param archetypeAttributeName the archetype attribute name * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields + * @param minValue the minimum allowed value + * @param maxValue the maximum allowed value */ - public ArchetypeAttributeInt(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength) { + public ArchetypeAttributeInt(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, final int minValue, final int maxValue) { super(archetypeAttributeName, attributeName, description, inputLength); + this.minValue = minValue; + this.maxValue = maxValue; } /** {@inheritDoc} */ @@ -68,4 +82,20 @@ return new GuiInfo<G, A, R>(new DialogAttribInt<G, A, R>(this, input), cLabel, input, null, null, false); } + /** + * Returns the minimum allowed value. + * @return the minimum allowed value + */ + public int getMinValue() { + return minValue; + } + + /** + * Returns the maximum allowed value. + * @return the maximum allowed value + */ + public int getMaxValue() { + return maxValue; + } + } // class ArchetypeAttributeInt Modified: trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeParser.java 2009-01-09 08:40:08 UTC (rev 5873) +++ trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeParser.java 2009-01-09 08:58:40 UTC (rev 5874) @@ -216,7 +216,38 @@ final String falseValue = falseAttr.getValue().trim(); return new ArchetypeAttributeBoolSpec<G, A, R>(archetypeAttributeName, attributeName, description, inputLength, trueValue, falseValue); } else if (atype.equalsIgnoreCase("int")) { - return new ArchetypeAttributeInt<G, A, R>(archetypeAttributeName, attributeName, description, inputLength); + final Attr minValueAttr = root.getAttributeNode("min"); + final int minValue; + if (minValueAttr == null) { + minValue = Integer.MIN_VALUE; + } else { + try { + minValue = Integer.parseInt(minValueAttr.getValue()); + } catch (final NumberFormatException ex) { + errorViewCollector.addError("type " + typeName + " has invalid min attribute: " + minValueAttr.getValue() + "."); + return null; + } + } + + final Attr maxValueAttr = root.getAttributeNode("max"); + final int maxValue; + if (maxValueAttr == null) { + maxValue = Integer.MAX_VALUE; + } else { + try { + maxValue = Integer.parseInt(maxValueAttr.getValue()); + } catch (final NumberFormatException ex) { + errorViewCollector.addError("type " + typeName + " has invalid max attribute: " + maxValueAttr.getValue() + "."); + return null; + } + } + + if (minValue > maxValue) { + errorViewCollector.addError("type " + typeName + " has invalid min..max range: " + minValue + ".." + maxValue + "."); + return null; + } + + return new ArchetypeAttributeInt<G, A, R>(archetypeAttributeName, attributeName, description, inputLength, minValue, maxValue); } else if (atype.equalsIgnoreCase("long")) { return new ArchetypeAttributeLong<G, A, R>(archetypeAttributeName, attributeName, description, inputLength); } else if (atype.equalsIgnoreCase("float")) { Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribInt.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribInt.java 2009-01-09 08:40:08 UTC (rev 5873) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribInt.java 2009-01-09 08:58:40 UTC (rev 5874) @@ -24,7 +24,7 @@ import javax.swing.JOptionPane; import javax.swing.text.Document; import javax.swing.text.Style; -import net.sf.gridarta.archtype.ArchetypeAttribute; +import net.sf.gridarta.archtype.ArchetypeAttributeInt; import net.sf.gridarta.archtype.ArchetypeType; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -35,6 +35,12 @@ public class DialogAttribInt<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends DialogAttrib<G, A, R> { /** + * Reference to the attribute data. + */ + @NotNull + public final ArchetypeAttributeInt<G, A, R> ref; + + /** * The input ui component for editing the value. */ @NotNull @@ -45,24 +51,21 @@ * @param ref reference to the attribute data * @param input the input ui component for editing the value */ - public DialogAttribInt(@NotNull final ArchetypeAttribute<G, A, R> ref, @NotNull final JFormattedTextField input) { + public DialogAttribInt(@NotNull final ArchetypeAttributeInt<G, A, R> ref, @NotNull final JFormattedTextField input) { super(ref); + this.ref = ref; this.input = input; } /** {@inheritDoc} */ public String getText2(@NotNull final G gameObject, @NotNull final R archetype, final String[] newName, final String[] newFace, final String[] newMsg, final String[] newAnim, final ArchetypeType<G, A, R> typeStruct, final Component parent) { final String archetypeAttributeName = ref.getArchetypeAttributeName(); + final int value; if (input.getText().trim().length() == 0) { - if (archetype.getAttributeInt(archetypeAttributeName) != 0) { - return archetypeAttributeName + " 0"; - } + value = 0; } else { try { - final int value = ((Number) input.getValue()).intValue(); - if (archetype.getAttributeInt(archetypeAttributeName) != value) { - return archetypeAttributeName + " " + value; - } + value = ((Number) input.getValue()).intValue(); } catch (final NumberFormatException e) { // parsing failed: wrong entry!! JOptionPane.showMessageDialog(parent, "Attribute '" + ref.getAttributeName() + "' must be a number!", "Input Error", JOptionPane.ERROR_MESSAGE); @@ -70,6 +73,15 @@ } } + if (value < ref.getMinValue() || value > ref.getMaxValue()) { + JOptionPane.showMessageDialog(parent, "Attribute '" + ref.getAttributeName() + "' must be " + ref.getMinValue() + ".." + ref.getMaxValue() + "!", "Input Error", JOptionPane.ERROR_MESSAGE); + return null; + } + + if (archetype.getAttributeInt(archetypeAttributeName) != value) { + return archetypeAttributeName + " " + value; + } + return ""; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2009-01-09 20:46:16
|
Revision: 5876 http://gridarta.svn.sourceforge.net/gridarta/?rev=5876&view=rev Author: akirschbaum Date: 2009-01-09 20:46:10 +0000 (Fri, 09 Jan 2009) Log Message: ----------- Fix #1842537 (About Box Issues): allow copying from "About" tab in about dialog. Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog Added Paths: ----------- trunk/lib/japi-lib-swing-about-trunk-774.jar Removed Paths: ------------- trunk/lib/japi-lib-swing-about-trunk-773.jar Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2009-01-09 18:18:44 UTC (rev 5875) +++ trunk/crossfire/ChangeLog 2009-01-09 20:46:10 UTC (rev 5876) @@ -1,5 +1,8 @@ 2009-01-09 Andreas Kirschbaum + * Fix #1842537 (About Box Issues): allow copying from "About" tab + in about dialog. + * Check some input fields in game object attribute dialog for valid values. (Affected values are the members of "struct liv" of the Crossfire server.) Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2009-01-09 18:18:44 UTC (rev 5875) +++ trunk/daimonin/ChangeLog 2009-01-09 20:46:10 UTC (rev 5876) @@ -1,5 +1,8 @@ 2009-01-09 Andreas Kirschbaum + * Fix #1842537 (About Box Issues): allow copying from "About" tab + in about dialog. + * Update JAPI library. 2009-01-08 Andreas Kirschbaum Deleted: trunk/lib/japi-lib-swing-about-trunk-773.jar =================================================================== (Binary files differ) Added: trunk/lib/japi-lib-swing-about-trunk-774.jar =================================================================== (Binary files differ) Property changes on: trunk/lib/japi-lib-swing-about-trunk-774.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2009-01-10 18:36:34
|
Revision: 5878 http://gridarta.svn.sourceforge.net/gridarta/?rev=5878&view=rev Author: akirschbaum Date: 2009-01-10 18:36:30 +0000 (Sat, 10 Jan 2009) Log Message: ----------- Remove "scripts" field from settings dialog since it was unused. Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/crossfire/src/cfeditor/GlobalSettingsImpl.java trunk/crossfire/src/cfeditor/ResourceFileManager.java trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java trunk/daimonin/ChangeLog trunk/daimonin/src/daieditor/GlobalSettingsImpl.java trunk/daimonin/src/daieditor/ResourceFileManager.java trunk/daimonin/src/daieditor/gui/prefs/ResPrefs.java trunk/src/app/net/sf/gridarta/GlobalSettings.java trunk/src/app/net/sf/gridarta/GlobalSettingsImpl.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/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2009-01-10 18:23:03 UTC (rev 5877) +++ trunk/crossfire/ChangeLog 2009-01-10 18:36:30 UTC (rev 5878) @@ -1,3 +1,7 @@ +2009-01-10 Andreas Kirschbaum + + * Remove "scripts" field from settings dialog since it was unused. + 2009-01-09 Andreas Kirschbaum * Fix #1842537 (About Box Issues): allow copying from "About" tab Modified: trunk/crossfire/src/cfeditor/GlobalSettingsImpl.java =================================================================== --- trunk/crossfire/src/cfeditor/GlobalSettingsImpl.java 2009-01-10 18:23:03 UTC (rev 5877) +++ trunk/crossfire/src/cfeditor/GlobalSettingsImpl.java 2009-01-10 18:36:30 UTC (rev 5878) @@ -83,7 +83,6 @@ public void initDirs() { setMapsDirectory(new File(prefs.get(ResourceFileManager.MAP_DIR_KEY, ResourceFileManager.DEFAULT_MAP_DIR))); setArchDirectory(new File(prefs.get(ResourceFileManager.ARCH_DIR_KEY, ResourceFileManager.DEFAULT_ARCH_DIR))); - setScriptDirectory(new File(prefs.get(ResourceFileManager.SCRIPT_DIR_KEY, ResourceFileManager.DEFAULT_SCRIPT_DIR))); // set map dir if (getMapsDirectory().getPath().length() > 0) { Modified: trunk/crossfire/src/cfeditor/ResourceFileManager.java =================================================================== --- trunk/crossfire/src/cfeditor/ResourceFileManager.java 2009-01-10 18:23:03 UTC (rev 5877) +++ trunk/crossfire/src/cfeditor/ResourceFileManager.java 2009-01-10 18:36:30 UTC (rev 5878) @@ -33,10 +33,6 @@ public static final String DEFAULT_ARCH_DIR = "arch"; - public static final String SCRIPT_DIR_KEY = "scriptDirectory"; - - public static final String DEFAULT_SCRIPT_DIR = "script"; - /** * Private constructor to prevent instantiation. */ Modified: trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java 2009-01-10 18:23:03 UTC (rev 5877) +++ trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java 2009-01-10 18:36:30 UTC (rev 5878) @@ -70,9 +70,6 @@ /** TextField for map directory path. */ private JFileField mapField; - /** TextField for script directory path. */ - private JFileField scriptField; - /** Checbox whether arches are to be loaded from collection. */ private JCheckBox loadArches; @@ -109,7 +106,6 @@ public void apply() { prefs.put(ResourceFileManager.ARCH_DIR_KEY, createPath(archField.getText())); prefs.put(ResourceFileManager.MAP_DIR_KEY, createPath(mapField.getText())); - prefs.put(ResourceFileManager.SCRIPT_DIR_KEY, createPath(scriptField.getText())); prefs.putBoolean(GlobalSettings.LOAD_ARCH_COLL, loadArches.isSelected()); final String imageSet = (String) imageSetBox.getSelectedItem(); @@ -123,7 +119,6 @@ public void revert() { archField.setText(globalSettings.getArchDirectory().getPath()); mapField.setText(globalSettings.getMapsDirectory().getPath()); - scriptField.setText(globalSettings.getScriptDirectory().getPath()); loadArches.setSelected(globalSettings.isArchLoadedFromCollection()); imageSetBox.setSelectedIndex(linearSearch(imageSets, getCurrentImageSet())); } @@ -132,7 +127,6 @@ public void defaults() { archField.setText(ResourceFileManager.DEFAULT_ARCH_DIR); mapField.setText(ResourceFileManager.DEFAULT_MAP_DIR); - scriptField.setText(ResourceFileManager.DEFAULT_SCRIPT_DIR); loadArches.setSelected(true); imageSetBox.setSelectedIndex(linearSearch(imageSets, "disabled")); } @@ -144,7 +138,6 @@ return !( createPath(archField.getText()).equals(globalSettings.getArchDirectory().getPath()) && createPath(mapField.getText()).equals(globalSettings.getMapsDirectory().getPath()) && - createPath(scriptField.getText()).equals(globalSettings.getScriptDirectory().getPath()) && loadArches.isSelected() == prefs.getBoolean(GlobalSettings.LOAD_ARCH_COLL, globalSettings.isArchLoadedFromCollection()) && imageSet.equals(getCurrentImageSet()) ); @@ -175,7 +168,6 @@ resourcePanel.setBorder(createTitledBorder("optionsResPaths")); archField = createFileField(resourcePanel, "optionsResArch", globalSettings.getArchDirectory().getPath(), JFileChooser.DIRECTORIES_ONLY); mapField = createFileField(resourcePanel, "optionsResMaps", globalSettings.getMapsDirectory().getPath(), JFileChooser.DIRECTORIES_ONLY); - scriptField = createFileField(resourcePanel, "optionsResScripts", globalSettings.getScriptDirectory().getPath(), JFileChooser.DIRECTORIES_ONLY); return resourcePanel; } Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2009-01-10 18:23:03 UTC (rev 5877) +++ trunk/daimonin/ChangeLog 2009-01-10 18:36:30 UTC (rev 5878) @@ -1,3 +1,7 @@ +2009-01-10 Andreas Kirschbaum + + * Remove "scripts" field from settings dialog since it was unused. + 2009-01-09 Andreas Kirschbaum * Fix #1842537 (About Box Issues): allow copying from "About" tab Modified: trunk/daimonin/src/daieditor/GlobalSettingsImpl.java =================================================================== --- trunk/daimonin/src/daieditor/GlobalSettingsImpl.java 2009-01-10 18:23:03 UTC (rev 5877) +++ trunk/daimonin/src/daieditor/GlobalSettingsImpl.java 2009-01-10 18:36:30 UTC (rev 5878) @@ -67,7 +67,6 @@ public void initDirs() { setMapsDirectory(new File(prefs.get(ResourceFileManager.MAP_DIR_KEY, ResourceFileManager.DEFAULT_MAP_DIR))); setArchDirectory(new File(prefs.get(ResourceFileManager.ARCH_DIR_KEY, ResourceFileManager.DEFAULT_ARCH_DIR))); - setScriptDirectory(new File(prefs.get(ResourceFileManager.SCRIPT_DIR_KEY, ResourceFileManager.DEFAULT_SCRIPT_DIR))); mediaDir = new File(prefs.get(ResourceFileManager.MEDIA_DIR_KEY, ResourceFileManager.DEFAULT_MEDIA_DIR)); setMapDir(getMapsDirectory()); finishInitDirs(); Modified: trunk/daimonin/src/daieditor/ResourceFileManager.java =================================================================== --- trunk/daimonin/src/daieditor/ResourceFileManager.java 2009-01-10 18:23:03 UTC (rev 5877) +++ trunk/daimonin/src/daieditor/ResourceFileManager.java 2009-01-10 18:36:30 UTC (rev 5878) @@ -33,10 +33,6 @@ public static final String DEFAULT_ARCH_DIR = "../arch"; - public static final String SCRIPT_DIR_KEY = "scriptDirectory"; - - public static final String DEFAULT_SCRIPT_DIR = "script"; - public static final String MEDIA_DIR_KEY = "mediaDirectory"; public static final String DEFAULT_MEDIA_DIR = "../client/media"; Modified: trunk/daimonin/src/daieditor/gui/prefs/ResPrefs.java =================================================================== --- trunk/daimonin/src/daieditor/gui/prefs/ResPrefs.java 2009-01-10 18:23:03 UTC (rev 5877) +++ trunk/daimonin/src/daieditor/gui/prefs/ResPrefs.java 2009-01-10 18:36:30 UTC (rev 5878) @@ -66,9 +66,6 @@ /** TextField for map directory path. */ private JFileField mapField; - /** TextField for script directory path. */ - private JFileField scriptField; - /** TextField for media directory path. */ private JFileField mediaField; @@ -102,7 +99,6 @@ public void apply() { prefs.put(ResourceFileManager.ARCH_DIR_KEY, createPath(archField.getText())); prefs.put(ResourceFileManager.MAP_DIR_KEY, createPath(mapField.getText())); - prefs.put(ResourceFileManager.SCRIPT_DIR_KEY, createPath(scriptField.getText())); prefs.put(ResourceFileManager.MEDIA_DIR_KEY, createPath(mediaField.getText())); prefs.putBoolean(GlobalSettings.LOAD_ARCH_COLL, loadArches.isSelected()); globalSettings.initDirs(); @@ -113,7 +109,6 @@ public void revert() { archField.setText(globalSettings.getArchDirectory().getPath()); mapField.setText(globalSettings.getMapsDirectory().getPath()); - scriptField.setText(globalSettings.getScriptDirectory().getPath()); mediaField.setText(globalSettings.getMediaDefaultFolder().getPath()); loadArches.setSelected(globalSettings.isArchLoadedFromCollection()); } @@ -122,7 +117,6 @@ public void defaults() { archField.setText(ResourceFileManager.DEFAULT_ARCH_DIR); mapField.setText(ResourceFileManager.DEFAULT_MAP_DIR); - scriptField.setText(ResourceFileManager.DEFAULT_SCRIPT_DIR); loadArches.setSelected(true); } @@ -131,7 +125,6 @@ return !( createPath(archField.getText()).equals(globalSettings.getArchDirectory().getPath()) && createPath(mapField.getText()).equals(globalSettings.getMapsDirectory().getPath()) && - createPath(scriptField.getText()).equals(globalSettings.getScriptDirectory().getPath()) && createPath(mediaField.getText()).equals(globalSettings.getMediaDefaultFolder().getPath()) && loadArches.isSelected() == prefs.getBoolean(GlobalSettings.LOAD_ARCH_COLL, globalSettings.isArchLoadedFromCollection()) ); @@ -162,7 +155,6 @@ resourcePanel.setBorder(createTitledBorder("optionsResPaths")); archField = createFileField(resourcePanel, "optionsResArch", globalSettings.getArchDirectory().getPath(), JFileChooser.DIRECTORIES_ONLY); mapField = createFileField(resourcePanel, "optionsResMaps", globalSettings.getMapsDirectory().getPath(), JFileChooser.DIRECTORIES_ONLY); - scriptField = createFileField(resourcePanel, "optionsResScripts", globalSettings.getScriptDirectory().getPath(), JFileChooser.DIRECTORIES_ONLY); mediaField = createFileField(resourcePanel, "optionsResMedia", globalSettings.getMediaDefaultFolder().getPath(), JFileChooser.DIRECTORIES_ONLY); return resourcePanel; } Modified: trunk/src/app/net/sf/gridarta/GlobalSettings.java =================================================================== --- trunk/src/app/net/sf/gridarta/GlobalSettings.java 2009-01-10 18:23:03 UTC (rev 5877) +++ trunk/src/app/net/sf/gridarta/GlobalSettings.java 2009-01-10 18:36:30 UTC (rev 5878) @@ -47,12 +47,6 @@ @NotNull File getMapDir(); - /** - * Get the default folder of scripts. - * @return default folder of scripts. - */ - File getScriptDirectory(); - void setImageDirectory(File imageDirectory); File getImageDirectory(); Modified: trunk/src/app/net/sf/gridarta/GlobalSettingsImpl.java =================================================================== --- trunk/src/app/net/sf/gridarta/GlobalSettingsImpl.java 2009-01-10 18:23:03 UTC (rev 5877) +++ trunk/src/app/net/sf/gridarta/GlobalSettingsImpl.java 2009-01-10 18:36:30 UTC (rev 5878) @@ -41,8 +41,6 @@ @NotNull private File mapDir; - private File scriptDirectory; - /** The current main directory. */ private File currentDirectory = new File(System.getProperty("user.dir")); @@ -89,15 +87,6 @@ } /** {@inheritDoc} */ - public File getScriptDirectory() { - return scriptDirectory; - } - - protected void setScriptDirectory(final File scriptDirectory) { - this.scriptDirectory = scriptDirectory; - } - - /** {@inheritDoc} */ public File getCurrentDirectory() { return currentDirectory; } Modified: trunk/src/app/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages.properties 2009-01-10 18:23:03 UTC (rev 5877) +++ trunk/src/app/net/sf/gridarta/messages.properties 2009-01-10 18:36:30 UTC (rev 5878) @@ -860,8 +860,6 @@ optionsResArch.shortdescription=Path name for archetype files optionsResMaps=Maps optionsResMaps.shortdescription=Path name for map files -optionsResScripts=Scripts -optionsResScripts.shortdescription=Path name for script files optionsRestart.title=Warning optionsRestart.message=Most options require restarting the editor to take effect. optionsLoadArchColl.text=Load Arches from Collection Modified: trunk/src/app/net/sf/gridarta/messages_de.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_de.properties 2009-01-10 18:23:03 UTC (rev 5877) +++ trunk/src/app/net/sf/gridarta/messages_de.properties 2009-01-10 18:36:30 UTC (rev 5878) @@ -809,8 +809,6 @@ optionsResArch.shortdescription=Dateiname der Archetypen-Datei optionsResMaps=Karten optionsResMaps.shortdescription=Verzeichnis f\xFCr Karten -optionsResScripts=Skripte -optionsResScripts.shortdescription=Verzeichnis f\xFCr Scripte optionsRestart.title=Warnung optionsRestart.message=Viele Optionen erfordern einen Programmneustart, um effektiv zu werden. optionsLoadArchColl.text=Vorbereitete Archetypen laden Modified: trunk/src/app/net/sf/gridarta/messages_fr.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_fr.properties 2009-01-10 18:23:03 UTC (rev 5877) +++ trunk/src/app/net/sf/gridarta/messages_fr.properties 2009-01-10 18:36:30 UTC (rev 5878) @@ -808,8 +808,6 @@ #optionsResArch.shortdescription= #optionsResMaps= #optionsResMaps.shortdescription= -#optionsResScripts= -#optionsResScripts.shortdescription= #optionsRestart.title= #optionsRestart.message= #optionsLoadArchColl.text= Modified: trunk/src/app/net/sf/gridarta/messages_sv.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_sv.properties 2009-01-10 18:23:03 UTC (rev 5877) +++ trunk/src/app/net/sf/gridarta/messages_sv.properties 2009-01-10 18:36:30 UTC (rev 5878) @@ -813,8 +813,6 @@ #optionsResArch.shortdescription= optionsResMaps=Kartor #optionsResMaps.shortdescription= -optionsResScripts=Script -#optionsResScripts.shortdescription= optionsRestart.title=Varning optionsRestart.message=De flesta inst\xE4llningarna kr\xE4ver att editor startas om f\xF6r att g\xE4lla. optionsLoadArchColl.text=L\xE4s arketyper fr\xE5n samling This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2009-01-25 19:26:39
|
Revision: 5879 http://gridarta.svn.sourceforge.net/gridarta/?rev=5879&view=rev Author: akirschbaum Date: 2009-01-25 19:26:33 +0000 (Sun, 25 Jan 2009) Log Message: ----------- Fix settings dialog: save correct path name for "map directory". Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java trunk/daimonin/ChangeLog trunk/daimonin/src/daieditor/gui/prefs/ResPrefs.java trunk/src/app/net/sf/gridarta/io/PathManager.java Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2009-01-10 18:36:30 UTC (rev 5878) +++ trunk/crossfire/ChangeLog 2009-01-25 19:26:33 UTC (rev 5879) @@ -1,3 +1,7 @@ +2009-01-25 Andreas Kirschbaum + + * Fix settings dialog: save correct path name for "map directory". + 2009-01-10 Andreas Kirschbaum * Remove "scripts" field from settings dialog since it was unused. Modified: trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java 2009-01-10 18:36:30 UTC (rev 5878) +++ trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java 2009-01-25 19:26:33 UTC (rev 5879) @@ -43,7 +43,6 @@ import net.sf.japi.swing.ActionBuilderFactory; import net.sf.japi.swing.misc.JFileField; import net.sf.japi.swing.prefs.AbstractPrefs; -import org.jetbrains.annotations.NotNull; /** * Preferences Module for resource preferences. @@ -104,8 +103,8 @@ /** {@inheritDoc} */ public void apply() { - prefs.put(ResourceFileManager.ARCH_DIR_KEY, createPath(archField.getText())); - prefs.put(ResourceFileManager.MAP_DIR_KEY, createPath(mapField.getText())); + prefs.put(ResourceFileManager.ARCH_DIR_KEY, PathManager.getAbsolutePath(archField.getText())); + prefs.put(ResourceFileManager.MAP_DIR_KEY, PathManager.getAbsolutePath(mapField.getText())); prefs.putBoolean(GlobalSettings.LOAD_ARCH_COLL, loadArches.isSelected()); final String imageSet = (String) imageSetBox.getSelectedItem(); @@ -136,8 +135,8 @@ final String selectedimageSet = (String) imageSetBox.getSelectedItem(); final String imageSet = selectedimageSet == null ? "disabled" : selectedimageSet; return !( - createPath(archField.getText()).equals(globalSettings.getArchDirectory().getPath()) && - createPath(mapField.getText()).equals(globalSettings.getMapsDirectory().getPath()) && + PathManager.getAbsolutePath(archField.getText()).equals(globalSettings.getArchDirectory().getPath()) && + PathManager.getAbsolutePath(mapField.getText()).equals(globalSettings.getMapsDirectory().getPath()) && loadArches.isSelected() == prefs.getBoolean(GlobalSettings.LOAD_ARCH_COLL, globalSettings.isArchLoadedFromCollection()) && imageSet.equals(getCurrentImageSet()) ); @@ -246,14 +245,4 @@ return imageSet.equals("none") ? "disabled" : imageSet; } - /** - * Creates an absolute path from the given path name. - * @param path the path name to convert - * @return the absolute path name - */ - @NotNull - private static String createPath(@NotNull final String path) { - return PathManager.relativeToAbsolute(System.getProperty("user.dir"), PathManager.path(path)); - } - } // class ResPrefs Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2009-01-10 18:36:30 UTC (rev 5878) +++ trunk/daimonin/ChangeLog 2009-01-25 19:26:33 UTC (rev 5879) @@ -1,3 +1,7 @@ +2009-01-25 Andreas Kirschbaum + + * Fix settings dialog: save correct path name for "map directory". + 2009-01-10 Andreas Kirschbaum * Remove "scripts" field from settings dialog since it was unused. Modified: trunk/daimonin/src/daieditor/gui/prefs/ResPrefs.java =================================================================== --- trunk/daimonin/src/daieditor/gui/prefs/ResPrefs.java 2009-01-10 18:36:30 UTC (rev 5878) +++ trunk/daimonin/src/daieditor/gui/prefs/ResPrefs.java 2009-01-25 19:26:33 UTC (rev 5879) @@ -39,7 +39,6 @@ import net.sf.japi.swing.ActionBuilderFactory; import net.sf.japi.swing.misc.JFileField; import net.sf.japi.swing.prefs.AbstractPrefs; -import org.jetbrains.annotations.NotNull; /** * Preferences Module for resource preferences. @@ -97,9 +96,9 @@ /** {@inheritDoc} */ public void apply() { - prefs.put(ResourceFileManager.ARCH_DIR_KEY, createPath(archField.getText())); - prefs.put(ResourceFileManager.MAP_DIR_KEY, createPath(mapField.getText())); - prefs.put(ResourceFileManager.MEDIA_DIR_KEY, createPath(mediaField.getText())); + prefs.put(ResourceFileManager.ARCH_DIR_KEY, PathManager.getAbsolutePath(archField.getText())); + prefs.put(ResourceFileManager.MAP_DIR_KEY, PathManager.getAbsolutePath(mapField.getText())); + prefs.put(ResourceFileManager.MEDIA_DIR_KEY, PathManager.getAbsolutePath(mediaField.getText())); prefs.putBoolean(GlobalSettings.LOAD_ARCH_COLL, loadArches.isSelected()); globalSettings.initDirs(); ACTION_BUILDER.showOnetimeMessageDialog(this, JOptionPane.WARNING_MESSAGE, "optionsRestart"); @@ -123,9 +122,9 @@ /** {@inheritDoc} */ public boolean isChanged() { return !( - createPath(archField.getText()).equals(globalSettings.getArchDirectory().getPath()) && - createPath(mapField.getText()).equals(globalSettings.getMapsDirectory().getPath()) && - createPath(mediaField.getText()).equals(globalSettings.getMediaDefaultFolder().getPath()) && + PathManager.getAbsolutePath(archField.getText()).equals(globalSettings.getArchDirectory().getPath()) && + PathManager.getAbsolutePath(mapField.getText()).equals(globalSettings.getMapsDirectory().getPath()) && + PathManager.getAbsolutePath(mediaField.getText()).equals(globalSettings.getMediaDefaultFolder().getPath()) && loadArches.isSelected() == prefs.getBoolean(GlobalSettings.LOAD_ARCH_COLL, globalSettings.isArchLoadedFromCollection()) ); } @@ -194,14 +193,4 @@ return fileField; } - /** - * Creates an absolute path from the given path name. - * @param path the path name to convert - * @return the absolute path name - */ - @NotNull - private static String createPath(@NotNull final String path) { - return PathManager.relativeToAbsolute(System.getProperty("user.dir"), PathManager.path(path)); - } - } // class ResPrefs Modified: trunk/src/app/net/sf/gridarta/io/PathManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/io/PathManager.java 2009-01-10 18:36:30 UTC (rev 5878) +++ trunk/src/app/net/sf/gridarta/io/PathManager.java 2009-01-25 19:26:33 UTC (rev 5879) @@ -22,6 +22,7 @@ import java.io.File; import java.io.IOException; import net.sf.gridarta.GlobalSettings; +import org.jetbrains.annotations.NotNull; /** * This class contains methods for converting relative map paths to absolute map @@ -235,4 +236,13 @@ return path; } + /** + * Returns the given path in absolute form. + * @param path the path to convert + * @return the absolute path + */ + public static String getAbsolutePath(@NotNull final String path) { + return relativeToAbsolute(System.getProperty("user.dir")+"/dummy", path(path)); + } + } // class PathManager This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |