You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(103) |
Jun
(121) |
Jul
(16) |
Aug
(67) |
Sep
(126) |
Oct
(161) |
Nov
(164) |
Dec
(588) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(394) |
Feb
(181) |
Mar
(131) |
Apr
(180) |
May
(255) |
Jun
(11) |
Jul
(79) |
Aug
(70) |
Sep
(274) |
Oct
(138) |
Nov
(195) |
Dec
(8) |
2008 |
Jan
(3) |
Feb
(142) |
Mar
(162) |
Apr
(124) |
May
(148) |
Jun
(157) |
Jul
(425) |
Aug
(373) |
Sep
(264) |
Oct
(315) |
Nov
(225) |
Dec
(6) |
2009 |
Jan
(67) |
Feb
(78) |
Mar
(279) |
Apr
(294) |
May
(92) |
Jun
(65) |
Jul
(134) |
Aug
(41) |
Sep
(138) |
Oct
(125) |
Nov
(126) |
Dec
(122) |
2010 |
Jan
(15) |
Feb
(48) |
Mar
(9) |
Apr
(195) |
May
(373) |
Jun
(507) |
Jul
(42) |
Aug
(16) |
Sep
(38) |
Oct
(81) |
Nov
(64) |
Dec
(18) |
2011 |
Jan
(13) |
Feb
(12) |
Mar
(39) |
Apr
(1) |
May
(2) |
Jun
(27) |
Jul
(27) |
Aug
(31) |
Sep
(14) |
Oct
(102) |
Nov
(20) |
Dec
(37) |
2012 |
Jan
(22) |
Feb
(1) |
Mar
(1) |
Apr
(2) |
May
(2) |
Jun
(18) |
Jul
(6) |
Aug
(1) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2013 |
Jan
(1) |
Feb
(2) |
Mar
(1) |
Apr
(1) |
May
(47) |
Jun
(7) |
Jul
(107) |
Aug
|
Sep
|
Oct
(112) |
Nov
(31) |
Dec
(17) |
2014 |
Jan
(29) |
Feb
(111) |
Mar
(34) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(18) |
Dec
(10) |
From: <aki...@us...> - 2014-11-28 13:47:20
|
Revision: 9710 http://sourceforge.net/p/gridarta/code/9710 Author: akirschbaum Date: 2014-11-28 13:47:11 +0000 (Fri, 28 Nov 2014) Log Message: ----------- Delete incorrect branch. Removed Paths: ------------- streams/tilestretching/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-11-28 13:42:08
|
Revision: 9709 http://sourceforge.net/p/gridarta/code/9709 Author: akirschbaum Date: 2014-11-28 13:42:02 +0000 (Fri, 28 Nov 2014) Log Message: ----------- Create branch. Added Paths: ----------- streams/tilestretching/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-11-16 23:33:01
|
Revision: 9708 http://sourceforge.net/p/gridarta/code/9708 Author: akirschbaum Date: 2014-11-16 23:32:54 +0000 (Sun, 16 Nov 2014) Log Message: ----------- Remove support for 'no_priest' map attribute; add support for 'height_diff' map attribute. [Atrinik] Modified Paths: -------------- trunk/src/atrinik/ChangeLog trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/io/MapArchObjectParser.java trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/maparchobject/MapArchObject.java trunk/src/atrinik/src/main/resources/HelpFiles/tut_mapattr.html trunk/src/atrinik/src/main/resources/net/sf/gridarta/var/atrinik/messages.properties trunk/src/atrinik/src/main/resources/net/sf/gridarta/var/atrinik/messages_de.properties trunk/src/atrinik/src/main/resources/net/sf/gridarta/var/atrinik/messages_fr.properties trunk/src/atrinik/src/main/resources/net/sf/gridarta/var/atrinik/messages_sv.properties Modified: trunk/src/atrinik/ChangeLog =================================================================== --- trunk/src/atrinik/ChangeLog 2014-10-07 20:26:35 UTC (rev 9707) +++ trunk/src/atrinik/ChangeLog 2014-11-16 23:32:54 UTC (rev 9708) @@ -1,3 +1,8 @@ +2014-11-16 Alex Tokar + + * Remove support for 'no_priest' map attribute; add support for + 'height_diff' map attribute. + 2014-10-07 Andreas Kirschbaum * Browse archetypes: Add option to save the current selection as a Modified: trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java =================================================================== --- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java 2014-10-07 20:26:35 UTC (rev 9707) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java 2014-11-16 23:32:54 UTC (rev 9708) @@ -227,11 +227,11 @@ private final AbstractButton checkboxNoMagic = new JCheckBox(); /** - * The checkbox for the no priest attribute. + * The checkbox for the height diff attribute. * @serial */ @NotNull - private final AbstractButton checkboxNoPriest = new JCheckBox(); + private final AbstractButton checkboxHeightDiff = new JCheckBox(); /** * The checkbox for the no summon attribute. @@ -429,7 +429,7 @@ optionPanel.add(createPanelCBox(checkboxNoSave, map.isNoSave(), "mapNoSave")); optionPanel.add(createPanelCBox(checkboxNoMagic, map.isNoMagic(), "mapNoMagic")); - optionPanel.add(createPanelCBox(checkboxNoPriest, map.isNoPriest(), "mapNoPrayers")); + optionPanel.add(createPanelCBox(checkboxHeightDiff, map.isHeightDiff(), "mapHeightDiff")); optionPanel.add(createPanelCBox(checkboxNoHarm, map.isNoHarm(), "mapNoHarm")); optionPanel.add(createPanelCBox(checkboxNoSummon, map.isNoSummon(), "mapNoSumm")); optionPanel.add(createPanelCBox(checkboxNoFixedLogin, map.isFixedLogin(), "mapFixedLogin")); @@ -689,7 +689,7 @@ mapArchObject.setNoSave(checkboxNoSave.isSelected()); mapArchObject.setNoMagic(checkboxNoMagic.isSelected()); - mapArchObject.setNoPriest(checkboxNoPriest.isSelected()); + mapArchObject.setHeightDiff(checkboxHeightDiff.isSelected()); mapArchObject.setNoHarm(checkboxNoHarm.isSelected()); mapArchObject.setNoSummon(checkboxNoSummon.isSelected()); mapArchObject.setFixedLogin(checkboxNoFixedLogin.isSelected()); @@ -755,7 +755,7 @@ checkboxNoSave.setSelected(map.isNoSave()); checkboxNoMagic.setSelected(map.isNoMagic()); - checkboxNoPriest.setSelected(map.isNoPriest()); + checkboxHeightDiff.setSelected(map.isHeightDiff()); checkboxNoHarm.setSelected(map.isNoHarm()); checkboxNoSummon.setSelected(map.isNoSummon()); checkboxNoFixedLogin.setSelected(map.isFixedLogin()); Modified: trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/io/MapArchObjectParser.java =================================================================== --- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/io/MapArchObjectParser.java 2014-10-07 20:26:35 UTC (rev 9707) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/io/MapArchObjectParser.java 2014-11-16 23:32:54 UTC (rev 9708) @@ -78,8 +78,8 @@ if (mapArchObject.isNoMagic()) { appendable.append("no_magic 1\n"); } - if (mapArchObject.isNoPriest()) { - appendable.append("no_priest 1\n"); + if (mapArchObject.isHeightDiff()) { + appendable.append("height_diff 1\n"); } if (mapArchObject.isNoSummon()) { appendable.append("no_summon 1\n"); @@ -142,8 +142,8 @@ return true; } - if (line.startsWith("no_priest ")) { - mapArchObject.setNoPriest(NumberUtils.parseInt(line.substring(10)) != 0); + if (line.startsWith("height_diff ")) { + mapArchObject.setHeightDiff(NumberUtils.parseInt(line.substring(12)) != 0); return true; } Modified: trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/maparchobject/MapArchObject.java =================================================================== --- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/maparchobject/MapArchObject.java 2014-10-07 20:26:35 UTC (rev 9707) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/maparchobject/MapArchObject.java 2014-11-16 23:32:54 UTC (rev 9708) @@ -56,10 +56,10 @@ private boolean noMagic; /** - * No prayers. + * Height diff. * @serial */ - private boolean noPriest; + private boolean heightDiff; /** * No harmful spells allowed. @@ -159,7 +159,7 @@ super(mapArchObject); noSave = mapArchObject.noSave; noMagic = mapArchObject.noMagic; - noPriest = mapArchObject.noPriest; + heightDiff = mapArchObject.heightDiff; noHarm = mapArchObject.noHarm; noSummon = mapArchObject.noSummon; fixedLogin = mapArchObject.fixedLogin; @@ -183,7 +183,7 @@ super.setState(mapArchObject); setNoSave(mapArchObject.noSave); setNoMagic(mapArchObject.noMagic); - setNoPriest(mapArchObject.noPriest); + setHeightDiff(mapArchObject.heightDiff); setNoHarm(mapArchObject.noHarm); setNoSummon(mapArchObject.noSummon); setFixedLogin(mapArchObject.fixedLogin); @@ -242,23 +242,23 @@ } /** - * Returns the no priest attribute. - * @return the no priest attribute + * Returns the height diff attribute. + * @return the height diff attribute */ - public boolean isNoPriest() { - return noPriest; + public boolean isHeightDiff() { + return heightDiff; } /** - * Sets the no priest attribute. - * @param noPriest the no priest attribute + * Sets the height diff attribute. + * @param heightDiff the height diff attribute */ - public void setNoPriest(final boolean noPriest) { - if (this.noPriest == noPriest) { + public void setHeightDiff(final boolean heightDiff) { + if (this.heightDiff == heightDiff) { return; } - this.noPriest = noPriest; + this.heightDiff = heightDiff; setModified(); } @@ -560,7 +560,7 @@ return false; } final MapArchObject mapArchObject = (MapArchObject) obj; - return super.equals(obj) && mapArchObject.noSave == noSave && mapArchObject.noMagic == noMagic && mapArchObject.noPriest == noPriest && mapArchObject.noHarm == noHarm && mapArchObject.noSummon == noSummon && mapArchObject.fixedLogin == fixedLogin && mapArchObject.unique == unique && mapArchObject.fixedResetTime == fixedResetTime && mapArchObject.playerNoSave == playerNoSave && mapArchObject.pvp == pvp && mapArchObject.tilesetId == tilesetId && mapArchObject.tilesetX == tilesetX && mapArchObject.tilesetY == tilesetY && mapArchObject.backgroundMusic.equals(backgroundMusic) && mapArchObject.region.equals(region) && mapArchObject.weather.equals(weather); + return super.equals(obj) && mapArchObject.noSave == noSave && mapArchObject.noMagic == noMagic && mapArchObject.heightDiff == heightDiff && mapArchObject.noHarm == noHarm && mapArchObject.noSummon == noSummon && mapArchObject.fixedLogin == fixedLogin && mapArchObject.unique == unique && mapArchObject.fixedResetTime == fixedResetTime && mapArchObject.playerNoSave == playerNoSave && mapArchObject.pvp == pvp && mapArchObject.tilesetId == tilesetId && mapArchObject.tilesetX == tilesetX && mapArchObject.tilesetY == tilesetY && mapArchObject.backgroundMusic.equals(backgroundMusic) && mapArchObject.region.equals(region) && mapArchObject.weather.equals(weather); } /** @@ -568,7 +568,7 @@ */ @Override public int hashCode() { - return super.hashCode() + (noSave ? 2 : 0) + (noMagic ? 4 : 0) + (noPriest ? 8 : 0) + (noHarm ? 16 : 0) + (noSummon ? 32 : 0) + (fixedLogin ? 64 : 0) + (unique ? 128 : 0) + (fixedResetTime ? 256 : 0) + (playerNoSave ? 512 : 0) + (pvp ? 1024 : 0) + tilesetId + tilesetX + tilesetY + backgroundMusic.hashCode() + region.hashCode() + weather.hashCode(); + return super.hashCode() + (noSave ? 2 : 0) + (noMagic ? 4 : 0) + (heightDiff ? 8 : 0) + (noHarm ? 16 : 0) + (noSummon ? 32 : 0) + (fixedLogin ? 64 : 0) + (unique ? 128 : 0) + (fixedResetTime ? 256 : 0) + (playerNoSave ? 512 : 0) + (pvp ? 1024 : 0) + tilesetId + tilesetX + tilesetY + backgroundMusic.hashCode() + region.hashCode() + weather.hashCode(); } /** Modified: trunk/src/atrinik/src/main/resources/HelpFiles/tut_mapattr.html =================================================================== --- trunk/src/atrinik/src/main/resources/HelpFiles/tut_mapattr.html 2014-10-07 20:26:35 UTC (rev 9707) +++ trunk/src/atrinik/src/main/resources/HelpFiles/tut_mapattr.html 2014-11-16 23:32:54 UTC (rev 9708) @@ -93,9 +93,6 @@ <P><B>No Magic</B>: Players cannot cast magic spells anywhere on the map. This works like the entire map was tiled with "no magic" arches.</P> -<P><B>No Prayers</B>: Players cannot cast prayers anywhere on the map. This - works like the entire map was tiled with "unholy floor" arches.</P> - <P><B>No Harmful Spells</B>: If enabled, players can cast only self spells (both magic and prayers), and spells which have no damaging, negative or global effects. This means all kinds of attack spells are disabled, as well as Modified: trunk/src/atrinik/src/main/resources/net/sf/gridarta/var/atrinik/messages.properties =================================================================== --- trunk/src/atrinik/src/main/resources/net/sf/gridarta/var/atrinik/messages.properties 2014-10-07 20:26:35 UTC (rev 9707) +++ trunk/src/atrinik/src/main/resources/net/sf/gridarta/var/atrinik/messages.properties 2014-11-16 23:32:54 UTC (rev 9708) @@ -90,7 +90,7 @@ mapOptions=Options mapNoSave=No Save mapNoMagic=No Magic -mapNoPrayers=No Prayers +mapHeightDiff=Height Difference mapNoHarm=No Harmful Spells mapNoSumm=No Summoning mapFixedLogin=Fixed Login Modified: trunk/src/atrinik/src/main/resources/net/sf/gridarta/var/atrinik/messages_de.properties =================================================================== --- trunk/src/atrinik/src/main/resources/net/sf/gridarta/var/atrinik/messages_de.properties 2014-10-07 20:26:35 UTC (rev 9707) +++ trunk/src/atrinik/src/main/resources/net/sf/gridarta/var/atrinik/messages_de.properties 2014-11-16 23:32:54 UTC (rev 9708) @@ -39,7 +39,7 @@ mapOptions=Optionen mapNoSave=Nicht speichern mapNoMagic=Keine Magie -mapNoPrayers=Keine Gebete +#mapHeightDiff= mapNoHarm=Keine gef\xE4hrlichen Zauber mapNoSumm=Keine Herbeirufungszauber mapFixedLogin=Login am Startpunkt Modified: trunk/src/atrinik/src/main/resources/net/sf/gridarta/var/atrinik/messages_fr.properties =================================================================== --- trunk/src/atrinik/src/main/resources/net/sf/gridarta/var/atrinik/messages_fr.properties 2014-10-07 20:26:35 UTC (rev 9707) +++ trunk/src/atrinik/src/main/resources/net/sf/gridarta/var/atrinik/messages_fr.properties 2014-11-16 23:32:54 UTC (rev 9708) @@ -40,7 +40,7 @@ #mapOptions= #mapNoSave= #mapNoMagic= -#mapNoPrayers= +#mapHeightDiff= #mapNoHarm= #mapNoSumm= #mapFixedLogin= Modified: trunk/src/atrinik/src/main/resources/net/sf/gridarta/var/atrinik/messages_sv.properties =================================================================== --- trunk/src/atrinik/src/main/resources/net/sf/gridarta/var/atrinik/messages_sv.properties 2014-10-07 20:26:35 UTC (rev 9707) +++ trunk/src/atrinik/src/main/resources/net/sf/gridarta/var/atrinik/messages_sv.properties 2014-11-16 23:32:54 UTC (rev 9708) @@ -39,7 +39,7 @@ mapOptions=Inst\xE4llningar mapNoSave=Ingen spara mapNoMagic=Ingen magi -mapNoPrayers=Inga b\xF6ner +#mapHeightDiff= mapNoHarm=Inga farliga trollformler mapNoSumm=Ingen \xE5kallning mapFixedLogin=Fixerad inloggning This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-10-07 20:26:39
|
Revision: 9707 http://sourceforge.net/p/gridarta/code/9707 Author: akirschbaum Date: 2014-10-07 20:26:35 +0000 (Tue, 07 Oct 2014) Log Message: ----------- Browse archetypes: Add option to save the current selection as a CSV file. Modified Paths: -------------- trunk/src/atrinik/ChangeLog trunk/src/crossfire/ChangeLog trunk/src/daimonin/ChangeLog trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/BrowseArchetypesDialog.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/BrowseArchetypesTableModel.java trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages.properties trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_de.properties trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_fr.properties trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_sv.properties trunk/src/utils/src/main/java/net/sf/gridarta/utils/FileFilters.java Modified: trunk/src/atrinik/ChangeLog =================================================================== --- trunk/src/atrinik/ChangeLog 2014-10-07 20:16:12 UTC (rev 9706) +++ trunk/src/atrinik/ChangeLog 2014-10-07 20:26:35 UTC (rev 9707) @@ -1,3 +1,8 @@ +2014-10-07 Andreas Kirschbaum + + * Browse archetypes: Add option to save the current selection as a + CSV file. + 2014-03-15 Alex Tokar * Update Map|Open in Client function according to ADS-2. Modified: trunk/src/crossfire/ChangeLog =================================================================== --- trunk/src/crossfire/ChangeLog 2014-10-07 20:16:12 UTC (rev 9706) +++ trunk/src/crossfire/ChangeLog 2014-10-07 20:26:35 UTC (rev 9707) @@ -1,3 +1,8 @@ +2014-10-07 Andreas Kirschbaum + + * Browse archetypes: Add option to save the current selection as a + CSV file. + 2014-05-30 Andreas Kirschbaum * Support map attribute "first_load". Modified: trunk/src/daimonin/ChangeLog =================================================================== --- trunk/src/daimonin/ChangeLog 2014-10-07 20:16:12 UTC (rev 9706) +++ trunk/src/daimonin/ChangeLog 2014-10-07 20:26:35 UTC (rev 9707) @@ -1,3 +1,8 @@ +2014-10-07 Andreas Kirschbaum + + * Browse archetypes: Add option to save the current selection as a + CSV file. + 2014-03-10 Andreas Kirschbaum * Remember new map path when using "save as" to save a map. Also Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/BrowseArchetypesDialog.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/BrowseArchetypesDialog.java 2014-10-07 20:16:12 UTC (rev 9706) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/BrowseArchetypesDialog.java 2014-10-07 20:26:35 UTC (rev 9707) @@ -26,6 +26,8 @@ import java.awt.event.ItemListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; +import java.io.File; +import java.io.IOException; import java.util.Collection; import java.util.TreeSet; import javax.swing.BoxLayout; @@ -34,6 +36,7 @@ import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JDialog; +import javax.swing.JFileChooser; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; @@ -54,6 +57,8 @@ import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.utils.ActionBuilderUtils; +import net.sf.gridarta.utils.FileChooserUtils; +import net.sf.gridarta.utils.FileFilters; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; import net.sf.japi.swing.action.ActionMethod; @@ -135,6 +140,12 @@ private final JComboBox addAttributeComboBox; /** + * The {@link JFileChooser} for saving CSV files. + */ + @NotNull + private final JFileChooser chooser = new JFileChooser(); + + /** * Creates a new instance. * @param parentComponent the parent component for the dialog * @param archetypeChooserControl the archetype chooser control to to @@ -247,6 +258,7 @@ addAttributePanel.setLayout(new BoxLayout(addAttributePanel, BoxLayout.LINE_AXIS)); addAttributePanel.add(addAttributeButton); addAttributePanel.add(addAttributeComboBox); + addAttributePanel.add(new JButton(ACTION_BUILDER.createAction(false, "browseArchetypesSave", this))); setOptions(new Object[] { addAttributePanel }); updateComboBox(); @@ -262,6 +274,9 @@ dialog.setLocationRelativeTo(parentComponent); setInitialValue(archetypesTable); updateActions(); + + chooser.setDialogTitle(ActionBuilderUtils.getString(ACTION_BUILDER, "browseArchetypesSave.title")); + chooser.setFileFilter(FileFilters.CSV_FILE_FILTER); } /** @@ -299,6 +314,28 @@ } /** + * Action method for saving the current list to a CSV file. + */ + @ActionMethod + public void browseArchetypesSave() { + chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); + chooser.setMultiSelectionEnabled(false); + FileChooserUtils.sanitizeCurrentDirectory(chooser); + final int returnVal = chooser.showSaveDialog(this); + if (returnVal == JFileChooser.APPROVE_OPTION) { + File file = chooser.getSelectedFile(); + try { + if (chooser.getFileFilter() == FileFilters.CSV_FILE_FILTER && !file.getName().endsWith(".csv")) { + file = new File(file.getParentFile(), file.getName() + ".csv"); + } + archetypesTableModel.saveAsCsv(file); + } catch (final IOException ex) { + ACTION_BUILDER.showMessageDialog(this, "browseArchetypesSaveIOException", file, ex.getMessage()); + } + } + } + + /** * Adds an attribute to the table. * @param performAction whether the action should be performed * @return whether the action can or was performed Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/BrowseArchetypesTableModel.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/BrowseArchetypesTableModel.java 2014-10-07 20:16:12 UTC (rev 9706) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/BrowseArchetypesTableModel.java 2014-10-07 20:26:35 UTC (rev 9707) @@ -19,10 +19,18 @@ package net.sf.gridarta.gui.dialog.browsearchetypes; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.Writer; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.WeakHashMap; +import java.util.regex.Pattern; import javax.swing.table.AbstractTableModel; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.archetypeset.ArchetypeSet; @@ -53,6 +61,19 @@ private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); /** + * If a value written into a CSV file matches this regex, it will not be + * surrounded by " characters. + */ + @NotNull + private static final Pattern PATTERN_PLAIN_CSV_VALUE = Pattern.compile("[a-zA-Z_0-9]+"); + + /** + * A {@link Pattern} that matches a single " character. + */ + @NotNull + private static final Pattern PATTERN_QUOTE = Pattern.compile("\""); + + /** * The {@link ArchetypeSet} from which archetypes are shown. */ @NotNull @@ -256,4 +277,62 @@ return archetypes.get(index); } + /** + * Saves the current contents as a CSV file. + * @param file the file to write to + * @throws IOException if an I/O error occurs writing the file + */ + public void saveAsCsv(@NotNull final File file) throws IOException { + final OutputStream outputStream = new FileOutputStream(file); + try { + final Writer writer = new OutputStreamWriter(outputStream); + try { + final BufferedWriter bufferedWriter = new BufferedWriter(writer); + try { + final int columns = getColumnCount(); + final int rows = getRowCount(); + for (int column = 0; column < columns; column++) { + if (column > 0) { + bufferedWriter.write(","); + } + writeCsvValue(bufferedWriter, getColumnName(column)); + } + bufferedWriter.newLine(); + for (int row = 0; row < rows; row++) { + for (int column = 0; column < columns; column++) { + if (column > 0) { + bufferedWriter.write(","); + } + final Object value = getValueAt(row, column); + writeCsvValue(bufferedWriter, value == null ? "" : value.toString()); + } + bufferedWriter.newLine(); + } + } finally { + bufferedWriter.close(); + } + } finally { + writer.close(); + } + } finally { + outputStream.close(); + } + } + + /** + * Writes a value into a CSV value. + * @param writer the file to write to + * @param value the value to write + * @throws IOException if an I/O error occurs writing the value + */ + private static void writeCsvValue(@NotNull final Writer writer, @NotNull final String value) throws IOException { + if (PATTERN_PLAIN_CSV_VALUE.matcher(value).matches()) { + writer.write(value); + } else { + writer.write("\""); + writer.write(PATTERN_QUOTE.matcher(value).replaceAll("\"\"")); + writer.write("\""); + } + } + } Modified: trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages.properties 2014-10-07 20:16:12 UTC (rev 9706) +++ trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages.properties 2014-10-07 20:26:35 UTC (rev 9707) @@ -639,6 +639,7 @@ attribApply.text=Apply attribCancel.text=Cancel +fileDialog.filter.csv=CSV Images fileDialog.filter.maps=Map Files fileDialog.filter.png=PNG Images fileDialog.filter.python=Python Scripts @@ -1841,6 +1842,12 @@ # Browse Archetypes Dialog browseArchetypesAddAttribute.text=Add Attribute browseArchetypesAddAttribute.shortdescription=Displays an attribute. +browseArchetypesSave.text= +browseArchetypesSave.shortdescription=Saves the current list into a CSV file. +browseArchetypesSave.icon=general/Save16 +browseArchetypesSave.title=Save as CSV file +browseArchetypesSaveIOException.title=Couldn''t save CSV file +browseArchetypesSaveIOException.message=The CSV file could not be created because the file\n{0} cannot be written:\n{1} browseArchetypes.title=Browse Archetypes browseArchetypes.table.archetype=Archetype browseArchetypes.table.name=Name Modified: trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_de.properties =================================================================== --- trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_de.properties 2014-10-07 20:16:12 UTC (rev 9706) +++ trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_de.properties 2014-10-07 20:26:35 UTC (rev 9707) @@ -617,6 +617,7 @@ attribApply.text=Anwenden attribCancel.text=Abbrechen +fileDialog.filter.csv=CSV-Dateien fileDialog.filter.maps=Karten-Dateien fileDialog.filter.png=PNG-Grafiken fileDialog.filter.python=Python-Skripte @@ -1587,6 +1588,11 @@ # Browse Archetypes Dialog browseArchetypesAddAttribute.text=Attribut anzeigen browseArchetypesAddAttribute.shortdescription=F\xFCgt das Attribut zur Tabelle hinzu. +browseArchetypesSave.text= +browseArchetypesSave.shortdescription=Speicher the aktuelle Auswahl als CSV-Datei. +browseArchetypesSave.title=Als CSV-Datei speichern +browseArchetypesSaveIOException.title=Kann CSV-Datei nicht speichern +browseArchetypesSaveIOException.message=Die CSV-Datei kann nicht erzeugt werden, da ein Ein-/Ausgabefehler\nbeim Schreiben von {0} aufgetreten ist:\n{1} browseArchetypes.title=Archetypen anzeigen browseArchetypes.table.archetype=Archetyp browseArchetypes.table.name=Name Modified: trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_fr.properties =================================================================== --- trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_fr.properties 2014-10-07 20:16:12 UTC (rev 9706) +++ trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_fr.properties 2014-10-07 20:26:35 UTC (rev 9707) @@ -611,6 +611,7 @@ attribApply.text=Appliquer attribCancel.text=Annuler +#fileDialog.filter.csv= fileDialog.filter.maps=Fichier carte fileDialog.filter.png=Images PNG fileDialog.filter.python=Scripts python @@ -1574,6 +1575,11 @@ # Browse Archetypes Dialog browseArchetypesAddAttribute.text=Ajouter browseArchetypesAddAttribute.shortdescription=Ajouter un attribut \u00e0 l'affichage. +#browseArchetypesSave.text= +#browseArchetypesSave.shortdescription= +#browseArchetypesSave.title= +#browseArchetypesSaveIOException.title= +#browseArchetypesSaveIOException.message= browseArchetypes.title=Parcourir les arch\u00e9types browseArchetypes.table.archetype=Arch\u00e9type browseArchetypes.table.name=Nom Modified: trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_sv.properties =================================================================== --- trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_sv.properties 2014-10-07 20:16:12 UTC (rev 9706) +++ trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_sv.properties 2014-10-07 20:26:35 UTC (rev 9707) @@ -611,6 +611,7 @@ attribApply.text=Anv\u00e4nd attribCancel.text=Avbryt +#fileDialog.filter.csv= fileDialog.filter.maps=Kartfiler fileDialog.filter.png=PNG-bilder fileDialog.filter.python=Pythonscript @@ -1573,6 +1574,11 @@ # Browse Archetypes Dialog #browseArchetypesAddAttribute.text= #browseArchetypesAddAttribute.shortdescription= +#browseArchetypesSave.text= +#browseArchetypesSave.shortdescription= +#browseArchetypesSave.title= +#browseArchetypesSaveIOException.title= +#browseArchetypesSaveIOException.message= #browseArchetypes.title= #browseArchetypes.table.archetype= #browseArchetypes.table.name= Modified: trunk/src/utils/src/main/java/net/sf/gridarta/utils/FileFilters.java =================================================================== --- trunk/src/utils/src/main/java/net/sf/gridarta/utils/FileFilters.java 2014-10-07 20:16:12 UTC (rev 9706) +++ trunk/src/utils/src/main/java/net/sf/gridarta/utils/FileFilters.java 2014-10-07 20:26:35 UTC (rev 9707) @@ -67,4 +67,10 @@ @NotNull public static final FileFilter PNG_FILE_FILTER = new HideFileFilterProxy(new EndingFileFilter(true, ActionBuilderUtils.getString(ACTION_BUILDER, "fileDialog.filter.png"), ".png")); + /** + * Swing FileFilter for CSV files. + */ + @NotNull + public static final FileFilter CSV_FILE_FILTER = new HideFileFilterProxy(new EndingFileFilter(true, ActionBuilderUtils.getString(ACTION_BUILDER, "fileDialog.filter.csv"), ".csv")); + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-10-07 20:16:22
|
Revision: 9706 http://sourceforge.net/p/gridarta/code/9706 Author: akirschbaum Date: 2014-10-07 20:16:12 +0000 (Tue, 07 Oct 2014) Log Message: ----------- Fix spuriously failing regression test. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenuLoader.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenuLoader.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenuLoader.java 2014-05-30 17:43:11 UTC (rev 9705) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenuLoader.java 2014-10-07 20:16:12 UTC (rev 9706) @@ -62,7 +62,7 @@ * The {@link Preferences}. */ @NotNull - private static final Preferences PREFERENCES = Preferences.userNodeForPackage(MainControl.class); + private final Preferences preferences = Preferences.userNodeForPackage(MainControl.class); /** * The preferences key prefix. @@ -95,7 +95,7 @@ * @return the number of entries */ public int loadNumEntries() { - final int result = PREFERENCES.getInt(key + "Num", 0); + final int result = preferences.getInt(key + "Num", 0); if (LOG.isDebugEnabled()) { LOG.debug(System.identityHashCode(this) + " loadNumEntries=" + result); } @@ -110,7 +110,7 @@ if (LOG.isDebugEnabled()) { LOG.debug(System.identityHashCode(this) + " saveNumEntries(" + num + ")"); } - PREFERENCES.putInt(key + "Num", num); + preferences.putInt(key + "Num", num); } /** @@ -122,10 +122,10 @@ @NotNull public Result loadEntry(final int index) throws IOException { final String suffix = "[" + index + "]"; - final String title = PREFERENCES.get(key + "Title" + suffix, ""); - final String filename = PREFERENCES.get(key + "Filename" + suffix, ""); - final String directory = PREFERENCES.get(key + "Directory" + suffix, ""); - final String typeString = PREFERENCES.get(key + "Type" + suffix, Type.MAP.toString()); + final String title = preferences.get(key + "Title" + suffix, ""); + final String filename = preferences.get(key + "Filename" + suffix, ""); + final String directory = preferences.get(key + "Directory" + suffix, ""); + final String typeString = preferences.get(key + "Type" + suffix, Type.MAP.toString()); final Type type; try { type = Type.valueOf(typeString); @@ -185,17 +185,17 @@ LOG.debug(System.identityHashCode(this) + " saveEntry(title=" + title + ", filename=" + filename + ", directory=" + directory + ", type=" + type + ")"); } final String suffix = "[" + index + "]"; - PREFERENCES.put(key + "Title" + suffix, title); - PREFERENCES.put(key + "Filename" + suffix, filename); + preferences.put(key + "Title" + suffix, title); + preferences.put(key + "Filename" + suffix, filename); if (directory.isEmpty()) { - PREFERENCES.remove(key + "Directory" + suffix); + preferences.remove(key + "Directory" + suffix); } else { - PREFERENCES.put(key + "Directory" + suffix, directory); + preferences.put(key + "Directory" + suffix, directory); } if (type == Type.MAP) { - PREFERENCES.remove(key + "Type" + suffix); + preferences.remove(key + "Type" + suffix); } else { - PREFERENCES.put(key + "Type" + suffix, type.toString()); + preferences.put(key + "Type" + suffix, type.toString()); } } @@ -208,10 +208,10 @@ LOG.debug(System.identityHashCode(this) + " removeEntry(" + index + ")"); } final String suffix = "[" + index + "]"; - PREFERENCES.remove(key + "Title" + suffix); - PREFERENCES.remove(key + "Filename" + suffix); - PREFERENCES.remove(key + "Directory" + suffix); - PREFERENCES.remove(key + "Type" + suffix); + preferences.remove(key + "Title" + suffix); + preferences.remove(key + "Filename" + suffix); + preferences.remove(key + "Directory" + suffix); + preferences.remove(key + "Type" + suffix); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-05-30 17:43:18
|
Revision: 9705 http://sourceforge.net/p/gridarta/code/9705 Author: akirschbaum Date: 2014-05-30 17:43:11 +0000 (Fri, 30 May 2014) Log Message: ----------- Support map attribute "first_load". [Crossfire] Modified Paths: -------------- trunk/src/crossfire/ChangeLog trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/MapPropertiesDialog.java trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/io/MapArchObjectParser.java trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/maparchobject/MapArchObject.java trunk/src/crossfire/src/main/resources/net/sf/gridarta/var/crossfire/messages.properties trunk/src/crossfire/src/main/resources/net/sf/gridarta/var/crossfire/messages_de.properties trunk/src/crossfire/src/main/resources/net/sf/gridarta/var/crossfire/messages_fr.properties trunk/src/crossfire/src/main/resources/net/sf/gridarta/var/crossfire/messages_sv.properties Added Paths: ----------- trunk/src/crossfire/src/test/java/net/sf/gridarta/var/crossfire/model/io/MapArchObjectParserTest.java Modified: trunk/src/crossfire/ChangeLog =================================================================== --- trunk/src/crossfire/ChangeLog 2014-03-26 06:45:57 UTC (rev 9704) +++ trunk/src/crossfire/ChangeLog 2014-05-30 17:43:11 UTC (rev 9705) @@ -1,3 +1,7 @@ +2014-05-30 Andreas Kirschbaum + + * Support map attribute "first_load". + 2014-03-11 Andreas Kirschbaum * Properly load cfpython_menu.def. Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/MapPropertiesDialog.java =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/MapPropertiesDialog.java 2014-03-26 06:45:57 UTC (rev 9704) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/MapPropertiesDialog.java 2014-05-30 17:43:11 UTC (rev 9705) @@ -326,6 +326,13 @@ private final JTextField fieldSkySetting = new JTextField(); /** + * The timestamp when the Crossfire server has loaded this map. + * @serial + */ + @NotNull + private final JTextField fieldFirstLoad = new JTextField(); + + /** * The button for ok. * @serial */ @@ -442,6 +449,7 @@ TextComponentUtils.setAutoSelectOnFocus(fieldWindSpeed); TextComponentUtils.setAutoSelectOnFocus(fieldWindDirection); TextComponentUtils.setAutoSelectOnFocus(fieldSkySetting); + TextComponentUtils.setAutoSelectOnFocus(fieldFirstLoad); } /** @@ -480,6 +488,7 @@ addInputFieldLine(panel, fieldSwapTime, 10, String.valueOf(map.getSwapTime()), "mapSwapTime"); addInputFieldLine(panel, fieldResetTimeout, 10, String.valueOf(map.getResetTimeout()), "mapResetTimeout"); addInputFieldLine(panel, fieldBackgroundMusic, 10, String.valueOf(map.getBackgroundMusic()), "mapBackgroundMusic"); + addInputFieldLine(panel, fieldFirstLoad, 10, String.valueOf(map.getFirstLoad()), "mapFirstLoad"); addFiller(panel); return panel; } @@ -671,6 +680,7 @@ final Size2D mapSize; final int enterX; final int enterY; + final int firstLoad; try { // try to parse everything final int width = parseProperty(mapWidthField.getText(), "Width"); @@ -695,6 +705,7 @@ windSpeed = parseProperty(fieldWindSpeed.getText(), "Wind Speed"); windDirection = parseProperty(fieldWindDirection.getText(), "Wind Direction"); skySetting = parseProperty(fieldSkySetting.getText(), "Sky Setting"); + firstLoad = parseProperty(fieldFirstLoad.getText(), "First Load"); // Now do some sanity checks: if (width < 1 || height < 1) { @@ -740,6 +751,7 @@ mapArchObject.setUnique(checkboxUnique.isSelected()); mapArchObject.setOutdoor(checkboxOutdoor.isSelected()); mapArchObject.setNoSmooth(checkboxNoSmooth.isSelected()); + mapArchObject.setFirstLoad(firstLoad); mapArchObject.setShopItems(shopItems); mapArchObject.setShopRace(shopRace); @@ -845,6 +857,7 @@ fieldBackgroundMusic.setText(String.valueOf(map.getBackgroundMusic())); fieldDarkness.setText(String.valueOf(map.getDarkness())); fieldDifficulty.setText(String.valueOf(map.getDifficulty())); + fieldFirstLoad.setText(String.valueOf(map.getFirstLoad())); checkboxUnique.setSelected(map.isUnique()); checkboxOutdoor.setSelected(map.isOutdoor()); Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/io/MapArchObjectParser.java =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/io/MapArchObjectParser.java 2014-03-26 06:45:57 UTC (rev 9704) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/io/MapArchObjectParser.java 2014-05-30 17:43:11 UTC (rev 9705) @@ -139,6 +139,9 @@ if (!mapArchObject.getBackgroundMusic().isEmpty()) { format.format("background_music %s\n", mapArchObject.getBackgroundMusic()); } + if (mapArchObject.getFirstLoad() != 0) { + format.format("first_load %d\n", mapArchObject.getFirstLoad()); + } appendable.append("end\n"); } @@ -247,6 +250,11 @@ return true; } + if (line.startsWith("first_load ")) { + mapArchObject.setFirstLoad(NumberUtils.parseInt(line.substring(11))); + return true; + } + return false; } Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/maparchobject/MapArchObject.java =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/maparchobject/MapArchObject.java 2014-03-26 06:45:57 UTC (rev 9704) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/maparchobject/MapArchObject.java 2014-05-30 17:43:11 UTC (rev 9705) @@ -150,6 +150,12 @@ private String backgroundMusic; /** + * The timestamp the Crossfire server has loaded this map. + * @serial + */ + private int firstLoad; + + /** * Creates a new instance. */ public MapArchObject() { @@ -182,6 +188,7 @@ shopMax = mapArchObject.shopMax; region = mapArchObject.region; backgroundMusic = mapArchObject.backgroundMusic; + firstLoad = mapArchObject.firstLoad; } /** @@ -207,6 +214,7 @@ setShopMax(mapArchObject.shopMax); setRegion(mapArchObject.region); setBackgroundMusic(mapArchObject.backgroundMusic); + setFirstLoad(mapArchObject.firstLoad); } /** @@ -600,6 +608,27 @@ } /** + * Returns the timestamp the Crossfire server has loaded this map. + * @return the timestamp + */ + public int getFirstLoad() { + return firstLoad; + } + + /** + * Sets the timestamp the Crossfire server has loaded this map. + * @param firstLoad the timestamp + */ + public void setFirstLoad(final int firstLoad) { + if (this.firstLoad == firstLoad) { + return; + } + + this.firstLoad = firstLoad; + setModified(); + } + + /** * {@inheritDoc} */ @SuppressWarnings("FloatingPointEquality") @@ -612,7 +641,7 @@ return false; } final MapArchObject mapArchObject = (MapArchObject) obj; - return super.equals(obj) && mapArchObject.loreText.toString().equals(loreText.toString()) && mapArchObject.unique == unique && mapArchObject.template == template && mapArchObject.noSmooth == noSmooth && mapArchObject.temperature == temperature && mapArchObject.pressure == pressure && mapArchObject.humidity == humidity && mapArchObject.windSpeed == windSpeed && mapArchObject.windDirection == windDirection && mapArchObject.sky == sky && mapArchObject.shopItems.equals(shopItems) && mapArchObject.shopRace.equals(shopRace) && mapArchObject.shopGreed == shopGreed && mapArchObject.shopMin == shopMin && mapArchObject.shopMax == shopMax && mapArchObject.region.equals(region) && mapArchObject.backgroundMusic.equals(backgroundMusic); + return super.equals(obj) && mapArchObject.loreText.toString().equals(loreText.toString()) && mapArchObject.unique == unique && mapArchObject.template == template && mapArchObject.noSmooth == noSmooth && mapArchObject.temperature == temperature && mapArchObject.pressure == pressure && mapArchObject.humidity == humidity && mapArchObject.windSpeed == windSpeed && mapArchObject.windDirection == windDirection && mapArchObject.sky == sky && mapArchObject.shopItems.equals(shopItems) && mapArchObject.shopRace.equals(shopRace) && mapArchObject.shopGreed == shopGreed && mapArchObject.shopMin == shopMin && mapArchObject.shopMax == shopMax && mapArchObject.region.equals(region) && mapArchObject.backgroundMusic.equals(backgroundMusic) && mapArchObject.firstLoad == firstLoad; } /** @@ -620,7 +649,7 @@ */ @Override public int hashCode() { - return super.hashCode() + loreText.hashCode() + (unique ? 1 : 0) + (template ? 2 : 0) + (noSmooth ? 8 : 0) + temperature + pressure + humidity + windSpeed + windDirection + sky + shopItems.hashCode() + shopRace.hashCode() + (int) shopGreed + shopMin + shopMax + region.hashCode() + backgroundMusic.hashCode(); + return super.hashCode() + loreText.hashCode() + (unique ? 1 : 0) + (template ? 2 : 0) + (noSmooth ? 8 : 0) + temperature + pressure + humidity + windSpeed + windDirection + sky + shopItems.hashCode() + shopRace.hashCode() + (int) shopGreed + shopMin + shopMax + region.hashCode() + backgroundMusic.hashCode() + firstLoad; } /** Modified: trunk/src/crossfire/src/main/resources/net/sf/gridarta/var/crossfire/messages.properties =================================================================== --- trunk/src/crossfire/src/main/resources/net/sf/gridarta/var/crossfire/messages.properties 2014-03-26 06:45:57 UTC (rev 9704) +++ trunk/src/crossfire/src/main/resources/net/sf/gridarta/var/crossfire/messages.properties 2014-05-30 17:43:11 UTC (rev 9705) @@ -103,6 +103,7 @@ mapWindSpeed=Wind speed mapWindDirection=Wind direction mapSkySetting=Sky setting +mapFirstLoad=First load timestamp ####### Modified: trunk/src/crossfire/src/main/resources/net/sf/gridarta/var/crossfire/messages_de.properties =================================================================== --- trunk/src/crossfire/src/main/resources/net/sf/gridarta/var/crossfire/messages_de.properties 2014-03-26 06:45:57 UTC (rev 9704) +++ trunk/src/crossfire/src/main/resources/net/sf/gridarta/var/crossfire/messages_de.properties 2014-05-30 17:43:11 UTC (rev 9705) @@ -51,6 +51,7 @@ mapWindSpeed=Windgeschwindigkeit mapWindDirection=Windrichtung mapSkySetting=Wetterbedingung +mapFirstLoad=Kartenlade-Zeitpunkt ####### Modified: trunk/src/crossfire/src/main/resources/net/sf/gridarta/var/crossfire/messages_fr.properties =================================================================== --- trunk/src/crossfire/src/main/resources/net/sf/gridarta/var/crossfire/messages_fr.properties 2014-03-26 06:45:57 UTC (rev 9704) +++ trunk/src/crossfire/src/main/resources/net/sf/gridarta/var/crossfire/messages_fr.properties 2014-05-30 17:43:11 UTC (rev 9705) @@ -52,6 +52,7 @@ #mapWindSpeed= #mapWindDirection= #mapSkySetting= +#mapFirstLoad= ####### Modified: trunk/src/crossfire/src/main/resources/net/sf/gridarta/var/crossfire/messages_sv.properties =================================================================== --- trunk/src/crossfire/src/main/resources/net/sf/gridarta/var/crossfire/messages_sv.properties 2014-03-26 06:45:57 UTC (rev 9704) +++ trunk/src/crossfire/src/main/resources/net/sf/gridarta/var/crossfire/messages_sv.properties 2014-05-30 17:43:11 UTC (rev 9705) @@ -51,6 +51,7 @@ #mapWindSpeed= #mapWindDirection= #mapSkySetting= +#mapFirstLoad= ####### Added: trunk/src/crossfire/src/test/java/net/sf/gridarta/var/crossfire/model/io/MapArchObjectParserTest.java =================================================================== --- trunk/src/crossfire/src/test/java/net/sf/gridarta/var/crossfire/model/io/MapArchObjectParserTest.java (rev 0) +++ trunk/src/crossfire/src/test/java/net/sf/gridarta/var/crossfire/model/io/MapArchObjectParserTest.java 2014-05-30 17:43:11 UTC (rev 9705) @@ -0,0 +1,29 @@ +package net.sf.gridarta.var.crossfire.model.io; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.StringReader; +import net.sf.gridarta.var.crossfire.model.maparchobject.MapArchObject; +import org.junit.Assert; +import org.junit.Test; + +/** + * Regression tests for {@link MapArchObjectParser}. + */ +public class MapArchObjectParserTest { + + /** + * Checks that the "first_load" attribute can be parsed. + * @throws IOException if the test fails + */ + @SuppressWarnings("IOResourceOpenedButNotSafelyClosed") + @Test + public void testLoadFirstLoad() throws IOException { + final MapArchObjectParser parser = new MapArchObjectParser(); + final BufferedReader reader = new BufferedReader(new StringReader("arch map\nfirst_load 1234\nend\n")); + final MapArchObject mapArchObject = new MapArchObject(); + parser.load(reader, mapArchObject); + Assert.assertEquals(1234, mapArchObject.getFirstLoad()); + } + +} Property changes on: trunk/src/crossfire/src/test/java/net/sf/gridarta/var/crossfire/model/io/MapArchObjectParserTest.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-03-26 06:46:08
|
Revision: 9704 http://sourceforge.net/p/gridarta/code/9704 Author: akirschbaum Date: 2014-03-26 06:45:57 +0000 (Wed, 26 Mar 2014) Log Message: ----------- Add debug output. Modified Paths: -------------- streams/debug/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenu.java streams/debug/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenuLoader.java streams/debug/src/gridarta/src/test/java/net/sf/gridarta/gui/mapmenu/MapMenuPreferencesTest.java streams/debug/src/preferences/src/main/java/net/sf/gridarta/preferences/FilePreferences.java streams/debug/src/preferences/src/main/java/net/sf/gridarta/preferences/Storage.java Modified: streams/debug/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenu.java =================================================================== --- streams/debug/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenu.java 2014-03-26 06:40:42 UTC (rev 9703) +++ streams/debug/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenu.java 2014-03-26 06:45:57 UTC (rev 9704) @@ -117,6 +117,8 @@ //noinspection ThisEscapedInObjectConstruction LOG.debug(System.identityHashCode(this) + " new " + key); } + //noinspection ThisEscapedInObjectConstruction + System.out.println("MapMenu: " + System.identityHashCode(this) + " new " + key); mapMenuLoader = new MapMenuLoader(key, pathManager); treeModel.addTreeModelListener(treeModelListener); } @@ -129,6 +131,7 @@ if (LOG.isDebugEnabled()) { LOG.debug(System.identityHashCode(this) + " load: root.removeAllChildren"); } + System.out.println("MapMenu: " + System.identityHashCode(this) + " load: root.removeAllChildren"); root.removeAllChildren(); for (int i = 0; i < num; i++) { final MapMenuLoader.Result result; @@ -136,6 +139,7 @@ result = mapMenuLoader.loadEntry(i); } catch (final IOException ex) { LOG.warn("dropping invalid bookmark: " + ex.getMessage()); + System.out.println("MapMenu: " + System.identityHashCode(this) + " warn: dropping invalid bookmark: " + ex.getMessage()); continue; } addMapMenuEntry(result.getDirectory(), result.getMapMenuEntry()); @@ -222,6 +226,7 @@ if (LOG.isDebugEnabled()) { LOG.debug(System.identityHashCode(this) + " addMapMenuEntry(" + directory + ", " + treeNode + ")"); } + System.out.println("MapMenu: " + System.identityHashCode(this) + " addMapMenuEntry(" + directory + ", " + treeNode + ")"); final String[] paths = StringUtils.PATTERN_SLASH.split(directory); DefaultMutableTreeNode dir2 = root; for (final String path : paths) { @@ -246,6 +251,7 @@ if (LOG.isDebugEnabled()) { LOG.debug(System.identityHashCode(this) + " getOrCreateDirectory(" + this2 + ", " + path + ")=invalid directory name"); } + System.out.println("MapMenu: " + System.identityHashCode(this) + " getOrCreateDirectory(" + this2 + ", " + path + ")=invalid directory name"); throw new IllegalArgumentException("invalid directory name '" + path + "'"); } @@ -256,6 +262,7 @@ if (LOG.isDebugEnabled()) { LOG.debug(System.identityHashCode(this) + " getOrCreateDirectory(" + this2 + ", " + path + ")=existing " + treeNode); } + System.out.println("MapMenu: " + System.identityHashCode(this) + " getOrCreateDirectory(" + this2 + ", " + path + ")=existing " + treeNode); return treeNode; } } @@ -265,6 +272,7 @@ if (LOG.isDebugEnabled()) { LOG.debug(System.identityHashCode(this) + " getOrCreateDirectory(" + this2 + ", " + path + ")=new " + new2); } + System.out.println("MapMenu: " + System.identityHashCode(this) + " getOrCreateDirectory(" + this2 + ", " + path + ")=new " + new2); return new2; } @@ -281,6 +289,7 @@ if (LOG.isDebugEnabled()) { LOG.debug(System.identityHashCode(this) + " insertNodeInto(" + mapEntry + ", " + parent + ", " + index + ")"); } + System.out.println("MapMenu: " + System.identityHashCode(this) + " insertNodeInto(" + mapEntry + ", " + parent + ", " + index + ")"); final DefaultMutableTreeNode treeNode = new DefaultMutableTreeNode(mapEntry, mapEntry.allowsChildren()); treeModel.insertNodeInto(treeNode, parent, index); save(); @@ -297,6 +306,7 @@ if (LOG.isDebugEnabled()) { LOG.debug(System.identityHashCode(this) + " removeNode " + treeNode); } + System.out.println("MapMenu: " + System.identityHashCode(this) + " removeNode " + treeNode); final String directory = getDirectory(treeNode); treeModel.removeNodeFromParent(treeNode); deletedNodes.addFirst(new DeletedNode(directory, treeNode)); @@ -308,6 +318,7 @@ if (LOG.isDebugEnabled()) { LOG.debug(System.identityHashCode(this) + " removeNode: not removing root " + treeNode); } + System.out.println("MapMenu: " + System.identityHashCode(this) + " removeNode: not removing root " + treeNode); } } @@ -370,6 +381,7 @@ if (LOG.isDebugEnabled()) { LOG.debug(System.identityHashCode(this) + " size(" + root + ")=" + result); } + System.out.println("MapMenu: " + System.identityHashCode(this) + " size(" + root + ")=" + result); return result; } Modified: streams/debug/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenuLoader.java =================================================================== --- streams/debug/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenuLoader.java 2014-03-26 06:40:42 UTC (rev 9703) +++ streams/debug/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenuLoader.java 2014-03-26 06:45:57 UTC (rev 9704) @@ -86,6 +86,8 @@ //noinspection ThisEscapedInObjectConstruction LOG.debug(System.identityHashCode(this) + " new " + key); } + //noinspection ThisEscapedInObjectConstruction + System.out.println("MapMenuLoader: " + System.identityHashCode(this) + " new " + key); this.key = key; this.pathManager = pathManager; } @@ -99,6 +101,7 @@ if (LOG.isDebugEnabled()) { LOG.debug(System.identityHashCode(this) + " loadNumEntries=" + result); } + System.out.println("MapMenuLoader: " + System.identityHashCode(this) + " loadNumEntries=" + result); return result; } @@ -110,6 +113,7 @@ if (LOG.isDebugEnabled()) { LOG.debug(System.identityHashCode(this) + " saveNumEntries(" + num + ")"); } + System.out.println("MapMenuLoader: " + System.identityHashCode(this) + " saveNumEntries(" + num + ")"); PREFERENCES.putInt(key + "Num", num); } @@ -133,6 +137,7 @@ if (LOG.isDebugEnabled()) { LOG.debug(System.identityHashCode(this) + " loadEntry(" + index + ")=invalid type: " + typeString + " [" + ex.getMessage() + "]"); } + System.out.println("MapMenuLoader: " + System.identityHashCode(this) + " loadEntry(" + index + ")=invalid type: " + typeString + " [" + ex.getMessage() + "]"); throw new IOException("invalid type: " + typeString, ex); } if (type == Type.DIR) { @@ -143,18 +148,21 @@ if (LOG.isDebugEnabled()) { LOG.debug(System.identityHashCode(this) + " loadEntry(" + index + ")=invalid directory name: " + title + " [" + ex.getMessage() + "]"); } + System.out.println("MapMenuLoader: " + System.identityHashCode(this) + " loadEntry(" + index + ")=invalid directory name: " + title + " [" + ex.getMessage() + "]"); throw new IOException("invalid directory name: " + title, ex); } final Result result = new Result(directory, mapMenuEntry); if (LOG.isDebugEnabled()) { LOG.debug(System.identityHashCode(this) + " loadEntry(" + index + ")=DIR[" + result + "]"); } + System.out.println("MapMenuLoader: " + System.identityHashCode(this) + " loadEntry(" + index + ")=DIR[" + result + "]"); return result; } else if (type == Type.MAP) { if (filename.isEmpty()) { if (LOG.isDebugEnabled()) { LOG.debug(System.identityHashCode(this) + " loadEntry(" + index + ")=empty filename: " + title); } + System.out.println("MapMenuLoader: " + System.identityHashCode(this) + " loadEntry(" + index + ")=empty filename: " + title); throw new IOException("bookmark without file name: " + title); } @@ -163,11 +171,13 @@ if (LOG.isDebugEnabled()) { LOG.debug(System.identityHashCode(this) + " loadEntry(" + index + ")=MAP[" + result + "]"); } + System.out.println("MapMenuLoader: " + System.identityHashCode(this) + " loadEntry(" + index + ")=MAP[" + result + "]"); return result; } else { if (LOG.isDebugEnabled()) { LOG.debug(System.identityHashCode(this) + " loadEntry(" + index + ")=invalid type: " + type); } + System.out.println("MapMenuLoader: " + System.identityHashCode(this) + " loadEntry(" + index + ")=invalid type: " + type); throw new IOException("invalid type: " + type); } } @@ -184,6 +194,7 @@ if (LOG.isDebugEnabled()) { LOG.debug(System.identityHashCode(this) + " saveEntry(title=" + title + ", filename=" + filename + ", directory=" + directory + ", type=" + type + ")"); } + System.out.println("MapMenuLoader: " + System.identityHashCode(this) + " saveEntry(title=" + title + ", filename=" + filename + ", directory=" + directory + ", type=" + type + ")"); final String suffix = "[" + index + "]"; PREFERENCES.put(key + "Title" + suffix, title); PREFERENCES.put(key + "Filename" + suffix, filename); @@ -207,6 +218,7 @@ if (LOG.isDebugEnabled()) { LOG.debug(System.identityHashCode(this) + " removeEntry(" + index + ")"); } + System.out.println("MapMenuLoader: " + System.identityHashCode(this) + " removeEntry(" + index + ")"); final String suffix = "[" + index + "]"; PREFERENCES.remove(key + "Title" + suffix); PREFERENCES.remove(key + "Filename" + suffix); Modified: streams/debug/src/gridarta/src/test/java/net/sf/gridarta/gui/mapmenu/MapMenuPreferencesTest.java =================================================================== --- streams/debug/src/gridarta/src/test/java/net/sf/gridarta/gui/mapmenu/MapMenuPreferencesTest.java 2014-03-26 06:40:42 UTC (rev 9703) +++ streams/debug/src/gridarta/src/test/java/net/sf/gridarta/gui/mapmenu/MapMenuPreferencesTest.java 2014-03-26 06:45:57 UTC (rev 9704) @@ -50,6 +50,7 @@ */ @Test public void test1() throws IOException { + System.out.println("MapMenuPrefernecesTest: begin test1"); final PathManager pathManager = new PathManager(new TestProjectSettings()); final MapMenuLoader pref = new MapMenuLoader("key", pathManager); Assert.assertEquals(0, pref.loadNumEntries()); @@ -92,6 +93,7 @@ // ignore } pref.loadEntry(1); + System.out.println("MapMenuPrefernecesTest: end test1"); } /** @@ -100,6 +102,7 @@ */ @Test public void test2() throws BackingStoreException { + System.out.println("MapMenuPrefernecesTest: begin test2"); final PathManager pathManager = new PathManager(new TestProjectSettings()); final ActionBuilder actionBuilder = new DefaultActionBuilder("net.sf.gridarta"); ActionBuilderFactory.getInstance().putActionBuilder("net.sf.gridarta", actionBuilder); @@ -114,6 +117,7 @@ final MapMenu mapMenu1 = new MapMenu("test", pathManager); mapMenu1.load(); + System.out.println("MapMenuPrefernecesTest: check mapMenu1.size()=" + mapMenu1.size() + " == 10"); Assert.assertEquals(10, mapMenu1.size()); for (final String key : preferences.keys()) { @@ -130,6 +134,7 @@ Assert.assertEquals(10, mapMenu2.size()); compareTrees(mapMenu1.getRoot(), mapMenu2.getRoot()); + System.out.println("MapMenuPrefernecesTest: end test2"); } /** @@ -138,6 +143,7 @@ */ @Test public void test3() { + System.out.println("MapMenuPrefernecesTest: begin test3"); final PathManager pathManager = new PathManager(new TestProjectSettings()); final ActionBuilder actionBuilder = new DefaultActionBuilder("net.sf.gridarta"); ActionBuilderFactory.getInstance().putActionBuilder("net.sf.gridarta", actionBuilder); @@ -155,6 +161,7 @@ mapMenu2.load(); compareTrees(mapMenu1.getRoot(), mapMenu2.getRoot()); + System.out.println("MapMenuPrefernecesTest: end test3"); } /** Modified: streams/debug/src/preferences/src/main/java/net/sf/gridarta/preferences/FilePreferences.java =================================================================== --- streams/debug/src/preferences/src/main/java/net/sf/gridarta/preferences/FilePreferences.java 2014-03-26 06:40:42 UTC (rev 9703) +++ streams/debug/src/preferences/src/main/java/net/sf/gridarta/preferences/FilePreferences.java 2014-03-26 06:45:57 UTC (rev 9704) @@ -101,6 +101,7 @@ if (LOG.isDebugEnabled()) { LOG.debug("childrenNamesSpi(" + fullName + ")=" + Arrays.toString(result)); } + System.out.println("FilePreferences: childrenNamesSpi(" + fullName + ")=" + Arrays.toString(result)); return result; } @@ -129,6 +130,7 @@ if (LOG.isDebugEnabled()) { LOG.debug("flush(" + fullName + ")"); } + System.out.println("FilePreferences: flush(" + fullName + ")"); storage.sync(false); } @@ -151,6 +153,7 @@ if (LOG.isDebugEnabled()) { LOG.debug("get(" + fullName + ", " + key + ") called for removed node"); } + System.out.println("FilePreferences: get(" + fullName + ", " + key + ") called for removed node"); throw new IllegalStateException("removed node"); } @@ -173,6 +176,7 @@ if (LOG.isDebugEnabled()) { LOG.debug("get(" + fullName + ", " + key + ", " + def + ")=" + value); } + System.out.println("FilePreferences: get(" + fullName + ", " + key + ", " + def + ")=" + value); return value; } @@ -235,6 +239,7 @@ if (LOG.isDebugEnabled()) { LOG.debug("getSpi(" + fullName + ", key=" + key + ")"); } + System.out.println("FilePreferences: getSpi(" + fullName + ", key=" + key + ")"); return storage.getValue(fullName, key); } @@ -248,6 +253,7 @@ if (LOG.isDebugEnabled()) { LOG.debug("keysSpi(" + fullName + ")"); } + System.out.println("FilePreferences: keysSpi(" + fullName + ")"); return storage.getKeys(fullName); } @@ -260,6 +266,7 @@ if (LOG.isDebugEnabled()) { LOG.debug("putSpi(" + fullName + ", key=" + key + ", value=" + value + ")"); } + System.out.println("FilePreferences: putSpi(" + fullName + ", key=" + key + ", value=" + value + ")"); storage.putValue(fullName, key, value); } @@ -272,6 +279,7 @@ if (LOG.isDebugEnabled()) { LOG.debug("removeNodeSpi(" + fullName + ")"); } + System.out.println("FilePreferences: removeNodeSpi(" + fullName + ")"); storage.removeNode(fullName); } @@ -284,6 +292,7 @@ if (LOG.isDebugEnabled()) { LOG.debug("removeSpi(" + fullName + ", key=" + key + ")"); } + System.out.println("FilePreferences: removeSpi(" + fullName + ", key=" + key + ")"); storage.removeValue(fullName, key); } @@ -305,6 +314,7 @@ if (LOG.isDebugEnabled()) { LOG.debug("sync(" + fullName + ")"); } + System.out.println("FilePreferences: sync(" + fullName + ")"); storage.sync(true); } Modified: streams/debug/src/preferences/src/main/java/net/sf/gridarta/preferences/Storage.java =================================================================== --- streams/debug/src/preferences/src/main/java/net/sf/gridarta/preferences/Storage.java 2014-03-26 06:40:42 UTC (rev 9703) +++ streams/debug/src/preferences/src/main/java/net/sf/gridarta/preferences/Storage.java 2014-03-26 06:45:57 UTC (rev 9704) @@ -98,6 +98,7 @@ if (LOG.isDebugEnabled()) { LOG.debug("new"); } + System.out.println("Storage: new"); this.defaultPath = defaultPath; this.file = file; @@ -114,6 +115,7 @@ if (LOG.isDebugEnabled()) { LOG.debug("newNode(" + path + ")"); } + System.out.println("Storage: newNode(" + path + ")"); if (!values.containsKey(path)) { values.put(path, new TreeMap<String, String>()); @@ -131,6 +133,7 @@ if (LOG.isDebugEnabled()) { LOG.debug("childrenNames(" + path + ")"); } + System.out.println("Storage: childrenNames(" + path + ")"); final String prefix = path + "/"; final Set<String> result = new TreeSet<String>(); @@ -154,6 +157,7 @@ if (LOG.isDebugEnabled()) { LOG.debug("getValue(" + path + ", " + key + ")"); } + System.out.println("Storage: getValue(" + path + ", " + key + ")"); final Map<String, String> map = values.get(path); assert map != null; // AbstractPreferences.getSpi() ensures this @@ -171,6 +175,7 @@ if (LOG.isDebugEnabled()) { LOG.debug("getKeys(" + path + ")"); } + System.out.println("Storage: getKeys(" + path + ")"); final Map<String, String> map = values.get(path); assert map != null; // AbstractPreferences.keysSpi() ensures this @@ -188,6 +193,7 @@ if (LOG.isDebugEnabled()) { LOG.debug("putValue(" + path + ", " + key + ", " + value + ")"); } + System.out.println("Storage: putValue(" + path + ", " + key + ", " + value + ")"); final Map<String, String> map = values.get(path); assert map != null; // AbstractPreferences.putSpi() ensures this @@ -205,6 +211,7 @@ if (LOG.isDebugEnabled()) { LOG.debug("removeNode(" + path + ")"); } + System.out.println("Storage: removeNode(" + path + ")"); if (values.remove(path) != null) { setChanged(); @@ -220,6 +227,7 @@ if (LOG.isDebugEnabled()) { LOG.debug("removeValue(" + path + ", " + key + ")"); } + System.out.println("Storage: removeValue(" + path + ", " + key + ")"); final Map<String, String> map = values.get(path); assert map != null; // AbstractPreferences.removeSpi() ensures this @@ -238,6 +246,7 @@ if (LOG.isDebugEnabled()) { LOG.debug("sync(" + sync + ")"); } + System.out.println("Storage: syn(" + sync + ")"); try { saveValues(); @@ -259,6 +268,7 @@ saveValues(); } catch (final IOException ex) { LOG.warn(file + ": " + ex.getMessage()); + System.out.println("Storage: warn: " + file + ": " + ex.getMessage()); } } @@ -273,6 +283,7 @@ if (LOG.isDebugEnabled()) { LOG.debug("loadValues: " + file); } + System.out.println("Storage: loadValues: " + file); values.clear(); @@ -297,6 +308,7 @@ // ignore } catch (final IOException ex) { LOG.warn(file + ": " + ex.getMessage()); + System.out.println("Storage: warn: " + file + ": " + ex.getMessage()); } } @@ -325,6 +337,7 @@ final String[] tmp = PATTERN_EQUAL.split(line, 2); if (tmp.length != 2) { LOG.warn(file + ":" + lnr.getLineNumber() + ": syntax error"); + System.out.println("Storage: warn: " + file + ":" + lnr.getLineNumber() + ": syntax error"); continue; } final String key = tmp[0]; @@ -347,6 +360,7 @@ if (LOG.isDebugEnabled()) { LOG.debug("saveValues: " + file); } + System.out.println("Storage: saveValues: " + file); final File tmpFile = new File(file.getPath() + ".tmp"); final FileOutputStream fos = new FileOutputStream(tmpFile); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-03-26 06:40:51
|
Revision: 9703 http://sourceforge.net/p/gridarta/code/9703 Author: akirschbaum Date: 2014-03-26 06:40:42 +0000 (Wed, 26 Mar 2014) Log Message: ----------- Create stream for debugging. Added Paths: ----------- streams/debug/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-03-24 20:34:00
|
Revision: 9702 http://sourceforge.net/p/gridarta/code/9702 Author: akirschbaum Date: 2014-03-24 20:33:55 +0000 (Mon, 24 Mar 2014) Log Message: ----------- Include more debug output in test reports. Modified Paths: -------------- trunk/src/atrinik/src/test/resources/log4j.properties trunk/src/crossfire/src/test/resources/log4j.properties trunk/src/daimonin/src/test/resources/log4j.properties trunk/src/gridarta/src/test/resources/log4j.properties trunk/src/model/src/test/resources/log4j.properties trunk/src/plugin/src/test/resources/log4j.properties trunk/src/preferences/src/test/resources/log4j.properties trunk/src/project/src/test/resources/log4j.properties trunk/src/textedit/src/test/resources/log4j.properties trunk/src/utils/src/test/resources/log4j.properties Modified: trunk/src/atrinik/src/test/resources/log4j.properties =================================================================== --- trunk/src/atrinik/src/test/resources/log4j.properties 2014-03-24 20:33:21 UTC (rev 9701) +++ trunk/src/atrinik/src/test/resources/log4j.properties 2014-03-24 20:33:55 UTC (rev 9702) @@ -17,8 +17,8 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # -# Set root logger level to INFO and its only appender to A1. -log4j.rootLogger=INFO, A1 +# Set root logger level to DEBUG and its only appender to A1. +log4j.rootLogger=DEBUG, A1 # A1 is set to be a ConsoleAppender. log4j.appender.A1=org.apache.log4j.ConsoleAppender Modified: trunk/src/crossfire/src/test/resources/log4j.properties =================================================================== --- trunk/src/crossfire/src/test/resources/log4j.properties 2014-03-24 20:33:21 UTC (rev 9701) +++ trunk/src/crossfire/src/test/resources/log4j.properties 2014-03-24 20:33:55 UTC (rev 9702) @@ -17,8 +17,8 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # -# Set root logger level to INFO and its only appender to A1. -log4j.rootLogger=INFO, A1 +# Set root logger level to DEBUG and its only appender to A1. +log4j.rootLogger=DEBUG, A1 # A1 is set to be a ConsoleAppender. log4j.appender.A1=org.apache.log4j.ConsoleAppender Modified: trunk/src/daimonin/src/test/resources/log4j.properties =================================================================== --- trunk/src/daimonin/src/test/resources/log4j.properties 2014-03-24 20:33:21 UTC (rev 9701) +++ trunk/src/daimonin/src/test/resources/log4j.properties 2014-03-24 20:33:55 UTC (rev 9702) @@ -17,8 +17,8 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # -# Set root logger level to INFO and its only appender to A1. -log4j.rootLogger=INFO, A1 +# Set root logger level to DEBUG and its only appender to A1. +log4j.rootLogger=DEBUG, A1 # A1 is set to be a ConsoleAppender. log4j.appender.A1=org.apache.log4j.ConsoleAppender Modified: trunk/src/gridarta/src/test/resources/log4j.properties =================================================================== --- trunk/src/gridarta/src/test/resources/log4j.properties 2014-03-24 20:33:21 UTC (rev 9701) +++ trunk/src/gridarta/src/test/resources/log4j.properties 2014-03-24 20:33:55 UTC (rev 9702) @@ -17,8 +17,8 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # -# Set root logger level to INFO and its only appender to A1. -log4j.rootLogger=INFO, A1 +# Set root logger level to DEBUG and its only appender to A1. +log4j.rootLogger=DEBUG, A1 # A1 is set to be a ConsoleAppender. log4j.appender.A1=org.apache.log4j.ConsoleAppender Modified: trunk/src/model/src/test/resources/log4j.properties =================================================================== --- trunk/src/model/src/test/resources/log4j.properties 2014-03-24 20:33:21 UTC (rev 9701) +++ trunk/src/model/src/test/resources/log4j.properties 2014-03-24 20:33:55 UTC (rev 9702) @@ -17,8 +17,8 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # -# Set root logger level to INFO and its only appender to A1. -log4j.rootLogger=INFO, A1 +# Set root logger level to DEBUG and its only appender to A1. +log4j.rootLogger=DEBUG, A1 # A1 is set to be a ConsoleAppender. log4j.appender.A1=org.apache.log4j.ConsoleAppender Modified: trunk/src/plugin/src/test/resources/log4j.properties =================================================================== --- trunk/src/plugin/src/test/resources/log4j.properties 2014-03-24 20:33:21 UTC (rev 9701) +++ trunk/src/plugin/src/test/resources/log4j.properties 2014-03-24 20:33:55 UTC (rev 9702) @@ -17,8 +17,8 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # -# Set root logger level to INFO and its only appender to A1. -log4j.rootLogger=INFO, A1 +# Set root logger level to DBEUG and its only appender to A1. +log4j.rootLogger=DEBUG, A1 # A1 is set to be a ConsoleAppender. log4j.appender.A1=org.apache.log4j.ConsoleAppender Modified: trunk/src/preferences/src/test/resources/log4j.properties =================================================================== --- trunk/src/preferences/src/test/resources/log4j.properties 2014-03-24 20:33:21 UTC (rev 9701) +++ trunk/src/preferences/src/test/resources/log4j.properties 2014-03-24 20:33:55 UTC (rev 9702) @@ -17,8 +17,8 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # -# Set root logger level to INFO and its only appender to A1. -log4j.rootLogger=INFO, A1 +# Set root logger level to DEBUG and its only appender to A1. +log4j.rootLogger=DEBUG, A1 # A1 is set to be a ConsoleAppender. log4j.appender.A1=org.apache.log4j.ConsoleAppender Modified: trunk/src/project/src/test/resources/log4j.properties =================================================================== --- trunk/src/project/src/test/resources/log4j.properties 2014-03-24 20:33:21 UTC (rev 9701) +++ trunk/src/project/src/test/resources/log4j.properties 2014-03-24 20:33:55 UTC (rev 9702) @@ -17,8 +17,8 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # -# Set root logger level to INFO and its only appender to A1. -log4j.rootLogger=INFO, A1 +# Set root logger level to DEBUG and its only appender to A1. +log4j.rootLogger=DEBUG, A1 # A1 is set to be a ConsoleAppender. log4j.appender.A1=org.apache.log4j.ConsoleAppender Modified: trunk/src/textedit/src/test/resources/log4j.properties =================================================================== --- trunk/src/textedit/src/test/resources/log4j.properties 2014-03-24 20:33:21 UTC (rev 9701) +++ trunk/src/textedit/src/test/resources/log4j.properties 2014-03-24 20:33:55 UTC (rev 9702) @@ -17,8 +17,8 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # -# Set root logger level to INFO and its only appender to A1. -log4j.rootLogger=INFO, A1 +# Set root logger level to DEBUG and its only appender to A1. +log4j.rootLogger=DEBUG, A1 # A1 is set to be a ConsoleAppender. log4j.appender.A1=org.apache.log4j.ConsoleAppender Modified: trunk/src/utils/src/test/resources/log4j.properties =================================================================== --- trunk/src/utils/src/test/resources/log4j.properties 2014-03-24 20:33:21 UTC (rev 9701) +++ trunk/src/utils/src/test/resources/log4j.properties 2014-03-24 20:33:55 UTC (rev 9702) @@ -17,8 +17,8 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # -# Set root logger level to INFO and its only appender to A1. -log4j.rootLogger=INFO, A1 +# Set root logger level to DEBUG and its only appender to A1. +log4j.rootLogger=DEBUG, A1 # A1 is set to be a ConsoleAppender. log4j.appender.A1=org.apache.log4j.ConsoleAppender This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-03-24 20:33:25
|
Revision: 9701 http://sourceforge.net/p/gridarta/code/9701 Author: akirschbaum Date: 2014-03-24 20:33:21 +0000 (Mon, 24 Mar 2014) Log Message: ----------- Add debug output. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenu.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenu.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenu.java 2014-03-15 18:13:36 UTC (rev 9700) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenu.java 2014-03-24 20:33:21 UTC (rev 9701) @@ -113,6 +113,10 @@ * @param pathManager the path manager instance */ public MapMenu(@NotNull final String key, @NotNull final PathManager pathManager) { + if (LOG.isDebugEnabled()) { + //noinspection ThisEscapedInObjectConstruction + LOG.debug(System.identityHashCode(this) + " new " + key); + } mapMenuLoader = new MapMenuLoader(key, pathManager); treeModel.addTreeModelListener(treeModelListener); } @@ -122,6 +126,9 @@ */ public void load() { final int num = mapMenuLoader.loadNumEntries(); + if (LOG.isDebugEnabled()) { + LOG.debug(System.identityHashCode(this) + " load: root.removeAllChildren"); + } root.removeAllChildren(); for (int i = 0; i < num; i++) { final MapMenuLoader.Result result; @@ -212,6 +219,9 @@ */ @NotNull public TreePath addMapMenuEntry(@NotNull final String directory, @NotNull final DefaultMutableTreeNode treeNode) { + if (LOG.isDebugEnabled()) { + LOG.debug(System.identityHashCode(this) + " addMapMenuEntry(" + directory + ", " + treeNode + ")"); + } final String[] paths = StringUtils.PATTERN_SLASH.split(directory); DefaultMutableTreeNode dir2 = root; for (final String path : paths) { @@ -233,6 +243,9 @@ @NotNull public DefaultMutableTreeNode getOrCreateDirectory(@NotNull final MutableTreeNode this2, @NotNull final String path) { if (!MapMenuEntryDir.isValidDirectory(path)) { + if (LOG.isDebugEnabled()) { + LOG.debug(System.identityHashCode(this) + " getOrCreateDirectory(" + this2 + ", " + path + ")=invalid directory name"); + } throw new IllegalArgumentException("invalid directory name '" + path + "'"); } @@ -240,16 +253,21 @@ final DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) this2.getChildAt(i); final MapMenuEntry mapMenuEntry = (MapMenuEntry) treeNode.getUserObject(); if (mapMenuEntry.allowsChildren() && mapMenuEntry.getTitle().equals(path)) { + if (LOG.isDebugEnabled()) { + LOG.debug(System.identityHashCode(this) + " getOrCreateDirectory(" + this2 + ", " + path + ")=existing " + treeNode); + } return treeNode; } } final DefaultMutableTreeNode new2 = new DefaultMutableTreeNode(new MapMenuEntryDir(path), true); treeModel.insertNodeInto(new2, this2, this2.getChildCount()); + if (LOG.isDebugEnabled()) { + LOG.debug(System.identityHashCode(this) + " getOrCreateDirectory(" + this2 + ", " + path + ")=new " + new2); + } return new2; } - /** * Inserts a new node into the tree. * @param mapEntry the map entry to add @@ -260,6 +278,9 @@ */ @NotNull public TreePath insertNodeInto(@NotNull final MapMenuEntry mapEntry, @NotNull final DefaultMutableTreeNode parent, final int index) { + if (LOG.isDebugEnabled()) { + LOG.debug(System.identityHashCode(this) + " insertNodeInto(" + mapEntry + ", " + parent + ", " + index + ")"); + } final DefaultMutableTreeNode treeNode = new DefaultMutableTreeNode(mapEntry, mapEntry.allowsChildren()); treeModel.insertNodeInto(treeNode, parent, index); save(); @@ -273,6 +294,9 @@ */ public void removeNode(@NotNull final DefaultMutableTreeNode treeNode) { if (treeNode != root) { + if (LOG.isDebugEnabled()) { + LOG.debug(System.identityHashCode(this) + " removeNode " + treeNode); + } final String directory = getDirectory(treeNode); treeModel.removeNodeFromParent(treeNode); deletedNodes.addFirst(new DeletedNode(directory, treeNode)); @@ -280,6 +304,10 @@ deletedNodes.removeLast(); } save(); + } else { + if (LOG.isDebugEnabled()) { + LOG.debug(System.identityHashCode(this) + " removeNode: not removing root " + treeNode); + } } } @@ -339,6 +367,9 @@ result += size(childTreeNode); } } + if (LOG.isDebugEnabled()) { + LOG.debug(System.identityHashCode(this) + " size(" + root + ")=" + result); + } return result; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-03-15 18:13:40
|
Revision: 9700 http://sourceforge.net/p/gridarta/code/9700 Author: akirschbaum Date: 2014-03-15 18:13:36 +0000 (Sat, 15 Mar 2014) Log Message: ----------- Update Map|Open in Client function according to ADS-2. [Atrinik] Modified Paths: -------------- trunk/src/atrinik/ChangeLog trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/actions/AtrinikServerActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/AbstractServerActions.java Modified: trunk/src/atrinik/ChangeLog =================================================================== --- trunk/src/atrinik/ChangeLog 2014-03-15 13:36:40 UTC (rev 9699) +++ trunk/src/atrinik/ChangeLog 2014-03-15 18:13:36 UTC (rev 9700) @@ -1,3 +1,7 @@ +2014-03-15 Alex Tokar + + * Update Map|Open in Client function according to ADS-2. + 2014-03-11 Andreas Kirschbaum * Properly load cfpython_menu.def. Modified: trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/actions/AtrinikServerActions.java =================================================================== --- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/actions/AtrinikServerActions.java 2014-03-15 13:36:40 UTC (rev 9699) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/actions/AtrinikServerActions.java 2014-03-15 18:13:36 UTC (rev 9700) @@ -55,11 +55,26 @@ private static final String CHARSET_NAME = "US-ASCII"; /** - * Command sub-type: teleport character to map. + * Control command type: control a map. */ - private static final int CMD_CONTROL_UPDATE_MAP = 1; + private static final int CMD_CONTROL_MAP = 1; /** + * Control command type: control a player. + */ + private static final int CMD_CONTROL_PLAYER = 2; + + /** + * Control command sub-type: reset a map. + */ + private static final int CMD_CONTROL_MAP_RESET = 1; + + /** + * Control command sub-type: teleport character to map. + */ + private static final int CMD_CONTROL_PLAYER_TELEPORT = 1; + + /** * Creates a new instance. * @param fileControl the file control for saving maps */ @@ -68,9 +83,50 @@ } /** + * Send a bytes packet to the Atrinik server instance. + * @param stream packet to send. + * @throws IOException on failure + */ + private void sendPacket(@NotNull final ByteArrayOutputStream stream) throws IOException { + final byte[] packet = stream.toByteArray(); + packet[0] = (byte) ((packet.length - 2) >> 8); + packet[1] = (byte) (packet.length - 2); + try { + final Socket socket = new Socket("127.0.0.1", 13327); + try { + final OutputStream outputStream = socket.getOutputStream(); + outputStream.write(packet); + socket.shutdownOutput(); + } finally { + socket.close(); + } + } catch (final IOException ex) { + throw new IOException("127.0.0.1:13327: " + ex.getMessage(), ex); + } + } + + /** * {@inheritDoc} */ @Override + protected void resetMap(@NotNull final String mapPath) throws IOException { + final ByteArrayOutputStream tmp = new ByteArrayOutputStream(); + tmp.write(0); + tmp.write(0); + tmp.write(SERVER_CMD_CONTROL); + tmp.write(APPLICATION_NAME_IDENTIFIER.getBytes(CHARSET_NAME)); + tmp.write(0); // termination of application name identifier + tmp.write(CMD_CONTROL_MAP); + tmp.write(CMD_CONTROL_MAP_RESET); + tmp.write(mapPath.getBytes(CHARSET_NAME)); + tmp.write(0); + sendPacket(tmp); + } + + /** + * {@inheritDoc} + */ + @Override protected void teleportCharacterToMap(@NotNull final String mapPath, final int mapX, final int mapY) throws IOException { final ByteArrayOutputStream tmp = new ByteArrayOutputStream(); tmp.write(0); @@ -78,28 +134,16 @@ tmp.write(SERVER_CMD_CONTROL); tmp.write(APPLICATION_NAME_IDENTIFIER.getBytes(CHARSET_NAME)); tmp.write(0); // termination of application name identifier - tmp.write(CMD_CONTROL_UPDATE_MAP); + tmp.write(CMD_CONTROL_PLAYER); + tmp.write(CMD_CONTROL_PLAYER_TELEPORT); + tmp.write(0); // empty player name tmp.write(mapPath.getBytes(CHARSET_NAME)); tmp.write(0); tmp.write(mapX >> 8); tmp.write(mapX); tmp.write(mapY >> 8); tmp.write(mapY); - final byte[] packet = tmp.toByteArray(); - packet[0] = (byte) ((packet.length - 2) >> 8); - packet[1] = (byte) (packet.length - 2); - try { - final Socket socket = new Socket("127.0.0.1", 13327); - try { - final OutputStream outputStream = socket.getOutputStream(); - outputStream.write(packet); - socket.shutdownOutput(); - } finally { - socket.close(); - } - } catch (final IOException ex) { - throw new IOException("127.0.0.1:13327: " + ex.getMessage(), ex); - } + sendPacket(tmp); } } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/AbstractServerActions.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/AbstractServerActions.java 2014-03-15 13:36:40 UTC (rev 9699) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/AbstractServerActions.java 2014-03-15 18:13:36 UTC (rev 9700) @@ -116,6 +116,7 @@ final int mapY = cursor.y; final String mapPath = mapFile.getMapPath().toString(); try { + resetMap(mapPath); // TODO: remove from here and add to map saving teleportCharacterToMap(mapPath, mapX, mapY); } catch (final IOException ex) { fileControl.reportTeleportCharacterError(mapPath, ex.getMessage()); @@ -126,6 +127,13 @@ } /** + * Resets a map identified by the given map path. + * @param mapPath the map path to reset. + * @throws IOException if reset fails + */ + protected abstract void resetMap(@NotNull final String mapPath) throws IOException; + + /** * Teleports the character to the given map path. * @param mapPath the map path to teleport to * @param mapX the x coordinate to teleport to This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-03-15 13:36:47
|
Revision: 9699 http://sourceforge.net/p/gridarta/code/9699 Author: akirschbaum Date: 2014-03-15 13:36:40 +0000 (Sat, 15 Mar 2014) Log Message: ----------- Move logging statements out of synchronized block. Modified Paths: -------------- trunk/src/preferences/src/main/java/net/sf/gridarta/preferences/FilePreferences.java Modified: trunk/src/preferences/src/main/java/net/sf/gridarta/preferences/FilePreferences.java =================================================================== --- trunk/src/preferences/src/main/java/net/sf/gridarta/preferences/FilePreferences.java 2014-03-15 13:29:40 UTC (rev 9698) +++ trunk/src/preferences/src/main/java/net/sf/gridarta/preferences/FilePreferences.java 2014-03-15 13:36:40 UTC (rev 9699) @@ -145,6 +145,7 @@ throw new IllegalArgumentException("null key"); } + String value; synchronized (lock) { if (isRemoved()) { if (LOG.isDebugEnabled()) { @@ -156,28 +157,23 @@ //noinspection CatchGenericClass try { - final String value = getSpi(key); - if (value != null) { - if (LOG.isDebugEnabled()) { - LOG.debug("get(" + fullName + ", " + key + ", " + def + ")=" + value); - } - - return value; - } + value = getSpi(key); } catch (final Exception ignored) { - // ignore + //noinspection AssignmentToNull + value = null; } + if (value == null) { + if (def != null) { + putSpi(key, def); + } - if (def != null) { - putSpi(key, def); + value = def; } - - if (LOG.isDebugEnabled()) { - LOG.debug("get(" + fullName + ", " + key + ", " + def + ")=" + def); - } - - return def; } + if (LOG.isDebugEnabled()) { + LOG.debug("get(" + fullName + ", " + key + ", " + def + ")=" + value); + } + return value; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-03-15 13:29:46
|
Revision: 9698 http://sourceforge.net/p/gridarta/code/9698 Author: akirschbaum Date: 2014-03-15 13:29:40 +0000 (Sat, 15 Mar 2014) Log Message: ----------- Add nullable annotations. Modified Paths: -------------- trunk/src/preferences/src/main/java/net/sf/gridarta/preferences/FilePreferences.java trunk/src/preferences/src/main/java/net/sf/gridarta/preferences/FilePreferencesFactory.java trunk/src/preferences/src/main/java/net/sf/gridarta/preferences/FilePreferencesNode.java trunk/src/preferences/src/main/java/net/sf/gridarta/preferences/FilePreferencesRoot.java trunk/src/preferences/src/main/java/net/sf/gridarta/preferences/Storage.java Modified: trunk/src/preferences/src/main/java/net/sf/gridarta/preferences/FilePreferences.java =================================================================== --- trunk/src/preferences/src/main/java/net/sf/gridarta/preferences/FilePreferences.java 2014-03-15 12:59:20 UTC (rev 9697) +++ trunk/src/preferences/src/main/java/net/sf/gridarta/preferences/FilePreferences.java 2014-03-15 13:29:40 UTC (rev 9698) @@ -38,17 +38,20 @@ /** * The Logger for printing log messages. */ + @NotNull private static final Category LOG = Logger.getLogger(FilePreferences.class); /** * The node type of this node. */ + @NotNull private final NodeType nodeType; /** * The full path name of this node. It is used as a key in the preferences * file. */ + @NotNull private final String fullName; /** @@ -65,7 +68,7 @@ * @param nodeType the node type of this node * @param storage the storage instance used for loading/saving values */ - protected FilePreferences(@Nullable final AbstractPreferences parent, @NotNull final String name, final NodeType nodeType, @NotNull final Storage storage) { + protected FilePreferences(@Nullable final AbstractPreferences parent, @NotNull final String name, @NotNull final NodeType nodeType, @NotNull final Storage storage) { super(parent, name); this.nodeType = nodeType; this.storage = storage; @@ -91,6 +94,7 @@ /** * {@inheritDoc} */ + @NotNull @Override protected String[] childrenNamesSpi() throws BackingStoreException { final String[] result = storage.childrenNames(fullName); @@ -104,7 +108,7 @@ * {@inheritDoc} */ @Override - protected AbstractPreferences childSpi(final String name) { + protected AbstractPreferences childSpi(@NotNull final String name) { return new FilePreferencesNode(this, name, nodeType); } @@ -135,7 +139,8 @@ */ @Nullable @Override - public String get(final String key, final String def) { + public String get(@NotNull final String key, @Nullable final String def) { + //noinspection ConstantConditions if (key == null) { throw new IllegalArgumentException("null key"); } @@ -179,7 +184,7 @@ * {@inheritDoc} */ @Override - public boolean getBoolean(final String key, final boolean def) { + public boolean getBoolean(@NotNull final String key, final boolean def) { final boolean result = super.getBoolean(key, def); putSpi(key, Boolean.toString(result)); return result; @@ -189,7 +194,7 @@ * {@inheritDoc} */ @Override - public double getDouble(final String key, final double def) { + public double getDouble(@NotNull final String key, final double def) { final double result = super.getDouble(key, def); putSpi(key, Double.toString(result)); return result; @@ -199,7 +204,7 @@ * {@inheritDoc} */ @Override - public float getFloat(final String key, final float def) { + public float getFloat(@NotNull final String key, final float def) { final float result = super.getFloat(key, def); putSpi(key, Float.toString(result)); return result; @@ -209,7 +214,7 @@ * {@inheritDoc} */ @Override - public int getInt(final String key, final int def) { + public int getInt(@NotNull final String key, final int def) { final int result = super.getInt(key, def); putSpi(key, Integer.toString(result)); return result; @@ -219,7 +224,7 @@ * {@inheritDoc} */ @Override - public long getLong(final String key, final long def) { + public long getLong(@NotNull final String key, final long def) { final long result = super.getLong(key, def); putSpi(key, Long.toString(result)); return result; @@ -230,7 +235,7 @@ */ @Nullable @Override - protected String getSpi(final String key) { + protected String getSpi(@NotNull final String key) { if (LOG.isDebugEnabled()) { LOG.debug("getSpi(" + fullName + ", key=" + key + ")"); } @@ -241,6 +246,7 @@ /** * {@inheritDoc} */ + @NotNull @Override protected String[] keysSpi() throws BackingStoreException { if (LOG.isDebugEnabled()) { @@ -254,7 +260,7 @@ * {@inheritDoc} */ @Override - protected void putSpi(final String key, final String value) { + protected void putSpi(@NotNull final String key, @NotNull final String value) { if (LOG.isDebugEnabled()) { LOG.debug("putSpi(" + fullName + ", key=" + key + ", value=" + value + ")"); } @@ -278,7 +284,7 @@ * {@inheritDoc} */ @Override - protected void removeSpi(final String key) { + protected void removeSpi(@NotNull final String key) { if (LOG.isDebugEnabled()) { LOG.debug("removeSpi(" + fullName + ", key=" + key + ")"); } Modified: trunk/src/preferences/src/main/java/net/sf/gridarta/preferences/FilePreferencesFactory.java =================================================================== --- trunk/src/preferences/src/main/java/net/sf/gridarta/preferences/FilePreferencesFactory.java 2014-03-15 12:59:20 UTC (rev 9697) +++ trunk/src/preferences/src/main/java/net/sf/gridarta/preferences/FilePreferencesFactory.java 2014-03-15 13:29:40 UTC (rev 9698) @@ -35,11 +35,13 @@ /** * The user preferences as returned by {@link #userRoot()}. */ + @Nullable private static Preferences userRoot; /** * The system preferences as returned by {@link #userRoot()}. */ + @Nullable private static Preferences systemRoot; /** @@ -58,6 +60,7 @@ /** * {@inheritDoc} */ + @NotNull @Override public Preferences userRoot() { if (userRoot == null) { @@ -69,6 +72,7 @@ /** * {@inheritDoc} */ + @NotNull @Override public Preferences systemRoot() { if (systemRoot == null) { Modified: trunk/src/preferences/src/main/java/net/sf/gridarta/preferences/FilePreferencesNode.java =================================================================== --- trunk/src/preferences/src/main/java/net/sf/gridarta/preferences/FilePreferencesNode.java 2014-03-15 12:59:20 UTC (rev 9697) +++ trunk/src/preferences/src/main/java/net/sf/gridarta/preferences/FilePreferencesNode.java 2014-03-15 13:29:40 UTC (rev 9698) @@ -33,7 +33,7 @@ * @param name the node name * @param nodeType the node type of this node */ - public FilePreferencesNode(@NotNull final FilePreferences parent, @NotNull final String name, final NodeType nodeType) { + public FilePreferencesNode(@NotNull final FilePreferences parent, @NotNull final String name, @NotNull final NodeType nodeType) { super(parent, name, nodeType, parent.getStorage()); } Modified: trunk/src/preferences/src/main/java/net/sf/gridarta/preferences/FilePreferencesRoot.java =================================================================== --- trunk/src/preferences/src/main/java/net/sf/gridarta/preferences/FilePreferencesRoot.java 2014-03-15 12:59:20 UTC (rev 9697) +++ trunk/src/preferences/src/main/java/net/sf/gridarta/preferences/FilePreferencesRoot.java 2014-03-15 13:29:40 UTC (rev 9698) @@ -32,7 +32,7 @@ * @param nodeType the node type of this node * @param storage the storage instance to use for loading/saving values */ - FilePreferencesRoot(final NodeType nodeType, @NotNull final Storage storage) { + FilePreferencesRoot(@NotNull final NodeType nodeType, @NotNull final Storage storage) { super(null, "", nodeType, storage); } Modified: trunk/src/preferences/src/main/java/net/sf/gridarta/preferences/Storage.java =================================================================== --- trunk/src/preferences/src/main/java/net/sf/gridarta/preferences/Storage.java 2014-03-15 12:59:20 UTC (rev 9697) +++ trunk/src/preferences/src/main/java/net/sf/gridarta/preferences/Storage.java 2014-03-15 13:29:40 UTC (rev 9698) @@ -56,6 +56,7 @@ /** * The Logger for printing log messages. */ + @NotNull private static final Category LOG = Logger.getLogger(Storage.class); /** @@ -78,11 +79,13 @@ /** * Pattern to ignore in path names. */ + @NotNull private static final Pattern PATTERN_IGNORE = Pattern.compile("[\\[].*"); /** * The stored values. Maps path name to key name to value. */ + @NotNull private final Map<String, Map<String, String>> values = new TreeMap<String, Map<String, String>>(); /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-03-15 12:59:28
|
Revision: 9697 http://sourceforge.net/p/gridarta/code/9697 Author: akirschbaum Date: 2014-03-15 12:59:20 +0000 (Sat, 15 Mar 2014) Log Message: ----------- Add debug output. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenuEntry.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenuLoader.java trunk/src/preferences/src/main/java/net/sf/gridarta/preferences/FilePreferences.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenuEntry.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenuEntry.java 2014-03-11 09:07:04 UTC (rev 9696) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenuEntry.java 2014-03-15 12:59:20 UTC (rev 9697) @@ -77,4 +77,13 @@ */ public abstract void visit(@NotNull final MapMenuEntryVisitor visitor); + /** + * {@inheritDoc} + */ + @NotNull + @Override + public String toString() { + return title; + } + } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenuLoader.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenuLoader.java 2014-03-11 09:07:04 UTC (rev 9696) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenuLoader.java 2014-03-15 12:59:20 UTC (rev 9697) @@ -24,6 +24,8 @@ import java.util.prefs.Preferences; import net.sf.gridarta.MainControl; import net.sf.gridarta.model.io.PathManager; +import org.apache.log4j.Category; +import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; /** @@ -51,6 +53,12 @@ } /** + * The Logger for printing log messages. + */ + @NotNull + private static final Category LOG = Logger.getLogger(MapMenuLoader.class); + + /** * The {@link Preferences}. */ @NotNull @@ -74,6 +82,10 @@ * @param pathManager the global path manager instance */ public MapMenuLoader(@NotNull final String key, @NotNull final PathManager pathManager) { + if (LOG.isDebugEnabled()) { + //noinspection ThisEscapedInObjectConstruction + LOG.debug(System.identityHashCode(this) + " new " + key); + } this.key = key; this.pathManager = pathManager; } @@ -83,7 +95,11 @@ * @return the number of entries */ public int loadNumEntries() { - return PREFERENCES.getInt(key + "Num", 0); + final int result = PREFERENCES.getInt(key + "Num", 0); + if (LOG.isDebugEnabled()) { + LOG.debug(System.identityHashCode(this) + " loadNumEntries=" + result); + } + return result; } /** @@ -91,6 +107,9 @@ * @param num the number of entries */ public void saveNumEntries(final int num) { + if (LOG.isDebugEnabled()) { + LOG.debug(System.identityHashCode(this) + " saveNumEntries(" + num + ")"); + } PREFERENCES.putInt(key + "Num", num); } @@ -111,6 +130,9 @@ try { type = Type.valueOf(typeString); } catch (final IllegalArgumentException ex) { + if (LOG.isDebugEnabled()) { + LOG.debug(System.identityHashCode(this) + " loadEntry(" + index + ")=invalid type: " + typeString + " [" + ex.getMessage() + "]"); + } throw new IOException("invalid type: " + typeString, ex); } if (type == Type.DIR) { @@ -118,17 +140,34 @@ try { mapMenuEntry = new MapMenuEntryDir(title); } catch (final IllegalArgumentException ex) { + if (LOG.isDebugEnabled()) { + LOG.debug(System.identityHashCode(this) + " loadEntry(" + index + ")=invalid directory name: " + title + " [" + ex.getMessage() + "]"); + } throw new IOException("invalid directory name: " + title, ex); } - return new Result(directory, mapMenuEntry); + final Result result = new Result(directory, mapMenuEntry); + if (LOG.isDebugEnabled()) { + LOG.debug(System.identityHashCode(this) + " loadEntry(" + index + ")=DIR[" + result + "]"); + } + return result; } else if (type == Type.MAP) { if (filename.isEmpty()) { + if (LOG.isDebugEnabled()) { + LOG.debug(System.identityHashCode(this) + " loadEntry(" + index + ")=empty filename: " + title); + } throw new IOException("bookmark without file name: " + title); } final MapMenuEntry mapMenuEntry = new MapMenuEntryMap(pathManager.getMapFile(new File(filename)), title); - return new Result(directory, mapMenuEntry); + final Result result = new Result(directory, mapMenuEntry); + if (LOG.isDebugEnabled()) { + LOG.debug(System.identityHashCode(this) + " loadEntry(" + index + ")=MAP[" + result + "]"); + } + return result; } else { + if (LOG.isDebugEnabled()) { + LOG.debug(System.identityHashCode(this) + " loadEntry(" + index + ")=invalid type: " + type); + } throw new IOException("invalid type: " + type); } } @@ -142,6 +181,9 @@ * @param type the entry's type */ public void saveEntry(final int index, @NotNull final String title, @NotNull final String filename, @NotNull final String directory, @NotNull final Type type) { + if (LOG.isDebugEnabled()) { + LOG.debug(System.identityHashCode(this) + " saveEntry(title=" + title + ", filename=" + filename + ", directory=" + directory + ", type=" + type + ")"); + } final String suffix = "[" + index + "]"; PREFERENCES.put(key + "Title" + suffix, title); PREFERENCES.put(key + "Filename" + suffix, filename); @@ -162,6 +204,9 @@ * @param index the preference index */ public void removeEntry(final int index) { + if (LOG.isDebugEnabled()) { + LOG.debug(System.identityHashCode(this) + " removeEntry(" + index + ")"); + } final String suffix = "[" + index + "]"; PREFERENCES.remove(key + "Title" + suffix); PREFERENCES.remove(key + "Filename" + suffix); @@ -216,6 +261,15 @@ return mapMenuEntry; } + /** + * {@inheritDoc} + */ + @NotNull + @Override + public String toString() { + return "directory=" + directory + ",mapMenuEntry=" + mapMenuEntry; + } + } } Modified: trunk/src/preferences/src/main/java/net/sf/gridarta/preferences/FilePreferences.java =================================================================== --- trunk/src/preferences/src/main/java/net/sf/gridarta/preferences/FilePreferences.java 2014-03-11 09:07:04 UTC (rev 9696) +++ trunk/src/preferences/src/main/java/net/sf/gridarta/preferences/FilePreferences.java 2014-03-15 12:59:20 UTC (rev 9697) @@ -19,6 +19,7 @@ package net.sf.gridarta.preferences; +import java.util.Arrays; import java.util.prefs.AbstractPreferences; import java.util.prefs.BackingStoreException; import java.util.prefs.Preferences; @@ -92,7 +93,11 @@ */ @Override protected String[] childrenNamesSpi() throws BackingStoreException { - return storage.childrenNames(fullName); + final String[] result = storage.childrenNames(fullName); + if (LOG.isDebugEnabled()) { + LOG.debug("childrenNamesSpi(" + fullName + ")=" + Arrays.toString(result)); + } + return result; } /** @@ -137,6 +142,10 @@ synchronized (lock) { if (isRemoved()) { + if (LOG.isDebugEnabled()) { + LOG.debug("get(" + fullName + ", " + key + ") called for removed node"); + } + throw new IllegalStateException("removed node"); } @@ -144,6 +153,10 @@ try { final String value = getSpi(key); if (value != null) { + if (LOG.isDebugEnabled()) { + LOG.debug("get(" + fullName + ", " + key + ", " + def + ")=" + value); + } + return value; } } catch (final Exception ignored) { @@ -153,6 +166,11 @@ if (def != null) { putSpi(key, def); } + + if (LOG.isDebugEnabled()) { + LOG.debug("get(" + fullName + ", " + key + ", " + def + ")=" + def); + } + return def; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-03-11 09:07:08
|
Revision: 9696 http://sourceforge.net/p/gridarta/code/9696 Author: akirschbaum Date: 2014-03-11 09:07:04 +0000 (Tue, 11 Mar 2014) Log Message: ----------- Remove static state from CFPythonPopup. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/scripteditor/CFPythonPopup.java trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/DefaultInputHandler.java trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/TextAreaDefaults.java trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/actions/FunctionMenu.java trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/actions/InputActions.java Added Paths: ----------- trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/scripteditor/MenuEntries.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2014-03-11 08:21:53 UTC (rev 9695) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2014-03-11 09:07:04 UTC (rev 9696) @@ -201,6 +201,7 @@ import net.sf.gridarta.model.settings.VolatileSettings; import net.sf.gridarta.plugin.PluginParameters; import net.sf.gridarta.project.ProjectModel; +import net.sf.gridarta.textedit.scripteditor.MenuEntries; import net.sf.gridarta.textedit.scripteditor.ScriptEditControl; import net.sf.gridarta.textedit.textarea.TextAreaDefaults; import net.sf.gridarta.updater.UpdaterManager; @@ -349,7 +350,8 @@ final FindDialogManager<G, A, R> findDialogManager = new FindDialogManager<G, A, R>(parent, mapViewManager); final Exiter exiter = new DefaultExiter(parent); scriptEditControl = new ScriptEditControl(editorFactory.getScriptFileFilter(), scriptExtension, parent, projectModel.getProjectSettings().getMapsDirectory(), PREFERENCES, exiter); - final TextAreaDefaults textAreaDefaults = new TextAreaDefaults(scriptEditControl); + final MenuEntries menuEntries = new MenuEntries(); + final TextAreaDefaults textAreaDefaults = new TextAreaDefaults(scriptEditControl, menuEntries); scriptEditControl.setTextAreaDefaults(textAreaDefaults); final GameObjectAttributesDialogFactory<G, A, R> gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<G, A, R>(projectModel.getArchetypeTypeSet(), parent, treasureListTree, projectModel.getFaceObjectProviders(), projectModel.getAnimationObjects(), projectModel.getProjectSettings(), editorFactory.getMapFileFilter(), editorFactory.getScriptFileFilter(), projectModel.getFaceObjects(), projectModel.getGameObjectSpells(), projectModel.getNumberSpells(), editorFactory.getUndefinedSpellIndex(), projectModel.getTreasureTree(), noFaceSquareIcon, unknownSquareIcon, textAreaDefaults, projectModel.getMapManager()); final ScriptedEventEditor<G, A, R> scriptedEventEditor = new ScriptedEventEditor<G, A, R>(projectModel.getProjectSettings(), scriptEditControl); Modified: trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/scripteditor/CFPythonPopup.java =================================================================== --- trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/scripteditor/CFPythonPopup.java 2014-03-11 08:21:53 UTC (rev 9695) +++ trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/scripteditor/CFPythonPopup.java 2014-03-11 09:07:04 UTC (rev 9696) @@ -22,24 +22,13 @@ import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.io.UnsupportedEncodingException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; import javax.swing.JComboBox; import javax.swing.JPopupMenu; import javax.swing.text.BadLocationException; import net.sf.gridarta.textedit.textarea.JEditTextArea; -import net.sf.gridarta.utils.IOUtils; import org.apache.log4j.Category; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; /** * This class implements a popup window which shows all python methods in the @@ -53,12 +42,6 @@ public class CFPythonPopup extends JComboBox { /** - * Python menu definitions. - */ - @NotNull - private static final String PYTHON_MENU_FILE = "/cfpython_menu.def"; - - /** * The Logger for printing log messages. */ @NotNull @@ -70,13 +53,6 @@ private static final long serialVersionUID = 1L; /** - * List of menu entries (all CFPython commands). - * @serial - */ - @Nullable - private static String[] menuEntries; - - /** * The popup menu. * @serial */ @@ -87,7 +63,7 @@ * Whether this menu has been fully initialized. * @serial */ - private boolean isReady; + private final boolean isReady; /** * The caret position in the document where this popup was opened. @@ -98,92 +74,26 @@ /** * Creates a new instance. * @param scriptEditControl the script edit control to forward to + * @param menuEntries the menu entries to include */ - public CFPythonPopup(@NotNull final ScriptEditControl scriptEditControl) { + public CFPythonPopup(@NotNull final ScriptEditControl scriptEditControl, @NotNull final MenuEntries menuEntries) { setBackground(Color.white); // white background - // make sure the command list is initialized - if (menuEntries == null) { - loadCommandList(); - } - menu = new CFPythonPopupMenu(this); - if (menuEntries != null) { - for (final String menuEntry : menuEntries) { - addItem(" " + menuEntry); - } + for (final String menuEntry : menuEntries) { + addItem(" " + menuEntry); } // listener for selection events addActionListener(new MenuActionListener(this, scriptEditControl)); - if (menuEntries != null && menuEntries.length > 0) { - isReady = true; // this menu is now ready for use - } + isReady = !menuEntries.isEmpty(); setRequestFocusEnabled(true); } /** - * Load the list of CFPython commands from the data file. - */ - private static void loadCommandList() { - try { - final InputStream inputStream = CFPythonPopup.class.getResourceAsStream(PYTHON_MENU_FILE); - if (inputStream == null) { - LOG.error("Resource '" + PYTHON_MENU_FILE + "' not found"); - return; - } - try { - final List<String> cmdList = new ArrayList<String>(); // temporary list to store commands - final Reader reader = new InputStreamReader(inputStream, IOUtils.MAP_ENCODING); - try { - final BufferedReader bufferedReader = new BufferedReader(reader); - try { - // read file into the cmdList vector: - while (true) { - final String inputLine = bufferedReader.readLine(); - if (inputLine == null) { - break; - } - final String line = inputLine.trim(); - if (!line.isEmpty() && !line.startsWith("#")) { - // ATM, the descriptive info about method headers is cut out - // (TODO: parse and show the full info in a status bar) - final int k = line.indexOf('('); - if (k > 0) { - cmdList.add(line.substring(0, k) + "()"); - } else { - LOG.error("Parse error in " + PYTHON_MENU_FILE + ":"); - LOG.error(" \"" + line + "\" missing '()'"); - cmdList.add(line + "()"); // that line is probably garbage, but will work - } - } - } - Collections.sort(cmdList, String.CASE_INSENSITIVE_ORDER); - - // now create the 'menuEntries' array - if (!cmdList.isEmpty()) { - menuEntries = cmdList.toArray(new String[cmdList.size()]); - } - } finally { - bufferedReader.close(); - } - } finally { - reader.close(); - } - } finally { - inputStream.close(); - } - } catch (final UnsupportedEncodingException ex) { - LOG.error("Cannot decode file '" + PYTHON_MENU_FILE + "': " + ex.getMessage()); - } catch (final IOException ex) { - LOG.error("Cannot read file '" + PYTHON_MENU_FILE + "': " + ex.getMessage()); - } - } - - /** * Returns whether this popup menu has been fully initialized and is ready * for use. * @return {@code true} if initialized, otherwise {@code false} Added: trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/scripteditor/MenuEntries.java =================================================================== --- trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/scripteditor/MenuEntries.java (rev 0) +++ trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/scripteditor/MenuEntries.java 2014-03-11 09:07:04 UTC (rev 9696) @@ -0,0 +1,137 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.textedit.scripteditor; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.io.Serializable; +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import net.sf.gridarta.utils.IOUtils; +import org.apache.log4j.Category; +import org.apache.log4j.Logger; +import org.jetbrains.annotations.NotNull; + +/** + * List of menu entries (all CFPython commands). + * @author Andreas Kirschbaum + */ +public class MenuEntries implements Iterable<String>, Serializable { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** + * Python menu definitions. + */ + @NotNull + private static final String PYTHON_MENU_FILE = "/cfpython_menu.def"; + + /** + * The Logger for printing log messages. + */ + @NotNull + private static final Category LOG = Logger.getLogger(MenuEntries.class); + + /** + * List of menu entries (all CFPython commands). + * @serial + */ + @NotNull + private final List<String> menuEntries = new ArrayList<String>(); + + /** + * Creates a new instance. + */ + public MenuEntries() { + try { + final InputStream inputStream = CFPythonPopup.class.getResourceAsStream(PYTHON_MENU_FILE); + if (inputStream == null) { + LOG.error("Resource '" + PYTHON_MENU_FILE + "' not found"); + return; + } + try { + final Reader reader = new InputStreamReader(inputStream, IOUtils.MAP_ENCODING); + try { + final BufferedReader bufferedReader = new BufferedReader(reader); + try { + // read file into the cmdList vector: + while (true) { + final String inputLine = bufferedReader.readLine(); + if (inputLine == null) { + break; + } + final String line = inputLine.trim(); + if (!line.isEmpty() && !line.startsWith("#")) { + // ATM, the descriptive info about method headers is cut out + // (TODO: parse and show the full info in a status bar) + final int k = line.indexOf('('); + if (k > 0) { + menuEntries.add(line.substring(0, k) + "()"); + } else { + LOG.error("Parse error in " + PYTHON_MENU_FILE + ":"); + LOG.error(" \"" + line + "\" missing '()'"); + menuEntries.add(line + "()"); // that line is probably garbage, but will work + } + } + } + Collections.sort(menuEntries, String.CASE_INSENSITIVE_ORDER); + } finally { + bufferedReader.close(); + } + } finally { + reader.close(); + } + } finally { + inputStream.close(); + } + } catch (final UnsupportedEncodingException ex) { + LOG.error("Cannot decode file '" + PYTHON_MENU_FILE + "': " + ex.getMessage()); + } catch (final IOException ex) { + LOG.error("Cannot read file '" + PYTHON_MENU_FILE + "': " + ex.getMessage()); + } + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public Iterator<String> iterator() { + return Collections.unmodifiableCollection(menuEntries).iterator(); + } + + /** + * Returns whether no menu entries have been loaded. + * @return whether no menu entries have been loaded + */ + public boolean isEmpty() { + return menuEntries.isEmpty(); + } + +} Property changes on: trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/scripteditor/MenuEntries.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Modified: trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/DefaultInputHandler.java =================================================================== --- trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/DefaultInputHandler.java 2014-03-11 08:21:53 UTC (rev 9695) +++ trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/DefaultInputHandler.java 2014-03-11 09:07:04 UTC (rev 9696) @@ -16,6 +16,7 @@ import java.util.HashMap; import java.util.Map; import javax.swing.KeyStroke; +import net.sf.gridarta.textedit.scripteditor.MenuEntries; import net.sf.gridarta.textedit.scripteditor.ScriptEditControl; import net.sf.gridarta.textedit.textarea.actions.InputActions; import org.apache.log4j.Category; @@ -45,9 +46,11 @@ /** * Creates a new input handler with no key bindings defined. * @param scriptEditControl the script edit control to affect + * @param menuEntries the menu entries to include in the function list + * popup */ - public DefaultInputHandler(@NotNull final ScriptEditControl scriptEditControl) { - inputActions = new InputActions(scriptEditControl); + public DefaultInputHandler(@NotNull final ScriptEditControl scriptEditControl, @NotNull final MenuEntries menuEntries) { + inputActions = new InputActions(scriptEditControl, menuEntries); bindings = new HashMap<KeyStroke, ActionListener>(); } Modified: trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/TextAreaDefaults.java =================================================================== --- trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/TextAreaDefaults.java 2014-03-11 08:21:53 UTC (rev 9695) +++ trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/TextAreaDefaults.java 2014-03-11 09:07:04 UTC (rev 9696) @@ -12,6 +12,7 @@ import java.awt.Color; import javax.swing.JPopupMenu; +import net.sf.gridarta.textedit.scripteditor.MenuEntries; import net.sf.gridarta.textedit.scripteditor.ScriptEditControl; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -79,9 +80,11 @@ /** * Creates a new instance. * @param scriptEditControl the script edit control to affect + * @param menuEntries the menu entries to include in the function menu + * popup */ - public TextAreaDefaults(@NotNull final ScriptEditControl scriptEditControl) { - inputHandler = new DefaultInputHandler(scriptEditControl); + public TextAreaDefaults(@NotNull final ScriptEditControl scriptEditControl, @NotNull final MenuEntries menuEntries) { + inputHandler = new DefaultInputHandler(scriptEditControl, menuEntries); inputHandler.addDefaultKeyBindings(); } Modified: trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/actions/FunctionMenu.java =================================================================== --- trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/actions/FunctionMenu.java 2014-03-11 08:21:53 UTC (rev 9695) +++ trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/actions/FunctionMenu.java 2014-03-11 09:07:04 UTC (rev 9696) @@ -14,6 +14,7 @@ import java.awt.event.ActionListener; import javax.swing.text.BadLocationException; import net.sf.gridarta.textedit.scripteditor.CFPythonPopup; +import net.sf.gridarta.textedit.scripteditor.MenuEntries; import net.sf.gridarta.textedit.scripteditor.ScriptEditControl; import net.sf.gridarta.textedit.textarea.InputHandler; import net.sf.gridarta.textedit.textarea.JEditTextArea; @@ -33,9 +34,10 @@ /** * Creates a new instance. * @param scriptEditControl the script edit control to forward to + * @param menuEntries the menu entries to include */ - public FunctionMenu(@NotNull final ScriptEditControl scriptEditControl) { - cfPythonPopup = new CFPythonPopup(scriptEditControl); + public FunctionMenu(@NotNull final ScriptEditControl scriptEditControl, @NotNull final MenuEntries menuEntries) { + cfPythonPopup = new CFPythonPopup(scriptEditControl, menuEntries); } /** Modified: trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/actions/InputActions.java =================================================================== --- trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/actions/InputActions.java 2014-03-11 08:21:53 UTC (rev 9695) +++ trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/actions/InputActions.java 2014-03-11 09:07:04 UTC (rev 9696) @@ -14,6 +14,7 @@ import java.util.HashMap; import java.util.Map; import net.sf.gridarta.textedit.scripteditor.Actions; +import net.sf.gridarta.textedit.scripteditor.MenuEntries; import net.sf.gridarta.textedit.scripteditor.ScriptEditControl; import org.jetbrains.annotations.NotNull; @@ -105,9 +106,9 @@ private final Map<String, ActionListener> actions = new HashMap<String, ActionListener>(); - public InputActions(@NotNull final ScriptEditControl scriptEditControl) { + public InputActions(@NotNull final ScriptEditControl scriptEditControl, @NotNull final MenuEntries menuEntries) { final ActionListener save = new Save(scriptEditControl); - functionMenu = new FunctionMenu(scriptEditControl); + functionMenu = new FunctionMenu(scriptEditControl, menuEntries); actions.put("backspace", backspace); actions.put("backspace-word", backspaceWord); actions.put("delete", delete); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-03-11 08:21:59
|
Revision: 9695 http://sourceforge.net/p/gridarta/code/9695 Author: akirschbaum Date: 2014-03-11 08:21:53 +0000 (Tue, 11 Mar 2014) Log Message: ----------- Properly load cfpython_menu.def. [Atrinik,Crossfire] Modified Paths: -------------- trunk/gridarta.ipr trunk/src/atrinik/ChangeLog trunk/src/crossfire/ChangeLog trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/scripteditor/CFPythonPopup.java Modified: trunk/gridarta.ipr =================================================================== --- trunk/gridarta.ipr 2014-03-10 20:51:07 UTC (rev 9694) +++ trunk/gridarta.ipr 2014-03-11 08:21:53 UTC (rev 9695) @@ -232,6 +232,7 @@ <entry name="?*.jpeg" /> <entry name="?*.jpg" /> <entry name="?*.txt" /> + <entry name="?*.def" /> </wildcardResourcePatterns> <annotationProcessing enabled="false" useClasspath="true" /> </component> Modified: trunk/src/atrinik/ChangeLog =================================================================== --- trunk/src/atrinik/ChangeLog 2014-03-10 20:51:07 UTC (rev 9694) +++ trunk/src/atrinik/ChangeLog 2014-03-11 08:21:53 UTC (rev 9695) @@ -1,3 +1,7 @@ +2014-03-11 Andreas Kirschbaum + + * Properly load cfpython_menu.def. + 2014-03-10 Andreas Kirschbaum * Remember new map path when using "save as" to save a map. Also Modified: trunk/src/crossfire/ChangeLog =================================================================== --- trunk/src/crossfire/ChangeLog 2014-03-10 20:51:07 UTC (rev 9694) +++ trunk/src/crossfire/ChangeLog 2014-03-11 08:21:53 UTC (rev 9695) @@ -1,3 +1,7 @@ +2014-03-11 Andreas Kirschbaum + + * Properly load cfpython_menu.def. + 2014-03-10 Andreas Kirschbaum * Remember new map path when using "save as" to save a map. Also Modified: trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/scripteditor/CFPythonPopup.java =================================================================== --- trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/scripteditor/CFPythonPopup.java 2014-03-10 20:51:07 UTC (rev 9694) +++ trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/scripteditor/CFPythonPopup.java 2014-03-11 08:21:53 UTC (rev 9695) @@ -23,14 +23,11 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.BufferedReader; -import java.io.EOFException; -import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.UnsupportedEncodingException; -import java.net.URL; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -59,7 +56,7 @@ * Python menu definitions. */ @NotNull - private static final String PYTHON_MENU_FILE = "cfpython_menu.def"; + private static final String PYTHON_MENU_FILE = "/cfpython_menu.def"; /** * The Logger for printing log messages. @@ -132,17 +129,14 @@ * Load the list of CFPython commands from the data file. */ private static void loadCommandList() { - final URL url; try { - url = IOUtils.getResource(null, PYTHON_MENU_FILE); - } catch (final FileNotFoundException ex) { - LOG.error("File '" + PYTHON_MENU_FILE + "': " + ex.getMessage()); - return; - } - final List<String> cmdList = new ArrayList<String>(); // temporary list to store commands - try { - final InputStream inputStream = url.openStream(); + final InputStream inputStream = CFPythonPopup.class.getResourceAsStream(PYTHON_MENU_FILE); + if (inputStream == null) { + LOG.error("Resource '" + PYTHON_MENU_FILE + "' not found"); + return; + } try { + final List<String> cmdList = new ArrayList<String>(); // temporary list to store commands final Reader reader = new InputStreamReader(inputStream, IOUtils.MAP_ENCODING); try { final BufferedReader bufferedReader = new BufferedReader(reader); @@ -161,7 +155,7 @@ if (k > 0) { cmdList.add(line.substring(0, k) + "()"); } else { - LOG.error("Parse error in " + url + ":"); + LOG.error("Parse error in " + PYTHON_MENU_FILE + ":"); LOG.error(" \"" + line + "\" missing '()'"); cmdList.add(line + "()"); // that line is probably garbage, but will work } @@ -182,14 +176,10 @@ } finally { inputStream.close(); } - } catch (final FileNotFoundException ex) { - LOG.error("File '" + url + "' not found: " + ex.getMessage()); - } catch (final EOFException ignored) { - // expected exception, do not handle: end of file/spell struct reached } catch (final UnsupportedEncodingException ex) { - LOG.error("Cannot decode file '" + url + "': " + ex.getMessage()); + LOG.error("Cannot decode file '" + PYTHON_MENU_FILE + "': " + ex.getMessage()); } catch (final IOException ex) { - LOG.error("Cannot read file '" + url + "': " + ex.getMessage()); + LOG.error("Cannot read file '" + PYTHON_MENU_FILE + "': " + ex.getMessage()); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-03-10 20:51:13
|
Revision: 9694 http://sourceforge.net/p/gridarta/code/9694 Author: akirschbaum Date: 2014-03-10 20:51:07 +0000 (Mon, 10 Mar 2014) Log Message: ----------- Remember new map path when using "save as" to save a map. Also clear the map's modified flag. Modified Paths: -------------- trunk/src/atrinik/ChangeLog trunk/src/crossfire/ChangeLog trunk/src/daimonin/ChangeLog trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapcontrol/DefaultMapControl.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapcontrol/MapControl.java trunk/src/model/src/test/java/net/sf/gridarta/model/mapcontrol/DefaultMapControlTest.java trunk/src/model/src/test/java/net/sf/gridarta/model/mapcontrol/TestMapControlCreator.java Modified: trunk/src/atrinik/ChangeLog =================================================================== --- trunk/src/atrinik/ChangeLog 2014-03-10 20:26:52 UTC (rev 9693) +++ trunk/src/atrinik/ChangeLog 2014-03-10 20:51:07 UTC (rev 9694) @@ -1,3 +1,8 @@ +2014-03-10 Andreas Kirschbaum + + * Remember new map path when using "save as" to save a map. Also + clear the map's modified flag. + 2014-03-09 Andreas Kirschbaum * Properly update pickmap view when using a relative maps Modified: trunk/src/crossfire/ChangeLog =================================================================== --- trunk/src/crossfire/ChangeLog 2014-03-10 20:26:52 UTC (rev 9693) +++ trunk/src/crossfire/ChangeLog 2014-03-10 20:51:07 UTC (rev 9694) @@ -1,3 +1,8 @@ +2014-03-10 Andreas Kirschbaum + + * Remember new map path when using "save as" to save a map. Also + clear the map's modified flag. + 2014-03-09 Andreas Kirschbaum * Properly update pickmap view when using a relative maps Modified: trunk/src/daimonin/ChangeLog =================================================================== --- trunk/src/daimonin/ChangeLog 2014-03-10 20:26:52 UTC (rev 9693) +++ trunk/src/daimonin/ChangeLog 2014-03-10 20:51:07 UTC (rev 9694) @@ -1,3 +1,8 @@ +2014-03-10 Andreas Kirschbaum + + * Remember new map path when using "save as" to save a map. Also + clear the map's modified flag. + 2014-03-09 Andreas Kirschbaum * Properly update pickmap view when using a relative maps Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java 2014-03-10 20:26:52 UTC (rev 9693) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java 2014-03-10 20:51:07 UTC (rev 9694) @@ -31,6 +31,7 @@ import net.sf.gridarta.gui.mapimagecache.MapImageCache; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.io.PathManager; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.mapcontrol.MapControl; import net.sf.gridarta.model.mapmanager.FileControl; @@ -125,6 +126,12 @@ private final ScriptEditControl scriptEditControl; /** + * The {@link PathManager} for creating {@link MapFile} instances. + */ + @NotNull + private final PathManager pathManager; + + /** * The {@link JFileChooser} for opening a file. Set to {@code null} if not * yet created. */ @@ -144,8 +151,9 @@ * @param newMapDialogFactory the new map dialog factory * @param scriptExtension the file extension for script files * @param scriptEditControl the script edit control to forward to + * @param pathManager the path manager for creating map file instances */ - public DefaultFileControl(@NotNull final ProjectSettings projectSettings, @NotNull final VolatileSettings volatileSettings, @NotNull final MapImageCache<G, A, R> mapImageCache, @NotNull final MapManager<G, A, R> mapManager, @NotNull final MapViewsManager<G, A, R> mapViewsManager, @NotNull final Component parent, @NotNull final FileFilter mapFileFilter, @NotNull final FileFilter scriptFileFilter, @NotNull final NewMapDialogFactory<G, A, R> newMapDialogFactory, @NotNull final String scriptExtension, @NotNull final ScriptEditControl scriptEditControl) { + public DefaultFileControl(@NotNull final ProjectSettings projectSettings, @NotNull final VolatileSettings volatileSettings, @NotNull final MapImageCache<G, A, R> mapImageCache, @NotNull final MapManager<G, A, R> mapManager, @NotNull final MapViewsManager<G, A, R> mapViewsManager, @NotNull final Component parent, @NotNull final FileFilter mapFileFilter, @NotNull final FileFilter scriptFileFilter, @NotNull final NewMapDialogFactory<G, A, R> newMapDialogFactory, @NotNull final String scriptExtension, @NotNull final ScriptEditControl scriptEditControl, @NotNull final PathManager pathManager) { this.projectSettings = projectSettings; this.volatileSettings = volatileSettings; this.mapImageCache = mapImageCache; @@ -157,6 +165,7 @@ this.newMapDialogFactory = newMapDialogFactory; this.scriptExtension = scriptExtension; this.scriptEditControl = scriptEditControl; + this.pathManager = pathManager; } /** @@ -284,7 +293,7 @@ } try { - mapControl.saveAs(file); + mapControl.saveAs(pathManager.getMapFile(file)); } catch (final IOException ex) { reportSaveError(file, ex.getMessage()); return false; Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2014-03-10 20:26:52 UTC (rev 9693) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2014-03-10 20:51:07 UTC (rev 9694) @@ -378,7 +378,7 @@ final ArchetypeChooserControl<G, A, R> archetypeChooserControl = new ArchetypeChooserControl<G, A, R>(projectModel.getArchetypeChooserModel(), archetypeChooserView); mapViewsManager = new MapViewsManager<G, A, R>(mapViewSettings, mapViewFactory, projectModel.getMapManager(), projectModel.getPickmapManager(), projectModel.getPathManager()); newMapDialogFactory = editorFactory.newNewMapDialogFactory(mapViewsManager, projectModel.getMapArchObjectFactory(), pickmapChooserView, parent); - fileControl = new DefaultFileControl<G, A, R>(projectModel.getProjectSettings(), volatileSettings, mapImageCache, projectModel.getMapManager(), mapViewsManager, parent, GuiFileFilters.MAP_FILE_FILTER, editorFactory.getScriptFileFilter(), newMapDialogFactory, scriptExtension, scriptEditControl); + fileControl = new DefaultFileControl<G, A, R>(projectModel.getProjectSettings(), volatileSettings, mapImageCache, projectModel.getMapManager(), mapViewsManager, parent, GuiFileFilters.MAP_FILE_FILTER, editorFactory.getScriptFileFilter(), newMapDialogFactory, scriptExtension, scriptEditControl, projectModel.getPathManager()); mapViewsManager.setFileControl(fileControl); final PickmapChooserControl<G, A, R> pickmapChooserControl = new PickmapChooserControl<G, A, R>(pickmapChooserModel, pickmapSettings, newMapDialogFactory, mapFolderTree, projectModel.getMapManager(), parent, mapViewsManager, fileControl, pickmapChooserView); final DefaultObjectChooser<G, A, R> objectChooser = new DefaultObjectChooser<G, A, R>(archetypeChooserControl, pickmapChooserControl, projectModel.getArchetypeChooserModel(), pickmapChooserModel, projectModel.getArchetypeTypeSet()); Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/mapcontrol/DefaultMapControl.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/mapcontrol/DefaultMapControl.java 2014-03-10 20:26:52 UTC (rev 9693) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/mapcontrol/DefaultMapControl.java 2014-03-10 20:51:07 UTC (rev 9694) @@ -204,14 +204,6 @@ /** * {@inheritDoc} */ - @Override - public void saveAs(@NotNull final File file) throws IOException { - encodeMapFile(file); - } - - /** - * {@inheritDoc} - */ @NotNull @Override public MapModel<G, A, R> getMapModel() { Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/mapcontrol/MapControl.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/mapcontrol/MapControl.java 2014-03-10 20:26:52 UTC (rev 9693) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/mapcontrol/MapControl.java 2014-03-10 20:51:07 UTC (rev 9694) @@ -19,7 +19,6 @@ package net.sf.gridarta.model.mapcontrol; -import java.io.File; import java.io.IOException; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; @@ -76,14 +75,6 @@ void saveAs(@NotNull MapFile mapFile) throws IOException; /** - * Saves the file with the given file. This does not update the map file and - * does not reset the modified state. - * @param file the file to be saved to - * @throws IOException if saving fails - */ - void saveAs(@NotNull File file) throws IOException; - - /** * Increases the use counter. */ void acquire(); Modified: trunk/src/model/src/test/java/net/sf/gridarta/model/mapcontrol/DefaultMapControlTest.java =================================================================== --- trunk/src/model/src/test/java/net/sf/gridarta/model/mapcontrol/DefaultMapControlTest.java 2014-03-10 20:26:52 UTC (rev 9693) +++ trunk/src/model/src/test/java/net/sf/gridarta/model/mapcontrol/DefaultMapControlTest.java 2014-03-10 20:51:07 UTC (rev 9694) @@ -19,12 +19,14 @@ package net.sf.gridarta.model.mapcontrol; +import java.awt.Point; import java.io.File; import java.io.IOException; import net.sf.gridarta.model.archetype.TestArchetype; import net.sf.gridarta.model.gameobject.TestGameObject; import net.sf.gridarta.model.maparchobject.TestMapArchObject; import net.sf.gridarta.model.mapmodel.MapFile; +import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.utils.Size2D; import org.junit.Assert; import org.junit.Test; @@ -55,4 +57,37 @@ } } + /** + * Checks that {@link MapControl#saveAs(MapFile)} does update the map's file + * and that it does reset the map's modified flag. + * @throws InterruptedException if the test fails + * @throws IOException if the test fails + */ + @Test + public void testSaveAs1() throws IOException, InterruptedException { + final TestMapControlCreator mapControlCreator = new TestMapControlCreator(); + final File mapsDirectory = mapControlCreator.createMapsDirectory(); + try { + final MapFile mapFile = mapControlCreator.getPathManager().getMapFile(new File(mapControlCreator.getProjectSettings().getMapsDirectory(), "path1/path2/mapfile")); + final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl = mapControlCreator.newMapControl(null, "name", new Size2D(1, 1)); + + final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = mapControl.getMapModel(); + mapModel.beginTransaction("TEST"); + try { + mapModel.addGameObjectToMap(mapControlCreator.getMapModelCreator().newGameObject("arch", "name"), new Point(0, 0), mapControlCreator.getMapModelCreator().getTopmostInsertionMode()); + } finally { + mapModel.endTransaction(); + } + + Assert.assertTrue(mapControl.getMapModel().isModified()); + Assert.assertNull(mapControl.getMapModel().getMapFile()); + mapControl.saveAs(mapFile); // save map must not fail even if the destination dir does not yet exist + Assert.assertTrue(mapFile.getFile().exists()); + Assert.assertFalse(mapControl.getMapModel().isModified()); + Assert.assertEquals(mapFile, mapControl.getMapModel().getMapFile()); + } finally { + TestMapControlCreator.deleteTempDir(mapsDirectory); + } + } + } Modified: trunk/src/model/src/test/java/net/sf/gridarta/model/mapcontrol/TestMapControlCreator.java =================================================================== --- trunk/src/model/src/test/java/net/sf/gridarta/model/mapcontrol/TestMapControlCreator.java 2014-03-10 20:26:52 UTC (rev 9693) +++ trunk/src/model/src/test/java/net/sf/gridarta/model/mapcontrol/TestMapControlCreator.java 2014-03-10 20:51:07 UTC (rev 9694) @@ -336,11 +336,12 @@ throw new IllegalArgumentException(); } - final File mapFile = new File(projectSettings.getMapsDirectory(), tmp[0]); + final MapFile mapFile = new PathManager(projectSettings).getMapFile(new File(projectSettings.getMapsDirectory(), tmp[0])); final String mapName = tmp[1]; - if (!mapFile.getParentFile().exists() && !mapFile.getParentFile().mkdirs()) { - throw new IOException("cannot create directory: " + mapFile.getParentFile()); + final File file = mapFile.getFile(); + if (!file.getParentFile().exists() && !file.getParentFile().mkdirs()) { + throw new IOException("cannot create directory: " + file.getParentFile()); } final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = mapModelCreator.newMapModel(5, 5); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-03-10 20:26:55
|
Revision: 9693 http://sourceforge.net/p/gridarta/code/9693 Author: akirschbaum Date: 2014-03-10 20:26:52 +0000 (Mon, 10 Mar 2014) Log Message: ----------- Somewhat fix build script for .deb package. Do not build .deb package in Jenkins build. Modified Paths: -------------- trunk/build-jenkins.sh trunk/debian/compat trunk/debian/control trunk/debian/gridarta-atrinik.install trunk/debian/gridarta-crossfire.install trunk/debian/gridarta-daimonin.install trunk/debian/rules Modified: trunk/build-jenkins.sh =================================================================== --- trunk/build-jenkins.sh 2014-03-09 21:22:08 UTC (rev 9692) +++ trunk/build-jenkins.sh 2014-03-10 20:26:52 UTC (rev 9693) @@ -3,7 +3,7 @@ set -e unset DISPLAY cd trunk -debuild -uc -us +#debuild -uc -us gradle clean rm -rf .gradle gradle installApp check preparePublish :javadoc Modified: trunk/debian/compat =================================================================== --- trunk/debian/compat 2014-03-09 21:22:08 UTC (rev 9692) +++ trunk/debian/compat 2014-03-10 20:26:52 UTC (rev 9693) @@ -1 +1 @@ -7 +9 Modified: trunk/debian/control =================================================================== --- trunk/debian/control 2014-03-09 21:22:08 UTC (rev 9692) +++ trunk/debian/control 2014-03-10 20:26:52 UTC (rev 9693) @@ -2,7 +2,7 @@ Section: editors Priority: optional Maintainer: Andreas Kirschbaum <aki...@us...> -Build-Depends: debhelper (>= 7.0.50~), ant, ant-optional, openjdk-6-jdk | sun-java6-jdk +Build-Depends: debhelper (>= 7.0.50~), gradle, openjdk-6-jdk | sun-java6-jdk Standards-Version: 3.9.1 Homepage: http://gridarta.sourceforge.net/ Modified: trunk/debian/gridarta-atrinik.install =================================================================== --- trunk/debian/gridarta-atrinik.install 2014-03-09 21:22:08 UTC (rev 9692) +++ trunk/debian/gridarta-atrinik.install 2014-03-10 20:26:52 UTC (rev 9693) @@ -1,3 +1,3 @@ -AtrinikEditor.jar usr/share/java +src/atrinik/build/libs/AtrinikEditor.jar usr/share/java misc/gridarta-atrinik usr/bin misc/gridarta-atrinik.desktop usr/share/applications Modified: trunk/debian/gridarta-crossfire.install =================================================================== --- trunk/debian/gridarta-crossfire.install 2014-03-09 21:22:08 UTC (rev 9692) +++ trunk/debian/gridarta-crossfire.install 2014-03-10 20:26:52 UTC (rev 9693) @@ -1,3 +1,3 @@ -CrossfireEditor.jar usr/share/java +src/crossfire/build/libs/CrossfireEditor.jar usr/share/java misc/gridarta-crossfire usr/bin misc/gridarta-crossfire.desktop usr/share/applications Modified: trunk/debian/gridarta-daimonin.install =================================================================== --- trunk/debian/gridarta-daimonin.install 2014-03-09 21:22:08 UTC (rev 9692) +++ trunk/debian/gridarta-daimonin.install 2014-03-10 20:26:52 UTC (rev 9693) @@ -1,3 +1,3 @@ -DaimoninEditor.jar usr/share/java +src/daimonin/build/libs/DaimoninEditor.jar usr/share/java misc/gridarta-daimonin usr/bin misc/gridarta-daimonin.desktop usr/share/applications Modified: trunk/debian/rules =================================================================== --- trunk/debian/rules 2014-03-09 21:22:08 UTC (rev 9692) +++ trunk/debian/rules 2014-03-10 20:26:52 UTC (rev 9693) @@ -7,6 +7,8 @@ %: dh $@ +override_dh_auto_build: + gradle createEditorJar + override_dh_auto_test: - dh_auto_test - ant test + gradle check This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-03-09 21:22:17
|
Revision: 9692 http://sourceforge.net/p/gridarta/code/9692 Author: akirschbaum Date: 2014-03-09 21:22:08 +0000 (Sun, 09 Mar 2014) Log Message: ----------- Remove unused code. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/JEditTextArea.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java 2014-03-09 21:01:46 UTC (rev 9691) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java 2014-03-09 21:22:08 UTC (rev 9692) @@ -31,7 +31,6 @@ import net.sf.gridarta.gui.mapimagecache.MapImageCache; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.io.PathManager; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.mapcontrol.MapControl; import net.sf.gridarta.model.mapmanager.FileControl; @@ -126,12 +125,6 @@ private final ScriptEditControl scriptEditControl; /** - * The {@link PathManager} to use. - */ - @NotNull - private final PathManager pathManager; - - /** * The {@link JFileChooser} for opening a file. Set to {@code null} if not * yet created. */ @@ -151,9 +144,8 @@ * @param newMapDialogFactory the new map dialog factory * @param scriptExtension the file extension for script files * @param scriptEditControl the script edit control to forward to - * @param pathManager the path manager to use */ - public DefaultFileControl(@NotNull final ProjectSettings projectSettings, @NotNull final VolatileSettings volatileSettings, @NotNull final MapImageCache<G, A, R> mapImageCache, @NotNull final MapManager<G, A, R> mapManager, @NotNull final MapViewsManager<G, A, R> mapViewsManager, @NotNull final Component parent, @NotNull final FileFilter mapFileFilter, @NotNull final FileFilter scriptFileFilter, @NotNull final NewMapDialogFactory<G, A, R> newMapDialogFactory, @NotNull final String scriptExtension, @NotNull final ScriptEditControl scriptEditControl, @NotNull final PathManager pathManager) { + public DefaultFileControl(@NotNull final ProjectSettings projectSettings, @NotNull final VolatileSettings volatileSettings, @NotNull final MapImageCache<G, A, R> mapImageCache, @NotNull final MapManager<G, A, R> mapManager, @NotNull final MapViewsManager<G, A, R> mapViewsManager, @NotNull final Component parent, @NotNull final FileFilter mapFileFilter, @NotNull final FileFilter scriptFileFilter, @NotNull final NewMapDialogFactory<G, A, R> newMapDialogFactory, @NotNull final String scriptExtension, @NotNull final ScriptEditControl scriptEditControl) { this.projectSettings = projectSettings; this.volatileSettings = volatileSettings; this.mapImageCache = mapImageCache; @@ -165,7 +157,6 @@ this.newMapDialogFactory = newMapDialogFactory; this.scriptExtension = scriptExtension; this.scriptEditControl = scriptEditControl; - this.pathManager = pathManager; } /** Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2014-03-09 21:01:46 UTC (rev 9691) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2014-03-09 21:22:08 UTC (rev 9692) @@ -378,7 +378,7 @@ final ArchetypeChooserControl<G, A, R> archetypeChooserControl = new ArchetypeChooserControl<G, A, R>(projectModel.getArchetypeChooserModel(), archetypeChooserView); mapViewsManager = new MapViewsManager<G, A, R>(mapViewSettings, mapViewFactory, projectModel.getMapManager(), projectModel.getPickmapManager(), projectModel.getPathManager()); newMapDialogFactory = editorFactory.newNewMapDialogFactory(mapViewsManager, projectModel.getMapArchObjectFactory(), pickmapChooserView, parent); - fileControl = new DefaultFileControl<G, A, R>(projectModel.getProjectSettings(), volatileSettings, mapImageCache, projectModel.getMapManager(), mapViewsManager, parent, GuiFileFilters.MAP_FILE_FILTER, editorFactory.getScriptFileFilter(), newMapDialogFactory, scriptExtension, scriptEditControl, projectModel.getPathManager()); + fileControl = new DefaultFileControl<G, A, R>(projectModel.getProjectSettings(), volatileSettings, mapImageCache, projectModel.getMapManager(), mapViewsManager, parent, GuiFileFilters.MAP_FILE_FILTER, editorFactory.getScriptFileFilter(), newMapDialogFactory, scriptExtension, scriptEditControl); mapViewsManager.setFileControl(fileControl); final PickmapChooserControl<G, A, R> pickmapChooserControl = new PickmapChooserControl<G, A, R>(pickmapChooserModel, pickmapSettings, newMapDialogFactory, mapFolderTree, projectModel.getMapManager(), parent, mapViewsManager, fileControl, pickmapChooserView); final DefaultObjectChooser<G, A, R> objectChooser = new DefaultObjectChooser<G, A, R>(archetypeChooserControl, pickmapChooserControl, projectModel.getArchetypeChooserModel(), pickmapChooserModel, projectModel.getArchetypeTypeSet()); Modified: trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/JEditTextArea.java =================================================================== --- trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/JEditTextArea.java 2014-03-09 21:01:46 UTC (rev 9691) +++ trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/JEditTextArea.java 2014-03-09 21:22:08 UTC (rev 9692) @@ -131,12 +131,6 @@ private final SyntaxDocument document; @NotNull - private final DocumentListener documentHandler; - - @NotNull - private final Segment lineSegment = new Segment(); - - @NotNull private final TextAreaSelection selection; @NotNull @@ -164,7 +158,6 @@ config = new TextAreaConfig(defaults.getEditable(), defaults.getElectricScroll()); painter = new TextAreaPainter(this, selection, caret, defaults, brackets, config, paintInvalid); painter.recalculateVisibleLines(); - documentHandler = new DocumentHandler(); // Initialize the GUI setLayout(new ScrollLayout(this)); @@ -185,7 +178,7 @@ // Load the defaults inputHandler = defaults.getInputHandler(); this.document = document; - document.addDocumentListener(documentHandler); + document.addDocumentListener(new DocumentHandler()); select(0, 0); updateScrollBars(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-03-09 21:01:51
|
Revision: 9691 http://sourceforge.net/p/gridarta/code/9691 Author: akirschbaum Date: 2014-03-09 21:01:46 +0000 (Sun, 09 Mar 2014) Log Message: ----------- Properly update pickmap view when using a relative maps directory. Modified Paths: -------------- trunk/src/atrinik/ChangeLog trunk/src/crossfire/ChangeLog trunk/src/daimonin/ChangeLog trunk/src/model/src/main/java/net/sf/gridarta/model/settings/AbstractDefaultProjectSettings.java trunk/src/utils/src/main/java/net/sf/gridarta/utils/IOUtils.java Modified: trunk/src/atrinik/ChangeLog =================================================================== --- trunk/src/atrinik/ChangeLog 2014-03-09 20:54:11 UTC (rev 9690) +++ trunk/src/atrinik/ChangeLog 2014-03-09 21:01:46 UTC (rev 9691) @@ -1,5 +1,8 @@ 2014-03-09 Andreas Kirschbaum + * Properly update pickmap view when using a relative maps + directory, + * Remove support for building with Ant. From now on Gradle is required to build the editor from sources. Modified: trunk/src/crossfire/ChangeLog =================================================================== --- trunk/src/crossfire/ChangeLog 2014-03-09 20:54:11 UTC (rev 9690) +++ trunk/src/crossfire/ChangeLog 2014-03-09 21:01:46 UTC (rev 9691) @@ -1,5 +1,8 @@ 2014-03-09 Andreas Kirschbaum + * Properly update pickmap view when using a relative maps + directory, + * Remove support for building with Ant. From now on Gradle is required to build the editor from sources. Modified: trunk/src/daimonin/ChangeLog =================================================================== --- trunk/src/daimonin/ChangeLog 2014-03-09 20:54:11 UTC (rev 9690) +++ trunk/src/daimonin/ChangeLog 2014-03-09 21:01:46 UTC (rev 9691) @@ -1,5 +1,8 @@ 2014-03-09 Andreas Kirschbaum + * Properly update pickmap view when using a relative maps + directory, + * Remove support for building with Ant. From now on Gradle is required to build the editor from sources. Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/settings/AbstractDefaultProjectSettings.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/settings/AbstractDefaultProjectSettings.java 2014-03-09 20:54:11 UTC (rev 9690) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/settings/AbstractDefaultProjectSettings.java 2014-03-09 21:01:46 UTC (rev 9691) @@ -24,6 +24,7 @@ import java.util.prefs.PreferenceChangeListener; import java.util.prefs.Preferences; import net.sf.gridarta.MainControl; +import net.sf.gridarta.utils.IOUtils; import org.jetbrains.annotations.NotNull; /** @@ -122,11 +123,11 @@ @Override public void preferenceChange(final PreferenceChangeEvent evt) { if (evt.getKey().equals(ARCH_DIRECTORY_KEY)) { - archDirectory = new File(PREFERENCES.get(ARCH_DIRECTORY_KEY, editorSettings.getArchDirectoryDefault().toString())); + archDirectory = IOUtils.getCanonicalFile(new File(PREFERENCES.get(ARCH_DIRECTORY_KEY, editorSettings.getArchDirectoryDefault().toString()))); } else if (evt.getKey().equals(MAP_DIRECTORY_KEY)) { setMapsDirectoryInt(new File(PREFERENCES.get(MAP_DIRECTORY_KEY, editorSettings.getMapsDirectoryDefault().toString())), false); } else if (evt.getKey().equals(MEDIA_DIRECTORY_KEY)) { - mediaDirectory = new File(PREFERENCES.get(MEDIA_DIRECTORY_KEY, editorSettings.getMediaDirectoryDefault().toString())); + mediaDirectory = IOUtils.getCanonicalFile(new File(PREFERENCES.get(MEDIA_DIRECTORY_KEY, editorSettings.getMediaDirectoryDefault().toString()))); } else if (evt.getKey().equals(IMAGE_SET_KEY)) { imageSet = PREFERENCES.get(IMAGE_SET_KEY, editorSettings.getImageSetDefault()); } else if (evt.getKey().equals(CONFIG_SOURCE_KEY)) { @@ -137,9 +138,9 @@ }; PREFERENCES.addPreferenceChangeListener(preferenceChangeListener); - archDirectory = new File(PREFERENCES.get(ARCH_DIRECTORY_KEY, editorSettings.getArchDirectoryDefault().toString())); - mapsDirectory = new File(PREFERENCES.get(MAP_DIRECTORY_KEY, editorSettings.getMapsDirectoryDefault().toString())); - mediaDirectory = new File(PREFERENCES.get(MEDIA_DIRECTORY_KEY, editorSettings.getMediaDirectoryDefault().toString())); + archDirectory = IOUtils.getCanonicalFile(new File(PREFERENCES.get(ARCH_DIRECTORY_KEY, editorSettings.getArchDirectoryDefault().toString()))); + mapsDirectory = IOUtils.getCanonicalFile(new File(PREFERENCES.get(MAP_DIRECTORY_KEY, editorSettings.getMapsDirectoryDefault().toString()))); + mediaDirectory = IOUtils.getCanonicalFile(new File(PREFERENCES.get(MEDIA_DIRECTORY_KEY, editorSettings.getMediaDirectoryDefault().toString()))); imageSet = PREFERENCES.get(IMAGE_SET_KEY, editorSettings.getImageSetDefault()); configSourceName = PREFERENCES.get(CONFIG_SOURCE_KEY, ""); } @@ -158,12 +159,13 @@ */ @Override public void setArchDirectory(@NotNull final File archDirectory) { - if (this.archDirectory.equals(archDirectory)) { + final File effectiveArchDirectory = IOUtils.getCanonicalFile(archDirectory); + if (this.archDirectory.equals(effectiveArchDirectory)) { return; } - this.archDirectory = archDirectory; - PREFERENCES.put(ARCH_DIRECTORY_KEY, archDirectory.toString()); + this.archDirectory = effectiveArchDirectory; + PREFERENCES.put(ARCH_DIRECTORY_KEY, effectiveArchDirectory.toString()); } /** @@ -189,13 +191,14 @@ * @param updatePreferences whether the preferences should be updated */ private void setMapsDirectoryInt(@NotNull final File mapsDirectory, final boolean updatePreferences) { - if (this.mapsDirectory.equals(mapsDirectory)) { + final File effectiveMapsDirectory = IOUtils.getCanonicalFile(mapsDirectory); + if (this.mapsDirectory.equals(effectiveMapsDirectory)) { return; } - this.mapsDirectory = mapsDirectory; + this.mapsDirectory = effectiveMapsDirectory; if (updatePreferences) { - PREFERENCES.put(MAP_DIRECTORY_KEY, mapsDirectory.toString()); + PREFERENCES.put(MAP_DIRECTORY_KEY, effectiveMapsDirectory.toString()); } fireMapsDirectoryChanged(); } @@ -214,15 +217,16 @@ */ @Override public void setMediaDirectory(@NotNull final File mediaDirectory) { + final File effectiveMediaDirectory = IOUtils.getCanonicalFile(mediaDirectory); if (!editorSettings.hasMediaDirectory()) { return; } - if (this.mediaDirectory.equals(mediaDirectory)) { + if (this.mediaDirectory.equals(effectiveMediaDirectory)) { return; } - this.mediaDirectory = mediaDirectory; - PREFERENCES.put(MEDIA_DIRECTORY_KEY, mediaDirectory.getPath()); + this.mediaDirectory = effectiveMediaDirectory; + PREFERENCES.put(MEDIA_DIRECTORY_KEY, effectiveMediaDirectory.getPath()); } /** Modified: trunk/src/utils/src/main/java/net/sf/gridarta/utils/IOUtils.java =================================================================== --- trunk/src/utils/src/main/java/net/sf/gridarta/utils/IOUtils.java 2014-03-09 20:54:11 UTC (rev 9690) +++ trunk/src/utils/src/main/java/net/sf/gridarta/utils/IOUtils.java 2014-03-09 21:01:46 UTC (rev 9691) @@ -204,4 +204,19 @@ } } + /** + * Calls {@link File#getCanonicalFile()}. If this fails, returns {@link + * File#getAbsoluteFile()}. + * @param file the file + * @return the absolute path + */ + @NotNull + public static File getCanonicalFile(@NotNull final File file) { + try { + return file.getCanonicalFile(); + } catch (final IOException ignored) { + return file.getAbsoluteFile(); + } + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-03-09 20:54:16
|
Revision: 9690 http://sourceforge.net/p/gridarta/code/9690 Author: akirschbaum Date: 2014-03-09 20:54:11 +0000 (Sun, 09 Mar 2014) Log Message: ----------- Move code from PathManager to IOUtils. Modified Paths: -------------- trunk/src/model/src/main/java/net/sf/gridarta/model/io/PathManager.java trunk/src/utils/src/main/java/net/sf/gridarta/utils/IOUtils.java Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/io/PathManager.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/io/PathManager.java 2014-03-09 13:21:10 UTC (rev 9689) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/io/PathManager.java 2014-03-09 20:54:11 UTC (rev 9690) @@ -20,11 +20,11 @@ package net.sf.gridarta.model.io; import java.io.File; -import java.io.IOException; import net.sf.gridarta.model.mapmodel.AbsoluteMapPath; import net.sf.gridarta.model.mapmodel.MapFile; import net.sf.gridarta.model.mapmodel.MapPathUtils; import net.sf.gridarta.model.settings.ProjectSettings; +import net.sf.gridarta.utils.IOUtils; import org.jetbrains.annotations.NotNull; /** @@ -81,9 +81,9 @@ */ @NotNull public MapFile getMapFile(@NotNull final File file) { - final String canonicalFile = getCanonicalPath(file); + final String canonicalFile = IOUtils.getCanonicalPath(file); final File mapsDirectory = projectSettings.getMapsDirectory(); - final String canonicalMapsDir = getCanonicalPath(mapsDirectory) + "/"; + final String canonicalMapsDir = IOUtils.getCanonicalPath(mapsDirectory) + "/"; final String mapPath; final File baseDir; if (canonicalFile.startsWith(canonicalMapsDir)) { @@ -98,19 +98,4 @@ return new MapFile(new MapFile(baseDir), MapPathUtils.newMapPath(mapPath)); } - /** - * Calls {@link File#getCanonicalPath()}. If this fails, returns {@link - * File#getAbsolutePath()}. - * @param file the file - * @return the absolute path - */ - @NotNull - private static String getCanonicalPath(@NotNull final File file) { - try { - return file.getCanonicalPath(); - } catch (final IOException ignored) { - return file.getAbsolutePath(); - } - } - } Modified: trunk/src/utils/src/main/java/net/sf/gridarta/utils/IOUtils.java =================================================================== --- trunk/src/utils/src/main/java/net/sf/gridarta/utils/IOUtils.java 2014-03-09 13:21:10 UTC (rev 9689) +++ trunk/src/utils/src/main/java/net/sf/gridarta/utils/IOUtils.java 2014-03-09 20:54:11 UTC (rev 9690) @@ -189,4 +189,19 @@ throw new IOException("'" + name + "' not found in " + pathSpec); } + /** + * Calls {@link File#getCanonicalPath()}. If this fails, returns {@link + * File#getAbsolutePath()}. + * @param file the file + * @return the absolute path + */ + @NotNull + public static String getCanonicalPath(@NotNull final File file) { + try { + return file.getCanonicalPath(); + } catch (final IOException ignored) { + return file.getAbsolutePath(); + } + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-03-09 13:21:14
|
Revision: 9689 http://sourceforge.net/p/gridarta/code/9689 Author: akirschbaum Date: 2014-03-09 13:21:10 +0000 (Sun, 09 Mar 2014) Log Message: ----------- Remove outdated files. Removed Paths: ------------- trunk/src/atrinik/INSTALL.txt trunk/src/atrinik/README.txt trunk/src/crossfire/INSTALL.txt trunk/src/crossfire/manifest.txt trunk/src/daimonin/INSTALL.txt trunk/src/daimonin/README.txt Deleted: trunk/src/atrinik/INSTALL.txt =================================================================== --- trunk/src/atrinik/INSTALL.txt 2014-03-09 11:28:03 UTC (rev 9688) +++ trunk/src/atrinik/INSTALL.txt 2014-03-09 13:21:10 UTC (rev 9689) @@ -1,63 +0,0 @@ -How to run the DaimoninEditor: -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Simply run the jar file "AtrinikEditor.jar" in the main directory. -In Windows this is done by a double click on "AtrinikEditor.jar". -In Linux/Unix you type in the console: "java -jar AtrinikEditor.jar". - -The java runtime will be enough to run the client. Download it automatically -from sun. This will install the latest runtime using your browser. - -NOTE: you need Java 6.0 (=1.6.0) or newer to run the editor. - -** There is no need to install anything else (SDK, ...) except you want ** -** compile the editor ** - -You can download the java RUNTIME here: -http://java.sun.com/webapps/getjava/BrowserRedirect?locale=en&host=www.java.com:80 -or this -http://java.com - -If you edit many and big maps, it is recommended to run the editor -with a higher maximum memory size, like 128 Mb: -"java -jar -Xmx128m AtrinikEditor.jar" -(Note that in this way, the editor won't *always* use 128 Mb. -It will only use that much when it is required.) -For client users that edit normal maps (24x24 size) the default settings (which -is equal to -Xmx64m) is enough. - - -In case there is no jar file available, that means you will need -to compile the editor from the sources first. Read next paragraph. - - -How to build the AtrinikEditor from sources: -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -If you have checked out the AtrinikEditor sources from SVN, or -downloaded a "developer version", then you've got the Java sources. -Now you can modify the Java code, you can add classes, but please -don't move or rename any directories. - -When you find yourself in the position that you want to compile -the Java sources for the editor, you have mainly these options: - -1. Compile using Apache Ant. -2. Compile & Debug using Intellij IDEA. -3. Compile using one of the OS-specific build scripts. - (There is no guarantee any of these works correctly.) - (Keep in mind that the sources are UTF-8) -4. Compile "by hand" via command line. - (Do not forget to add -encoding utf-8 for the Java compiler) - -I strongly recommend using Ant for compile and IDEA for coding & compile. - -I strongly recommend the supplied buildfile and running Ant directly, either -through your IDE's capabilities or the command line. - -Visit <http://ant.apache.org/> for more information about Ant. - - -System requirements & Supported Java Versions: -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -You need at least 96 MB of system RAM and 400 MHz CPU speed -in order to run the AtrinikEditor. It has been reported to work -on systems with lesser specs, but the speed was very slow. Deleted: trunk/src/atrinik/README.txt =================================================================== --- trunk/src/atrinik/README.txt 2014-03-09 11:28:03 UTC (rev 9688) +++ trunk/src/atrinik/README.txt 2014-03-09 13:21:10 UTC (rev 9689) @@ -1,91 +0,0 @@ -Building the Daimonin Editor with Ant -===================================== - -To build with Ant, there are 3 possible ways: -* Stay in the main directory (daimonin/editor), use - ant -f make/ant/build.xml - for building -* Change to the ant directory, use ant for building - ( cd make/ant ; ant ) -* Create a new build.xml with the following content: -<?xml version="1.0" encoding="UTF-8"?> -<project name="DaimoninEditor Private" default="jar"> - <import file="make/ant/build.xml" /> -</project> - -The third way probably is the preferred way by vi / vim users, because the -build.xml is searched in current file upwards path, not sub-directories. - - -developer.properties --------------------- - -You can modify the build process to fit your personal needs. For this, create -a file named "developer.properties" in this directory. -The following can be changed (properties' names): -* debug mode compilation (debug) -* ctags tags creation (user.ctags) -* ftp upload of DaimoninEditor.jar (user.ftp.host, user.ftp.user, - user.ftp.pass, user.ftp.dir, user.ftp.depends, user.ftp.passive, - user.ftp.ignoreNoncriticalErrors) - -The following properties are supported (place them as name-value-pairs in -daimonin/editor/build.properties, like user.ctags=yes) -* debug - Developers sometimes want debug builds. A debug build contains all symbols - needed for debugging a Java application (private symbol names, line - numbers). But also, a debug build is 25% larger. - Value: yes|no - Default: no -* user.ctags - ctags is a program that scans source codes for symbols and generates symbol - tables. It is used by users of editors like vim or emacs for tag table - initialization. The tags can then be used to navigate from a symbol usage - to its declaration. - Value: yes|no - Default: no -* user.ftp.host - DaimoninEditor.jar FTP Upload Host. - Value: valid host name or ip address - Default: no default value -* user.ftp.user - DaimoninEditor.jar FTP Upload Login username. - Value: valid ftp username - Default: no default value -* user.ftp.pass - DaimoninEditor.jar FTP Upload Login password - Value: valid ftp password - Default: no default value -* user.ftp.dir - DaimoninEditor.jar FTP Upload Remote Directory - Value: valid remote directory - Default: no default value -* user.ftp.depends - DaimoninEditor.jar FTP Upload Only if file has changed - Value: yes|no - Default: yes -* user.ftp.passive - DaimoninEditor.jar FTP Upload use passive FTP - Value: yes|no - Default: yes -* user.ftp.ignoreNoncriticalErrors - DaimoninEditor.jar FTP Upload ignore non-critical errors - Value: yes|no - Default: yes -* build.number - Build number, will be automatically created and increased by Ant -* build.developer - If you plan to release your DaimoninEditor.jar, you definitely should set this. - The build number will only be shown in the about dialog if you also set - the property build.developer. - Theoretically, creating a unique build.number would be possible via CVS, but - the delay in CVS usage is too long. To keep build numbers unique, they are - only published if they also denote the build developer. - -Example user.properties file: -user.ctags=yes -debug=yes -user.ftp.host=www.example.com -user.ftp.user=cheristheus1234 -user.ftp.pass=12345678 -user.ftp.dir=daimonin Deleted: trunk/src/crossfire/INSTALL.txt =================================================================== --- trunk/src/crossfire/INSTALL.txt 2014-03-09 11:28:03 UTC (rev 9688) +++ trunk/src/crossfire/INSTALL.txt 2014-03-09 13:21:10 UTC (rev 9689) @@ -1,73 +0,0 @@ -How to run the editor: -^^^^^^^^^^^^^^^^^^^^^ -Simply run the jar file "CrossfireEditor.jar" in the main directory. -In Windows this is done by a double-click on "CrossfireEditor.jar". -In Linux/Unix you type in the console: "java -jar CrossfireEditor.jar". - -If you have enough memory, it is recommended to run the editor -with a higher maximum memory size, like 128 Mb: -"java -jar -Xmx128m CrossfireEditor.jar" -(Note that in this way, the editor won't *always* use 128 Mb. -It will only use that much when it is required.) - - -In case there is no jar file available, that means you will need -to compile the editor from the sources first. Read next paragraph. - - -How to build the CrossfireEditor from sources: -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -If you have checked out the Gridarta sources from SVN, or -downloaded a "developer version", then you've got the Java sources. -Now you can modify the Java code, you can add classes, but please -don't move or rename any directories. - -When you find yourself in the position that you want to compile the -Java sources for the editor, you need Apache Ant. Visit -<http://ant.apache.org/> for more information about Ant. - - -Compiling the sources: -^^^^^^^^^^^^^^^^^^^^^ -Install Ant on your system. Make sure both the JAVA_HOME -and ANT_HOME environment variables are set correctly. - -Change into the crossfire sub-directory or the Gridarta directory. -On the console type "ant" - that's all. - - -(Note that, if you want, you can also run the editor with -ant by typing "ant run". This does exactly the same as -"java -jar CrossfireEditor.jar".) - - -How to create a CrossfireEditor release package: -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -A "release" version is meant to be a complete running version of -the CrossfireEditor, without sources. A binary so to speak, though for -Java the most suitable thing is a jar file. -The jar file will contain everything except pickmaps, hence a -release package should only contain these two things: -Jar file and pickmaps. - -1. Run Ant to create the jar file "CrossfireEditor.jar" (see above). - -2. Assemble jar file and pickmaps in the following directory tree: - - crossfire/ - resource/ - pickmaps/ - [all pickmap files] - CrossfireEditor.jar - ChangeLog - -3. Zip the package in a widely available compression format. - Preferably use tar.gz as this is available both on Unix/Linux - and windows (winzip). - - -System requirements & Supported Java Versions: -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -You need at least 128 MB of system RAM and 400 MHz CPU speed -in order to run the editor. It has been reported to work -on systems with lesser specs, but the speed was very slow. Deleted: trunk/src/crossfire/manifest.txt =================================================================== --- trunk/src/crossfire/manifest.txt 2014-03-09 11:28:03 UTC (rev 9688) +++ trunk/src/crossfire/manifest.txt 2014-03-09 13:21:10 UTC (rev 9689) @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Created-By: build_win script -Main-Class: net.sf.gridarta.var.crossfire.maincontrol.CrossfireEditor Deleted: trunk/src/daimonin/INSTALL.txt =================================================================== --- trunk/src/daimonin/INSTALL.txt 2014-03-09 11:28:03 UTC (rev 9688) +++ trunk/src/daimonin/INSTALL.txt 2014-03-09 13:21:10 UTC (rev 9689) @@ -1,63 +0,0 @@ -How to run the DaimoninEditor: -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Simply run the jar file "DaimoninEditor.jar" in the main directory. -In Windows this is done by a double click on "DaimoninEditor.jar". -In Linux/Unix you type in the console: "java -jar DaimoninEditor.jar". - -The java runtime will be enough to run the client. Download it automatically -from sun. This will install the latest runtime using your browser. - -NOTE: you need Java 6.0 (=1.6.0) or newer to run the editor. - -** There is no need to install anything else (SDK, ...) except you want ** -** compile the editor ** - -You can download the java RUNTIME here: -http://java.sun.com/webapps/getjava/BrowserRedirect?locale=en&host=www.java.com:80 -or this -http://java.com - -If you edit many and big maps, it is recommended to run the editor -with a higher maximum memory size, like 128 Mb: -"java -jar -Xmx128m DaimoninEditor.jar" -(Note that in this way, the editor won't *always* use 128 Mb. -It will only use that much when it is required.) -For client users that edit normal maps (24x24 size) the default settings (which -is equal to -Xmx64m) is enough. - - -In case there is no jar file available, that means you will need -to compile the editor from the sources first. Read next paragraph. - - -How to build the DaimoninEditor from sources: -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -If you have checked out the DaimoninEditor sources from SVN, or -downloaded a "developer version", then you've got the Java sources. -Now you can modify the Java code, you can add classes, but please -don't move or rename any directories. - -When you find yourself in the position that you want to compile -the Java sources for the editor, you have mainly these options: - -1. Compile using Apache Ant. -2. Compile & Debug using Intellij IDEA. -3. Compile using one of the OS-specific build scripts. - (There is no guarantee any of these works correctly.) - (Keep in mind that the sources are UTF-8) -4. Compile "by hand" via command line. - (Do not forget to add -encoding utf-8 for the Java compiler) - -I strongly recommend using Ant for compile and IDEA for coding & compile. - -I strongly recommend the supplied buildfile and running Ant directly, either -through your IDE's capabilities or the command line. - -Visit <http://ant.apache.org/> for more information about Ant. - - -System requirements & Supported Java Versions: -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -You need at least 96 MB of system RAM and 400 MHz CPU speed -in order to run the DaimoninEditor. It has been reported to work -on systems with lesser specs, but the speed was very slow. Deleted: trunk/src/daimonin/README.txt =================================================================== --- trunk/src/daimonin/README.txt 2014-03-09 11:28:03 UTC (rev 9688) +++ trunk/src/daimonin/README.txt 2014-03-09 13:21:10 UTC (rev 9689) @@ -1,91 +0,0 @@ -Building the Daimonin Editor with Ant -===================================== - -To build with Ant, there are 3 possible ways: -* Stay in the main directory (daimonin/editor), use - ant -f make/ant/build.xml - for building -* Change to the ant directory, use ant for building - ( cd make/ant ; ant ) -* Create a new build.xml with the following content: -<?xml version="1.0" encoding="UTF-8"?> -<project name="DaimoninEditor Private" default="jar"> - <import file="make/ant/build.xml" /> -</project> - -The third way probably is the preferred way by vi / vim users, because the -build.xml is searched in current file upwards path, not sub-directories. - - -developer.properties --------------------- - -You can modify the build process to fit your personal needs. For this, create -a file named "developer.properties" in this directory. -The following can be changed (properties' names): -* debug mode compilation (debug) -* ctags tags creation (user.ctags) -* ftp upload of DaimoninEditor.jar (user.ftp.host, user.ftp.user, - user.ftp.pass, user.ftp.dir, user.ftp.depends, user.ftp.passive, - user.ftp.ignoreNoncriticalErrors) - -The following properties are supported (place them as name-value-pairs in -daimonin/editor/build.properties, like user.ctags=yes) -* debug - Developers sometimes want debug builds. A debug build contains all symbols - needed for debugging a Java application (private symbol names, line - numbers). But also, a debug build is 25% larger. - Value: yes|no - Default: no -* user.ctags - ctags is a program that scans source codes for symbols and generates symbol - tables. It is used by users of editors like vim or emacs for tag table - initialization. The tags can then be used to navigate from a symbol usage - to its declaration. - Value: yes|no - Default: no -* user.ftp.host - DaimoninEditor.jar FTP Upload Host. - Value: valid host name or ip address - Default: no default value -* user.ftp.user - DaimoninEditor.jar FTP Upload Login username. - Value: valid ftp username - Default: no default value -* user.ftp.pass - DaimoninEditor.jar FTP Upload Login password - Value: valid ftp password - Default: no default value -* user.ftp.dir - DaimoninEditor.jar FTP Upload Remote Directory - Value: valid remote directory - Default: no default value -* user.ftp.depends - DaimoninEditor.jar FTP Upload Only if file has changed - Value: yes|no - Default: yes -* user.ftp.passive - DaimoninEditor.jar FTP Upload use passive FTP - Value: yes|no - Default: yes -* user.ftp.ignoreNoncriticalErrors - DaimoninEditor.jar FTP Upload ignore non-critical errors - Value: yes|no - Default: yes -* build.number - Build number, will be automatically created and increased by Ant -* build.developer - If you plan to release your DaimoninEditor.jar, you definitely should set this. - The build number will only be shown in the about dialog if you also set - the property build.developer. - Theoretically, creating a unique build.number would be possible via CVS, but - the delay in CVS usage is too long. To keep build numbers unique, they are - only published if they also denote the build developer. - -Example user.properties file: -user.ctags=yes -debug=yes -user.ftp.host=www.example.com -user.ftp.user=cheristheus1234 -user.ftp.pass=12345678 -user.ftp.dir=daimonin This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-03-09 11:28:08
|
Revision: 9688 http://sourceforge.net/p/gridarta/code/9688 Author: akirschbaum Date: 2014-03-09 11:28:03 +0000 (Sun, 09 Mar 2014) Log Message: ----------- Remove support for building with Ant. From now on Gradle is required to build the editor from sources. Modified Paths: -------------- trunk/README trunk/build-jenkins.sh trunk/src/atrinik/ChangeLog trunk/src/crossfire/ChangeLog trunk/src/daimonin/ChangeLog Removed Paths: ------------- trunk/build.xml Modified: trunk/README =================================================================== --- trunk/README 2014-03-09 11:18:38 UTC (rev 9687) +++ trunk/README 2014-03-09 11:28:03 UTC (rev 9688) @@ -77,10 +77,6 @@ The build file to build the project with Gradle. See also INSTALL. -build.xml - The build file to build the project with Ant. This file may or may not work - anymore. The preferred way to build the project is now Gradle. - build/ (generated) **/build/ (generated) These directories contain generated files. Modified: trunk/build-jenkins.sh =================================================================== --- trunk/build-jenkins.sh 2014-03-09 11:18:38 UTC (rev 9687) +++ trunk/build-jenkins.sh 2014-03-09 11:28:03 UTC (rev 9688) @@ -4,7 +4,6 @@ unset DISPLAY cd trunk debuild -uc -us -ant clean jar test checkstyle javadoc gradle clean rm -rf .gradle gradle installApp check preparePublish :javadoc Deleted: trunk/build.xml =================================================================== --- trunk/build.xml 2014-03-09 11:18:38 UTC (rev 9687) +++ trunk/build.xml 2014-03-09 11:28:03 UTC (rev 9688) @@ -1,1291 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?><!-- - ~ Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - ~ Copyright (C) 2000-2011 The Gridarta Developers. - ~ - ~ This program is free software; you can redistribute it and/or modify - ~ it under the terms of the GNU General Public License as published by - ~ the Free Software Foundation; either version 2 of the License, or - ~ (at your option) any later version. - ~ - ~ This program is distributed in the hope that it will be useful, - ~ but WITHOUT ANY WARRANTY; without even the implied warranty of - ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ~ GNU General Public License for more details. - ~ - ~ You should have received a copy of the GNU General Public License along - ~ with this program; if not, write to the Free Software Foundation, Inc., - ~ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - --> - -<!DOCTYPE project [<!ENTITY catalogForAnt SYSTEM "src/gridarta/src/doc/dtd/catalogForAnt.xml">]> -<project default="jar"> - - <description> - Build file for Gridarta - 2D MMORPG Map Editor. - </description> - - <property file="developer.properties"/> - <property file="project.properties"/> - <property name="build.source.encoding" value="utf-8"/> - <property name="build.source.version" value="1.6"/> - <property name="build.target.version" value="${build.source.version}"/> - <property name="debug" value="true"/> - <property name="build.developer" value="unknown"/> - <property name="javac.fork" value="no"/> - <property name="javac.args" value="-Xlint:all,-path,-unchecked,-fallthrough,-serial,-deprecation"/> - <property name="user.javadoc.link" value="http://java.sun.com/javase/6/docs/api/"/> - <property name="user.javadoc.javasrc" value="${user.javadoc.javahome}/src"/> - <property name="user.svn.javahl" value="false"/> - <property name="svn.baseUrl" value="https://gridarta.svn.sourceforge.net/svnroot/gridarta"/> - - <condition property="svnCreateBranch" value="true"> - <equals arg1="${project.version.patch}" arg2="0"/> - </condition> - <condition property="svn.branch.sourceUrl" value="${svn.baseUrl}/trunk"> - <equals arg1="${project.version.patch}" arg2="0"/> - </condition> - <condition property="svn.branch.targetUrl" value="${svn.baseUrl}/branches/${project.version.major}.${project.version.minor}"> - <equals arg1="${project.version.patch}" arg2="0"/> - </condition> - <condition property="svn.branch.message" value="Creating branch for version ${project.version.major}.${project.version.minor}"> - <equals arg1="${project.version.patch}" arg2="0"/> - </condition> - <property name="svn.tag.sourceUrl" value="${svn.baseUrl}/branches/${project.version.major}.${project.version.minor}"/> - <property name="svn.tag.targetUrl" value="${svn.baseUrl}/tags/${project.version.major}.${project.version.minor}.${project.version.patch}"/> - <property name="svn.tag.message" value="Creating release tag for version ${project.version.major}.${project.version.minor}.${project.version.patch}"/> - - <property name="build.dir" value="dest"/> - <property name="dist.dir" value="dist"/> - <property name="docs.dir" value="docs"/> - - <path id="path.class.atrinik.app"> - <pathelement location="${build.dir}/atrinik/app"/> - </path> - <path id="path.class.atrinik.test"> - <path refid="path.class.atrinik.app"/> - <pathelement location="${build.dir}/atrinik/test"/> - </path> - - <path id="path.class.crossfire.app"> - <pathelement location="${build.dir}/crossfire/app"/> - </path> - <path id="path.class.crossfire.test"> - <path refid="path.class.crossfire.app"/> - <pathelement location="${build.dir}/crossfire/test"/> - </path> - - <path id="path.class.daimonin.app"> - <pathelement location="${build.dir}/daimonin/app"/> - </path> - <path id="path.class.daimonin.test"> - <path refid="path.class.daimonin.app"/> - <pathelement location="${build.dir}/daimonin/test"/> - </path> - - <path id="path.class.gridarta.app"> - <pathelement location="${build.dir}/gridarta/app"/> - </path> - <path id="path.class.gridarta.test"> - <path refid="path.class.gridarta.app"/> - <pathelement location="${build.dir}/gridarta/test"/> - </path> - - <path id="path.class.model.app"> - <pathelement location="${build.dir}/model/app"/> - </path> - <path id="path.class.model.test"> - <path refid="path.class.model.app"/> - <pathelement location="${build.dir}/model/test"/> - </path> - - <path id="path.class.preferences.app"> - <pathelement location="${build.dir}/preferences/app"/> - </path> - <path id="path.class.preferences.test"> - <path refid="path.class.preferences.app"/> - <pathelement location="${build.dir}/preferences/test"/> - </path> - - <path id="path.class.plugin.app"> - <pathelement location="${build.dir}/plugin/app"/> - </path> - <path id="path.class.plugin.test"> - <path refid="path.class.plugin.app"/> - <pathelement location="${build.dir}/plugin/test"/> - </path> - - <path id="path.class.project.app"> - <pathelement location="${build.dir}/project/app"/> - </path> - <path id="path.class.project.test"> - <path refid="path.class.project.app"/> - <pathelement location="${build.dir}/project/test"/> - </path> - - <path id="path.class.textedit.app"> - <pathelement location="${build.dir}/textedit/app"/> - </path> - <path id="path.class.textedit.test"> - <path refid="path.class.textedit.app"/> - <pathelement location="${build.dir}/textedit/test"/> - </path> - - <path id="path.class.utils.app"> - <pathelement location="${build.dir}/utils/app"/> - </path> - <path id="path.class.utils.test"> - <path refid="path.class.utils.app"/> - <pathelement location="${build.dir}/utils/test"/> - </path> - - <path id="path.lib.annotations" location="repo/annotations/0.0/annotations-0.0.jar"/> - <path id="path.lib.bsh-core" location="repo/bsh/bsh-core/2.0b4/bsh-core-2.0b4.jar"/> - <path id="path.lib.bsh-util" location="repo/bsh/bsh-util/2.0b4/bsh-util-2.0b4.jar"/> - <path id="path.lib.getopt" location="repo/java-getopt/1.0.13/java-getopt-1.0.13.jar"/> - <path id="path.lib.japi-swing-about" location="repo/japi-lib/japi-lib-swing-about/0.1.0/japi-lib-swing-about-0.1.0.jar"/> - <path id="path.lib.japi-swing-action" location="repo/japi-lib/japi-lib-swing-action/0.1.0/japi-lib-swing-action-0.1.0.jar"/> - <path id="path.lib.japi-swing-misc" location="repo/japi-lib/japi-lib-swing-misc/trunk-1398/japi-lib-swing-misc-trunk-1398.jar"/> - <path id="path.lib.japi-swing-prefs" location="repo/japi-lib/japi-lib-swing-prefs/0.1.0/japi-lib-swing-prefs-0.1.0.jar"/> - <path id="path.lib.japi-swing-tod" location="repo/japi-lib/japi-lib-swing-tod/0.1.0/japi-lib-swing-tod-0.1.0.jar"/> - <path id="path.lib.japi-util" location="repo/japi-lib/japi-lib-util/trunk-1410/japi-lib-util-trunk-1410.jar"/> - <path id="path.lib.japi-xml" location="repo/japi-lib/japi-lib-xml/0.1.0/japi-lib-xml-0.1.0.jar"/> - <path id="path.lib.jdom" location="repo/jdom/1.0/jdom-1.0.jar"/> - <path id="path.lib.log4j" location="repo/log4j/1.2.13/log4j-1.2.13.jar"/> - <path id="path.lib.junit" location="repo/junit/4.2/junit-4.2.jar"/> - <path id="path.lib.rsyntaxtextarea" location="repo/rsyntaxtextarea/1.5.1/rsyntaxtextarea-1.5.1.jar"/> - - <path id="xsltpath"> - <fileset dir="lib" includes="**/*.jar"/> - <fileset dir="repo" includes="**/*.jar"/> - </path> - <taskdef name="megaxslt" classpathref="xsltpath" classname="com.hujer.ant.tasks.megaxslt.MegaXsltTask"/> - <taskdef name="rgzip" classpath="lib/megaxslt.jar" classname="com.hujer.ant.tasks.rgzip.RGZipTask"/> - <taskdef name="pack200" classpath="lib/Pack200Task.jar" classname="com.sun.tools.apache.ant.pack200.Pack200Task"/> - <taskdef name="freshmeat" classpath="repo/antmeat/0.3/antmeat-0.3.jar" classname="de.frewert.ant.freshmeat.Announcement"> - <classpath> - <pathelement path="lib/xmlrpc-2.0.1.jar"/> - <pathelement path="lib/commons-codec-1.3.jar"/> - </classpath> - </taskdef> - <taskdef name="svn" classpath="lib/svnant.jar" classname="org.tigris.subversion.svnant.SvnTask"> - <classpath> - <pathelement path="lib/svnClientAdapter.jar"/> - <pathelement path="lib/jakarta-regexp-1.3.jar"/> - </classpath> - </taskdef> - - &catalogForAnt; - - <target name="update" if="dev.autoupdate"> - <svn javahl="${user.svn.javahl}"> - <update dir="."/> - </svn> - </target> - - <target name="clean" description="Removes all generated files."> - <delete dir="${build.dir}"/> - <delete dir="${dist.dir}"/> - <delete file="src/gridarta/src/doc/dev/SafeCopy.java.xhtml"/> - <delete file="src/gridarta/src/doc/dev/changelog.xml"/> - <delete dir="${docs.dir}"/> - <delete file="AtrinikEditor.jar"/> - <delete file="CrossfireEditor.jar"/> - <delete file="DaimoninEditor.jar"/> - </target> - - <target name="jar" description="Creates AtrinikEditor.jar, CrossfireEditor.jar, and DaimoninEditor.jar" depends="jar-atrinik,jar-crossfire,jar-daimonin"/> - - <target name="jar-atrinik" description="Creates AtrinikEditor.jar" depends="compile-atrinik,init-properties"> - <jar destfile="AtrinikEditor.jar" index="true"> - <fileset dir="${build.dir}/atrinik/app"/> - <fileset dir="${build.dir}/gridarta/app"/> - <fileset dir="${build.dir}/model/app"/> - <fileset dir="${build.dir}/preferences/app"/> - <fileset dir="${build.dir}/plugin/app"/> - <fileset dir="${build.dir}/project/app"/> - <fileset dir="${build.dir}/textedit/app"/> - <fileset dir="${build.dir}/utils/app"/> - <fileset dir="${build.dir}" includes="build.properties"/> - <fileset file="COPYING"/> - <fileset file="repo/bsh/bsh-LICENSE"/> - <fileset file="repo/japi-lib/japi-lib.jar-LICENSE"/> - <fileset file="repo/java-getopt/1.0.13/java-getopt-1.0.13.jar-LICENSE"/> - <fileset file="repo/jdom/1.0/jdom-1.0.jar-LICENSE"/> - <fileset file="repo/jlfgr/1.0/jlfgr-1.0.jar-LICENSE"/> - <fileset file="repo/log4j/1.2.13/log4j-1.2.13.jar-LICENSE"/> - <fileset file="repo/rsyntaxtextarea/1.5.1/rsyntaxtextarea-1.5.1.jar-LICENSE"/> - <zipfileset src="repo/bsh/bsh-classgen/2.0b4/bsh-classgen-2.0b4.jar" excludes="META-INF/**"/> - <zipfileset src="repo/bsh/bsh-commands/2.0b4/bsh-commands-2.0b4.jar" excludes="META-INF/**"/> - <zipfileset src="repo/bsh/bsh-core/2.0b4/bsh-core-2.0b4.jar" excludes="META-INF/**"/> - <zipfileset src="repo/bsh/bsh-util/2.0b4/bsh-util-2.0b4.jar" excludes="META-INF/**"/> - <zipfileset src="repo/java-getopt/1.0.13/java-getopt-1.0.13.jar"/> - <zipfileset src="repo/jdom/1.0/jdom-1.0.jar"/> - <zipfileset src="repo/log4j/1.2.13/log4j-1.2.13.jar"/> - <zipfileset src="repo/rsyntaxtextarea/1.5.1/rsyntaxtextarea-1.5.1.jar"/> - <zipgroupfileset dir="repo/japi-lib" includes="**/japi-lib-*.jar"/> - <manifest> - <attribute name="Main-Class" value="net.sf.gridarta.var.atrinik.maincontrol.AtrinikEditor"/> - <attribute name="SplashScreen-Image" value="icons/CFIntro.gif"/> - </manifest> - </jar> - </target> - - <target name="jar-crossfire" description="Creates CrossfireEditor.jar" depends="compile-crossfire,init-properties"> - <jar destfile="CrossfireEditor.jar" index="true"> - <fileset dir="${build.dir}/crossfire/app"/> - <fileset dir="${build.dir}/gridarta/app"/> - <fileset dir="${build.dir}/model/app"/> - <fileset dir="${build.dir}/preferences/app"/> - <fileset dir="${build.dir}/plugin/app"/> - <fileset dir="${build.dir}/project/app"/> - <fileset dir="${build.dir}/textedit/app"/> - <fileset dir="${build.dir}/utils/app"/> - <fileset dir="${build.dir}" includes="build.properties"/> - <fileset file="COPYING"/> - <fileset file="repo/bsh/bsh-LICENSE"/> - <fileset file="repo/japi-lib/japi-lib.jar-LICENSE"/> - <fileset file="repo/java-getopt/1.0.13/java-getopt-1.0.13.jar-LICENSE"/> - <fileset file="repo/jdom/1.0/jdom-1.0.jar-LICENSE"/> - <fileset file="repo/jlfgr/1.0/jlfgr-1.0.jar-LICENSE"/> - <fileset file="repo/log4j/1.2.13/log4j-1.2.13.jar-LICENSE"/> - <fileset file="repo/rsyntaxtextarea/1.5.1/rsyntaxtextarea-1.5.1.jar-LICENSE"/> - <zipfileset src="repo/bsh/bsh-classgen/2.0b4/bsh-classgen-2.0b4.jar" excludes="META-INF/**"/> - <zipfileset src="repo/bsh/bsh-commands/2.0b4/bsh-commands-2.0b4.jar" excludes="META-INF/**"/> - <zipfileset src="repo/bsh/bsh-core/2.0b4/bsh-core-2.0b4.jar" excludes="META-INF/**"/> - <zipfileset src="repo/bsh/bsh-util/2.0b4/bsh-util-2.0b4.jar" excludes="META-INF/**"/> - <zipfileset src="repo/java-getopt/1.0.13/java-getopt-1.0.13.jar"/> - <zipfileset src="repo/jdom/1.0/jdom-1.0.jar" excludes="META-INF/**"/> - <zipfileset src="repo/log4j/1.2.13/log4j-1.2.13.jar"/> - <zipfileset src="repo/rsyntaxtextarea/1.5.1/rsyntaxtextarea-1.5.1.jar"/> - <zipgroupfileset dir="repo/japi-lib" includes="**/japi-lib-*.jar"/> - <manifest> - <attribute name="Main-Class" value="net.sf.gridarta.var.crossfire.maincontrol.CrossfireEditor"/> - <attribute name="SplashScreen-Image" value="icons/CFIntro.gif"/> - </manifest> - </jar> - </target> - - <target name="jar-daimonin" description="Creates DaimoninEditor.jar" depends="compile-daimonin,init-properties"> - <jar destfile="DaimoninEditor.jar" index="true"> - <fileset dir="${build.dir}/daimonin/app"/> - <fileset dir="${build.dir}/gridarta/app"/> - <fileset dir="${build.dir}/model/app"/> - <fileset dir="${build.dir}/preferences/app"/> - <fileset dir="${build.dir}/plugin/app"/> - <fileset dir="${build.dir}/project/app"/> - <fileset dir="${build.dir}/textedit/app"/> - <fileset dir="${build.dir}/utils/app"/> - <fileset dir="${build.dir}" includes="build.properties"/> - <fileset file="COPYING"/> - <fileset file="repo/bsh/bsh-LICENSE"/> - <fileset file="repo/japi-lib/japi-lib.jar-LICENSE"/> - <fileset file="repo/java-getopt/1.0.13/java-getopt-1.0.13.jar-LICENSE"/> - <fileset file="repo/jdom/1.0/jdom-1.0.jar-LICENSE"/> - <fileset file="repo/jlfgr/1.0/jlfgr-1.0.jar-LICENSE"/> - <fileset file="repo/log4j/1.2.13/log4j-1.2.13.jar-LICENSE"/> - <fileset file="repo/rsyntaxtextarea/1.5.1/rsyntaxtextarea-1.5.1.jar-LICENSE"/> - <zipfileset src="repo/bsh/bsh-classgen/2.0b4/bsh-classgen-2.0b4.jar" excludes="META-INF/**"/> - <zipfileset src="repo/bsh/bsh-commands/2.0b4/bsh-commands-2.0b4.jar" excludes="META-INF/**"/> - <zipfileset src="repo/bsh/bsh-core/2.0b4/bsh-core-2.0b4.jar" excludes="META-INF/**"/> - <zipfileset src="repo/bsh/bsh-util/2.0b4/bsh-util-2.0b4.jar" excludes="META-INF/**"/> - <zipfileset src="repo/java-getopt/1.0.13/java-getopt-1.0.13.jar"/> - <zipfileset src="repo/jdom/1.0/jdom-1.0.jar"/> - <zipfileset src="repo/log4j/1.2.13/log4j-1.2.13.jar"/> - <zipfileset src="repo/rsyntaxtextarea/1.5.1/rsyntaxtextarea-1.5.1.jar"/> - <zipgroupfileset dir="repo/japi-lib" includes="**/japi-lib-*.jar"/> - <manifest> - <attribute name="Main-Class" value="net.sf.gridarta.var.daimonin.maincontrol.DaimoninEditor"/> - <attribute name="SplashScreen-Image" value="icons/CFIntro.gif"/> - </manifest> - </jar> - </target> - - <target name="init-properties"> - <tstamp> - <format property="build.tstamp" pattern="yyyy-MM-dd HH:mm:ss z" timezone="UTC"/> - </tstamp> - <exec executable="svnversion" outputproperty="build.number" failifexecutionfails="false"/> - <property name="build.number" value="unknown"/> - <echoproperties destfile="${build.dir}/build.properties"> - <propertyset> - <propertyref prefix="build.developer"/> - <propertyref prefix="build.number"/> - <propertyref prefix="build.tstamp"/> - </propertyset> - </echoproperties> - </target> - - <target name="compile-atrinik" description="Compiles the atrinik module." depends="compile-gridarta,compile-model,compile-preferences,compile-plugin,compile-project,compile-utils"> - <mkdir dir="${build.dir}/atrinik/app"/> - <javac srcdir="src/atrinik/src/main/java" destdir="${build.dir}/atrinik/app" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="${debug}"> - <classpath> - <path refid="path.class.gridarta.app"/> - <path refid="path.class.model.app"/> - <path refid="path.class.plugin.app"/> - <path refid="path.class.project.app"/> - <path refid="path.class.utils.app"/> - <path refid="path.lib.annotations"/> - <path refid="path.lib.japi-swing-action"/> - <path refid="path.lib.japi-swing-misc"/> - <path refid="path.lib.japi-swing-prefs"/> - <path refid="path.lib.log4j"/> - </classpath> - <compilerarg line="${javac.args}"/> - </javac> - <copy todir="${build.dir}/atrinik/app"> - <fileset dir="src/atrinik/src/main/resources"/> - </copy> - <mkdir dir="${build.dir}/atrinik/test"/> - <javac srcdir="src/atrinik/src/test/java" destdir="${build.dir}/atrinik/test" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="yes"> - <classpath> - <path refid="path.class.atrinik.app"/> - <path refid="path.class.gridarta.test"/> - <path refid="path.class.model.test"/> - <path refid="path.class.utils.test"/> - <path refid="path.lib.annotations"/> - <path refid="path.lib.japi-swing-action"/> - <path refid="path.lib.junit"/> - </classpath> - <compilerarg line="${javac.args}"/> - </javac> - <copy todir="${build.dir}/atrinik/test"> - <fileset dir="src/atrinik/src/test/resources"/> - </copy> - </target> - - <target name="compile-crossfire" description="Compiles the crossfire module." depends="compile-gridarta,compile-model,compile-preferences,compile-plugin,compile-project,compile-utils"> - <mkdir dir="${build.dir}/crossfire/app"/> - <javac srcdir="src/crossfire/src/main/java" destdir="${build.dir}/crossfire/app" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="${debug}"> - <classpath> - <path refid="path.class.gridarta.app"/> - <path refid="path.class.model.app"/> - <path refid="path.class.plugin.app"/> - <path refid="path.class.project.app"/> - <path refid="path.class.utils.app"/> - <path refid="path.lib.annotations"/> - <path refid="path.lib.japi-swing-action"/> - <path refid="path.lib.japi-swing-misc"/> - <path refid="path.lib.japi-swing-prefs"/> - <path refid="path.lib.log4j"/> - </classpath> - <compilerarg line="${javac.args}"/> - </javac> - <copy todir="${build.dir}/crossfire/app"> - <fileset dir="src/crossfire/src/main/resources"/> - </copy> - <mkdir dir="${build.dir}/crossfire/test"/> - <javac srcdir="src/crossfire/src/test/java" destdir="${build.dir}/crossfire/test" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="yes"> - <classpath> - <path refid="path.class.crossfire.app"/> - <path refid="path.class.gridarta.test"/> - <path refid="path.class.model.test"/> - <path refid="path.class.utils.test"/> - <path refid="path.lib.annotations"/> - <path refid="path.lib.japi-swing-action"/> - <path refid="path.lib.junit"/> - </classpath> - <compilerarg line="${javac.args}"/> - </javac> - <copy todir="${build.dir}/crossfire/test"> - <fileset dir="src/crossfire/src/test/resources"/> - </copy> - </target> - - <target name="compile-daimonin" description="Compiles the daimonin module." depends="compile-gridarta,compile-model,compile-plugin,compile-project,compile-utils"> - <mkdir dir="${build.dir}/daimonin/app"/> - <javac srcdir="src/daimonin/src/main/java" destdir="${build.dir}/daimonin/app" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="${debug}"> - <classpath> - <path refid="path.class.gridarta.app"/> - <path refid="path.class.model.app"/> - <path refid="path.class.plugin.app"/> - <path refid="path.class.project.app"/> - <path refid="path.class.utils.app"/> - <path refid="path.lib.annotations"/> - <path refid="path.lib.japi-swing-action"/> - <path refid="path.lib.japi-swing-misc"/> - <path refid="path.lib.japi-swing-prefs"/> - <path refid="path.lib.log4j"/> - </classpath> - <compilerarg line="${javac.args}"/> - </javac> - <copy todir="${build.dir}/daimonin/app"> - <fileset dir="src/daimonin/src/main/resources"/> - </copy> - <mkdir dir="${build.dir}/daimonin/test"/> - <javac srcdir="src/daimonin/src/test/java" destdir="${build.dir}/daimonin/test" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="yes"> - <classpath> - <path refid="path.class.daimonin.app"/> - <path refid="path.class.gridarta.test"/> - <path refid="path.class.model.test"/> - <path refid="path.class.utils.test"/> - <path refid="path.lib.junit"/> - </classpath> - <compilerarg line="${javac.args}"/> - </javac> - <copy todir="${build.dir}/daimonin/test"> - <fileset dir="src/daimonin/src/test/resources"/> - </copy> - </target> - - <target name="compile-gridarta" description="Compiles the gridarta module." depends="compile-model,compile-preferences,compile-plugin,compile-project,compile-textedit,compile-utils"> - <mkdir dir="${build.dir}/gridarta/app"/> - <javac srcdir="src/gridarta/src/main/java" destdir="${build.dir}/gridarta/app" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="${debug}"> - <classpath> - <path refid="path.class.model.app"/> - <path refid="path.class.preferences.app"/> - <path refid="path.class.plugin.app"/> - <path refid="path.class.project.app"/> - <path refid="path.class.textedit.app"/> - <path refid="path.class.utils.app"/> - <path refid="path.lib.annotations"/> - <path refid="path.lib.bsh-core"/> - <path refid="path.lib.bsh-util"/> - <path refid="path.lib.getopt"/> - <path refid="path.lib.japi-swing-about"/> - <path refid="path.lib.japi-swing-action"/> - <path refid="path.lib.japi-swing-misc"/> - <path refid="path.lib.japi-swing-prefs"/> - <path refid="path.lib.japi-swing-tod"/> - <path refid="path.lib.japi-util"/> - <path refid="path.lib.jdom"/> - <path refid="path.lib.log4j"/> - <path refid="path.lib.rsyntaxtextarea"/> - </classpath> - <compilerarg line="${javac.args}"/> - </javac> - <copy todir="${build.dir}/gridarta/app"> - <fileset dir="src/gridarta/src/main/resources"/> - </copy> - <mkdir dir="${build.dir}/gridarta/test"/> - <javac srcdir="src/gridarta/src/test/java" destdir="${build.dir}/gridarta/test" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="yes"> - <classpath> - <path refid="path.class.gridarta.app"/> - <path refid="path.class.model.test"/> - <path refid="path.class.preferences.test"/> - <path refid="path.class.textedit.test"/> - <path refid="path.class.utils.test"/> - <path refid="path.lib.annotations"/> - <path refid="path.lib.japi-swing-action"/> - <path refid="path.lib.junit"/> - </classpath> - <compilerarg line="${javac.args}"/> - </javac> - <copy todir="${build.dir}/gridarta/test"> - <fileset dir="src/gridarta/src/test/resources"/> - </copy> - </target> - - <target name="compile-model" description="Compiles the model module." depends="compile-utils"> - <mkdir dir="${build.dir}/model/app"/> - <javac srcdir="src/model/src/main/java" destdir="${build.dir}/model/app" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="${debug}"> - <classpath> - <path refid="path.class.utils.app"/> - <path refid="path.lib.annotations"/> - <path refid="path.lib.japi-swing-action"/> - <path refid="path.lib.japi-swing-misc"/> - <path refid="path.lib.japi-util"/> - <path refid="path.lib.japi-xml"/> - <path refid="path.lib.jdom"/> - <path refid="path.lib.log4j"/> - </classpath> - <compilerarg line="${javac.args}"/> - </javac> - <copy todir="${build.dir}/model/app"> - <fileset dir="src/model/src/main/resources"/> - </copy> - <mkdir dir="${build.dir}/model/test"/> - <javac srcdir="src/model/src/test/java" destdir="${build.dir}/model/test" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="yes"> - <classpath> - <path refid="path.class.model.app"/> - <path refid="path.class.utils.test"/> - <path refid="path.lib.annotations"/> - <path refid="path.lib.japi-swing-action"/> - <path refid="path.lib.japi-swing-misc"/> - <path refid="path.lib.japi-util"/> - <path refid="path.lib.junit"/> - <path refid="path.lib.log4j"/> - </classpath> - <compilerarg line="${javac.args}"/> - </javac> - <copy todir="${build.dir}/model/test"> - <fileset dir="src/model/src/test/resources"/> - </copy> - </target> - - <target name="compile-preferences" description="Compiles the preferences module."> - <mkdir dir="${build.dir}/preferences/app"/> - <javac srcdir="src/preferences/src/main/java" destdir="${build.dir}/preferences/app" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="${debug}"> - <classpath> - <path refid="path.lib.annotations"/> - <path refid="path.lib.japi-swing-action"/> - <path refid="path.lib.log4j"/> - </classpath> - <compilerarg line="${javac.args}"/> - </javac> - <copy todir="${build.dir}/preferences/app"> - <fileset dir="src/preferences/src/main/resources"/> - </copy> - <mkdir dir="${build.dir}/preferences/test"/> - <javac srcdir="src/preferences/src/test/java" destdir="${build.dir}/preferences/test" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="yes"> - <classpath> - <path refid="path.class.preferences.app"/> - </classpath> - <compilerarg line="${javac.args}"/> - </javac> - <copy todir="${build.dir}/preferences/test"> - <fileset dir="src/preferences/src/test/resources"/> - </copy> - </target> - - <target name="compile-plugin" description="Compiles the plugin module." depends="compile-model,compile-utils"> - <mkdir dir="${build.dir}/plugin/app"/> - <javac srcdir="src/plugin/src/main/java" destdir="${build.dir}/plugin/app" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="${debug}"> - <classpath> - <path refid="path.class.model.app"/> - <path refid="path.class.utils.app"/> - <path refid="path.lib.annotations"/> - <path refid="path.lib.bsh-core"/> - <path refid="path.lib.bsh-util"/> - <path refid="path.lib.jdom"/> - <path refid="path.lib.log4j"/> - </classpath> - <compilerarg line="${javac.args}"/> - </javac> - <copy todir="${build.dir}/plugin/app"> - <fileset dir="src/plugin/src/main/resources"/> - </copy> - <mkdir dir="${build.dir}/plugin/test"/> - <javac srcdir="src/plugin/src/test/java" destdir="${build.dir}/plugin/test" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="yes"> - <classpath> - <path refid="path.class.model.app"/> - <path refid="path.class.model.test"/> - <path refid="path.class.plugin.app"/> - <path refid="path.class.utils.app"/> - <path refid="path.lib.annotations"/> - <path refid="path.lib.jdom"/> - <path refid="path.lib.junit"/> - </classpath> - <compilerarg line="${javac.args}"/> - </javac> - <copy todir="${build.dir}/plugin/test"> - <fileset dir="src/plugin/src/test/resources"/> - </copy> - </target> - - <target name="compile-project" description="Compiles the project module." depends="compile-model,compile-plugin,compile-utils"> - <mkdir dir="${build.dir}/project/app"/> - <javac srcdir="src/project/src/main/java" destdir="${build.dir}/project/app" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="${debug}"> - <classpath> - <path refid="path.class.model.app"/> - <path refid="path.class.plugin.app"/> - <path refid="path.class.utils.app"/> - <path refid="path.lib.annotations"/> - <path refid="path.lib.japi-swing-action"/> - <path refid="path.lib.log4j"/> - </classpath> - <compilerarg line="${javac.args}"/> - </javac> - <copy todir="${build.dir}/project/app"> - <fileset dir="src/project/src/main/resources"/> - </copy> - <mkdir dir="${build.dir}/project/test"/> - <javac srcdir="src/project/src/test/java" destdir="${build.dir}/project/test" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="yes"> - <classpath> - <path refid="path.class.project.app"/> - </classpath> - <compilerarg line="${javac.args}"/> - </javac> - <copy todir="${build.dir}/project/test"> - <fileset dir="src/project/src/test/resources"/> - </copy> - </target> - - <target name="compile-textedit" description="Compiles the textedit module." depends="compile-utils"> - <mkdir dir="${build.dir}/textedit/app"/> - <javac srcdir="src/textedit/src/main/java" destdir="${build.dir}/textedit/app" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="${debug}"> - <classpath> - <path refid="path.class.utils.app"/> - <path refid="path.lib.annotations"/> - <path refid="path.lib.japi-swing-action"/> - <path refid="path.lib.log4j"/> - </classpath> - <compilerarg line="${javac.args}"/> - </javac> - <copy todir="${build.dir}/textedit/app"> - <fileset dir="src/textedit/src/main/resources"/> - </copy> - <mkdir dir="${build.dir}/textedit/test"/> - <javac srcdir="src/textedit/src/test/java" destdir="${build.dir}/textedit/test" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="yes"> - <classpath> - <path refid="path.class.textedit.app"/> - <path refid="path.class.utils.test"/> - </classpath> - <compilerarg line="${javac.args}"/> - </javac> - <copy todir="${build.dir}/textedit/test"> - <fileset dir="src/textedit/src/test/resources"/> - </copy> - </target> - - <target name="compile-utils" description="Compiles the utils module."> - <mkdir dir="${build.dir}/utils/app"/> - <javac srcdir="src/utils/src/main/java" destdir="${build.dir}/utils/app" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="${debug}"> - <classpath> - <path refid="path.lib.annotations"/> - <path refid="path.lib.japi-swing-action"/> - <path refid="path.lib.japi-util"/> - <path refid="path.lib.japi-xml"/> - <path refid="path.lib.log4j"/> - </classpath> - <compilerarg line="${javac.args}"/> - </javac> - <copy todir="${build.dir}/utils/app"> - <fileset dir="src/utils/src/main/resources"/> - </copy> - <mkdir dir="${build.dir}/utils/test"/> - <javac srcdir="src/utils/src/test/java" destdir="${build.dir}/utils/test" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="yes"> - <classpath> - <path refid="path.class.utils.app"/> - <path refid="path.lib.annotations"/> - <path refid="path.lib.japi-swing-action"/> - <path refid="path.lib.japi-util"/> - <path refid="path.lib.japi-xml"/> - <path refid="path.lib.junit"/> - </classpath> - <compilerarg line="${javac.args}"/> - </javac> - <copy todir="${build.dir}/utils/test"> - <fileset dir="src/utils/src/test/resources"/> - </copy> - </target> - - <target name="doc" depends="editorialDoc,apiDoc" description="Creates project documentation."/> - - <target name="java2html" description="Converts documentation java sources to XHTML."> - <taskdef name="java2html" classpath="lib/java2html.jar" classname="de.java2html.anttasks.Java2HtmlTask"/> - <java2html srcdir="src/gridarta/src/doc" destdir="src/gridarta/src/doc" includes="**/*.java" outputformat="xhtml11" tabs="4" style="eclipse" addlineanchors="true" includedocumentfooter="true" includedocumentheader="true" lineanchorprefix="line" showdefaulttitle="true" showfilename="true" showlinenumbers="true" showtableborder="true"/> - </target> - - <target name="editorialDoc" description="Creates the editorial part of the project documentation." depends="java2html"> - <mkdir dir="${build.dir}/doc"/> - <megaxslt srcdir="src/gridarta/src/doc" destdir="${build.dir}/doc" includes="**/*.xhtml" validatesource="true" validatedest="true" ending="xhtml" transformerFactoryImplementationClassName="net.sf.saxon.TransformerFactoryImpl"> - <xmlcatalog refid="commonDTDs"/> - <transformation stylesheet="src/gridarta/src/doc/transform.xslt"/> - <transformation stylesheet="src/gridarta/src/doc/cleanupXhtml11.xslt"/> - </megaxslt> - <megaxslt srcdir="${build.dir}/doc" destdir="${build.dir}/doc" includes="**/*.xhtml" validatesource="true" validatedest="false" ending="html" converttocanonical="true" transformerFactoryImplementationClassName="net.sf.saxon.TransformerFactoryImpl"> - <xmlcatalog refid="commonDTDs"/> - <transformation stylesheet="src/gridarta/src/doc/xhtml2html.xslt"/> - </megaxslt> - <megaxslt srcdir="src/gridarta/src/doc" destdir="." includes="faq.xhtml" validatesource="true" validatedest="false" ending="" transformerFactoryImplementationClassName="net.sf.saxon.TransformerFactoryImpl"> - <xmlcatalog refid="commonDTDs"/> - <transformation stylesheet="src/gridarta/src/doc/faq2txt.xslt"/> - </megaxslt> - <copy file="faq" tofile="FAQ"/> - <copy todir="${build.dir}/doc"> - <fileset dir="src/gridarta/src/doc"> - <include name="**/.htaccess"/> - <include name="**/*.html"/> - <include name="dtd/**/*.mod"/> - <include name="dtd/**/*.dtd"/> - <include name="dtd/**/*.xml"/> - <include name="**/*.css"/> - <include name="**/*.png"/> - <include name="**/*.gif"/> - <include name="robots.txt"/> - <exclude name="**/.xvpics/*.png"/> - </fileset> - </copy> - </target> - - <target name="apiDoc" description="Creates public javadoc documentation."> - <mkdir dir="${build.dir}/doc/api/${project.version}"/> - <copy todir="${build.dir}/doc/api/${project.version}" file="src/gridarta/src/doc/copyright.xhtml"/> - <copy todir="${build.dir}/doc/api/${project.version}" file="src/gridarta/src/doc/dev/api/.htaccess"/> - <javadoc destdir="${build.dir}/doc/api/${project.version}" access="protected" author="yes" version="yes" locale="en_US" use="yes" splitindex="yes" windowtitle="Gridarta API documentation" doctitle="Gridarta<br />Yet another Java API<br />API Documentation" header="Gridarta ${project.version}<br />Yet another Java API<br />API Documentation" footer="Gridarta<br />Yet another Java API<br />API Documentation" bottom="<div style="text-align:center;">© 2005-2006 The Gridarta Developers. All rights reserved. See <a href="{@docRoot}/copyright.xhtml">copyright</a></div>" serialwarn="yes" charset="${build.source.encoding}" docencoding="${build.source.encoding}" source="${build.source.version}" encoding="${build.source.encoding}" linksource="yes" overview="src/gridarta/src/main/java/overview.html" link="${user.javadoc.link}"> - <classpath> - <fileset dir="lib" includes="*.jar" excludes="*.jar-LICENSE"/> - <fileset dir="repo" includes="**/*.jar" excludes="*.jar-LICENSE"/> - </classpath> - <sourcepath> - <pathelement path="${user.javadoc.javasrc}"/> - <path refid="path.class.atrinik.test"/> - <path refid="path.class.crossfire.test"/> - <path refid="path.class.daimonin.test"/> - <path refid="path.class.gridarta.test"/> - <path refid="path.class.model.test"/> - <path refid="path.class.preferences.test"/> - <path refid="path.class.plugin.test"/> - <path refid="path.class.project.test"/> - <path refid="path.class.textedit.test"/> - <path refid="path.class.utils.test"/> - </sourcepath> - <packageset dir="src/gridarta/src/main/java" defaultexcludes="yes"/> - <packageset dir="src/gridarta/src/test/java" defaultexcludes="yes"/> - <packageset dir="src/atrinik/src/main/java" defaultexcludes="yes"/> - <packageset dir="src/atrinik/src/test/java" defaultexcludes="yes"/> - <packageset dir="src/crossfire/src/main/java" defaultexcludes="yes"/> - <packageset dir="src/crossfire/src/test/java" defaultexcludes="yes"/> - <packageset dir="src/daimonin/src/main/java" defaultexcludes="yes"/> - <packageset dir="src/daimonin/src/test/java" defaultexcludes="yes"/> - <packageset dir="src/model/src/main/java" defaultexcludes="yes"/> - <packageset dir="src/model/src/test/java" defaultexcludes="yes"/> - <packageset dir="src/preferences/src/main/java" defaultexcludes="yes"/> - <packageset dir="src/preferences/src/test/java" defaultexcludes="yes"/> - <packageset dir="src/plugin/src/main/java" defaultexcludes="yes"/> - <packageset dir="src/plugin/src/test/java" defaultexcludes="yes"/> - <packageset dir="src/project/src/main/java" defaultexcludes="yes"/> - <packageset dir="src/project/src/test/java" defaultexcludes="yes"/> - <packageset dir="src/textedit/src/main/java" defaultexcludes="yes"/> - <packageset dir="src/textedit/src/test/java" defaultexcludes="yes"/> - <packageset dir="src/utils/src/main/java" defaultexcludes="yes"/> - <packageset dir="src/utils/src/test/java" defaultexcludes="yes"/> - <tag name="todo" description="Todo:"/> - <tag name="used" description="Manually marked as used." enabled="false"/> - <tag name="fixme" description="Fixme:"/> - <tag name="xxx" description="XXX:"/> - <tag name="note" description="Note:"/> - <tag name="warning" description="Warning:"/> - <tag name="retval" description="Return Value:"/> - <tag name="val" description="Value:"/> - <tag name="default" description="Default Value:"/> - <tag name="invariant" description="Invariant:"/> - <tag name="pre" description="Precondition:"/> - <tag name="noinspection" description="No Inspection:"/> - </javadoc> - </target> - - <target name="dist" description="Packs distribution archives." depends="distSrc,distLib,distDoc"/> - - <target name="distSrc" description="Packs source distribution archives."> - <mkdir dir="${dist.dir}"/> - <property name="distSrc" value="${dist.dir}/gridarta-${project.version}.src"/> - <parallel> - <tar tarfile="${distSrc}.tar"> - <tarfileset dir="." prefix="gridarta-${project.version}"> - <include name="src/gridarta/src/**"/> - <include name="build.xml"/> - </tarfileset> - </tar> - <zip destfile="${distSrc}.zip"> - <zipfileset dir="." prefix="gridarta-${project.version}"> - <include name="src/gridarta/src/**"/> - <include name="build.xml"/> - </zipfileset> - </zip> - <jar destfile="${distSrc}.jar"> - <zipfileset dir="." prefix="gridarta-${project.version}"> - <include name="src/gridarta/src/**"/> - <include name="build.xml"/> - </zipfileset> - </jar> - </parallel> - <parallel> - <gzip src="${distSrc}.tar" destfile="${distSrc}.tar.gz"/> - <bzip2 src="${distSrc}.tar" destfile="${distSrc}.tar.bz2"/> - </parallel> - <delete file="${distSrc}.tar"/> - </target> - - <target name="distLib" description="Packs library distribution archives."> <!--XXX:depends="compile"--> - <mkdir dir="${dist.dir}"/> - <property name="distLib" value="${dist.dir}/gridarta-${project.version}.lib"/> - <jar destfile="${distLib}.jar"> - <zipfileset dir="${build.dir}/app"/> - <manifest> - <attribute name="Implementation-Title" value="Gridarta"/> - <attribute name="Implementation-Vendor" value="The Gridarta Developers"/> - <attribute name="Implementation-Version" value="${project.version}"/> - <attribute name="Implementation-URL" value="http://sourceforge.net/projects/gridarta/"/> - </manifest> - </jar> - <pack200 src="${distLib}.jar" destfile="${distLib}.pack.gz" gzipoutput="true" stripdebug="true" effort="9" keepfileorder="false" modificationtime="latest" deflatehint="false"/> - </target> - - <target name="distDoc" description="Packs documentation archives." depends="apiDoc"> - <mkdir dir="${dist.dir}"/> - <property name="distDoc" value="${dist.dir}/gridarta-${project.version}.doc"/> - <parallel> - <tar tarfile="${distDoc}.tar"> - <tarfileset dir="${build.dir}/doc" prefix="gridarta-${project.version}"> - <include name="api/${project.version}/**"/> - </tarfileset> - </tar> - <zip destfile="${distDoc}.zip"> - <zipfileset dir="${build.dir}/doc" prefix="gridarta-${project.version}"> - <include name="api/${project.version}/**"/> - </zipfileset> - </zip> - <jar destfile="${distDoc}.jar"> - <zipfileset dir="${build.dir}/doc" prefix="gridarta-${project.version}"> - <include name="api/${project.version}/**"/> - </zipfileset> - </jar> - </parallel> - <parallel> - <gzip src="${distDoc}.tar" destfile="${distDoc}.tar.gz"/> - <bzip2 src="${distDoc}.tar" destfile="${distDoc}.tar.bz2"/> - </parallel> - <delete file="${distDoc}.tar"/> - </target> - - <target name="checkDevMail" description="Checks whether the developer defined his / her email address." unless="developer.email"> - <fail message="You must define the property developer.email with your email address in the file developer.properties."/> - </target> - - <target name="checkDevSmtp" description="Checks whether the developer defined his / her smtp host." unless="user.mail.smtp.host"> - <fail message="You must define the property user.mail.smtp.host with your smtp host address in the file developer.properties."/> - </target> - - <target name="releaseDist" description="Uploads distribution archives to sourceforge." if="developer.email" depends="checkDevMail, dist"> - <touch file="src/gridarta/src/doc/api/start.xhtml" millis="0"/> - <megaxslt srcdir="src/gridarta/src/doc/api" destdir="src/gridarta/src/doc/api" includes="start.xhtml" validatesource="true" validatedest="true" ending="xhtml" converttocanonical="true" checktimestamps="true"> - <xmlcatalog refid="commonDTDs"/> - <parameter name="project.version" value="${project.version}"/> - <transformation stylesheet="src/gridarta/src/doc/api/release.xslt"/> - </megaxslt> - <svn javahl="${user.svn.javahl}"> - <commit file="src/gridarta/src/doc/api/start.xhtml" message="Updating API link to include ${project.version}."/> - </svn> - <exec executable="rsync" failonerror="true"> - <arg line="-auzv -e ssh ${build.dir}/doc/api/ ${user.rsync.username}@${user.rsync.host}:${user.rsync.dir}/htdocs/api/"/> - </exec> - <sshexec host="${user.rsync.host}" username="${user.rsync.username}" keyfile="${user.ssh.keyfile}" command="rm ${user.rsync.dir}/htdocs/api/latest ; ln -s ${project.version} ${user.rsync.dir}/htdocs/api/latest"/> - <ftp server="upload.sourceforge.net" userid="anonymous" password="${developer.email}" remotedir="incoming" action="put"> - <fileset dir="${dist.dir}"/> - </ftp> - <antcall target="svnCreateBranch"/> - <antcall target="svnCreateTag"/> - <antcall target="uploadDoc"/> - </target> - - <target name="uploadDoc" description="Uploads the latest editorial documentation." depends="editorialDoc"> - <exec executable="rsync" failonerror="true"> - <arg line="-auzv-e ssh ${build.dir}/doc/ ${user.rsync.username}@${user.rsync.host}:${user.rsync.dir}/htdocs/"/> - </exec> - </target> - - <target name="announce" description="announce new version on freshmeat.net"> - <echo>Announcing. Press return to start announcing this release at - FreshMeat. - </echo> - <input/> - <freshmeat username="${user.freshmeat.username}" password="${user.freshmeat.password}"> - <printlicenses/> - <printreleasefoci/> - <publish projectname="gridarta" branchname="Default" version="${project.version}" focus="${project.focus}"> - <changes file="LatestNews"/> - <urlblock homepage="http://gridarta.sourceforge.net/" cvs="http://svn.sourceforge.net/viewcvs.cgi/gridarta/" mailinglist="http://sourceforge.net/mailarchive/forum.php?forum=gridarta-users" tgz="http://prdownloads.sourceforge.net/gridarta/gridarta-${project.version}.src.tar.gz?download" bz2="http://prdownloads.sourceforge.net/gridarta/gridarta-${project.version}.src.tar.bz2?download" zip="http://prdownloads.sourceforge.net/gridarta/gridarta-${project.version}.src.zip?download"/> - </publish> - </freshmeat> - </target> - - <target name="release" description="Releases a new version of Gridarta."> - <antcall target="clean"/> - <antcall target="releaseDist"/> - <echo>I've uploaded the distribution archives to sourceforge. Press - return when you're done configuring the new file releases on - sourceforge. I will then announce the release at FreshMeat. - </echo> - <input/> - <antcall target="announce"/> - </target> - - <target name="svnCreateBranch" description="Creates a release branch for a new major or minor revision. This target shouldn't be invoked directly." if="svnCreateBranch"> - <svn javahl="${user.svn.javahl}"> - <copy srcUrl="${svn.branch.sourceUrl}" desturl="${svn.branch.targetUrl}" message="${svn.branch.message}"/> - </svn> - </target> - - <target name="svnCreateTag" description="Creates a release tag for a new patch revision. This target shouldn't be invoked directly."> - <svn javahl="${user.svn.javahl}"> - <copy srcUrl="${svn.tag.sourceUrl}" desturl="${svn.tag.targetUrl}" message="${svn.tag.message}"/> - </svn> - </target> - - <target name="checkstyle" description="Runs checkstyle to style-check the source code"> - <taskdef resource="checkstyletask.properties" classpath="repo/checkstyle-all/5.0/checkstyle-all-5.0.jar"/> - <mkdir dir="${build.dir}/doc"/> - <checkstyle config="config/checkstyle/checkstyle.xml" failOnViolation="true"> - <formatter type="plain" tofile="${build.dir}/doc/checkstyle_report.txt"/> - <formatter type="plain"/> - <fileset dir="src/gridarta/src/main/java" includes="**/*.java"/> - <fileset dir="src/gridarta/src/test/java" includes="**/*.java"/> - <fileset dir="src/atrinik/src/main/java" includes="**/*.java"/> - <fileset dir="src/atrinik/src/test/java" includes="**/*.java"/> - <fileset dir="src/crossfire/src/main/java" includes="**/*.java"/> - <fileset dir="src/crossfire/src/test/java" includes="**/*.java"/> - <fileset dir="src/daimonin/src/main/java" includes="**/*.java"/> - <fileset dir="src/daimonin/src/test/java" includes="**/*.java"/> - <fileset dir="src/model/src/main/java" includes="**/*.java"/> - <fileset dir="src/model/src/test/java" includes="**/*.java"/> - <fileset dir="src/preferences/src/main/java" includes="**/*.java"/> - <fileset dir="src/preferences/src/test/java" includes="**/*.java"/> - <fileset dir="src/plugin/src/main/java" includes="**/*.java"/> - <fileset dir="src/plugin/src/test/java" includes="**/*.java"/> - <fileset dir="src/project/src/main/java" includes="**/*.java"/> - <fileset dir="src/project/src/test/java" includes="**/*.java"/> - <fileset dir="src/textedit/src/main/java" includes="**/*.java"/> - <fileset dir="src/textedit/src/test/java" includes="**/*.java"/> - <fileset dir="src/utils/src/main/java" includes="**/*.java"/> - <fileset dir="src/utils/src/test/java" includes="**/*.java"/> - </checkstyle> - </target> - - <target name="mailCheckstyle" description="Mails checkstyle results to the mailing list" depends="checkstyle,checkDevMail,checkDevSmtp"> - <mail from="${developer.email}" tolist="gri...@li..." mailhost="${user.mail.smtp.host}" subject="Checkstyle violation(s) in Gridarta" files="checkstyle_report.html"/> - </target> - - <target name="changelog" description="Updates the changelog"> - <exec executable="svn" output="src/gridarta/src/doc/dev/changelog.xml"> - <arg line="log -v --xml"/> - </exec> - <megaxslt srcdir="src/gridarta/src/doc/dev" destdir="src/gridarta/src/doc/dev" includes="changelog.xml" validatesource="false" validatedest="false" ending="xhtml" converttocanonical="true" transformerFactoryImplementationClassName="net.sf.saxon.TransformerFactoryImpl"> - <xmlcatalog refid="commonDTDs"/> - <transformation stylesheet="src/gridarta/src/doc/dev/changelog.xslt"/> - </megaxslt> - </target> - - <target name="javadoc" depends="init-properties" description="Creates the JavaDoc documentation for the complete editor source."> - <mkdir dir="${build.dir}/doc/dev/api"/> - <javadoc destdir="${build.dir}/doc/dev/api" locale="en_US" version="yes" author="yes" use="yes" splitindex="yes" windowtitle="Gridarta — API Documentation" doctitle="Gridarta ${build.number}<br />API Documentation" header="Gridarta ${build.number}<br />API Documentation" footer="Gridarta ${build.number}<br />API Documentation" serialwarn="no" charset="utf-8" docencoding="utf-8" source="${build.source.version}" encoding="${build.source.encoding}" linksource="yes" private="yes" overview="src/gridarta/src/main/java/overview.html" link="${user.javadoc.link}"> - <classpath> - <fileset dir="lib" includes="*.jar" excludes="*.jar-LICENSE"/> - <fileset dir="repo" includes="**/*.jar" excludes="*.jar-LICENSE"/> - </classpath> - <sourcepath> - <pathelement path="${user.javadoc.javasrc}"/> - <path refid="path.class.atrinik.test"/> - <path refid="path.class.crossfire.test"/> - <path refid="path.class.daimonin.test"/> - <path refid="path.class.gridarta.test"/> - <path refid="path.class.model.test"/> - <path refid="path.class.preferences.test"/> - <path refid="path.class.plugin.test"/> - <path refid="path.class.project.test"/> - <path refid="path.class.textedit.test"/> - <path refid="path.class.utils.test"/> - </sourcepath> - <packageset dir="src/gridarta/src/main/java" defaultexcludes="yes"/> - <packageset dir="src/gridarta/src/test/java" defaultexcludes="yes"/> - <packageset dir="src/atrinik/src/main/java" defaultexcludes="yes"/> - <packageset dir="src/atrinik/src/test/java" defaultexcludes="yes"/> - <packageset dir="src/crossfire/src/main/java" defaultexcludes="yes"/> - <packageset dir="src/crossfire/src/test/java" defaultexcludes="yes"/> - <packageset dir="src/daimonin/src/main/java" defaultexcludes="yes"/> - <packageset dir="src/daimonin/src/test/java" defaultexcludes="yes"/> - <packageset dir="src/model/src/main/java" defaultexcludes="yes"/> - <packageset dir="src/model/src/test/java" defaultexcludes="yes"/> - <packageset dir="src/preferences/src/main/java" defaultexcludes="yes"/> - <packageset dir="src/preferences/src/test/java" defaultexcludes="yes"/> - <packageset dir="src/plugin/src/main/java" defaultexcludes="yes"/> - <packageset dir="src/plugin/src/test/java" defaultexcludes="yes"/> - <packageset dir="src/project/src/main/java" defaultexcludes="yes"/> - <packageset dir="src/project/src/test/java" defaultexcludes="yes"/> - <packageset dir="src/textedit/src/main/java" defaultexcludes="yes"/> - <packageset dir="src/textedit/src/test/java" defaultexcludes="yes"/> - <packageset dir="src/utils/src/main/java" defaultexcludes="yes"/> - <packageset dir="src/utils/src/test/java" defaultexcludes="yes"/> - <bottom> - <![CDATA[<address> - <a href="http://sourceforge.net/"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=166996&type=1" alt="SourceForge.net Logo" width="88" height="31" class="now" /></a> - <a href="http://sourceforge.net/donate/index.php?group_id=166996"><img src="http://sourceforge.net/images/project-support.jpg" width="88" height="32" alt="Support This Project" class="now" /></a> - <a href="http://freshmeat.net/projects/g... [truncated message content] |
From: <aki...@us...> - 2014-03-09 11:18:44
|
Revision: 9687 http://sourceforge.net/p/gridarta/code/9687 Author: akirschbaum Date: 2014-03-09 11:18:38 +0000 (Sun, 09 Mar 2014) Log Message: ----------- Remove unused library jdom-1.0.jar. Modified Paths: -------------- trunk/gridarta.ipr trunk/src/atrinik/build.gradle trunk/src/crossfire/build.gradle trunk/src/crossfire/crossfire.iml trunk/src/daimonin/build.gradle trunk/src/gridarta/gridarta.iml trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages.properties trunk/src/model/build.gradle trunk/src/model/model.iml trunk/src/plugin/plugin.iml Removed Paths: ------------- trunk/repo/jdom/ Modified: trunk/gridarta.ipr =================================================================== --- trunk/gridarta.ipr 2014-03-09 10:48:51 UTC (rev 9686) +++ trunk/gridarta.ipr 2014-03-09 11:18:38 UTC (rev 9687) @@ -1752,7 +1752,6 @@ <w>javasrc</w> <w>javax</w> <w>jcity</w> - <w>jdom</w> <w>jessies</w> <w>jlfgr</w> <w>jloc</w> @@ -2391,13 +2390,6 @@ <JAVADOC /> <SOURCES /> </library> - <library name="jdom"> - <CLASSES> - <root url="jar://$PROJECT_DIR$/repo/jdom/1.0/jdom-1.0.jar!/" /> - </CLASSES> - <JAVADOC /> - <SOURCES /> - </library> <library name="junit"> <CLASSES> <root url="jar://$PROJECT_DIR$/repo/junit/4.2/junit-4.2.jar!/" /> Modified: trunk/src/atrinik/build.gradle =================================================================== --- trunk/src/atrinik/build.gradle 2014-03-09 10:48:51 UTC (rev 9686) +++ trunk/src/atrinik/build.gradle 2014-03-09 11:18:38 UTC (rev 9687) @@ -35,6 +35,7 @@ from new File(rootDir, 'repo/jlfgr/1.0/jlfgr-1.0.jar-LICENSE') from new File(rootDir, 'repo/log4j/1.2.13/log4j-1.2.13.jar-LICENSE') from new File(rootDir, 'repo/rsyntaxtextarea/1.5.1/rsyntaxtextarea-1.5.1.jar-LICENSE') + from new File(rootDir, 'repo/xom/1.2.10/xom-1.2.10.jar-LICENSE') inputs.files configurations.runtime doFirst { // The following must be executed in doFirst since the configuration Modified: trunk/src/crossfire/build.gradle =================================================================== --- trunk/src/crossfire/build.gradle 2014-03-09 10:48:51 UTC (rev 9686) +++ trunk/src/crossfire/build.gradle 2014-03-09 11:18:38 UTC (rev 9687) @@ -31,10 +31,10 @@ from new File(rootDir, 'repo/bsh/bsh-LICENSE') from new File(rootDir, 'repo/japi-lib/japi-lib.jar-LICENSE') from new File(rootDir, 'repo/java-getopt/1.0.13/java-getopt-1.0.13.jar-LICENSE') - from new File(rootDir, 'repo/jdom/1.0/jdom-1.0.jar-LICENSE') from new File(rootDir, 'repo/jlfgr/1.0/jlfgr-1.0.jar-LICENSE') from new File(rootDir, 'repo/log4j/1.2.13/log4j-1.2.13.jar-LICENSE') from new File(rootDir, 'repo/rsyntaxtextarea/1.5.1/rsyntaxtextarea-1.5.1.jar-LICENSE') + from new File(rootDir, 'repo/xom/1.2.10/xom-1.2.10.jar-LICENSE') inputs.files configurations.runtime doFirst { // The following must be executed in doFirst since the configuration Modified: trunk/src/crossfire/crossfire.iml =================================================================== --- trunk/src/crossfire/crossfire.iml 2014-03-09 10:48:51 UTC (rev 9686) +++ trunk/src/crossfire/crossfire.iml 2014-03-09 11:18:38 UTC (rev 9687) @@ -27,7 +27,6 @@ <orderEntry type="library" name="japi-lib-swing-tod" level="project" /> <orderEntry type="library" name="japi-lib-util" level="project" /> <orderEntry type="library" name="java-getopt" level="project" /> - <orderEntry type="library" name="jdom" level="project" /> <orderEntry type="library" name="junit" level="project" /> <orderEntry type="library" name="log4j" level="project" /> </component> Modified: trunk/src/daimonin/build.gradle =================================================================== --- trunk/src/daimonin/build.gradle 2014-03-09 10:48:51 UTC (rev 9686) +++ trunk/src/daimonin/build.gradle 2014-03-09 11:18:38 UTC (rev 9687) @@ -35,6 +35,7 @@ from new File(rootDir, 'repo/jlfgr/1.0/jlfgr-1.0.jar-LICENSE') from new File(rootDir, 'repo/log4j/1.2.13/log4j-1.2.13.jar-LICENSE') from new File(rootDir, 'repo/rsyntaxtextarea/1.5.1/rsyntaxtextarea-1.5.1.jar-LICENSE') + from new File(rootDir, 'repo/xom/1.2.10/xom-1.2.10.jar-LICENSE') inputs.files configurations.runtime doFirst { // The following must be executed in doFirst since the configuration Modified: trunk/src/gridarta/gridarta.iml =================================================================== --- trunk/src/gridarta/gridarta.iml 2014-03-09 10:48:51 UTC (rev 9686) +++ trunk/src/gridarta/gridarta.iml 2014-03-09 11:18:38 UTC (rev 9687) @@ -30,7 +30,6 @@ <orderEntry type="library" name="japi-lib-swing-tod" level="project" /> <orderEntry type="library" name="japi-lib-util" level="project" /> <orderEntry type="library" name="japi-lib-xml" level="project" /> - <orderEntry type="library" name="jdom" level="project" /> <orderEntry type="library" name="junit" level="project" /> <orderEntry type="library" name="log4j" level="project" /> <orderEntry type="library" name="rsyntaxtextarea" level="project" /> Modified: trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages.properties 2014-03-09 10:48:51 UTC (rev 9686) +++ trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages.properties 2014-03-09 11:18:38 UTC (rev 9687) @@ -982,8 +982,8 @@ license.4.file=bsh-LICENSE license.5.title=Log4J license.5.file=log4j-1.2.13.jar-LICENSE -license.6.title=JDOM -license.6.file=jdom-1.0.jar-LICENSE +license.6.title=XOM +license.6.file=xom-1.2.10.jar-LICENSE license.7.title=GNU getopt license.7.file=java-getopt-1.0.13.jar-LICENSE license.8.title=RSyntaxTextArea Modified: trunk/src/model/build.gradle =================================================================== --- trunk/src/model/build.gradle 2014-03-09 10:48:51 UTC (rev 9686) +++ trunk/src/model/build.gradle 2014-03-09 11:18:38 UTC (rev 9687) @@ -7,7 +7,6 @@ dependencies { compile name: 'annotations', version: '0.0' compile name: 'japi-lib-swing-misc', version: 'trunk-1398', group: 'japi-lib' - compile name: 'jdom', version: '1.0' compile name: 'log4j', version: '1.2.13' compile name: 'xom', version: '1.2.10' compile project(':src:utils') Modified: trunk/src/model/model.iml =================================================================== --- trunk/src/model/model.iml 2014-03-09 10:48:51 UTC (rev 9686) +++ trunk/src/model/model.iml 2014-03-09 11:18:38 UTC (rev 9687) @@ -17,7 +17,6 @@ <orderEntry type="library" name="japi-lib-swing-misc" level="project" /> <orderEntry type="library" name="japi-lib-util" level="project" /> <orderEntry type="library" name="japi-lib-xml" level="project" /> - <orderEntry type="library" name="jdom" level="project" /> <orderEntry type="library" name="junit" level="project" /> <orderEntry type="library" name="log4j" level="project" /> <orderEntry type="library" name="xom" level="project" /> Modified: trunk/src/plugin/plugin.iml =================================================================== --- trunk/src/plugin/plugin.iml 2014-03-09 10:48:51 UTC (rev 9686) +++ trunk/src/plugin/plugin.iml 2014-03-09 11:18:38 UTC (rev 9687) @@ -16,7 +16,6 @@ <orderEntry type="library" name="annotations" level="project" /> <orderEntry type="library" name="bsh-core" level="project" /> <orderEntry type="library" name="bsh-util" level="project" /> - <orderEntry type="library" name="jdom" level="project" /> <orderEntry type="library" name="junit" level="project" /> <orderEntry type="library" name="log4j" level="project" /> <orderEntry type="library" name="xom" level="project" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-03-09 10:48:57
|
Revision: 9686 http://sourceforge.net/p/gridarta/code/9686 Author: akirschbaum Date: 2014-03-09 10:48:51 +0000 (Sun, 09 Mar 2014) Log Message: ----------- Rewrite parser for editor plugins. Modified Paths: -------------- trunk/src/model/src/main/java/net/sf/gridarta/model/filter/FilterParser.java trunk/src/plugin/build.gradle trunk/src/plugin/plugin.iml trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/Plugin.java trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/PluginModel.java trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/PluginModelLoader.java trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/PluginModelParser.java trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/PluginParameterCodec.java trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/PluginParameterFactory.java trunk/src/plugin/src/test/java/net/sf/gridarta/plugin/parameter/PluginParameterCodecTest.java Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/filter/FilterParser.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/filter/FilterParser.java 2014-03-09 01:37:47 UTC (rev 9685) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/filter/FilterParser.java 2014-03-09 10:48:51 UTC (rev 9686) @@ -20,8 +20,11 @@ package net.sf.gridarta.model.filter; import java.util.Map.Entry; -import org.jdom.Content; -import org.jdom.Element; +import net.sf.gridarta.utils.XmlUtils; +import net.sf.gridarta.utils.xml.ElementsIterable; +import nu.xom.Element; +import nu.xom.Elements; +import nu.xom.ParentNode; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -49,21 +52,21 @@ public void visit(@NotNull final NamedFilterConfig filterConfig) { final Element result = new Element("value"); final Element enabled = new Element("enabled"); - enabled.addContent(Boolean.toString(filterConfig.isEnabled())); - result.addContent(enabled); + enabled.appendChild(Boolean.toString(filterConfig.isEnabled())); + result.appendChild(enabled); final Element inverted = new Element("inverted"); - inverted.addContent(Boolean.toString(filterConfig.isInverted())); - result.addContent(inverted); + inverted.appendChild(Boolean.toString(filterConfig.isInverted())); + result.appendChild(inverted); for (final Entry<String, FilterConfig<?, ?>> entry : filterConfig.getEntries().entrySet()) { final String key = entry.getKey(); final FilterConfig<?, ?> subFilterConfig = entry.getValue(); - final Content filterValue = toXML(subFilterConfig); - final Element subFilter = new Element("subfilter"); + final Element filterValue = toXML(subFilterConfig); + final ParentNode subFilter = new Element("subfilter"); final Element fName = new Element("name"); - fName.addContent(key); - subFilter.addContent(fName); - subFilter.addContent(filterValue); - result.addContent(subFilter); + fName.appendChild(key); + subFilter.appendChild(fName); + subFilter.appendChild(filterValue); + result.appendChild(subFilter); } element = result; } @@ -72,12 +75,12 @@ public void visit(@NotNull final NamedGameObjectMatcherFilterConfig filterConfig) { final Element value = new Element("value"); final Element enabled = new Element("enabled"); - enabled.addContent(Boolean.toString(filterConfig.isEnabled())); - value.addContent(enabled); + enabled.appendChild(Boolean.toString(filterConfig.isEnabled())); + value.appendChild(enabled); for (final String key : filterConfig.getProperties()) { final Element property = new Element("property"); - property.addContent(filterConfig.getProperty(key)); - value.addContent(property); + property.appendChild(filterConfig.getProperty(key)); + value.appendChild(property); } element = value; } @@ -98,19 +101,17 @@ return; } - final Element value = element.getChild("value"); - if (value == null) { + final Elements valueElements = element.getChildElements("value"); + if (valueElements.size() == 0) { return; } + final Element value = valueElements.get(0); - final boolean enabled = Boolean.valueOf(value.getChildTextTrim("enabled")); + final boolean enabled = Boolean.valueOf(XmlUtils.getChild(value, "enabled").getValue().trim()); filterConfig.setEnabled(enabled); - filterConfig.setInverted(Boolean.valueOf(value.getChildTextTrim("inverted"))); - //Element does not use type parameters - @SuppressWarnings("unchecked") - final Iterable<Element> it = (Iterable<Element>) value.getChildren("subfilter"); - for (final Element filterElement : it) { - final String name = filterElement.getChildTextTrim("name"); + filterConfig.setInverted(Boolean.valueOf(XmlUtils.getChild(value, "inverted").getValue().trim())); + for (final Element filterElement : new ElementsIterable(value.getChildElements("subfilter"))) { + final String name = XmlUtils.getChild(filterElement, "name").getValue().trim(); final FilterConfig<?, ?> subFilterConfig = filterConfig.getConfig(name); fromXML(filterElement, subFilterConfig); } @@ -122,19 +123,17 @@ return; } - final Element value = element.getChild("value"); - if (value == null) { + final Elements valueElements = element.getChildElements("value"); + if (valueElements.size() == 0) { return; } + final Element value = valueElements.get(0); - final boolean enabled = Boolean.valueOf(value.getChildTextTrim("enabled")); + final boolean enabled = Boolean.valueOf(XmlUtils.getChild(value, "enabled").getValue().trim()); filterConfig.setEnabled(enabled); - //Element does not use type parameters - @SuppressWarnings("unchecked") - final Iterable<Element> properties = (Iterable<Element>) value.getChildren("property"); - for (final Element property : properties) { - final String pName = property.getChildTextTrim("name"); - final String pValue = property.getChildTextTrim("value"); + for (final Element property : new ElementsIterable(value.getChildElements("property"))) { + final String pName = XmlUtils.getChild(property, "name").getValue().trim(); + final String pValue = XmlUtils.getChild(property, "value").getValue().trim(); filterConfig.setProperty(pName, pValue); } } @@ -147,7 +146,7 @@ * @return the exported settings */ @NotNull - public Content toXML(@NotNull final FilterConfig<?, ?> filterConfig) { + public Element toXML(@NotNull final FilterConfig<?, ?> filterConfig) { final Element prevElement = element; try { element = null; Modified: trunk/src/plugin/build.gradle =================================================================== --- trunk/src/plugin/build.gradle 2014-03-09 01:37:47 UTC (rev 9685) +++ trunk/src/plugin/build.gradle 2014-03-09 10:48:51 UTC (rev 9686) @@ -7,6 +7,7 @@ compile name: 'bsh-core', version: '2.0b4', group: 'bsh' compile name: 'bsh-util', version: '2.0b4', group: 'bsh' compile name: 'log4j', version: '1.2.13' + compile name: 'xom', version: '1.2.10' compile project(':src:model') testCompile name: 'junit', version: '4.2' testCompile project(':src:model').sourceSets.test.output Modified: trunk/src/plugin/plugin.iml =================================================================== --- trunk/src/plugin/plugin.iml 2014-03-09 01:37:47 UTC (rev 9685) +++ trunk/src/plugin/plugin.iml 2014-03-09 10:48:51 UTC (rev 9686) @@ -19,6 +19,7 @@ <orderEntry type="library" name="jdom" level="project" /> <orderEntry type="library" name="junit" level="project" /> <orderEntry type="library" name="log4j" level="project" /> + <orderEntry type="library" name="xom" level="project" /> </component> </module> Modified: trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/Plugin.java =================================================================== --- trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/Plugin.java 2014-03-09 01:37:47 UTC (rev 9685) +++ trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/Plugin.java 2014-03-09 10:48:51 UTC (rev 9686) @@ -37,10 +37,9 @@ import net.sf.gridarta.plugin.parameter.PluginParameterListener; import net.sf.gridarta.plugin.parameter.StringParameter; import net.sf.gridarta.utils.EventListenerList2; +import nu.xom.Element; import org.apache.log4j.Category; import org.apache.log4j.Logger; -import org.jdom.Content; -import org.jdom.Element; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -476,7 +475,7 @@ * @return the plugin parameter in XML representation */ @NotNull - public Content toXML(@NotNull final PluginParameter<G, A, R, ?> pluginParameter) { + public Element toXML(@NotNull final PluginParameter<G, A, R, ?> pluginParameter) { return codec.toXML(pluginParameter); } Modified: trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/PluginModel.java =================================================================== --- trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/PluginModel.java 2014-03-09 01:37:47 UTC (rev 9685) +++ trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/PluginModel.java 2014-03-09 10:48:51 UTC (rev 9686) @@ -31,15 +31,15 @@ import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.plugin.parameter.PluginParameterFactory; import net.sf.gridarta.utils.EventListenerList2; +import nu.xom.Document; +import nu.xom.Element; +import nu.xom.ParsingException; +import nu.xom.Serializer; import org.apache.log4j.Category; import org.apache.log4j.Logger; -import org.jdom.Document; -import org.jdom.Element; -import org.jdom.JDOMException; -import org.jdom.output.Format; -import org.jdom.output.XMLOutputter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import org.xml.sax.SAXException; /** * @author tchize @@ -116,8 +116,10 @@ addPlugin(PluginModelLoader.loadXML(pluginModelParser, file)); } catch (final IOException ex) { LOG.warn("can't load plugin: " + ex.getMessage()); - } catch (final JDOMException ex) { + } catch (final ParsingException ex) { LOG.warn("can't parse plugin: " + ex.getMessage()); + } catch (final SAXException ex) { + LOG.warn("can't parse plugin: " + ex.getMessage()); } } @@ -142,9 +144,9 @@ try { final Element root = pluginModelParser.toXML(plugin); final Document d = new Document(root); - final XMLOutputter out = new XMLOutputter(); - out.setFormat(Format.getPrettyFormat()); - out.output(d, fos); + final Serializer serializer = new Serializer(fos, "UTF-8"); + serializer.setIndent(2); + serializer.write(d); } finally { fos.close(); } Modified: trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/PluginModelLoader.java =================================================================== --- trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/PluginModelLoader.java 2014-03-09 01:37:47 UTC (rev 9685) +++ trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/PluginModelLoader.java 2014-03-09 10:48:51 UTC (rev 9686) @@ -27,14 +27,17 @@ import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.plugin.parameter.PluginParameterFactory; +import nu.xom.Builder; +import nu.xom.Document; +import nu.xom.Element; +import nu.xom.ParsingException; import org.apache.log4j.Category; import org.apache.log4j.Logger; -import org.jdom.Document; -import org.jdom.Element; -import org.jdom.JDOMException; -import org.jdom.input.SAXBuilder; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import org.xml.sax.SAXException; +import org.xml.sax.XMLReader; +import org.xml.sax.helpers.XMLReaderFactory; /** * Utility class for loading plugins. @@ -86,8 +89,10 @@ } } catch (final IOException ex) { errorView.addWarning(ErrorViewCategory.SCRIPTS_FILE_INVALID, pluginFile + ": " + ex.getMessage()); - } catch (final JDOMException ex) { + } catch (final ParsingException ex) { errorView.addWarning(ErrorViewCategory.SCRIPTS_FILE_INVALID, pluginFile + ": " + ex.getMessage()); + } catch (final SAXException ex) { + errorView.addWarning(ErrorViewCategory.SCRIPTS_FILE_INVALID, pluginFile + ": " + ex.getMessage()); } } } @@ -97,20 +102,20 @@ return pluginModel; } - public static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> Plugin<G, A, R> loadXML(@NotNull final PluginModelParser<G, A, R> pluginModelParser, @NotNull final File file) throws IOException, JDOMException { - final SAXBuilder builder = new SAXBuilder(false); /*non validating*/ + public static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> Plugin<G, A, R> loadXML(@NotNull final PluginModelParser<G, A, R> pluginModelParser, @NotNull final File file) throws IOException, ParsingException, SAXException { + final XMLReader xmlReader = XMLReaderFactory.createXMLReader(); + final Builder builder = new Builder(xmlReader, false); final Document d = builder.build(file); return loadXML(pluginModelParser, d, file); } @NotNull private static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> Plugin<G, A, R> loadXML(@NotNull final PluginModelParser<G, A, R> pluginModelParser, @NotNull final Document doc, @Nullable final File file) throws IOException { - if (!doc.hasRootElement()) { + final Element elt = doc.getRootElement(); + if (elt == null) { throw new IOException("plugin file is empty"); } - - final Element elt = doc.getRootElement(); - if (!elt.getName().equalsIgnoreCase("script")) { + if (!elt.getLocalName().equalsIgnoreCase("script")) { throw new IOException("missing root element named \"script\""); } Modified: trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/PluginModelParser.java =================================================================== --- trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/PluginModelParser.java 2014-03-09 01:37:47 UTC (rev 9685) +++ trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/PluginModelParser.java 2014-03-09 10:48:51 UTC (rev 9686) @@ -19,18 +19,21 @@ package net.sf.gridarta.plugin; -import java.util.Collection; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.plugin.parameter.NoSuchParameterException; import net.sf.gridarta.plugin.parameter.PluginParameter; import net.sf.gridarta.plugin.parameter.PluginParameterFactory; +import net.sf.gridarta.utils.XmlUtils; +import net.sf.gridarta.utils.xml.ElementsIterable; +import nu.xom.Attribute; +import nu.xom.Element; +import nu.xom.Elements; +import nu.xom.ParentNode; +import nu.xom.Text; import org.apache.log4j.Category; import org.apache.log4j.Logger; -import org.jdom.CDATA; -import org.jdom.Element; -import org.jdom.IllegalDataException; import org.jetbrains.annotations.NotNull; /** @@ -85,26 +88,23 @@ */ @NotNull public Plugin<G, A, R> fromXML(@NotNull final Element node) { - final Plugin<G, A, R> pluginModel = new Plugin<G, A, R>(node.getChildTextTrim("name"), pluginParameterFactory); - pluginModel.setCode(node.getChildTextTrim("code")); + final Plugin<G, A, R> pluginModel = new Plugin<G, A, R>(XmlUtils.getChild(node, "name").getValue().trim(), pluginParameterFactory); + pluginModel.setCode(XmlUtils.getChild(node, "code").getValue().trim()); boolean isAutoBoot = false; boolean isFilter = false; boolean isScript = false; - final Element mode = node.getChild("mode"); - if (mode == null) { + final Elements modeElements = node.getChildElements("mode"); + if (modeElements.size() == 0) { isScript = true; } else { - //Element does not use type parameters - @SuppressWarnings("unchecked") - final Iterable<Element> modes = mode.getChildren(); - for (final Element modeChild : modes) { - final boolean value = Boolean.valueOf(modeChild.getTextTrim()); - final String name = modeChild.getName(); - if (AUTO_BOOT.equalsIgnoreCase(name) && value) { + for (final Element modeChild : new ElementsIterable(modeElements.get(0).getChildElements())) { + final boolean value = Boolean.valueOf(modeChild.getValue()); + final String name = modeChild.getLocalName(); + if (name.equalsIgnoreCase(AUTO_BOOT) && value) { isAutoBoot = true; - } else if (FILTER.equalsIgnoreCase(name) && value) { + } else if (name.equalsIgnoreCase(FILTER) && value) { isFilter = true; - } else if (BASH.equalsIgnoreCase(name) && value) { + } else if (name.equalsIgnoreCase(BASH) && value) { isScript = true; } } @@ -112,20 +112,15 @@ pluginModel.setAutoBoot(isAutoBoot); pluginModel.setFilter(isFilter); pluginModel.setScript(isScript); - //Element does not use type parameters - @SuppressWarnings("unchecked") - final Collection<Element> parameters = node.getChildren("parameter"); - if (parameters != null && !parameters.isEmpty()) { - for (final Element parameter : parameters) { - PluginParameter<G, A, R, ?> pluginParameter; - try { - pluginParameter = pluginParameterFactory.createParameter(parameter); - } catch (final NoSuchParameterException ex) { - LOG.warn("Parameter type " + ex.getMessage() + " in plugin " + pluginModel + " is unknown"); - pluginParameter = pluginParameterFactory.createStringParameter(parameter); - } - pluginModel.addParameter(pluginParameter); + for (final Element parameter : new ElementsIterable(node.getChildElements("parameter"))) { + PluginParameter<G, A, R, ?> pluginParameter; + try { + pluginParameter = pluginParameterFactory.createParameter(parameter); + } catch (final NoSuchParameterException ex) { + LOG.warn("Parameter type " + ex.getMessage() + " in plugin " + pluginModel + " is unknown"); + pluginParameter = pluginParameterFactory.createStringParameter(parameter); } + pluginModel.addParameter(pluginParameter); } pluginModel.resetModified(); return pluginModel; @@ -141,30 +136,26 @@ final Element root = new Element("script"); final Element name = new Element("name"); final Element code = new Element("code"); - name.addContent(plugin.getName()); - try { - code.addContent(new CDATA(plugin.getCode())); // protect code in xml! - } catch (final IllegalDataException ignored) { - //can't be converted to CDATA :( - code.addContent(plugin.getCode()); - } - root.addContent(name); - root.addContent(code); - final Element modes = new Element("mode"); + name.appendChild(plugin.getName()); + code.appendChild(new Text(plugin.getCode())); + code.addAttribute(new Attribute("xml:space", "http://www.w3.org/XML/1998/namespace", "preserve")); + root.appendChild(name); + root.appendChild(code); + final ParentNode modes = new Element("mode"); final Element autoBoot = new Element(AUTO_BOOT); - autoBoot.addContent(Boolean.toString(plugin.isAutoBoot())); + autoBoot.appendChild(Boolean.toString(plugin.isAutoBoot())); final Element bash = new Element(BASH); - bash.addContent(Boolean.toString(plugin.isScript())); + bash.appendChild(Boolean.toString(plugin.isScript())); final Element filter = new Element(FILTER); - filter.addContent(Boolean.toString(plugin.isFilter())); - modes.addContent(autoBoot); - modes.addContent(bash); - modes.addContent(filter); + filter.appendChild(Boolean.toString(plugin.isFilter())); + modes.appendChild(autoBoot); + modes.appendChild(bash); + modes.appendChild(filter); - root.addContent(modes); + root.appendChild(modes); for (final PluginParameter<G, A, R, ?> pluginParameter : plugin) { - root.addContent(plugin.toXML(pluginParameter)); + root.appendChild(plugin.toXML(pluginParameter)); } return root; } Modified: trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/PluginParameterCodec.java =================================================================== --- trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/PluginParameterCodec.java 2014-03-09 01:37:47 UTC (rev 9685) +++ trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/PluginParameterCodec.java 2014-03-09 10:48:51 UTC (rev 9686) @@ -22,7 +22,8 @@ import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; -import org.jdom.Element; +import net.sf.gridarta.utils.XmlUtils; +import nu.xom.Element; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -50,12 +51,12 @@ final Element n = new Element("name"); final Element d = new Element("description"); final Element t = new Element("type"); - n.addContent(parameter.getName()); - d.addContent(parameter.getDescription()); - t.addContent(parameter.getParameterType()); - e.addContent(n); - e.addContent(d); - e.addContent(t); + n.appendChild(parameter.getName()); + d.appendChild(parameter.getDescription()); + t.appendChild(parameter.getParameterType()); + e.appendChild(n); + e.appendChild(d); + e.appendChild(t); return e; } @@ -64,8 +65,8 @@ public Element visit(@NotNull final ArchetypeParameter<G, A, R> parameter) { final Element e = toXML(parameter); final Element v = new Element("value"); - v.addContent(parameter.getStringValue()); - e.addContent(v); + v.appendChild(parameter.getStringValue()); + e.appendChild(v); return e; } @@ -74,14 +75,14 @@ public Element visit(@NotNull final BooleanParameter<G, A, R> parameter) { final Element e = toXML(parameter); final Element v = new Element("value"); - v.addContent(parameter.getStringValue()); - e.addContent(v); + v.appendChild(parameter.getStringValue()); + e.appendChild(v); final Element yes = new Element("trueText"); - yes.addContent(parameter.getTrueText()); + yes.appendChild(parameter.getTrueText()); final Element no = new Element("falseText"); - no.addContent(parameter.getFalseText()); - e.addContent(yes); - e.addContent(no); + no.appendChild(parameter.getFalseText()); + e.appendChild(yes); + e.appendChild(no); return e; } @@ -90,14 +91,14 @@ public Element visit(@NotNull final DoubleParameter<G, A, R> parameter) { final Element e = toXML(parameter); final Element v = new Element("value"); - v.addContent(parameter.getStringValue()); - e.addContent(v); + v.appendChild(parameter.getStringValue()); + e.appendChild(v); final Element min = new Element("minimum"); final Element max = new Element("maximum"); - min.addContent(Double.toString(parameter.getMin())); - max.addContent(Double.toString(parameter.getMax())); - e.addContent(min); - e.addContent(max); + min.appendChild(Double.toString(parameter.getMin())); + max.appendChild(Double.toString(parameter.getMax())); + e.appendChild(min); + e.appendChild(max); return e; } @@ -106,14 +107,14 @@ public Element visit(@NotNull final IntegerParameter<G, A, R> parameter) { final Element e = toXML(parameter); final Element v = new Element("value"); - v.addContent(parameter.getStringValue()); - e.addContent(v); + v.appendChild(parameter.getStringValue()); + e.appendChild(v); final Element min = new Element("minimum"); final Element max = new Element("maximum"); - min.addContent(Integer.toString(parameter.getMin())); - max.addContent(Integer.toString(parameter.getMax())); - e.addContent(min); - e.addContent(max); + min.appendChild(Integer.toString(parameter.getMin())); + max.appendChild(Integer.toString(parameter.getMax())); + e.appendChild(min); + e.appendChild(max); return e; } @@ -122,8 +123,8 @@ public Element visit(@NotNull final MapParameter<G, A, R> parameter) { final Element e = toXML(parameter); final Element v = new Element("value"); - v.addContent(parameter.isCurrentMap() ? "" : parameter.getStringValue()); - e.addContent(v); + v.appendChild(parameter.isCurrentMap() ? "" : parameter.getStringValue()); + e.appendChild(v); return e; } @@ -132,8 +133,8 @@ public Element visit(@NotNull final MapPathParameter<G, A, R> parameter) { final Element e = toXML(parameter); final Element s = new Element("value"); - s.addContent(parameter.getStringValue()); - e.addContent(s); + s.appendChild(parameter.getStringValue()); + e.appendChild(s); return e; } @@ -142,8 +143,8 @@ public Element visit(@NotNull final StringParameter<G, A, R> parameter) { final Element e = toXML(parameter); final Element s = new Element("value"); - s.addContent(parameter.getStringValue()); - e.addContent(s); + s.appendChild(parameter.getStringValue()); + e.appendChild(s); return e; } @@ -211,7 +212,7 @@ parameter.setMax(Integer.parseInt(getChildText("maximum", Integer.toString(Integer.MAX_VALUE)))); } catch (final NumberFormatException ignored) { } - parameter.setStringValue(e.getChildTextTrim("value")); + parameter.setStringValue(XmlUtils.getChild(e, "value").getValue().trim()); return parameter; } @@ -277,7 +278,7 @@ @NotNull private String getChildText(@NotNull final String key, @NotNull final String defaultValue) { assert e != null; - final String value = e.getChildTextTrim(key); + final String value = XmlUtils.getChild(e, key).getValue().trim(); return value == null ? defaultValue : value; } Modified: trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/PluginParameterFactory.java =================================================================== --- trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/PluginParameterFactory.java 2014-03-09 01:37:47 UTC (rev 9685) +++ trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/PluginParameterFactory.java 2014-03-09 10:48:51 UTC (rev 9686) @@ -26,7 +26,8 @@ import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.mapmanager.MapManager; import net.sf.gridarta.model.settings.ProjectSettings; -import org.jdom.Element; +import net.sf.gridarta.utils.XmlUtils; +import nu.xom.Element; import org.jetbrains.annotations.NotNull; /** @@ -70,7 +71,7 @@ @NotNull public PluginParameter<G, A, R, ?> createParameter(@NotNull final Element parameterNode) throws NoSuchParameterException { - return createParameter(parameterNode.getChildText("type"), parameterNode); + return createParameter(XmlUtils.getChild(parameterNode, "type").getValue(), parameterNode); } /** Modified: trunk/src/plugin/src/test/java/net/sf/gridarta/plugin/parameter/PluginParameterCodecTest.java =================================================================== --- trunk/src/plugin/src/test/java/net/sf/gridarta/plugin/parameter/PluginParameterCodecTest.java 2014-03-09 01:37:47 UTC (rev 9685) +++ trunk/src/plugin/src/test/java/net/sf/gridarta/plugin/parameter/PluginParameterCodecTest.java 2014-03-09 10:48:51 UTC (rev 9686) @@ -19,11 +19,10 @@ package net.sf.gridarta.plugin.parameter; +import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.io.StringReader; -import java.io.StringWriter; -import java.io.Writer; import net.sf.gridarta.model.archetype.TestArchetype; import net.sf.gridarta.model.gameobject.TestGameObject; import net.sf.gridarta.model.io.PathManager; @@ -35,16 +34,18 @@ import net.sf.gridarta.model.settings.ProjectSettings; import net.sf.gridarta.model.settings.TestProjectSettings; import net.sf.gridarta.utils.Size2D; -import org.jdom.Document; -import org.jdom.Element; -import org.jdom.JDOMException; -import org.jdom.input.SAXBuilder; -import org.jdom.output.Format; -import org.jdom.output.XMLOutputter; +import nu.xom.Builder; +import nu.xom.Document; +import nu.xom.Element; +import nu.xom.ParsingException; +import nu.xom.Serializer; import org.jetbrains.annotations.NotNull; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; +import org.xml.sax.SAXException; +import org.xml.sax.XMLReader; +import org.xml.sax.helpers.XMLReaderFactory; /** * Regression tests for {@link PluginParameterCodec}. @@ -66,9 +67,8 @@ sb.append(" <name>[name]</name>\r\n"); sb.append(" <description>[description]</description>\r\n"); sb.append(" <type>net.sf.gridarta.model.archetype.Archetype</type>\r\n"); - sb.append(" <value />\r\n"); + sb.append(" <value/>\r\n"); sb.append("</parameter>\r\n"); - sb.append("\r\n"); Assert.assertEquals(sb.toString(), toXML(parameter)); } @@ -89,7 +89,6 @@ sb.append(" <type>net.sf.gridarta.model.archetype.Archetype</type>\r\n"); sb.append(" <value>undefined_archetype</value>\r\n"); sb.append("</parameter>\r\n"); - sb.append("\r\n"); Assert.assertEquals(sb.toString(), toXML(parameter)); } @@ -111,7 +110,6 @@ sb.append(" <type>net.sf.gridarta.model.archetype.Archetype</type>\r\n"); sb.append(" <value>existing_archetype</value>\r\n"); sb.append("</parameter>\r\n"); - sb.append("\r\n"); Assert.assertEquals(sb.toString(), toXML(parameter)); } @@ -134,7 +132,6 @@ sb.append(" <trueText>Yes</trueText>\r\n"); sb.append(" <falseText>No</falseText>\r\n"); sb.append("</parameter>\r\n"); - sb.append("\r\n"); Assert.assertEquals(sb.toString(), toXML(parameter)); } @@ -158,7 +155,6 @@ sb.append(" <trueText>true-text</trueText>\r\n"); sb.append(" <falseText>false-text</falseText>\r\n"); sb.append("</parameter>\r\n"); - sb.append("\r\n"); Assert.assertEquals(sb.toString(), toXML(parameter)); } @@ -181,7 +177,6 @@ sb.append(" <minimum>0.0</minimum>\r\n"); sb.append(" <maximum>1.0</maximum>\r\n"); sb.append("</parameter>\r\n"); - sb.append("\r\n"); Assert.assertEquals(sb.toString(), toXML(parameter)); } @@ -205,7 +200,6 @@ sb.append(" <minimum>-123.456</minimum>\r\n"); sb.append(" <maximum>234.0</maximum>\r\n"); sb.append("</parameter>\r\n"); - sb.append("\r\n"); Assert.assertEquals(sb.toString(), toXML(parameter)); } @@ -228,7 +222,6 @@ sb.append(" <minimum>-2147483648</minimum>\r\n"); sb.append(" <maximum>2147483647</maximum>\r\n"); sb.append("</parameter>\r\n"); - sb.append("\r\n"); Assert.assertEquals(sb.toString(), toXML(parameter)); } @@ -252,7 +245,6 @@ sb.append(" <minimum>-123</minimum>\r\n"); sb.append(" <maximum>234</maximum>\r\n"); sb.append("</parameter>\r\n"); - sb.append("\r\n"); Assert.assertEquals(sb.toString(), toXML(parameter)); } @@ -272,9 +264,8 @@ sb.append(" <name>Name</name>\r\n"); sb.append(" <description>Description</description>\r\n"); sb.append(" <type>net.sf.gridarta.model.mapcontrol.MapControl</type>\r\n"); - sb.append(" <value />\r\n"); + sb.append(" <value/>\r\n"); sb.append("</parameter>\r\n"); - sb.append("\r\n"); Assert.assertEquals(sb.toString(), toXML(parameter)); } @@ -293,9 +284,8 @@ sb.append(" <name>[name]</name>\r\n"); sb.append(" <description>[description]</description>\r\n"); sb.append(" <type>net.sf.gridarta.model.mapcontrol.MapControl</type>\r\n"); - sb.append(" <value />\r\n"); + sb.append(" <value/>\r\n"); sb.append("</parameter>\r\n"); - sb.append("\r\n"); Assert.assertEquals(sb.toString(), toXML(parameter)); } @@ -319,7 +309,6 @@ sb.append(" <type>net.sf.gridarta.model.mapcontrol.MapControl</type>\r\n"); sb.append(" <value>/path/to/map</value>\r\n"); sb.append("</parameter>\r\n"); - sb.append("\r\n"); Assert.assertEquals(sb.toString(), toXML(parameter)); } @@ -340,9 +329,8 @@ sb.append(" <name>Name</name>\r\n"); sb.append(" <description>Description</description>\r\n"); sb.append(" <type>MapPathParameter</type>\r\n"); - sb.append(" <value />\r\n"); + sb.append(" <value/>\r\n"); sb.append("</parameter>\r\n"); - sb.append("\r\n"); Assert.assertEquals(sb.toString(), toXML(parameter)); } @@ -364,7 +352,6 @@ sb.append(" <type>MapPathParameter</type>\r\n"); sb.append(" <value>/path</value>\r\n"); sb.append("</parameter>\r\n"); - sb.append("\r\n"); Assert.assertEquals(sb.toString(), toXML(parameter)); } @@ -383,9 +370,8 @@ sb.append(" <name>Name</name>\r\n"); sb.append(" <description>Description</description>\r\n"); sb.append(" <type>java.lang.String</type>\r\n"); - sb.append(" <value />\r\n"); + sb.append(" <value/>\r\n"); sb.append("</parameter>\r\n"); - sb.append("\r\n"); Assert.assertEquals(sb.toString(), toXML(parameter)); } @@ -405,18 +391,18 @@ sb.append(" <type>java.lang.String</type>\r\n"); sb.append(" <value>string value</value>\r\n"); sb.append("</parameter>\r\n"); - sb.append("\r\n"); Assert.assertEquals(sb.toString(), toXML(parameter)); } /** * Checks that a {@link ArchetypeParameter} is correctly decoded. * @throws IOException if the test fails - * @throws JDOMException if the test fails * @throws NoSuchParameterException if the test fails + * @throws ParsingException if the test fails + * @throws SAXException if the test fails */ @Test - public void testArchetypeFromXml1() throws IOException, JDOMException, NoSuchParameterException { + public void testArchetypeFromXml1() throws IOException, NoSuchParameterException, ParsingException, SAXException { final StringBuilder sb = new StringBuilder(); sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"); sb.append("<parameter>\r\n"); @@ -425,7 +411,6 @@ sb.append(" <type>net.sf.gridarta.model.archetype.Archetype</type>\r\n"); sb.append(" <value/>\r\n"); sb.append("</parameter>\r\n"); - sb.append("\r\n"); final TestMapControlCreator mapControlCreator = new TestMapControlCreator(); final PluginParameter<TestGameObject, TestMapArchObject, TestArchetype, ?> parameter = fromXML(mapControlCreator, sb.toString()); Assert.assertTrue(parameter instanceof ArchetypeParameter); @@ -439,11 +424,12 @@ /** * Checks that an {@link ArchetypeParameter} is correctly decoded. * @throws IOException if the test fails - * @throws JDOMException if the test fails * @throws NoSuchParameterException if the test fails + * @throws ParsingException if the test fails + * @throws SAXException if the test fails */ @Test - public void testArchetypeFromXml2() throws IOException, JDOMException, NoSuchParameterException { + public void testArchetypeFromXml2() throws IOException, NoSuchParameterException, ParsingException, SAXException { final StringBuilder sb = new StringBuilder(); sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"); sb.append("<parameter>\r\n"); @@ -452,7 +438,6 @@ sb.append(" <type>net.sf.gridarta.model.archetype.Archetype</type>\r\n"); sb.append(" <value>undefined_archetype</value>\r\n"); sb.append("</parameter>\r\n"); - sb.append("\r\n"); final TestMapControlCreator mapControlCreator = new TestMapControlCreator(); final PluginParameter<TestGameObject, TestMapArchObject, TestArchetype, ?> parameter = fromXML(mapControlCreator, sb.toString()); Assert.assertTrue(parameter instanceof ArchetypeParameter); @@ -466,11 +451,12 @@ /** * Checks that an {@link ArchetypeParameter} is correctly decoded. * @throws IOException if the test fails - * @throws JDOMException if the test fails * @throws NoSuchParameterException if the test fails + * @throws ParsingException if the test fails + * @throws SAXException if the test fails */ @Test - public void testArchetypeFromXml3() throws IOException, JDOMException, NoSuchParameterException { + public void testArchetypeFromXml3() throws IOException, NoSuchParameterException, ParsingException, SAXException { final StringBuilder sb = new StringBuilder(); sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"); sb.append("<parameter>\r\n"); @@ -479,7 +465,6 @@ sb.append(" <type>net.sf.gridarta.model.archetype.Archetype</type>\r\n"); sb.append(" <value>existing_archetype</value>\r\n"); sb.append("</parameter>\r\n"); - sb.append("\r\n"); final TestMapControlCreator mapControlCreator = new TestMapControlCreator(); final TestArchetype archetype = mapControlCreator.getMapModelCreator().getArchetype("existing_archetype"); final PluginParameter<TestGameObject, TestMapArchObject, TestArchetype, ?> parameter = fromXML(mapControlCreator, sb.toString()); @@ -494,22 +479,22 @@ /** * Checks that a {@link BooleanParameter} is correctly decoded. * @throws IOException if the test fails - * @throws JDOMException if the test fails * @throws NoSuchParameterException if the test fails + * @throws ParsingException if the test fails + * @throws SAXException if the test fails */ @Test - public void testBooleanFromXml1() throws IOException, JDOMException, NoSuchParameterException { + public void testBooleanFromXml1() throws IOException, NoSuchParameterException, ParsingException, SAXException { final StringBuilder sb = new StringBuilder(); sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"); sb.append("<parameter>\r\n"); sb.append(" <name>Name</name>\r\n"); sb.append(" <description>Description</description>\r\n"); sb.append(" <type>java.lang.Boolean</type>\r\n"); - sb.append(" <value />\r\n"); + sb.append(" <value/>\r\n"); sb.append(" <trueText>Yes</trueText>\r\n"); sb.append(" <falseText>No</falseText>\r\n"); sb.append("</parameter>\r\n"); - sb.append("\r\n"); final TestMapControlCreator mapControlCreator = new TestMapControlCreator(); final PluginParameter<TestGameObject, TestMapArchObject, TestArchetype, ?> parameter = fromXML(mapControlCreator, sb.toString()); Assert.assertTrue(parameter instanceof BooleanParameter); @@ -525,11 +510,12 @@ /** * Checks that a {@link BooleanParameter} is correctly decoded. * @throws IOException if the test fails - * @throws JDOMException if the test fails * @throws NoSuchParameterException if the test fails + * @throws ParsingException if the test fails + * @throws SAXException if the test fails */ @Test - public void testBooleanFromXml2() throws IOException, JDOMException, NoSuchParameterException { + public void testBooleanFromXml2() throws IOException, NoSuchParameterException, ParsingException, SAXException { final StringBuilder sb = new StringBuilder(); sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"); sb.append("<parameter>\r\n"); @@ -540,7 +526,6 @@ sb.append(" <trueText>true-text</trueText>\r\n"); sb.append(" <falseText>false-text</falseText>\r\n"); sb.append("</parameter>\r\n"); - sb.append("\r\n"); final TestMapControlCreator mapControlCreator = new TestMapControlCreator(); final PluginParameter<TestGameObject, TestMapArchObject, TestArchetype, ?> parameter = fromXML(mapControlCreator, sb.toString()); Assert.assertTrue(parameter instanceof BooleanParameter); @@ -556,22 +541,22 @@ /** * Checks that a {@link DoubleParameter} is correctly decoded. * @throws IOException if the test fails - * @throws JDOMException if the test fails * @throws NoSuchParameterException if the test fails + * @throws ParsingException if the test fails + * @throws SAXException if the test fails */ @Test - public void testDoubleFromXml1() throws IOException, JDOMException, NoSuchParameterException { + public void testDoubleFromXml1() throws IOException, NoSuchParameterException, ParsingException, SAXException { final StringBuilder sb = new StringBuilder(); sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"); sb.append("<parameter>\r\n"); sb.append(" <name>Name</name>\r\n"); sb.append(" <description>Description</description>\r\n"); sb.append(" <type>java.lang.Double</type>\r\n"); - sb.append(" <value />\r\n"); + sb.append(" <value/>\r\n"); sb.append(" <minimum>0.0</minimum>\r\n"); sb.append(" <maximum>1.0</maximum>\r\n"); sb.append("</parameter>\r\n"); - sb.append("\r\n"); final TestMapControlCreator mapControlCreator = new TestMapControlCreator(); final PluginParameter<TestGameObject, TestMapArchObject, TestArchetype, ?> parameter = fromXML(mapControlCreator, sb.toString()); Assert.assertTrue(parameter instanceof DoubleParameter); @@ -587,11 +572,12 @@ /** * Checks that a {@link DoubleParameter} is correctly decoded. * @throws IOException if the test fails - * @throws JDOMException if the test fails * @throws NoSuchParameterException if the test fails + * @throws ParsingException if the test fails + * @throws SAXException if the test fails */ @Test - public void testDoubleFromXml2() throws IOException, JDOMException, NoSuchParameterException { + public void testDoubleFromXml2() throws IOException, NoSuchParameterException, ParsingException, SAXException { final StringBuilder sb = new StringBuilder(); sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"); sb.append("<parameter>\r\n"); @@ -602,7 +588,6 @@ sb.append(" <minimum>-123.456</minimum>\r\n"); sb.append(" <maximum>234.0</maximum>\r\n"); sb.append("</parameter>\r\n"); - sb.append("\r\n"); final TestMapControlCreator mapControlCreator = new TestMapControlCreator(); final PluginParameter<TestGameObject, TestMapArchObject, TestArchetype, ?> parameter = fromXML(mapControlCreator, sb.toString()); Assert.assertTrue(parameter instanceof DoubleParameter); @@ -618,22 +603,22 @@ /** * Checks that an {@link IntegerParameter} is correctly decoded. * @throws IOException if the test fails - * @throws JDOMException if the test fails * @throws NoSuchParameterException if the test fails + * @throws ParsingException if the test fails + * @throws SAXException if the test fails */ @Test - public void testIntegerFromXml1() throws IOException, JDOMException, NoSuchParameterException { + public void testIntegerFromXml1() throws IOException, NoSuchParameterException, ParsingException, SAXException { final StringBuilder sb = new StringBuilder(); sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"); sb.append("<parameter>\r\n"); sb.append(" <name>Name</name>\r\n"); sb.append(" <description>Description</description>\r\n"); sb.append(" <type>java.lang.Integer</type>\r\n"); - sb.append(" <value />\r\n"); + sb.append(" <value/>\r\n"); sb.append(" <minimum>-2147483648</minimum>\r\n"); sb.append(" <maximum>2147483647</maximum>\r\n"); sb.append("</parameter>\r\n"); - sb.append("\r\n"); final TestMapControlCreator mapControlCreator = new TestMapControlCreator(); final PluginParameter<TestGameObject, TestMapArchObject, TestArchetype, ?> parameter = fromXML(mapControlCreator, sb.toString()); Assert.assertTrue(parameter instanceof IntegerParameter); @@ -649,11 +634,12 @@ /** * Checks that an {@link IntegerParameter} is correctly decoded. * @throws IOException if the test fails - * @throws JDOMException if the test fails * @throws NoSuchParameterException if the test fails + * @throws ParsingException if the test fails + * @throws SAXException if the test fails */ @Test - public void testIntegerFromXml2() throws IOException, JDOMException, NoSuchParameterException { + public void testIntegerFromXml2() throws IOException, NoSuchParameterException, ParsingException, SAXException { final StringBuilder sb = new StringBuilder(); sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"); sb.append("<parameter>\r\n"); @@ -664,7 +650,6 @@ sb.append(" <minimum>-123</minimum>\r\n"); sb.append(" <maximum>234</maximum>\r\n"); sb.append("</parameter>\r\n"); - sb.append("\r\n"); final TestMapControlCreator mapControlCreator = new TestMapControlCreator(); final PluginParameter<TestGameObject, TestMapArchObject, TestArchetype, ?> parameter = fromXML(mapControlCreator, sb.toString()); Assert.assertTrue(parameter instanceof IntegerParameter); @@ -680,20 +665,20 @@ /** * Checks that a {@link MapParameter} is correctly decoded. * @throws IOException if the test fails - * @throws JDOMException if the test fails * @throws NoSuchParameterException if the test fails + * @throws ParsingException if the test fails + * @throws SAXException if the test fails */ @Test - public void testMapFromXml1() throws IOException, JDOMException, NoSuchParameterException { + public void testMapFromXml1() throws IOException, NoSuchParameterException, ParsingException, SAXException { final StringBuilder sb = new StringBuilder(); sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"); sb.append("<parameter>\r\n"); sb.append(" <name>Name</name>\r\n"); sb.append(" <description>Description</description>\r\n"); sb.append(" <type>net.sf.gridarta.model.mapcontrol.MapControl</type>\r\n"); - sb.append(" <value />\r\n"); + sb.append(" <value/>\r\n"); sb.append("</parameter>\r\n"); - sb.append("\r\n"); final TestMapControlCreator mapControlCreator = new TestMapControlCreator(); final PluginParameter<TestGameObject, TestMapArchObject, TestArchetype, ?> parameter = fromXML(mapControlCreator, sb.toString()); Assert.assertTrue(parameter instanceof MapParameter); @@ -707,12 +692,13 @@ /** * Checks that a {@link MapParameter} is correctly decoded. * @throws IOException if the test fails - * @throws JDOMException if the test fails * @throws NoSuchParameterException if the test fails + * @throws ParsingException if the test fails + * @throws SAXException if the test fails */ @Ignore @Test - public void testMapFromXml3() throws IOException, JDOMException, NoSuchParameterException { + public void testMapFromXml3() throws IOException, NoSuchParameterException, ParsingException, SAXException { final StringBuilder sb = new StringBuilder(); sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"); sb.append("<parameter>\r\n"); @@ -721,7 +707,6 @@ sb.append(" <type>net.sf.gridarta.model.mapcontrol.MapControl</type>\r\n"); sb.append(" <value>/path/to/map</value>\r\n"); sb.append("</parameter>\r\n"); - sb.append("\r\n"); final TestMapControlCreator mapControlCreator = new TestMapControlCreator(); final File mapDir = new File("/tmp"); mapControlCreator.getMapManager().newMap(null, new TestMapArchObject(), mapControlCreator.getPathManager().getMapFile(new File(mapDir, "path/to/map")), false); @@ -743,19 +728,17 @@ * Encodes a {@link PluginParameter} to its string representation. * @param parameter the plugin parameter * @return the string representation - * @throws IOException if encoding fails + * @throws IOException if the conversion fails */ @NotNull private static String toXML(@NotNull final PluginParameter<TestGameObject, TestMapArchObject, TestArchetype, ?> parameter) throws IOException { final PluginParameterCodec<TestGameObject, TestMapArchObject, TestArchetype> codec = new PluginParameterCodec<TestGameObject, TestMapArchObject, TestArchetype>(); final Element element = codec.toXML(parameter); - final Document d = new Document(element); - final XMLOutputter out = new XMLOutputter(); - out.setFormat(Format.getPrettyFormat()); - final Writer writer = new StringWriter(); - out.output(d, writer); - //noinspection ObjectToString - return writer.toString(); + final ByteArrayOutputStream stream = new ByteArrayOutputStream(); + final Serializer serializer = new Serializer(stream, "UTF-8"); + serializer.setIndent(2); + serializer.write(new Document(element)); + return new String(stream.toByteArray(), "UTF-8"); } /** @@ -764,12 +747,14 @@ * @param string the string representation * @return the plugin parameter * @throws IOException if decoding fails - * @throws JDOMException if decoding fails * @throws NoSuchParameterException if decoding fails + * @throws ParsingException if decoding fails + * @throws SAXException if decoding fails */ @NotNull - private static PluginParameter<TestGameObject, TestMapArchObject, TestArchetype, ?> fromXML(@NotNull final TestMapControlCreator mapControlCreator, @NotNull final String string) throws IOException, JDOMException, NoSuchParameterException { - final SAXBuilder builder = new SAXBuilder(false); + private static PluginParameter<TestGameObject, TestMapArchObject, TestArchetype, ?> fromXML(@NotNull final TestMapControlCreator mapControlCreator, @NotNull final String string) throws IOException, NoSuchParameterException, ParsingException, SAXException { + final XMLReader xmlReader = XMLReaderFactory.createXMLReader(); + final Builder builder = new Builder(xmlReader, false); final Document document = builder.build(new StringReader(string)); final PluginParameterFactory<TestGameObject, TestMapArchObject, TestArchetype> parameterFactory = new PluginParameterFactory<TestGameObject, TestMapArchObject, TestArchetype>(mapControlCreator.getArchetypeSet(), mapControlCreator.getMapManager(), mapControlCreator.getProjectSettings(), mapControlCreator.getPathManager()); final Element element = document.getRootElement(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |