From: <aki...@us...> - 2013-12-10 20:37:11
|
Revision: 9527 http://sourceforge.net/p/gridarta/code/9527 Author: akirschbaum Date: 2013-12-10 20:36:58 +0000 (Tue, 10 Dec 2013) Log Message: ----------- Add "Browse archetypes" to archetypes menu. Modified Paths: -------------- trunk/src/atrinik/ChangeLog trunk/src/atrinik/src/main/resources/net/sf/gridarta/var/atrinik/action.properties trunk/src/crossfire/ChangeLog trunk/src/crossfire/src/main/resources/net/sf/gridarta/var/crossfire/action.properties trunk/src/daimonin/ChangeLog trunk/src/daimonin/src/main/resources/net/sf/gridarta/var/daimonin/action.properties trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.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/model/src/main/java/net/sf/gridarta/model/archetype/Archetype.java trunk/src/model/src/main/java/net/sf/gridarta/model/baseobject/AbstractBaseObject.java trunk/src/model/src/main/java/net/sf/gridarta/model/baseobject/GameObjectText.java Added Paths: ----------- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/BrowseArchetypesAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/ 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/BrowseArchetypesDialogManager.java 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/ClosingLabel.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/TableHeaderCellRenderer.java Modified: trunk/src/atrinik/ChangeLog =================================================================== --- trunk/src/atrinik/ChangeLog 2013-12-10 19:57:47 UTC (rev 9526) +++ trunk/src/atrinik/ChangeLog 2013-12-10 20:36:58 UTC (rev 9527) @@ -1,3 +1,8 @@ +2013-12-10 Andreas Kirschbaum + + * Add "Browse archetypes" to archetypes menu. It shows a dialog to + browse attribute values of archetypes. + 2013-12-04 Andreas Kirschbaum * Switch to adjacent map if the map cursor attempts to move off Modified: trunk/src/atrinik/src/main/resources/net/sf/gridarta/var/atrinik/action.properties =================================================================== --- trunk/src/atrinik/src/main/resources/net/sf/gridarta/var/atrinik/action.properties 2013-12-10 19:57:47 UTC (rev 9526) +++ trunk/src/atrinik/src/main/resources/net/sf/gridarta/var/atrinik/action.properties 2013-12-10 20:36:58 UTC (rev 9527) @@ -28,7 +28,7 @@ file.menu=newMap openFile goMap recent closeMap - saveMap saveMapAs saveAllMaps - closeAllMaps reloadMap createImage - options shortcuts - exit edit.menu=undo redo - clear cut copy paste pasteTiled - shift - find findNext findPrev replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll invertSelection expandEmptySelection growSelection shrinkSelection map.menu=autoJoin - enterExit nextExit prevExit enterNorthMap enterEastMap enterSouthMap enterWestMap enterNorthEastMap enterSouthEastMap enterSouthWestMap enterNorthWestMap - mapCreateView mapProperties shrinkMapSize deleteUnknownObjects - gameObjectTextEditor -archetypes.menu=displayGameObjectNames displayArchetypeNames displayIconsOnly - findArchetypes +archetypes.menu=displayGameObjectNames displayArchetypeNames displayIconsOnly - findArchetypes browseArchetypes #pickmaps.menu: See gridarta resources.menu=collectArches collectSpells - reloadFaces - viewTreasurelists tools.menu=newScript editScript - controlServer controlClient - validateMap cleanCompletelyBlockedSquares - zoom gc Modified: trunk/src/crossfire/ChangeLog =================================================================== --- trunk/src/crossfire/ChangeLog 2013-12-10 19:57:47 UTC (rev 9526) +++ trunk/src/crossfire/ChangeLog 2013-12-10 20:36:58 UTC (rev 9527) @@ -1,3 +1,8 @@ +2013-12-10 Andreas Kirschbaum + + * Add "Browse archetypes" to archetypes menu. It shows a dialog to + browse attribute values of archetypes. + 2013-12-04 Andreas Kirschbaum * Switch to adjacent map if the map cursor attempts to move off Modified: trunk/src/crossfire/src/main/resources/net/sf/gridarta/var/crossfire/action.properties =================================================================== --- trunk/src/crossfire/src/main/resources/net/sf/gridarta/var/crossfire/action.properties 2013-12-10 19:57:47 UTC (rev 9526) +++ trunk/src/crossfire/src/main/resources/net/sf/gridarta/var/crossfire/action.properties 2013-12-10 20:36:58 UTC (rev 9527) @@ -28,7 +28,7 @@ file.menu=newMap openFile goMap recent closeMap - saveMap saveMapAs saveAllMaps - closeAllMaps reloadMap createImage - options shortcuts - exit edit.menu=undo redo - clear cut copy paste pasteTiled - shift - find findNext findPrev replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll invertSelection expandEmptySelection growSelection shrinkSelection map.menu=autoJoin - enterExit nextExit prevExit enterNorthMap enterEastMap enterSouthMap enterWestMap tileShow - mapCreateView mapProperties shrinkMapSize deleteUnknownObjects - gameObjectTextEditor -archetypes.menu=displayGameObjectNames displayArchetypeNames displayIconsOnly - findArchetypes +archetypes.menu=displayGameObjectNames displayArchetypeNames displayIconsOnly - findArchetypes browseArchetypes #pickmaps.menu: See gridarta resources.menu=collectArches - reloadFaces - viewTreasurelists tools.menu=newScript editScript - controlServer controlClient - validateMap - zoom gc Modified: trunk/src/daimonin/ChangeLog =================================================================== --- trunk/src/daimonin/ChangeLog 2013-12-10 19:57:47 UTC (rev 9526) +++ trunk/src/daimonin/ChangeLog 2013-12-10 20:36:58 UTC (rev 9527) @@ -1,3 +1,8 @@ +2013-12-10 Andreas Kirschbaum + + * Add "Browse archetypes" to archetypes menu. It shows a dialog to + browse attribute values of archetypes. + 2013-12-04 Andreas Kirschbaum * Switch to adjacent map if the map cursor attempts to move off Modified: trunk/src/daimonin/src/main/resources/net/sf/gridarta/var/daimonin/action.properties =================================================================== --- trunk/src/daimonin/src/main/resources/net/sf/gridarta/var/daimonin/action.properties 2013-12-10 19:57:47 UTC (rev 9526) +++ trunk/src/daimonin/src/main/resources/net/sf/gridarta/var/daimonin/action.properties 2013-12-10 20:36:58 UTC (rev 9527) @@ -28,7 +28,7 @@ file.menu=newMap openFile goMap recent closeMap - saveMap saveMapAs saveAllMaps - closeAllMaps reloadMap createImage - options shortcuts - exit edit.menu=undo redo - clear cut copy paste pasteTiled - shift - find findNext findPrev replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll invertSelection expandEmptySelection growSelection shrinkSelection map.menu=autoJoin - enterExit nextExit prevExit enterNorthMap enterEastMap enterSouthMap enterWestMap enterNorthEastMap enterSouthEastMap enterSouthWestMap enterNorthWestMap - mapCreateView mapProperties shrinkMapSize deleteUnknownObjects - gameObjectTextEditor -archetypes.menu=displayGameObjectNames displayArchetypeNames displayIconsOnly - findArchetypes +archetypes.menu=displayGameObjectNames displayArchetypeNames displayIconsOnly - findArchetypes browseArchetypes #pickmaps.menu: See gridarta resources.menu=collectArches collectSpells - reloadFaces - viewTreasurelists tools.menu=newScript editScript - controlServer controlClient - validateMap cleanCompletelyBlockedSquares - zoom gc Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/BrowseArchetypesAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/BrowseArchetypesAction.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/BrowseArchetypesAction.java 2013-12-10 20:36:58 UTC (rev 9527) @@ -0,0 +1,78 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.action; + +import java.awt.Component; +import javax.swing.Action; +import javax.swing.ImageIcon; +import net.sf.gridarta.gui.dialog.browsearchetypes.BrowseArchetypesDialogManager; +import net.sf.gridarta.gui.panel.archetypechooser.ArchetypeChooserControl; +import net.sf.gridarta.gui.panel.objectchooser.ObjectChooser; +import net.sf.gridarta.gui.utils.AbstractDialogManager; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.archetypeset.ArchetypeSet; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.utils.EditorAction; +import net.sf.japi.swing.action.ActionMethod; +import org.jetbrains.annotations.NotNull; + +/** + * An {@link EditorAction} that displays the browse archetypes dialog. + * @author Andreas Kirschbaum + */ +public class BrowseArchetypesAction<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements EditorAction { + + /** + * The browse archetypes dialog manager. + */ + @NotNull + private final AbstractDialogManager dialogManager; + + /** + * Creates a new instance. + * @param parent the parent component for the dialog + * @param archetypeChooserControl the archetype chooser control to search + * @param objectChooser the object chooser to use when selecting search + * results + * @param archetypeSet the archetype set for looking up archetypes + * @param closingIcon the icon to display in the closing buttons of the + * archetype browser + */ + public BrowseArchetypesAction(@NotNull final Component parent, @NotNull final ArchetypeChooserControl<G, A, R> archetypeChooserControl, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final ImageIcon closingIcon) { + dialogManager = new BrowseArchetypesDialogManager<G, A, R>(parent, archetypeChooserControl, objectChooser, archetypeSet, closingIcon); + } + + /** + * Shows the browse archetypes dialog. + */ + @ActionMethod + public void browseArchetypes() { + dialogManager.showDialog(); + } + + /** + * {@inheritDoc} + */ + @Override + public void setAction(@NotNull final Action action, @NotNull final String name) { + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/BrowseArchetypesAction.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 Added: 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 (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/BrowseArchetypesDialog.java 2013-12-10 20:36:58 UTC (rev 9527) @@ -0,0 +1,361 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gui.dialog.browsearchetypes; + +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.util.Collection; +import java.util.TreeSet; +import javax.swing.BoxLayout; +import javax.swing.DefaultComboBoxModel; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JDialog; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.ListSelectionModel; +import javax.swing.ScrollPaneConstants; +import javax.swing.SwingUtilities; +import javax.swing.WindowConstants; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import javax.swing.table.JTableHeader; +import javax.swing.table.TableColumnModel; +import net.sf.gridarta.gui.panel.archetypechooser.ArchetypeChooserControl; +import net.sf.gridarta.gui.panel.objectchooser.ObjectChooser; +import net.sf.gridarta.gui.utils.GUIConstants; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.archetypeset.ArchetypeSet; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.utils.ActionBuilderUtils; +import net.sf.japi.swing.action.ActionBuilder; +import net.sf.japi.swing.action.ActionBuilderFactory; +import net.sf.japi.swing.action.ActionMethod; +import org.jetbrains.annotations.NotNull; + +/** + * A dialog that displays archetypes. + * @author Andreas Kirschbaum + */ +public class BrowseArchetypesDialog<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends JOptionPane { + + /** + * The serial Version UID. + */ + private static final long serialVersionUID = 1L; + + /** + * The {@link ActionBuilder}. + */ + @NotNull + private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); + + /** + * The archetype set to search. + */ + @NotNull + private final ArchetypeChooserControl<G, A, R> archetypeChooserControl; + + /** + * The insertion object chooser to use when selecting search results. + */ + @NotNull + private final ObjectChooser<G, A, R> objectChooser; + + /** + * The attribute names currently not shown. + */ + @NotNull + private final Collection<String> availableAttributes = new TreeSet<String>(); + + /** + * The model of {@link #archetypesTable}. + */ + @NotNull + private final BrowseArchetypesTableModel<G, A, R> archetypesTableModel; + + /** + * The model of {@link #addAttributeComboBox}. + */ + @NotNull + private final DefaultComboBoxModel addAttributeComboBoxModel = new DefaultComboBoxModel(); + + /** + * The {@link JTable} showing the selected archetypes. + * @serial + */ + @NotNull + private final JTable archetypesTable; + + /** + * The dialog. + * @serial + */ + @NotNull + private final JDialog dialog; + + /** + * The button for adding the {@link #addAttributeComboBox selected + * attribute} to {@link #archetypesTable}. + */ + @NotNull + private final JButton addAttributeButton; + + /** + * The attribute to add to {@link #archetypesTable} if {@link + * #addAttributeButton} is selected. + */ + @NotNull + private final JComboBox addAttributeComboBox; + + /** + * Creates a new instance. + * @param parentComponent the parent component for the dialog + * @param archetypeChooserControl the archetype chooser control to to + * search + * @param objectChooser the object chooser to use when selecting search + * results + * @param archetypeSet the archetype set to show + * @param closingIcon the icon to display in the closing buttons of the + * table + */ + public BrowseArchetypesDialog(@NotNull final Component parentComponent, @NotNull final ArchetypeChooserControl<G, A, R> archetypeChooserControl, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final ImageIcon closingIcon) { + this.archetypeChooserControl = archetypeChooserControl; + this.objectChooser = objectChooser; + archetypesTableModel = new BrowseArchetypesTableModel<G, A, R>(archetypeSet); + archetypesTable = new JTable(archetypesTableModel); + + for (final Archetype<?, ?, ?> archetype : archetypeSet.getArchetypes()) { + for (final String attribute : archetype.getAttributeKeys()) { + availableAttributes.add(attribute); + } + } + if (availableAttributes.remove("value")) { + archetypesTableModel.addAttribute("value"); + } + + archetypesTable.setFillsViewportHeight(true); + archetypesTable.setAutoCreateRowSorter(true); + archetypesTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + archetypesTable.setRowSelectionAllowed(true); + archetypesTable.setColumnSelectionAllowed(false); + final ListSelectionListener listSelectionListener = new ListSelectionListener() { + + @Override + public void valueChanged(@NotNull final ListSelectionEvent e) { + highlightSelectedEntry(); + } + + }; + archetypesTable.getSelectionModel().addListSelectionListener(listSelectionListener); + final JTableHeader tableHeader = archetypesTable.getTableHeader(); + tableHeader.setReorderingAllowed(true); + final TableHeaderCellRenderer renderer = new TableHeaderCellRenderer(closingIcon, tableHeader.getDefaultRenderer()); + tableHeader.setDefaultRenderer(renderer); + final MouseListener mouseListener = new MouseListener() { + + /** + * Whether the mouse button is currently pressed. + */ + private boolean pressed; + + @Override + public void mouseClicked(@NotNull final MouseEvent e) { + if (pressed) { + pressed = false; + if (SwingUtilities.isLeftMouseButton(e)) { + final TableColumnModel columnModel = archetypesTable.getColumnModel(); + final int viewColumn = columnModel.getColumnIndexAtX(e.getX()); + final int columnIndex = archetypesTable.convertColumnIndexToModel(viewColumn); + final int offsetX = renderer.getX(columnIndex); + int cx = 0; + for (int i = 0; i < columnIndex; i++) { + cx += columnModel.getColumn(i).getWidth(); + } + final int ex = e.getX(); + if (offsetX >= 0 && ex - cx >= offsetX) { + final String attribute = archetypesTableModel.removeAttribute(columnIndex); + if (attribute != null) { + availableAttributes.add(attribute); + updateComboBox(); + addAttributeComboBoxModel.setSelectedItem(attribute); + } + } + } + } + } + + @Override + public void mousePressed(@NotNull final MouseEvent e) { + pressed = true; + } + + @Override + public void mouseReleased(@NotNull final MouseEvent e) { + } + + @Override + public void mouseEntered(@NotNull final MouseEvent e) { + } + + @Override + public void mouseExited(@NotNull final MouseEvent e) { + } + + }; + tableHeader.addMouseListener(mouseListener); + addAttributeButton = new JButton(ACTION_BUILDER.createAction(false, "browseArchetypesAddAttribute", this)); + addAttributeComboBox = new JComboBox(addAttributeComboBoxModel); + final ItemListener itemListener = new ItemListener() { + + @Override + public void itemStateChanged(@NotNull final ItemEvent e) { + updateActions(); + } + + }; + addAttributeComboBox.addItemListener(itemListener); + setMessage(createPanel()); + + final JPanel addAttributePanel = new JPanel(); + addAttributePanel.setLayout(new BoxLayout(addAttributePanel, BoxLayout.LINE_AXIS)); + addAttributePanel.add(addAttributeButton); + addAttributePanel.add(addAttributeComboBox); + setOptions(new Object[] { addAttributePanel }); + + updateComboBox(); + addAttributeComboBox.setSelectedIndex(Math.min(0, addAttributeComboBoxModel.getSize() - 1)); + + dialog = createDialog(parentComponent, ActionBuilderUtils.getString(ACTION_BUILDER, "browseArchetypes.title")); + dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); + dialog.setModal(false); + dialog.setResizable(true); + dialog.pack(); + dialog.setMinimumSize(new Dimension(200, 200)); + dialog.setSize(new Dimension(800, 600)); + dialog.setLocationRelativeTo(parentComponent); + setInitialValue(archetypesTable); + updateActions(); + } + + /** + * Opens the dialog. Returns immediately. + */ + public void showDialog() { + dialog.setVisible(true); + dialog.toFront(); + } + + /** + * Creates the GUI. + * @return the panel containing the GUI + */ + @NotNull + private JPanel createPanel() { + final JPanel mainPanel = new JPanel(new BorderLayout()); + + mainPanel.setBorder(GUIConstants.DIALOG_BORDER); + + final JScrollPane scrollPane = new JScrollPane(archetypesTable); + scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); + scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); + + mainPanel.add(scrollPane, BorderLayout.CENTER); + return mainPanel; + } + + /** + * Action method for "add attribute". + */ + @ActionMethod + public void browseArchetypesAddAttribute() { + doAddAttribute(true); + } + + /** + * Adds an attribute to the table. + * @param performAction whether the action should be performed + * @return whether the action can or was performed + */ + private boolean doAddAttribute(final boolean performAction) { + final String attributeName = (String) addAttributeComboBox.getSelectedItem(); + if (attributeName == null) { + return false; + } + + if (performAction) { + if (availableAttributes.remove(attributeName)) { + archetypesTableModel.addAttribute(attributeName); + final int selectedIndex = Math.max(addAttributeComboBox.getSelectedIndex(), 0); + updateComboBox(); + addAttributeComboBox.setSelectedIndex(Math.min(selectedIndex, addAttributeComboBoxModel.getSize() - 1)); + } + updateActions(); + } else if (!availableAttributes.contains(attributeName)) { + return false; + } + + return true; + } + + /** + * Updates the actions' states to reflect the current selection. + */ + private void updateActions() { + addAttributeButton.setEnabled(doAddAttribute(false)); + addAttributeComboBox.setEnabled(!availableAttributes.isEmpty()); + } + + /** + * Updates the contents of {@link #addAttributeComboBoxModel}. The current + * selection is lost. + */ + private void updateComboBox() { + addAttributeComboBoxModel.removeAllElements(); + for (final String attribute : availableAttributes) { + addAttributeComboBoxModel.addElement(attribute); + } + } + + /** + * Highlights the selected row from {@link #archetypesTable} in the + * insertion object chooser. + */ + private void highlightSelectedEntry() { + final int index = archetypesTable.getSelectedRow(); + if (index == -1) { + return; + } + + final R archetype = archetypesTableModel.get(archetypesTable.getRowSorter().convertRowIndexToModel(index)); + objectChooser.moveArchetypeChooserToFront(); + archetypeChooserControl.selectArchetype(archetype); + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/BrowseArchetypesDialog.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 Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/BrowseArchetypesDialogManager.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/BrowseArchetypesDialogManager.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/BrowseArchetypesDialogManager.java 2013-12-10 20:36:58 UTC (rev 9527) @@ -0,0 +1,117 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gui.dialog.browsearchetypes; + +import java.awt.Component; +import javax.swing.ImageIcon; +import net.sf.gridarta.gui.panel.archetypechooser.ArchetypeChooserControl; +import net.sf.gridarta.gui.panel.objectchooser.ObjectChooser; +import net.sf.gridarta.gui.utils.AbstractDialogManager; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.archetypeset.ArchetypeSet; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * A dialog manager for the browse archetypes dialog. + * @author Andreas Kirschbaum + */ +public class BrowseArchetypesDialogManager<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractDialogManager { + + /** + * The synchronization object for accessing {@link #browseArchetypesDialog}. + */ + @NotNull + private final Object sync = new Object(); + + /** + * The {@link BrowseArchetypesDialog} instance or <code>null</code> if the + * dialog isn't built yet. + */ + @Nullable + private BrowseArchetypesDialog<G, A, R> browseArchetypesDialog; + + /** + * The parent {@link Component} for the dialog. + */ + @NotNull + private final Component parent; + + /** + * The {@link ArchetypeChooserControl} to search. + */ + @NotNull + private final ArchetypeChooserControl<G, A, R> archetypeChooserControl; + + /** + * The {@link ObjectChooser} to use when selecting search results. + */ + @NotNull + private final ObjectChooser<G, A, R> objectChooser; + + /** + * The {@link ArchetypeSet} for looking up archetypes. + */ + @NotNull + private final ArchetypeSet<G, A, R> archetypeSet; + + /** + * The icon to display in the closing buttons of the archetype browser. + */ + @NotNull + private final ImageIcon closingIcon; + + /** + * Creates a new instance. + * @param parent the parent component for the dialog + * @param archetypeChooserControl the archetype chooser control to search + * @param objectChooser the object chooser to use when selecting search + * results + * @param archetypeSet the archetype set for looking up archetypes + * @param closingIcon the icon to display in the closing buttons of the + * archetype browser + */ + public BrowseArchetypesDialogManager(@NotNull final Component parent, @NotNull final ArchetypeChooserControl<G, A, R> archetypeChooserControl, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final ImageIcon closingIcon) { + this.parent = parent; + this.archetypeChooserControl = archetypeChooserControl; + this.objectChooser = objectChooser; + this.archetypeSet = archetypeSet; + this.closingIcon = closingIcon; + } + + /** + * {@inheritDoc} + */ + @Override + public void showDialog() { + BrowseArchetypesDialog<G, A, R> dialog; + synchronized (sync) { + dialog = browseArchetypesDialog; + if (dialog == null) { + dialog = new BrowseArchetypesDialog<G, A, R>(parent, archetypeChooserControl, objectChooser, archetypeSet, closingIcon); + browseArchetypesDialog = dialog; + } + } + dialog.showDialog(); + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/BrowseArchetypesDialogManager.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 Added: 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 (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/BrowseArchetypesTableModel.java 2013-12-10 20:36:58 UTC (rev 9527) @@ -0,0 +1,250 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gui.dialog.browsearchetypes; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.WeakHashMap; +import javax.swing.table.AbstractTableModel; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.archetypeset.ArchetypeSet; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * A {@link javax.swing.table.TableModel} that displays a selected set of + * attributes within a list of archetypes. + * @author Andreas Kirschbaum + */ +public class BrowseArchetypesTableModel<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractTableModel { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** + * The {@link ArchetypeSet} from which archetypes are shown. + */ + @NotNull + private final ArchetypeSet<G, A, R> archetypeSet; + + /** + * The shown archetypes. + */ + @NotNull + private final List<R> archetypes = new ArrayList<R>(); + + /** + * The shown attributes. + */ + @NotNull + private final List<String> attributes = new ArrayList<String>(); + + /** + * The classes corresponding to {@link #attributes}. + */ + @NotNull + private final List<Class<?>> classes = new ArrayList<Class<?>>(); + + /** + * Caches mapping of attribute name to table column class. + */ + @NotNull + private final Map<String, Class<?>> classMap = new WeakHashMap<String, Class<?>>(); + + /** + * Creates a new instance. + * @param archetypeSet the archetype set from which archetypes are shown + */ + public BrowseArchetypesTableModel(@NotNull final ArchetypeSet<G, A, R> archetypeSet) { + this.archetypeSet = archetypeSet; + update(); + } + + /** + * {@inheritDoc} + */ + @Override + public int getRowCount() { + return archetypes.size(); + } + + /** + * {@inheritDoc} + */ + @Override + public int getColumnCount() { + return 2 + attributes.size(); + } + + /** + * {@inheritDoc} + */ + @Nullable + @Override + public Object getValueAt(final int rowIndex, final int columnIndex) { + if (rowIndex < 0 || rowIndex >= archetypes.size()) { + return null; + } + final Archetype<?, ?, ?> archetype = archetypes.get(rowIndex); + if (columnIndex == 0) { + return archetype.getArchetypeName(); + } else if (columnIndex == 1) { + return archetype.getBestName(); + } else if (columnIndex >= 0 && columnIndex < 2 + attributes.size()) { + final String attribute = attributes.get(columnIndex - 2); + final String value = archetype.getAttributeString(attribute); + final Class<?> attributeClass = classes.get(columnIndex - 2); + if (attributeClass == Long.class) { + if (value.isEmpty()) { + return null; + } + try { + return Long.valueOf(value); + } catch (final NumberFormatException ignored) { + } + } + return value; + } else { + return null; + } + } + + /** + * {@inheritDoc} + */ + @Override + public String getColumnName(final int column) { + if (column == 0) { + return "Archetype"; + } else if (column == 1) { + return "Name"; + } else if (column >= 0 && column < 2 + attributes.size()) { + return attributes.get(column - 2); + } else { + return super.getColumnName(column); + } + } + + @Override + public Class<?> getColumnClass(final int columnIndex) { + if (columnIndex < 2) { + return String.class; + } else if (columnIndex >= 0 && columnIndex < 2 + attributes.size()) { + return classes.get(columnIndex - 2); + } else { + return super.getColumnClass(columnIndex); + } + } + + /** + * Updates {@link #archetypes} to include all archetypes from {@link + * #archetypeSet} that define at least one show attribute. + */ + private void update() { + archetypes.clear(); + for (final R archetype : archetypeSet.getArchetypes()) { + boolean include = false; + for (final String attribute : attributes) { + if (!archetype.getAttributeString(attribute).isEmpty()) { + include = true; + break; + } + } + if (include) { + archetypes.add(archetype); + } + } + fireTableStructureChanged(); + } + + /** + * Adds a column for an attribute to the table. + * @param attribute the attribute + */ + public void addAttribute(@NotNull final String attribute) { + classes.add(getAttributeClass(attribute)); + attributes.add(attribute); + update(); + } + + /** + * Returns the class for rendering attribute values. + * @param attribute the attribute + * @return the class + */ + @NotNull + private Class<?> getAttributeClass(@NotNull final String attribute) { + final Class<?> existingClass = classMap.get(attribute); + if (existingClass != null) { + return existingClass; + } + + for (final Archetype<?, ?, ?> archetype : archetypeSet.getArchetypes()) { + final String value = archetype.getAttributeString(attribute); + if (value.isEmpty()) { + // skip empty values + continue; + } + try { + Long.parseLong(value); + } catch (final NumberFormatException ignored) { + classMap.put(attribute, String.class); + return String.class; + } + } + classMap.put(attribute, Long.class); + return Long.class; + } + + /** + * Removes an attribute from the table. + * @param index the index of the column + * @return the attribute or {@code null} if the index is invalid + */ + @Nullable + public String removeAttribute(final int index) { + final String attribute; + try { + attribute = attributes.remove(index - 2); + classes.remove(index - 2); + } catch (final IndexOutOfBoundsException ignored) { + return null; + } + update(); + return attribute; + } + + /** + * Return one archetype. + * @param index the table row index + * @return the row content + */ + @NotNull + @SuppressWarnings("TypeMayBeWeakened") + public R get(final int index) { + return archetypes.get(index); + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/BrowseArchetypesTableModel.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 Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/ClosingLabel.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/ClosingLabel.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/ClosingLabel.java 2013-12-10 20:36:58 UTC (rev 9527) @@ -0,0 +1,63 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gui.dialog.browsearchetypes; + +import java.awt.Graphics; +import javax.swing.Icon; +import javax.swing.JLabel; +import org.jetbrains.annotations.NotNull; + +/** + * A {@link JLabel} that tracks the x coordinate at which it was painted last. + * @author Andreas Kirschbaum + */ +public class ClosingLabel extends JLabel { + + /** + * The remembered x coordinate. + */ + private int paintX; + + /** + * Creates a new instance. + * @param icon the icon to display + */ + public ClosingLabel(@NotNull final Icon icon) { + super(icon); + } + + /** + * {@inheritDoc} + */ + @Override + protected void paintComponent(@NotNull final Graphics g) { + paintX = getX(); + super.paintComponent(g); + } + + /** + * Returns the x coordinate at which this label was painted last. + * @return the x coordinate + */ + public int getPaintX() { + return paintX; + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/ClosingLabel.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 Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/TableHeaderCellRenderer.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/TableHeaderCellRenderer.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/TableHeaderCellRenderer.java 2013-12-10 20:36:58 UTC (rev 9527) @@ -0,0 +1,118 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gui.dialog.browsearchetypes; + +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Container; +import java.util.ArrayList; +import java.util.List; +import javax.swing.ImageIcon; +import javax.swing.JPanel; +import javax.swing.JTable; +import javax.swing.table.TableCellRenderer; +import org.jetbrains.annotations.NotNull; + +/** + * A {@link TableCellRenderer} that adds a closing icon. + * @author Andreas Kirschbaum + */ +public class TableHeaderCellRenderer implements TableCellRenderer { + + /** + * The icon. + */ + @NotNull + private final ImageIcon closingIcon; + + /** + * The default {@link TableCellRenderer} of the associated table. + */ + @NotNull + private final TableCellRenderer tableCellRenderer; + + /** + * The panel that renders the cell. It contains both the original contents + * of the cell and a closing icon. + */ + @NotNull + private final Container panel = new JPanel(new BorderLayout()); + + /** + * The closing icons. A separate instance is created for each table column + * as each column may have a different width and thus a different x position + * of the closing label. + */ + @NotNull + private final List<ClosingLabel> labels = new ArrayList<ClosingLabel>(); + + /** + * Creates a new instance. + * @param closingIcon the icon to display as the closing buttons + * @param tableCellRenderer the default table cell renderer of the + * associated table + */ + public TableHeaderCellRenderer(@NotNull final ImageIcon closingIcon, @NotNull final TableCellRenderer tableCellRenderer) { + this.closingIcon = closingIcon; + this.tableCellRenderer = tableCellRenderer; + } + + /** + * {@inheritDoc} + */ + @Override + public Component getTableCellRendererComponent(@NotNull final JTable table, @NotNull final Object value, final boolean isSelected, final boolean hasFocus, final int row, final int column) { + panel.removeAll(); + final Component x = tableCellRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); + panel.add(x, BorderLayout.CENTER); + if (column >= 2) { + ClosingLabel label; + try { + label = labels.get(column); + } catch (final IndexOutOfBoundsException ignored) { + while (labels.size() < column) { + labels.add(new ClosingLabel(closingIcon)); + } + label = new ClosingLabel(closingIcon); + assert labels.size() == column; + labels.add(label); + } + panel.add(label, BorderLayout.EAST); + } + return panel; + } + + /** + * Returns the x coordinate of a closing icon. + * @param index the index of the closing icon + * @return the x coordinate or {@code -1} if the index is invalid + */ + public int getX(final int index) { + final ClosingLabel label; + try { + label = labels.get(index); + } catch (final ArrayIndexOutOfBoundsException ignored) { + return -1; + } + + return label.getPaintX(); + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/TableHeaderCellRenderer.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/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-12-10 19:57:47 UTC (rev 9526) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-12-10 20:36:58 UTC (rev 9527) @@ -36,6 +36,7 @@ import net.sf.gridarta.action.AddBookmarkAction; import net.sf.gridarta.action.AddToSelectionAction; import net.sf.gridarta.action.ArchAttributesAction; +import net.sf.gridarta.action.BrowseArchetypesAction; import net.sf.gridarta.action.CleanCompletelyBlockedSquaresAction; import net.sf.gridarta.action.CloseAllMapsAction; import net.sf.gridarta.action.CollectArchesAction; @@ -409,6 +410,7 @@ final Action moveSquareInvAction = createAction("moveSquareInv", "Selected Square View", new MoveSquareInvAction<G, A, R>(selectedSquareModel, projectModel.getMapManager())); final Action moveSquareTopAction = createAction("moveSquareTop", "Selected Square View", new MoveSquareTopAction<G, A, R>(selectedSquareModel, projectModel.getMapManager())); createAction("findArchetypes", "Archetypes", new FindArchetypesAction<G, A, R>(parent, archetypeChooserControl, objectChooser, projectModel.getArchetypeTypeSet())); + createAction("browseArchetypes", "Archetypes", new BrowseArchetypesAction<G, A, R>(parent, archetypeChooserControl, objectChooser, projectModel.getArchetypeSet(), resourceIcons.getResourceIcon(ResourceIcons.CLOSE_TAB_SMALL_ICON))); createAction("moveSquarePrev", "Selected Square View", new MoveSquarePrevAction<G, A, R>(selectedSquareModel, projectModel.getMapManager())); createAction("moveSquareNext", "Selected Square View", new MoveSquareNextAction<G, A, R>(selectedSquareModel, projectModel.getMapManager())); createAction("prevWindow", "Map,Window", mapDesktop); Modified: trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages.properties 2013-12-10 19:57:47 UTC (rev 9526) +++ trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages.properties 2013-12-10 20:36:58 UTC (rev 9527) @@ -1511,7 +1511,10 @@ findArchetypes.shortdescription=Opens the find archetypes dialog. findArchetypes.accel=ctrl alt pressed A +browseArchetypes.text=Browse archetypes +browseArchetypes.shortdescription=Opens the browse archetypes dialog. + ######### # Window @@ -1836,3 +1839,9 @@ pluginViewNoScripts=no scripts available pluginViewConsoleTitle=Beanshell scripts I/O Console pluginViewProvideParameters=Please provide runtime parameters for {0}. + + +# Browse Archetypes Dialog +browseArchetypesAddAttribute.text=Add Attribute +browseArchetypesAddAttribute.shortdescription=Displays an attribute. +browseArchetypes.title=Browse Archetypes 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 2013-12-10 19:57:47 UTC (rev 9526) +++ trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_de.properties 2013-12-10 20:36:58 UTC (rev 9527) @@ -1279,7 +1279,10 @@ findArchetypes.text=Archetypen finden findArchetypes.shortdescription=\u00d6ffnet den Dialog zum Suchen von Archetypen. +browseArchetypes.text=Archetypen anzeigen +browseArchetypes.shortdescription=\u00d6ffnet den Dialog zum Anzeigen von Archetypen. + ######### # Window @@ -1581,3 +1584,9 @@ pluginViewNoScripts=Keine Editor-Scripte vorhanden pluginViewConsoleTitle=Editor-Script-Konsole pluginViewProvideParameters=Bitte Laufzeitparameter f\xFCr {0} eingeben. + + +# Browse Archetypes Dialog +browseArchetypesAddAttribute.text=Attribut anzeigen +browseArchetypesAddAttribute.shortdescription=F\xFCgt das Attribut zur Tabelle hinzu. +browseArchetypes.title=Archetypen anzeigen 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 2013-12-10 19:57:47 UTC (rev 9526) +++ trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_fr.properties 2013-12-10 20:36:58 UTC (rev 9527) @@ -1269,7 +1269,10 @@ findArchetypes.text=Chercher un arch\u00e9type findArchetypes.shortdescription=Ouvre le dialogue de recherche d'arch\u00e9type. +#browseArchetypes.text= +#browseArchetypes.shortdescription= + ######### # Window @@ -1566,3 +1569,9 @@ #pluginViewNoScripts= #pluginViewConsoleTitle= #pluginViewProvideParameters= + + +# Browse Archetypes Dialog +#browseArchetypesAddAttribute.text= +#browseArchetypesAddAttribute.shortdescription= +#browseArchetypes.title= 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 2013-12-10 19:57:47 UTC (rev 9526) +++ trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_sv.properties 2013-12-10 20:36:58 UTC (rev 9527) @@ -1271,7 +1271,10 @@ #findArchetypes.text= +#browseArchetypes.text= +#browseArchetypes.shortdescription= + ######### # Window @@ -1567,3 +1570,9 @@ #pluginViewNoScripts= #pluginViewConsoleTitle= #pluginViewProvideParameters= + + +# Browse Archetypes Dialog +#browseArchetypesAddAttribute.text= +#browseArchetypesAddAttribute.shortdescription= +#browseArchetypes.title= Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/archetype/Archetype.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetype/Archetype.java 2013-12-10 19:57:47 UTC (rev 9526) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetype/Archetype.java 2013-12-10 20:36:58 UTC (rev 9527) @@ -19,6 +19,7 @@ package net.sf.gridarta.model.archetype; +import java.util.Collection; import java.util.Iterator; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.gameobject.GameObject; @@ -178,4 +179,11 @@ */ void setArtifact(); + /** + * Returns all attribute keys of this archetype. + * @return the attribute keys + */ + @NotNull + Collection<String> getAttributeKeys(); + } Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/baseobject/AbstractBaseObject.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2013-12-10 19:57:47 UTC (rev 9526) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2013-12-10 20:36:58 UTC (rev 9527) @@ -20,6 +20,7 @@ package net.sf.gridarta.model.baseobject; import java.awt.Point; +import java.util.Collection; import javax.swing.ImageIcon; import net.sf.gridarta.model.anim.AnimationObject; import net.sf.gridarta.model.anim.AnimationObjects; @@ -910,7 +911,6 @@ return faceObjSource; } - /** * Sets object animation <code>animation <var>animName</var></code>. * @param animName object animation <code>animation <var>animName</var></code> @@ -1183,4 +1183,13 @@ } } + /** + * Returns all attribute keys of this object. + * @return the attribute keys + */ + @NotNull + public Collection<String> getAttributeKeys() { + return gameObjectText.getAttributeKeys(); + } + } Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/baseobject/GameObjectText.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/baseobject/GameObjectText.java 2013-12-10 19:57:47 UTC (rev 9526) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/baseobject/GameObjectText.java 2013-12-10 20:36:58 UTC (rev 9527) @@ -20,7 +20,9 @@ package net.sf.gridarta.model.baseobject; import java.io.Serializable; +import java.util.Collection; import java.util.HashMap; +import java.util.HashSet; import java.util.Map; import net.sf.gridarta.utils.StringUtils; import org.jetbrains.annotations.NotNull; @@ -243,4 +245,20 @@ return setObjectText(result.toString()); } + /** + * Returns all attribute keys of this object. + * @return the attribute keys + */ + @NotNull + public Collection<String> getAttributeKeys() { + final Collection<String> keys = new HashSet<String>(); + for (final String line : StringUtils.PATTERN_END_OF_LINE.split(objectText.toString(), 0)) { + final int index = line.indexOf(' '); + if (index != -1) { + keys.add(line.substring(0, index)); + } + } + return keys; + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-01-24 08:09:45
|
Revision: 9536 http://sourceforge.net/p/gridarta/code/9536 Author: akirschbaum Date: 2014-01-24 08:09:39 +0000 (Fri, 24 Jan 2014) Log Message: ----------- Make Edit|Grow Selectionto actually work. Modified Paths: -------------- trunk/src/atrinik/ChangeLog trunk/src/crossfire/ChangeLog trunk/src/daimonin/ChangeLog trunk/src/gridarta/src/main/java/net/sf/gridarta/action/GrowSelectionAction.java Modified: trunk/src/atrinik/ChangeLog =================================================================== --- trunk/src/atrinik/ChangeLog 2014-01-07 20:22:47 UTC (rev 9535) +++ trunk/src/atrinik/ChangeLog 2014-01-24 08:09:39 UTC (rev 9536) @@ -1,3 +1,7 @@ +2014-01-24 Andreas Kirschbaum + + * Make Edit|Grow Selectionto actually work. + 2013-12-10 Andreas Kirschbaum * Add "Browse archetypes" to archetypes menu. It shows a dialog to Modified: trunk/src/crossfire/ChangeLog =================================================================== --- trunk/src/crossfire/ChangeLog 2014-01-07 20:22:47 UTC (rev 9535) +++ trunk/src/crossfire/ChangeLog 2014-01-24 08:09:39 UTC (rev 9536) @@ -1,3 +1,7 @@ +2014-01-24 Andreas Kirschbaum + + * Make Edit|Grow Selectionto actually work. + 2013-12-10 Andreas Kirschbaum * Add "Browse archetypes" to archetypes menu. It shows a dialog to Modified: trunk/src/daimonin/ChangeLog =================================================================== --- trunk/src/daimonin/ChangeLog 2014-01-07 20:22:47 UTC (rev 9535) +++ trunk/src/daimonin/ChangeLog 2014-01-24 08:09:39 UTC (rev 9536) @@ -1,3 +1,7 @@ +2014-01-24 Andreas Kirschbaum + + * Make Edit|Grow Selectionto actually work. + 2013-12-10 Andreas Kirschbaum * Add "Browse archetypes" to archetypes menu. It shows a dialog to Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/GrowSelectionAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/GrowSelectionAction.java 2014-01-07 20:22:47 UTC (rev 9535) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/GrowSelectionAction.java 2014-01-24 08:09:39 UTC (rev 9536) @@ -91,7 +91,7 @@ * Grows the current map selection by one map square. */ @ActionMethod - public void shrinkSelection() { + public void growSelection() { doGrowSelection(true); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-01-24 08:55:15
|
Revision: 9537 http://sourceforge.net/p/gridarta/code/9537 Author: akirschbaum Date: 2014-01-24 08:55:11 +0000 (Fri, 24 Jan 2014) Log Message: ----------- Fix typo. Modified Paths: -------------- trunk/src/atrinik/ChangeLog trunk/src/crossfire/ChangeLog trunk/src/daimonin/ChangeLog Modified: trunk/src/atrinik/ChangeLog =================================================================== --- trunk/src/atrinik/ChangeLog 2014-01-24 08:09:39 UTC (rev 9536) +++ trunk/src/atrinik/ChangeLog 2014-01-24 08:55:11 UTC (rev 9537) @@ -1,6 +1,6 @@ 2014-01-24 Andreas Kirschbaum - * Make Edit|Grow Selectionto actually work. + * Make Edit|Grow Selection to actually work. 2013-12-10 Andreas Kirschbaum Modified: trunk/src/crossfire/ChangeLog =================================================================== --- trunk/src/crossfire/ChangeLog 2014-01-24 08:09:39 UTC (rev 9536) +++ trunk/src/crossfire/ChangeLog 2014-01-24 08:55:11 UTC (rev 9537) @@ -1,6 +1,6 @@ 2014-01-24 Andreas Kirschbaum - * Make Edit|Grow Selectionto actually work. + * Make Edit|Grow Selection to actually work. 2013-12-10 Andreas Kirschbaum Modified: trunk/src/daimonin/ChangeLog =================================================================== --- trunk/src/daimonin/ChangeLog 2014-01-24 08:09:39 UTC (rev 9536) +++ trunk/src/daimonin/ChangeLog 2014-01-24 08:55:11 UTC (rev 9537) @@ -1,6 +1,6 @@ 2014-01-24 Andreas Kirschbaum - * Make Edit|Grow Selectionto actually work. + * Make Edit|Grow Selection to actually work. 2013-12-10 Andreas Kirschbaum This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-01-24 08:56:12
|
Revision: 9538 http://sourceforge.net/p/gridarta/code/9538 Author: akirschbaum Date: 2014-01-24 08:56:06 +0000 (Fri, 24 Jan 2014) Log Message: ----------- Properly enable/disable Edit|Grow/Shrink Selection menu. Modified Paths: -------------- trunk/src/atrinik/ChangeLog trunk/src/crossfire/ChangeLog trunk/src/daimonin/ChangeLog trunk/src/gridarta/src/main/java/net/sf/gridarta/action/GrowSelectionAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ShrinkSelectionAction.java Modified: trunk/src/atrinik/ChangeLog =================================================================== --- trunk/src/atrinik/ChangeLog 2014-01-24 08:55:11 UTC (rev 9537) +++ trunk/src/atrinik/ChangeLog 2014-01-24 08:56:06 UTC (rev 9538) @@ -1,5 +1,7 @@ 2014-01-24 Andreas Kirschbaum + * Properly enable/disable Edit|Grow/Shrink Selection menu. + * Make Edit|Grow Selection to actually work. 2013-12-10 Andreas Kirschbaum Modified: trunk/src/crossfire/ChangeLog =================================================================== --- trunk/src/crossfire/ChangeLog 2014-01-24 08:55:11 UTC (rev 9537) +++ trunk/src/crossfire/ChangeLog 2014-01-24 08:56:06 UTC (rev 9538) @@ -1,5 +1,7 @@ 2014-01-24 Andreas Kirschbaum + * Properly enable/disable Edit|Grow/Shrink Selection menu. + * Make Edit|Grow Selection to actually work. 2013-12-10 Andreas Kirschbaum Modified: trunk/src/daimonin/ChangeLog =================================================================== --- trunk/src/daimonin/ChangeLog 2014-01-24 08:55:11 UTC (rev 9537) +++ trunk/src/daimonin/ChangeLog 2014-01-24 08:56:06 UTC (rev 9538) @@ -1,5 +1,7 @@ 2014-01-24 Andreas Kirschbaum + * Properly enable/disable Edit|Grow/Shrink Selection menu. + * Make Edit|Grow Selection to actually work. 2013-12-10 Andreas Kirschbaum Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/GrowSelectionAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/GrowSelectionAction.java 2014-01-24 08:55:11 UTC (rev 9537) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/GrowSelectionAction.java 2014-01-24 08:56:06 UTC (rev 9538) @@ -25,10 +25,13 @@ import net.sf.gridarta.gui.map.mapview.MapView; import net.sf.gridarta.gui.map.mapview.MapViewManager; import net.sf.gridarta.gui.map.mapview.MapViewManagerListener; +import net.sf.gridarta.gui.panel.selectedsquare.SelectedSquareModelListener; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.mapgrid.MapGrid; +import net.sf.gridarta.model.mapgrid.MapGridEvent; +import net.sf.gridarta.model.mapgrid.MapGridListener; import net.sf.gridarta.model.mapgrid.SelectionMode; import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.mapmodel.MapSquare; @@ -64,7 +67,13 @@ @Override public void activeMapViewChanged(@Nullable final MapView<G, A, R> mapView) { + if (currentMapView != null) { + currentMapView.getMapGrid().removeMapGridListener(mapGridListener); + } currentMapView = mapView; + if (currentMapView != null) { + currentMapView.getMapGrid().addMapGridListener(mapGridListener); + } updateAction(); } @@ -79,12 +88,34 @@ }; /** + * The {@link SelectedSquareModelListener} attached to {@link + * #currentMapView}. + */ + @NotNull + private final MapGridListener mapGridListener = new MapGridListener() { + + @Override + public void mapGridChanged(@NotNull final MapGridEvent e) { + updateAction(); + } + + @Override + public void mapGridResized(@NotNull final MapGridEvent e) { + updateAction(); + } + + }; + + /** * Creates a new instance. * @param mapViewManager the map view manager */ public GrowSelectionAction(@NotNull final MapViewManager<G, A, R> mapViewManager) { mapViewManager.addMapViewManagerListener(mapViewManagerListener); currentMapView = mapViewManager.getActiveMapView(); + if (currentMapView != null) { + currentMapView.getMapGrid().addMapGridListener(mapGridListener); + } } /** Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ShrinkSelectionAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ShrinkSelectionAction.java 2014-01-24 08:55:11 UTC (rev 9537) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ShrinkSelectionAction.java 2014-01-24 08:56:06 UTC (rev 9538) @@ -27,10 +27,13 @@ import net.sf.gridarta.gui.map.mapview.MapView; import net.sf.gridarta.gui.map.mapview.MapViewManager; import net.sf.gridarta.gui.map.mapview.MapViewManagerListener; +import net.sf.gridarta.gui.panel.selectedsquare.SelectedSquareModelListener; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.mapgrid.MapGrid; +import net.sf.gridarta.model.mapgrid.MapGridEvent; +import net.sf.gridarta.model.mapgrid.MapGridListener; import net.sf.gridarta.model.mapgrid.SelectionMode; import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.mapmodel.MapSquare; @@ -67,7 +70,13 @@ @Override public void activeMapViewChanged(@Nullable final MapView<G, A, R> mapView) { + if (currentMapView != null) { + currentMapView.getMapGrid().removeMapGridListener(mapGridListener); + } currentMapView = mapView; + if (currentMapView != null) { + currentMapView.getMapGrid().addMapGridListener(mapGridListener); + } updateAction(); } @@ -82,12 +91,34 @@ }; /** + * The {@link SelectedSquareModelListener} attached to {@link + * #currentMapView}. + */ + @NotNull + private final MapGridListener mapGridListener = new MapGridListener() { + + @Override + public void mapGridChanged(@NotNull final MapGridEvent e) { + updateAction(); + } + + @Override + public void mapGridResized(@NotNull final MapGridEvent e) { + updateAction(); + } + + }; + + /** * Creates a new instance. * @param mapViewManager the map view manager */ public ShrinkSelectionAction(@NotNull final MapViewManager<G, A, R> mapViewManager) { mapViewManager.addMapViewManagerListener(mapViewManagerListener); currentMapView = mapViewManager.getActiveMapView(); + if (currentMapView != null) { + currentMapView.getMapGrid().addMapGridListener(mapGridListener); + } } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-01-26 19:49:22
|
Revision: 9547 http://sourceforge.net/p/gridarta/code/9547 Author: akirschbaum Date: 2014-01-26 19:49:14 +0000 (Sun, 26 Jan 2014) Log Message: ----------- Move hard-coded default values of 'External Applications' in settings dialog into properties file. Modified Paths: -------------- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java trunk/src/atrinik/src/main/resources/net/sf/gridarta/var/atrinik/messages.properties trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java trunk/src/crossfire/src/main/resources/net/sf/gridarta/var/crossfire/messages.properties trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java trunk/src/daimonin/src/main/resources/net/sf/gridarta/var/daimonin/messages.properties trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/EditorFactory.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java Modified: trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2014-01-26 19:31:34 UTC (rev 9546) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2014-01-26 19:49:14 UTC (rev 9547) @@ -413,15 +413,6 @@ */ @NotNull @Override - public AppPreferencesModel createAppPreferencesModel() { - return new AppPreferencesModel("../server/atrinik_server", System.getProperty("os.name").toLowerCase().startsWith("win") ? "../client/atrinik.exe" : "../client-1.1.1/atrinik-client", "vim"); - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override public MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype> newMapPropertiesDialogFactory(@NotNull final ProjectSettings projectSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapPathNormalizer mapPathNormalizer) { return new DefaultMapPropertiesDialogFactory(mapManager, projectSettings, mapPathNormalizer); } 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-01-26 19:31:34 UTC (rev 9546) +++ trunk/src/atrinik/src/main/resources/net/sf/gridarta/var/atrinik/messages.properties 2014-01-26 19:49:14 UTC (rev 9547) @@ -177,3 +177,11 @@ validator.12=net.sf.gridarta.model.validation.checks.UndefinedFaceChecker validator.13=net.sf.gridarta.model.validation.checks.UnsetSlayingChecker 20,21,51,55,64,122 validator.14=net.sf.gridarta.model.validation.checks.MapCheckerScriptChecker map-checker.py -c --text-only -a ${ARCH} -r ${MAPS}/regions.reg -m ${MAP} + + +############################################################### +# Default settings for External Applications in Settings dialog +serverDefault=../server/atrinik_server +clientDefaultWindows=../client/atrinik.exe +clientDefaultOther=../client-1.1.1/atrinik-client +editorDefault=vim Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2014-01-26 19:31:34 UTC (rev 9546) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2014-01-26 19:49:14 UTC (rev 9547) @@ -304,15 +304,6 @@ */ @NotNull @Override - public AppPreferencesModel createAppPreferencesModel() { - return new AppPreferencesModel("crossfire-server", System.getProperty("os.name").toLowerCase().startsWith("win") ? "GTKClient.exe" : "crossfire-client-gtk2", "vim"); - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override public MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype> newMapPropertiesDialogFactory(@NotNull final ProjectSettings projectSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapPathNormalizer mapPathNormalizer) { return new DefaultMapPropertiesDialogFactory(mapManager, projectSettings, mapPathNormalizer); } 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-01-26 19:31:34 UTC (rev 9546) +++ trunk/src/crossfire/src/main/resources/net/sf/gridarta/var/crossfire/messages.properties 2014-01-26 19:49:14 UTC (rev 9547) @@ -154,3 +154,11 @@ validator.8=net.sf.gridarta.model.validation.checks.UndefinedArchetypeChecker validator.9=net.sf.gridarta.model.validation.checks.UnsetSlayingChecker 20,21,51,52,55,64,122 player validator.10=net.sf.gridarta.model.validation.checks.CustomTypeChecker 0,71 0,77 + + +############################################################### +# Default settings for External Applications in Settings dialog +serverDefault=crossfire-server +clientDefaultWindows=GTKClient.exe +clientDefaultOther=crossfire-client-gtk2 +editorDefault=vim Modified: trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2014-01-26 19:31:34 UTC (rev 9546) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2014-01-26 19:49:14 UTC (rev 9547) @@ -412,15 +412,6 @@ */ @NotNull @Override - public AppPreferencesModel createAppPreferencesModel() { - return new AppPreferencesModel("../server/daimonin_server", System.getProperty("os.name").toLowerCase().startsWith("win") ? "../client/Daimonin.exe" : "../client-BETA3-0.966/daimonin", "vim"); - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override public MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype> newMapPropertiesDialogFactory(@NotNull final ProjectSettings projectSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapPathNormalizer mapPathNormalizer) { return new DefaultMapPropertiesDialogFactory(mapManager, projectSettings, mapPathNormalizer); } Modified: trunk/src/daimonin/src/main/resources/net/sf/gridarta/var/daimonin/messages.properties =================================================================== --- trunk/src/daimonin/src/main/resources/net/sf/gridarta/var/daimonin/messages.properties 2014-01-26 19:31:34 UTC (rev 9546) +++ trunk/src/daimonin/src/main/resources/net/sf/gridarta/var/daimonin/messages.properties 2014-01-26 19:49:14 UTC (rev 9547) @@ -182,3 +182,11 @@ validator.17=net.sf.gridarta.model.validation.checks.UnsetSlayingChecker 20,21,51,55,64,122 validator.18=net.sf.gridarta.model.validation.checks.CustomTypeChecker 80,83,81 validator.19=net.sf.gridarta.model.validation.checks.SlayingChecker ^[a-zA-Z_0-9/.]*$ system_environment_sensor,|([0-1][0-9]|2[0-3]):[0-5][0-9]-([0-1][0-9]|2[0-3]):[0-5][0-9] + + +############################################################### +# Default settings for External Applications in Settings dialog +serverDefault=../server/daimonin_server +clientDefaultWindows=../client/Daimonin.exe +clientDefaultOther=../client-BETA3-0.966/daimonin +editorDefault=vim Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/EditorFactory.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/EditorFactory.java 2014-01-26 19:31:34 UTC (rev 9546) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/EditorFactory.java 2014-01-26 19:49:14 UTC (rev 9547) @@ -141,13 +141,6 @@ MapViewFactory<G, A, R> newMapViewFactory(@NotNull RendererFactory<G, A, R> rendererFactory, @NotNull PathManager pathManager); /** - * Creates a new {@link AppPreferencesModel} instance. - * @return the new instance - */ - @NotNull - AppPreferencesModel createAppPreferencesModel(); - - /** * Creates a new {@link MapPropertiesDialogFactory} instance. * @param projectSettings the project settings to use * @param mapManager the map manager to use 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-01-26 19:31:34 UTC (rev 9546) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2014-01-26 19:49:14 UTC (rev 9547) @@ -203,6 +203,7 @@ import net.sf.gridarta.textedit.scripteditor.ScriptEditControl; import net.sf.gridarta.textedit.textarea.TextAreaDefaults; import net.sf.gridarta.updater.UpdaterManager; +import net.sf.gridarta.utils.ActionBuilderUtils; import net.sf.gridarta.utils.ActionUtils; import net.sf.gridarta.utils.EditorAction; import net.sf.gridarta.utils.Exiter; @@ -323,7 +324,7 @@ final ImageCreator2<G, A, R> imageCreator2 = new ImageCreator2<G, A, R>(volatileSettings, imageCreator); final String spellFile = editorFactory.getSpellFile(); final SpellsUtils spellUtils = spellFile != null ? new SpellsUtils(spellFile) : null; - final AppPreferencesModel appPreferencesModel = editorFactory.createAppPreferencesModel(); + final AppPreferencesModel appPreferencesModel = new AppPreferencesModel(ActionBuilderUtils.getString(ACTION_BUILDER, "serverDefault"), System.getProperty("os.name").toLowerCase().startsWith("win") ? ActionBuilderUtils.getString(ACTION_BUILDER, "clientDefaultWindows") : ActionBuilderUtils.getString(ACTION_BUILDER, "clientDefaultOther"), ActionBuilderUtils.getString(ACTION_BUILDER, "editorDefault")); final MapViewManager<G, A, R> mapViewManager = new MapViewManager<G, A, R>(); final StatusBar<G, A, R> statusBar = new StatusBar<G, A, R>(projectModel.getMapManager(), mapViewManager, projectModel.getArchetypeSet(), projectModel.getFaceObjects()); final MapImageCache<G, A, R> mapImageCache = new MapImageCache<G, A, R>(projectModel.getMapManager(), resourceIcons.getResourceIcon(ResourceIcons.DEFAULT_ICON).getImage(), resourceIcons.getResourceIcon(ResourceIcons.DEFAULT_PREVIEW).getImage(), rendererFactory, editorFactory.getCacheFiles()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-01-26 20:51:58
|
Revision: 9558 http://sourceforge.net/p/gridarta/code/9558 Author: akirschbaum Date: 2014-01-26 20:51:52 +0000 (Sun, 26 Jan 2014) Log Message: ----------- Save modified plugin scripts. Modified Paths: -------------- trunk/src/atrinik/ChangeLog trunk/src/crossfire/ChangeLog trunk/src/daimonin/ChangeLog trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/Plugin.java trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/AbstractPluginParameter.java trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/AbstractStringPluginParameter.java trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/AbstractValuePluginParameter.java trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/BooleanParameter.java trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/DoubleParameter.java trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/IntegerParameter.java trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/PluginParameter.java Added Paths: ----------- trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/PluginParameterListener.java Modified: trunk/src/atrinik/ChangeLog =================================================================== --- trunk/src/atrinik/ChangeLog 2014-01-26 20:26:29 UTC (rev 9557) +++ trunk/src/atrinik/ChangeLog 2014-01-26 20:51:52 UTC (rev 9558) @@ -1,3 +1,7 @@ +2014-01-26 Andreas Kirschbaum + + * Save modified plugin scripts. + 2014-01-24 Andreas Kirschbaum * Properly enable/disable Edit|Grow/Shrink Selection menu. Modified: trunk/src/crossfire/ChangeLog =================================================================== --- trunk/src/crossfire/ChangeLog 2014-01-26 20:26:29 UTC (rev 9557) +++ trunk/src/crossfire/ChangeLog 2014-01-26 20:51:52 UTC (rev 9558) @@ -1,3 +1,7 @@ +2014-01-26 Andreas Kirschbaum + + * Save modified plugin scripts. + 2014-01-24 Andreas Kirschbaum * Properly enable/disable Edit|Grow/Shrink Selection menu. Modified: trunk/src/daimonin/ChangeLog =================================================================== --- trunk/src/daimonin/ChangeLog 2014-01-26 20:26:29 UTC (rev 9557) +++ trunk/src/daimonin/ChangeLog 2014-01-26 20:51:52 UTC (rev 9558) @@ -1,3 +1,7 @@ +2014-01-26 Andreas Kirschbaum + + * Save modified plugin scripts. + 2014-01-24 Andreas Kirschbaum * Properly enable/disable Edit|Grow/Shrink Selection menu. 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-01-26 20:26:29 UTC (rev 9557) +++ trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/Plugin.java 2014-01-26 20:51:52 UTC (rev 9558) @@ -38,6 +38,7 @@ import net.sf.gridarta.plugin.parameter.PluginParameter; import net.sf.gridarta.plugin.parameter.PluginParameterCodec; import net.sf.gridarta.plugin.parameter.PluginParameterFactory; +import net.sf.gridarta.plugin.parameter.PluginParameterListener; import net.sf.gridarta.plugin.parameter.StringParameter; import org.apache.log4j.Category; import org.apache.log4j.Logger; @@ -124,6 +125,20 @@ private boolean modified; /** + * The {@link PluginParameterListener} that is attached to all {@link + * #parameters plugin parameters} to detect changes. + */ + @NotNull + private final PluginParameterListener pluginParameterListener = new PluginParameterListener() { + + @Override + public void changed() { + setModified(); + } + + }; + + /** * Creates a new instance. * @param name the plugin name * @param pluginParameterFactory the plugin parameter factory for creating @@ -162,8 +177,7 @@ } this.code = code; - modified = true; - notifyListeners(); + setModified(); } /** @@ -212,8 +226,8 @@ return; } parameters.add(pluginParameter); - modified = true; - notifyListeners(); + pluginParameter.addPluginParameterListener(pluginParameterListener); + setModified(); } /** @@ -221,9 +235,8 @@ * @param index the plugin parameter's index */ public void removeParameter(final int index) { - parameters.remove(index); - modified = true; - notifyListeners(); + parameters.remove(index).removePluginParameterListener(pluginParameterListener); + setModified(); } /** @@ -287,8 +300,8 @@ */ public void addParameter(@NotNull final PluginParameter<G, A, R, ?> pluginParameter) { parameters.add(pluginParameter); - modified = true; - notifyListeners(); + pluginParameter.addPluginParameterListener(pluginParameterListener); + setModified(); } /** @@ -340,8 +353,7 @@ return; } this.autoBoot = autoBoot; - modified = true; - notifyListeners(); + setModified(); } /** @@ -353,8 +365,7 @@ return; } this.script = script; - modified = true; - notifyListeners(); + setModified(); } /** @@ -366,8 +377,7 @@ return; } this.filter = filter; - modified = true; - notifyListeners(); + setModified(); } /** @@ -377,9 +387,11 @@ * @throws NoSuchParameterException if the index is invalid */ public void convertType(final int index, @NotNull final String newType) throws NoSuchParameterException { - parameters.set(index, pluginParameterFactory.createParameter(newType, codec.toXML(parameters.get(index)))); - modified = true; - notifyListeners(); + final PluginParameter<G, A, R, ?> newParameter = pluginParameterFactory.createParameter(newType, codec.toXML(parameters.get(index))); + final PluginParameter<G, A, R, ?> oldParameter = parameters.set(index, newParameter); + oldParameter.removePluginParameterListener(pluginParameterListener); + newParameter.addPluginParameterListener(pluginParameterListener); + setModified(); } /** @@ -414,6 +426,14 @@ } /** + * Marks this plugin a modified since last save. + */ + private void setModified() { + modified = true; + notifyListeners(); + } + + /** * Returns the location to save this plugin to. * @return the location to save to, or <code>null</code> if the plugin has * no associated location Modified: trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/AbstractPluginParameter.java =================================================================== --- trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/AbstractPluginParameter.java 2014-01-26 20:26:29 UTC (rev 9557) +++ trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/AbstractPluginParameter.java 2014-01-26 20:51:52 UTC (rev 9558) @@ -22,6 +22,7 @@ import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.utils.EventListenerList2; import org.jetbrains.annotations.NotNull; /** @@ -31,6 +32,12 @@ public abstract class AbstractPluginParameter<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V> implements PluginParameter<G, A, R, V> { /** + * The {@link PluginParameterListener listeners} to notify. + */ + @NotNull + private final EventListenerList2<PluginParameterListener> listeners = new EventListenerList2<PluginParameterListener>(PluginParameterListener.class); + + /** * The name of the parameter for the plugin script. */ @NotNull @@ -51,6 +58,22 @@ /** * {@inheritDoc} */ + @Override + public void addPluginParameterListener(@NotNull final PluginParameterListener listener) { + listeners.add(listener); + } + + /** + * {@inheritDoc} + */ + @Override + public void removePluginParameterListener(@NotNull final PluginParameterListener listener) { + listeners.remove(listener); + } + + /** + * {@inheritDoc} + */ @NotNull @Override public String getName() { @@ -62,7 +85,11 @@ */ @Override public void setName(@NotNull final String name) { + if (this.name.equals(name)) { + return; + } this.name = name; + changed(); } /** @@ -79,7 +106,20 @@ */ @Override public void setDescription(@NotNull final String description) { + if (this.description.equals(description)) { + return; + } this.description = description; + changed(); } + /** + * Notifies all listeners that this plugin parameter has changed. + */ + protected void changed() { + for (final PluginParameterListener listener : listeners.getListeners()) { + listener.changed(); + } + } + } Modified: trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/AbstractStringPluginParameter.java =================================================================== --- trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/AbstractStringPluginParameter.java 2014-01-26 20:26:29 UTC (rev 9557) +++ trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/AbstractStringPluginParameter.java 2014-01-26 20:51:52 UTC (rev 9558) @@ -60,7 +60,11 @@ */ @Override public boolean setStringValue(@NotNull final String stringValue) { + if (this.stringValue.equals(stringValue)) { + return true; + } this.stringValue = stringValue; + changed(); return true; } Modified: trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/AbstractValuePluginParameter.java =================================================================== --- trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/AbstractValuePluginParameter.java 2014-01-26 20:26:29 UTC (rev 9557) +++ trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/AbstractValuePluginParameter.java 2014-01-26 20:51:52 UTC (rev 9558) @@ -59,7 +59,11 @@ * @param value the new value */ public void setValue(@NotNull final V value) { + if (this.value.equals(value)) { + return; + } this.value = value; + changed(); } } Modified: trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/BooleanParameter.java =================================================================== --- trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/BooleanParameter.java 2014-01-26 20:26:29 UTC (rev 9557) +++ trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/BooleanParameter.java 2014-01-26 20:51:52 UTC (rev 9558) @@ -120,7 +120,11 @@ * @param falseText the string representation */ public void setFalseText(@NotNull final String falseText) { + if (this.falseText.equals(falseText)) { + return; + } this.falseText = falseText; + changed(); } /** @@ -128,7 +132,11 @@ * @param trueText the string representation */ public void setTrueText(@NotNull final String trueText) { + if (this.trueText.equals(trueText)) { + return; + } this.trueText = trueText; + changed(); } } Modified: trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/DoubleParameter.java =================================================================== --- trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/DoubleParameter.java 2014-01-26 20:26:29 UTC (rev 9557) +++ trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/DoubleParameter.java 2014-01-26 20:51:52 UTC (rev 9558) @@ -125,7 +125,12 @@ * @param max the maximal allowed value */ public void setMax(final double max) { - this.max = Math.max(min, max); + final double newMax = Math.max(min, max); + if (this.max == newMax) { + return; + } + this.max = newMax; + changed(); if (getValue() > this.max) { setValue(this.max); } @@ -144,7 +149,12 @@ * @param min the minimal allowed value */ public void setMin(final double min) { - this.min = Math.min(min, max); + final double newMin = Math.min(min, max); + if (this.min == newMin) { + return; + } + this.min = newMin; + changed(); if (getValue() < this.min) { setValue(this.min); } Modified: trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/IntegerParameter.java =================================================================== --- trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/IntegerParameter.java 2014-01-26 20:26:29 UTC (rev 9557) +++ trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/IntegerParameter.java 2014-01-26 20:51:52 UTC (rev 9558) @@ -123,7 +123,12 @@ * @param max the maximal allowed value */ public void setMax(final int max) { - this.max = Math.max(min, max); + final int newMax = Math.max(min, max); + if (this.max == newMax) { + return; + } + this.max = newMax; + changed(); if (getValue() > this.max) { setValue(this.max); } @@ -142,7 +147,12 @@ * @param min the minimal allowed value */ public void setMin(final int min) { - this.min = Math.min(min, max); + final int newMin = Math.min(min, max); + if (this.min == newMin) { + return; + } + this.min = newMin; + changed(); if (getValue() < this.min) { setValue(this.min); } Modified: trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/PluginParameter.java =================================================================== --- trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/PluginParameter.java 2014-01-26 20:26:29 UTC (rev 9557) +++ trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/PluginParameter.java 2014-01-26 20:51:52 UTC (rev 9558) @@ -33,6 +33,18 @@ public interface PluginParameter<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V> { /** + * Adds a {@link PluginParameterListener listener} to be notified. + * @param listener the listener + */ + void addPluginParameterListener(@NotNull PluginParameterListener listener); + + /** + * Removes a {@link PluginParameterListener listener} to be notified. + * @param listener the listener + */ + void removePluginParameterListener(@NotNull PluginParameterListener listener); + + /** * The name of the parameter. It identifies the parameter in the user * interface and from the plugin script code. * @return the name Added: trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/PluginParameterListener.java =================================================================== --- trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/PluginParameterListener.java (rev 0) +++ trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/PluginParameterListener.java 2014-01-26 20:51:52 UTC (rev 9558) @@ -0,0 +1,36 @@ +/* + * 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.plugin.parameter; + +import java.util.EventListener; + +/** + * Interface for listeners interested in {@link PluginParameter} related + * events. + * @author Andreas Kirschbaum + */ +public interface PluginParameterListener extends EventListener { + + /** + * A value of the plugin parameter has changed. + */ + void changed(); + +} Property changes on: trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/PluginParameterListener.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-02-14 19:43:51
|
Revision: 9561 http://sourceforge.net/p/gridarta/code/9561 Author: akirschbaum Date: 2014-02-14 19:43:45 +0000 (Fri, 14 Feb 2014) Log Message: ----------- Properly update the selected square view if an object is inserted into an empty map square. Modified Paths: -------------- trunk/src/atrinik/ChangeLog trunk/src/crossfire/ChangeLog trunk/src/daimonin/ChangeLog trunk/src/model/src/main/java/net/sf/gridarta/model/mapcursor/MapCursor.java Modified: trunk/src/atrinik/ChangeLog =================================================================== --- trunk/src/atrinik/ChangeLog 2014-02-13 21:18:00 UTC (rev 9560) +++ trunk/src/atrinik/ChangeLog 2014-02-14 19:43:45 UTC (rev 9561) @@ -1,3 +1,8 @@ +2014-02-14 Andreas Kirschbaum + + * Properly update the selected square view if an object is + inserted into an empty map square. + 2014-01-26 Andreas Kirschbaum * Save modified plugin scripts. Modified: trunk/src/crossfire/ChangeLog =================================================================== --- trunk/src/crossfire/ChangeLog 2014-02-13 21:18:00 UTC (rev 9560) +++ trunk/src/crossfire/ChangeLog 2014-02-14 19:43:45 UTC (rev 9561) @@ -1,3 +1,8 @@ +2014-02-14 Andreas Kirschbaum + + * Properly update the selected square view if an object is + inserted into an empty map square. + 2014-01-26 Andreas Kirschbaum * Save modified plugin scripts. Modified: trunk/src/daimonin/ChangeLog =================================================================== --- trunk/src/daimonin/ChangeLog 2014-02-13 21:18:00 UTC (rev 9560) +++ trunk/src/daimonin/ChangeLog 2014-02-14 19:43:45 UTC (rev 9561) @@ -1,3 +1,8 @@ +2014-02-14 Andreas Kirschbaum + + * Properly update the selected square view if an object is + inserted into an empty map square. + 2014-01-26 Andreas Kirschbaum * Save modified plugin scripts. Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/mapcursor/MapCursor.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/mapcursor/MapCursor.java 2014-02-13 21:18:00 UTC (rev 9560) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/mapcursor/MapCursor.java 2014-02-14 19:43:45 UTC (rev 9561) @@ -495,7 +495,7 @@ if (transactionDepth == 0) { final boolean changedPos = !pos.equals(transactionPos) || mapSquare != transactionMapSquare; final boolean changedMode = dragging != transactionDragging; - final boolean changedGameObject = gameObject != transactionGameObject; + final boolean changedGameObject = mapSquare != transactionMapSquare || gameObject != transactionGameObject; final boolean changedSize = !mapRec.equals(transactionMapRec); if (!pos.equals(transactionPos)) { mapGrid.unSetCursor(transactionPos); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-02-14 20:41:56
|
Revision: 9562 http://sourceforge.net/p/gridarta/code/9562 Author: akirschbaum Date: 2014-02-14 20:41:51 +0000 (Fri, 14 Feb 2014) Log Message: ----------- Show all parameters when editing plugin parameters. Modified Paths: -------------- trunk/src/atrinik/ChangeLog trunk/src/crossfire/ChangeLog trunk/src/daimonin/ChangeLog trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/Plugin.java Modified: trunk/src/atrinik/ChangeLog =================================================================== --- trunk/src/atrinik/ChangeLog 2014-02-14 19:43:45 UTC (rev 9561) +++ trunk/src/atrinik/ChangeLog 2014-02-14 20:41:51 UTC (rev 9562) @@ -1,5 +1,7 @@ 2014-02-14 Andreas Kirschbaum + * Show all parameters when editing plugin parameters. + * Properly update the selected square view if an object is inserted into an empty map square. Modified: trunk/src/crossfire/ChangeLog =================================================================== --- trunk/src/crossfire/ChangeLog 2014-02-14 19:43:45 UTC (rev 9561) +++ trunk/src/crossfire/ChangeLog 2014-02-14 20:41:51 UTC (rev 9562) @@ -1,5 +1,7 @@ 2014-02-14 Andreas Kirschbaum + * Show all parameters when editing plugin parameters. + * Properly update the selected square view if an object is inserted into an empty map square. Modified: trunk/src/daimonin/ChangeLog =================================================================== --- trunk/src/daimonin/ChangeLog 2014-02-14 19:43:45 UTC (rev 9561) +++ trunk/src/daimonin/ChangeLog 2014-02-14 20:41:51 UTC (rev 9562) @@ -1,5 +1,7 @@ 2014-02-14 Andreas Kirschbaum + * Show all parameters when editing plugin parameters. + * Properly update the selected square view if an object is inserted into an empty map square. 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-02-14 19:43:45 UTC (rev 9561) +++ trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/Plugin.java 2014-02-14 20:41:51 UTC (rev 9562) @@ -429,6 +429,9 @@ * Marks this plugin a modified since last save. */ private void setModified() { + if (modified) { + return; + } modified = true; notifyListeners(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-02-15 06:34:37
|
Revision: 9563 http://sourceforge.net/p/gridarta/code/9563 Author: akirschbaum Date: 2014-02-15 06:34:30 +0000 (Sat, 15 Feb 2014) Log Message: ----------- Fix File|Options... to actually show the setting dialog. Modified Paths: -------------- trunk/src/atrinik/ChangeLog trunk/src/crossfire/ChangeLog trunk/src/daimonin/ChangeLog trunk/src/gridarta/build.gradle Modified: trunk/src/atrinik/ChangeLog =================================================================== --- trunk/src/atrinik/ChangeLog 2014-02-14 20:41:51 UTC (rev 9562) +++ trunk/src/atrinik/ChangeLog 2014-02-15 06:34:30 UTC (rev 9563) @@ -1,3 +1,7 @@ +2014-02-15 Andreas Kirschbaum + + * Fix File|Options... to actually show the setting dialog. + 2014-02-14 Andreas Kirschbaum * Show all parameters when editing plugin parameters. Modified: trunk/src/crossfire/ChangeLog =================================================================== --- trunk/src/crossfire/ChangeLog 2014-02-14 20:41:51 UTC (rev 9562) +++ trunk/src/crossfire/ChangeLog 2014-02-15 06:34:30 UTC (rev 9563) @@ -1,3 +1,7 @@ +2014-02-15 Andreas Kirschbaum + + * Fix File|Options... to actually show the setting dialog. + 2014-02-14 Andreas Kirschbaum * Show all parameters when editing plugin parameters. Modified: trunk/src/daimonin/ChangeLog =================================================================== --- trunk/src/daimonin/ChangeLog 2014-02-14 20:41:51 UTC (rev 9562) +++ trunk/src/daimonin/ChangeLog 2014-02-15 06:34:30 UTC (rev 9563) @@ -1,3 +1,7 @@ +2014-02-15 Andreas Kirschbaum + + * Fix File|Options... to actually show the setting dialog. + 2014-02-14 Andreas Kirschbaum * Show all parameters when editing plugin parameters. Modified: trunk/src/gridarta/build.gradle =================================================================== --- trunk/src/gridarta/build.gradle 2014-02-14 20:41:51 UTC (rev 9562) +++ trunk/src/gridarta/build.gradle 2014-02-15 06:34:30 UTC (rev 9563) @@ -19,6 +19,7 @@ compile project(':src:project') compile project(':src:textedit') compile project(':src:utils') + runtime name: 'japi-lib-lang', version: '0.1.0', group: 'japi-lib' testCompile name: 'junit', version: '4.2' testCompile project(':src:model').sourceSets.test.output } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-02-15 06:40:40
|
Revision: 9564 http://sourceforge.net/p/gridarta/code/9564 Author: akirschbaum Date: 2014-02-15 06:40:31 +0000 (Sat, 15 Feb 2014) Log Message: ----------- Add missing dependencies to build file. Modified Paths: -------------- trunk/src/atrinik/build.gradle trunk/src/crossfire/build.gradle trunk/src/daimonin/build.gradle Modified: trunk/src/atrinik/build.gradle =================================================================== --- trunk/src/atrinik/build.gradle 2014-02-15 06:34:30 UTC (rev 9563) +++ trunk/src/atrinik/build.gradle 2014-02-15 06:40:31 UTC (rev 9564) @@ -34,6 +34,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') + inputs.files configurations.runtime doFirst { // The following must be executed in doFirst since the configuration // has not been initialized at configuration time. Modified: trunk/src/crossfire/build.gradle =================================================================== --- trunk/src/crossfire/build.gradle 2014-02-15 06:34:30 UTC (rev 9563) +++ trunk/src/crossfire/build.gradle 2014-02-15 06:40:31 UTC (rev 9564) @@ -34,6 +34,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') + inputs.files configurations.runtime doFirst { // The following must be executed in doFirst since the configuration // has not been initialized at configuration time. Modified: trunk/src/daimonin/build.gradle =================================================================== --- trunk/src/daimonin/build.gradle 2014-02-15 06:34:30 UTC (rev 9563) +++ trunk/src/daimonin/build.gradle 2014-02-15 06:40:31 UTC (rev 9564) @@ -34,6 +34,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') + inputs.files configurations.runtime doFirst { // The following must be executed in doFirst since the configuration // has not been initialized at configuration time. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-02-15 12:44:43
|
Revision: 9566 http://sourceforge.net/p/gridarta/code/9566 Author: akirschbaum Date: 2014-02-15 12:44:39 +0000 (Sat, 15 Feb 2014) Log Message: ----------- Merge duplicated code. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/utils/JFileField.java trunk/src/model/src/main/java/net/sf/gridarta/model/io/PathManager.java trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/AbstractPathParameter.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/utils/JFileField.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/utils/JFileField.java 2014-02-15 12:39:00 UTC (rev 9565) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/utils/JFileField.java 2014-02-15 12:44:39 UTC (rev 9566) @@ -140,7 +140,7 @@ */ @NotNull private String getRelativeFile(final File file) { - return baseDir == null ? file.getPath() : PathManager.getMapPath(file.getAbsolutePath(), baseDir); + return baseDir == null ? file.getPath() : PathManager.getMapPath(file, baseDir); } /** 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-02-15 12:39:00 UTC (rev 9565) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/io/PathManager.java 2014-02-15 12:44:39 UTC (rev 9566) @@ -74,21 +74,19 @@ */ @NotNull public String getMapPath(@NotNull final File file) { - return getMapPath(file.getPath(), projectSettings.getMapsDirectory()); + return getMapPath(file, projectSettings.getMapsDirectory()); } /** - * Create map path. Replaces all occurrences of '\' with '/' and removes the - * path to the map directory (absolute, relative or canonical) from the - * path. - * @param mapDir the map dir - * @param path to create map path from - * @return fixed path + * Returns a relative path path for a {@link File}. + * @param file the file + * @param baseDir the base directory to relativize against + * @return the relative path */ @NotNull - public static String getMapPath(@NotNull final String path, @NotNull final File mapDir) { - @NotNull final String mapDirName = mapDir.getPath(); - String mapPath = path.replace('\\', '/'); + public static String getMapPath(@NotNull final File file, @NotNull final File baseDir) { + @NotNull final String mapDirName = baseDir.getPath(); + String mapPath = file.getPath().replace('\\', '/'); if (mapPath.startsWith(mapDirName)) { mapPath = mapPath.substring(mapDirName.length()); } Modified: trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/AbstractPathParameter.java =================================================================== --- trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/AbstractPathParameter.java 2014-02-15 12:39:00 UTC (rev 9565) +++ trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/AbstractPathParameter.java 2014-02-15 12:44:39 UTC (rev 9566) @@ -63,7 +63,7 @@ * @param file the file */ public void setFile(@NotNull final File file) { - setStringValue(PathManager.getMapPath(file.getAbsolutePath(), baseDir)); + setStringValue(PathManager.getMapPath(file, baseDir)); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-02-15 12:53:02
|
Revision: 9567 http://sourceforge.net/p/gridarta/code/9567 Author: akirschbaum Date: 2014-02-15 12:52:58 +0000 (Sat, 15 Feb 2014) Log Message: ----------- Extract PathManagerUtils from PathManager. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/prefs/AppPreferencesModel.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/maptilepane/TilePanel.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/utils/JFileField.java trunk/src/model/src/main/java/net/sf/gridarta/model/exitconnector/ExitLocation.java trunk/src/model/src/main/java/net/sf/gridarta/model/io/PathManager.java trunk/src/model/src/main/java/net/sf/gridarta/model/maplocation/MapLocation.java trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/AbstractPathParameter.java Added Paths: ----------- trunk/src/model/src/main/java/net/sf/gridarta/model/io/PathManagerUtils.java trunk/src/model/src/test/java/net/sf/gridarta/model/io/PathManagerUtilsTest.java Removed Paths: ------------- trunk/src/model/src/test/java/net/sf/gridarta/model/io/PathManagerTest.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/prefs/AppPreferencesModel.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/prefs/AppPreferencesModel.java 2014-02-15 12:44:39 UTC (rev 9566) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/prefs/AppPreferencesModel.java 2014-02-15 12:52:58 UTC (rev 9567) @@ -21,7 +21,7 @@ import java.util.prefs.Preferences; import net.sf.gridarta.MainControl; -import net.sf.gridarta.model.io.PathManager; +import net.sf.gridarta.model.io.PathManagerUtils; import org.jetbrains.annotations.NotNull; /** @@ -85,7 +85,7 @@ * @param server the server setting */ public static void setServer(@NotNull final CharSequence server) { - PREFERENCES.put(PREFERENCES_APP_SERVER, PathManager.path(server)); + PREFERENCES.put(PREFERENCES_APP_SERVER, PathManagerUtils.path(server)); } /** @@ -93,7 +93,7 @@ * @param client the client setting */ public static void setClient(@NotNull final CharSequence client) { - PREFERENCES.put(PREFERENCES_APP_CLIENT, PathManager.path(client)); + PREFERENCES.put(PREFERENCES_APP_CLIENT, PathManagerUtils.path(client)); } /** @@ -101,7 +101,7 @@ * @param editor the editor setting */ public static void setEditor(@NotNull final CharSequence editor) { - PREFERENCES.put(PREFERENCES_APP_EDITOR, PathManager.path(editor)); + PREFERENCES.put(PREFERENCES_APP_EDITOR, PathManagerUtils.path(editor)); } /** Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/maptilepane/TilePanel.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/maptilepane/TilePanel.java 2014-02-15 12:44:39 UTC (rev 9566) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/maptilepane/TilePanel.java 2014-02-15 12:52:58 UTC (rev 9567) @@ -34,7 +34,7 @@ import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.filechooser.FileFilter; -import net.sf.gridarta.model.io.PathManager; +import net.sf.gridarta.model.io.PathManagerUtils; import net.sf.gridarta.utils.ActionBuilderUtils; import net.sf.gridarta.utils.FileChooserUtils; import net.sf.japi.swing.action.ActionBuilder; @@ -300,11 +300,11 @@ isRelative = !isRelative; updateText(); } - final String relRef = new StringBuilder().append('/').append(PathManager.absoluteToRelative(absoluteReference.getPath() + '/', tmpRelativeReference.getPath())).toString(); + final String relRef = new StringBuilder().append('/').append(PathManagerUtils.absoluteToRelative(absoluteReference.getPath() + '/', tmpRelativeReference.getPath())).toString(); if (isRelative) { - textField.setText(PathManager.absoluteToRelative(relRef, path)); + textField.setText(PathManagerUtils.absoluteToRelative(relRef, path)); } else { - textField.setText(PathManager.relativeToAbsolute(relRef, path)); + textField.setText(PathManagerUtils.relativeToAbsolute(relRef, path)); } } @@ -313,7 +313,7 @@ */ public void updateRAState() { final String path = getText(); - isRelative = PathManager.isRelative(path); + isRelative = PathManagerUtils.isRelative(path); updateText(); } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/utils/JFileField.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/utils/JFileField.java 2014-02-15 12:44:39 UTC (rev 9566) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/utils/JFileField.java 2014-02-15 12:52:58 UTC (rev 9567) @@ -28,7 +28,7 @@ import javax.swing.JFileChooser; import javax.swing.JTextField; import javax.swing.event.DocumentListener; -import net.sf.gridarta.model.io.PathManager; +import net.sf.gridarta.model.io.PathManagerUtils; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; import net.sf.japi.swing.action.ActionMethod; @@ -140,7 +140,7 @@ */ @NotNull private String getRelativeFile(final File file) { - return baseDir == null ? file.getPath() : PathManager.getMapPath(file, baseDir); + return baseDir == null ? file.getPath() : PathManagerUtils.getMapPath(file, baseDir); } /** Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/exitconnector/ExitLocation.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/exitconnector/ExitLocation.java 2014-02-15 12:44:39 UTC (rev 9566) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/exitconnector/ExitLocation.java 2014-02-15 12:52:58 UTC (rev 9567) @@ -23,6 +23,7 @@ import java.io.File; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.io.PathManager; +import net.sf.gridarta.model.io.PathManagerUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -103,7 +104,7 @@ final String targetMapComponent = getMapComponent(targetMapPath); if (sourceMapComponent == null ? targetMapComponent == null : sourceMapComponent.equals(targetMapComponent)) { // relative reference - mapPath = PathManager.absoluteToRelative(sourceMapPath, targetMapPath); + mapPath = PathManagerUtils.absoluteToRelative(sourceMapPath, targetMapPath); } else { // absolute reference mapPath = targetMapPath; 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-02-15 12:44:39 UTC (rev 9566) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/io/PathManager.java 2014-02-15 12:52:58 UTC (rev 9567) @@ -21,9 +21,7 @@ import java.io.File; import java.io.IOException; -import java.util.regex.Pattern; import net.sf.gridarta.model.settings.ProjectSettings; -import net.sf.gridarta.utils.StringUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -38,21 +36,6 @@ public class PathManager { /** - * A {@link Pattern} that matches redundant directory parts like "dir/../". - */ - @NotNull - private static final Pattern PATTERN_REDUNDANT = Pattern.compile("[^/]+/\\.\\./"); - - /** - * A {@link Pattern} that matches redundant directory separators. - */ - @NotNull - private static final Pattern PATTERN_SLASHES = Pattern.compile("//*"); - - - // NOTE: There are certainly faster algorithms. But these methods are rarely used. - - /** * The {@link ProjectSettings} instance for obtaining folder information. */ @NotNull @@ -74,37 +57,10 @@ */ @NotNull public String getMapPath(@NotNull final File file) { - return getMapPath(file, projectSettings.getMapsDirectory()); + return PathManagerUtils.getMapPath(file, projectSettings.getMapsDirectory()); } /** - * Returns a relative path path for a {@link File}. - * @param file the file - * @param baseDir the base directory to relativize against - * @return the relative path - */ - @NotNull - public static String getMapPath(@NotNull final File file, @NotNull final File baseDir) { - @NotNull final String mapDirName = baseDir.getPath(); - String mapPath = file.getPath().replace('\\', '/'); - if (mapPath.startsWith(mapDirName)) { - mapPath = mapPath.substring(mapDirName.length()); - } - if (mapPath.startsWith(new File(mapDirName).getAbsolutePath())) { - mapPath = mapPath.substring(new File(mapDirName).getAbsolutePath().length()); - } - try { - if (mapPath.startsWith(new File(mapDirName).getCanonicalPath())) { - mapPath = mapPath.substring(new File(mapDirName).getCanonicalPath().length()); - } - } catch (final IOException ignored) { - // ignore - } - mapPath = mapPath.replace('\\', '/'); - return mapPath; - } - - /** * Returns a map path for a {@link File}. * @param file the file * @return the map path or <code>null</code> if the file is not within the @@ -127,149 +83,4 @@ return mapPath.replace('\\', '/'); } - /** - * Check whether a path is absolute. Paths starting with "/" are absolute, - * paths starting with other characters are relative. Empty paths are - * relative. - * @param path the path to check - * @return <code>true</code> if <var>path</var> is absolute, - * <code>false</code> otherwise - * @see #isRelative(String) which nearly is the opposite of this method - */ - public static boolean isAbsolute(@NotNull final String path) { - return path.startsWith("/") || new File(path).isAbsolute(); - } - - /** - * Check whether a path is relative. Paths not starting with "/" are - * relative, paths starting with are absolute. Empty paths are relative. - * @param path the path to check - * @return <code>true</code> if <var>path</var> is relative, - * <code>false</code> otherwise - * @see #isAbsolute(String) which nearly is the opposite of this method - */ - public static boolean isRelative(@NotNull final String path) { - return !path.startsWith("/") && !new File(path).isAbsolute(); - } - - /** - * Converts a relative path to an absolute path. If the path already is - * absolute, this method simply returns the path. If the reference ends on - * "/", it is treated as being a base directory, otherwise a file that's - * directory is taken as base. - * @param reference the reference file the relative path works on - * @param relative destination file with relative path - * @return absolute path from the base directory - */ - @NotNull - public static String relativeToAbsolute(@NotNull final String reference, @NotNull final String relative) { - final String normalizedReference = reference.replace('\\', '/'); - final String normalizedRelative = relative.replace('\\', '/'); - if (isAbsolute(normalizedRelative)) { - return normalizedRelative; - } - String work = normalizedReference.substring(0, normalizedReference.lastIndexOf('/') + 1) + normalizedRelative; // + 1 to include the "/" - String work2; - do { - work2 = work; - work = PATTERN_REDUNDANT.matcher(work2).replaceAll(""); - } while (!work2.equals(work)); - return work; - } - - /** - * Converts an absolute path to a relative path. If the path already is - * relative, this method simply returns the path. If the reference ends on - * "/", it is treated as being a base directory, otherwise a file that's - * directory is taken as base. - * @param reference the reference file the relative path works on - * @param absolute destination file with relative path - * @return absolute path from the base directory - */ - @NotNull - public static String absoluteToRelative(@NotNull final String reference, @NotNull final String absolute) { - final String normalizedReference = reference.replace('\\', '/'); - final String normalizedAbsolute = absolute.replace('\\', '/'); - if (isRelative(normalizedAbsolute)) { - return normalizedAbsolute; - } - //String reference2 = - // First: Strip equal path parts - final int difference = findDifference(normalizedReference, normalizedAbsolute); - final StringBuilder relative = new StringBuilder(normalizedAbsolute.substring(difference)); - final CharSequence referencePath = normalizedReference.substring(difference); - for (int i = 0, l = findOccurrences(referencePath, '/'); i < l; i++) { - relative.insert(0, "../"); - } - return relative.toString(); - } - - /** - * Helper method that returns the first string index at which two strings - * denoting paths aren't identical. That is, the index always points at the - * beginning or a '/'-character. The return value of this method is in every - * case good for a String.substring() invocation start index. - * @param s1 first string to compare - * @param s2 second string to compare - * @return index of first / after which s1 and s2 aren't identical or 0 if - * they differ from start - */ - private static int findDifference(@NotNull final CharSequence s1, @NotNull final CharSequence s2) { - int s1slash = -1; - int s2slash = -1; - char c1 = (char) 0; // initialize for equality for first loop cycle - char c2 = (char) 0; - for (int index = 0, l1 = s1.length(), l2 = s2.length(); index < l1 && index < l2 && c1 == c2; index++) { - c1 = s1.charAt(index); - c2 = s2.charAt(index); - if (c1 == '/') { - s1slash = index; - } - if (c2 == '/') { - s2slash = index; - } - } - return Math.min(s1slash, s2slash) + 1; - } - - /** - * Counts the occurrences of a character within a string. - * @param s the string to count in - * @param c character to count - * @return number of occurrences of <var>c</var> in <var>s</var> - */ - private static int findOccurrences(@NotNull final CharSequence s, final char c) { - int occurrences = 0; - for (int i = 0, l = s.length(); i < l; i++) { - if (s.charAt(i) == c) { - occurrences++; - } - } - return occurrences; - } - - /** - * Create a reasonable path. - * @param str the string to create path from - * @return path - */ - @NotNull - public static String path(@NotNull final CharSequence str) { - String path = StringUtils.PATTERN_BACKSLASH.matcher(str).replaceAll("/"); - path = path.endsWith("/") ? path.substring(0, path.length() - 1) : path; - path = path.startsWith("file:") ? path.substring("file:".length()) : path; - path = PATTERN_SLASHES.matcher(path).replaceAll("/"); - return path; - } - - /** - * Returns the given path in absolute form. - * @param path the path to convert - * @return the absolute path - */ - @NotNull - public static String getAbsolutePath(@NotNull final CharSequence path) { - return relativeToAbsolute(System.getProperty("user.dir") + "/dummy", path(path)); - } - } Added: trunk/src/model/src/main/java/net/sf/gridarta/model/io/PathManagerUtils.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/io/PathManagerUtils.java (rev 0) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/io/PathManagerUtils.java 2014-02-15 12:52:58 UTC (rev 9567) @@ -0,0 +1,224 @@ +/* + * 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.model.io; + +import java.io.File; +import java.io.IOException; +import java.util.regex.Pattern; +import net.sf.gridarta.utils.StringUtils; +import org.jetbrains.annotations.NotNull; + +/** + * Utility class for converting relative map paths to absolute map paths and + * vice versa. + */ +public class PathManagerUtils { + + /** + * A {@link Pattern} that matches redundant directory parts like "dir/../". + */ + @NotNull + private static final Pattern PATTERN_REDUNDANT = Pattern.compile("[^/]+/\\.\\./"); + + /** + * A {@link Pattern} that matches redundant directory separators. + */ + @NotNull + private static final Pattern PATTERN_SLASHES = Pattern.compile("//*"); + + /** + * Private constructor to prevent instantiation. + */ + private PathManagerUtils() { + } + + /** + * Returns a relative path path for a {@link File}. + * @param file the file + * @param baseDir the base directory to relativize against + * @return the relative path + */ + @NotNull + public static String getMapPath(@NotNull final File file, @NotNull final File baseDir) { + @NotNull final String mapDirName = baseDir.getPath(); + String mapPath = file.getPath().replace('\\', '/'); + if (mapPath.startsWith(mapDirName)) { + mapPath = mapPath.substring(mapDirName.length()); + } + if (mapPath.startsWith(new File(mapDirName).getAbsolutePath())) { + mapPath = mapPath.substring(new File(mapDirName).getAbsolutePath().length()); + } + try { + if (mapPath.startsWith(new File(mapDirName).getCanonicalPath())) { + mapPath = mapPath.substring(new File(mapDirName).getCanonicalPath().length()); + } + } catch (final IOException ignored) { + // ignore + } + mapPath = mapPath.replace('\\', '/'); + return mapPath; + } + + /** + * Check whether a path is absolute. Paths starting with "/" are absolute, + * paths starting with other characters are relative. Empty paths are + * relative. + * @param path the path to check + * @return <code>true</code> if <var>path</var> is absolute, + * <code>false</code> otherwise + * @see #isRelative(String) which nearly is the opposite of this method + */ + public static boolean isAbsolute(@NotNull final String path) { + return path.startsWith("/") || new File(path).isAbsolute(); + } + + /** + * Check whether a path is relative. Paths not starting with "/" are + * relative, paths starting with are absolute. Empty paths are relative. + * @param path the path to check + * @return <code>true</code> if <var>path</var> is relative, + * <code>false</code> otherwise + * @see #isAbsolute(String) which nearly is the opposite of this method + */ + public static boolean isRelative(@NotNull final String path) { + return !path.startsWith("/") && !new File(path).isAbsolute(); + } + + /** + * Converts a relative path to an absolute path. If the path already is + * absolute, this method simply returns the path. If the reference ends on + * "/", it is treated as being a base directory, otherwise a file that's + * directory is taken as base. + * @param reference the reference file the relative path works on + * @param relative destination file with relative path + * @return absolute path from the base directory + */ + @NotNull + public static String relativeToAbsolute(@NotNull final String reference, @NotNull final String relative) { + final String normalizedReference = reference.replace('\\', '/'); + final String normalizedRelative = relative.replace('\\', '/'); + if (isAbsolute(normalizedRelative)) { + return normalizedRelative; + } + String work = normalizedReference.substring(0, normalizedReference.lastIndexOf('/') + 1) + normalizedRelative; // + 1 to include the "/" + String work2; + do { + work2 = work; + work = PATTERN_REDUNDANT.matcher(work2).replaceAll(""); + } while (!work2.equals(work)); + return work; + } + + /** + * Converts an absolute path to a relative path. If the path already is + * relative, this method simply returns the path. If the reference ends on + * "/", it is treated as being a base directory, otherwise a file that's + * directory is taken as base. + * @param reference the reference file the relative path works on + * @param absolute destination file with relative path + * @return absolute path from the base directory + */ + @NotNull + public static String absoluteToRelative(@NotNull final String reference, @NotNull final String absolute) { + final String normalizedReference = reference.replace('\\', '/'); + final String normalizedAbsolute = absolute.replace('\\', '/'); + if (isRelative(normalizedAbsolute)) { + return normalizedAbsolute; + } + //String reference2 = + // First: Strip equal path parts + final int difference = findDifference(normalizedReference, normalizedAbsolute); + final StringBuilder relative = new StringBuilder(normalizedAbsolute.substring(difference)); + final CharSequence referencePath = normalizedReference.substring(difference); + for (int i = 0, l = findOccurrences(referencePath, '/'); i < l; i++) { + relative.insert(0, "../"); + } + return relative.toString(); + } + + /** + * Helper method that returns the first string index at which two strings + * denoting paths aren't identical. That is, the index always points at the + * beginning or a '/'-character. The return value of this method is in every + * case good for a String.substring() invocation start index. + * @param s1 first string to compare + * @param s2 second string to compare + * @return index of first / after which s1 and s2 aren't identical or 0 if + * they differ from start + */ + private static int findDifference(@NotNull final CharSequence s1, @NotNull final CharSequence s2) { + int s1slash = -1; + int s2slash = -1; + char c1 = (char) 0; // initialize for equality for first loop cycle + char c2 = (char) 0; + for (int index = 0, l1 = s1.length(), l2 = s2.length(); index < l1 && index < l2 && c1 == c2; index++) { + c1 = s1.charAt(index); + c2 = s2.charAt(index); + if (c1 == '/') { + s1slash = index; + } + if (c2 == '/') { + s2slash = index; + } + } + return Math.min(s1slash, s2slash) + 1; + } + + /** + * Counts the occurrences of a character within a string. + * @param s the string to count in + * @param c character to count + * @return number of occurrences of <var>c</var> in <var>s</var> + */ + private static int findOccurrences(@NotNull final CharSequence s, final char c) { + int occurrences = 0; + for (int i = 0, l = s.length(); i < l; i++) { + if (s.charAt(i) == c) { + occurrences++; + } + } + return occurrences; + } + + /** + * Create a reasonable path. + * @param str the string to create path from + * @return path + */ + @NotNull + public static String path(@NotNull final CharSequence str) { + String path = StringUtils.PATTERN_BACKSLASH.matcher(str).replaceAll("/"); + path = path.endsWith("/") ? path.substring(0, path.length() - 1) : path; + path = path.startsWith("file:") ? path.substring("file:".length()) : path; + path = PATTERN_SLASHES.matcher(path).replaceAll("/"); + return path; + } + + /** + * Returns the given path in absolute form. + * @param path the path to convert + * @return the absolute path + */ + @NotNull + public static String getAbsolutePath(@NotNull final CharSequence path) { + return relativeToAbsolute(System.getProperty("user.dir") + "/dummy", path(path)); + } + +} Property changes on: trunk/src/model/src/main/java/net/sf/gridarta/model/io/PathManagerUtils.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/model/src/main/java/net/sf/gridarta/model/maplocation/MapLocation.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/maplocation/MapLocation.java 2014-02-15 12:44:39 UTC (rev 9566) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/maplocation/MapLocation.java 2014-02-15 12:52:58 UTC (rev 9567) @@ -26,6 +26,7 @@ import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.io.PathManager; +import net.sf.gridarta.model.io.PathManagerUtils; import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.mapmodel.MapSquare; import net.sf.gridarta.utils.StringUtils; @@ -108,7 +109,7 @@ baseMapPath = pathManager.getMapPath(mapFile); } } - final String canonicalMapPath = PathManager.relativeToAbsolute(baseMapPath, mapPath); + final String canonicalMapPath = PathManagerUtils.relativeToAbsolute(baseMapPath, mapPath); final int mapX = getMapX(gameObject); final int mapY = getMapY(gameObject); return new MapLocation(canonicalMapPath, mapX, mapY); Deleted: trunk/src/model/src/test/java/net/sf/gridarta/model/io/PathManagerTest.java =================================================================== --- trunk/src/model/src/test/java/net/sf/gridarta/model/io/PathManagerTest.java 2014-02-15 12:44:39 UTC (rev 9566) +++ trunk/src/model/src/test/java/net/sf/gridarta/model/io/PathManagerTest.java 2014-02-15 12:52:58 UTC (rev 9567) @@ -1,83 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2010 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.model.io; - -import org.junit.Assert; -import org.junit.Test; - -/** - * Test for {@link PathManager}. - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - */ -public class PathManagerTest { - - /** - * Test case for {@link PathManager#path(CharSequence)}. - */ - @Test - public void testPath() { - Assert.assertEquals("Expecting trailing slash from directories being removed.", "/foo", PathManager.path("/foo/")); - Assert.assertEquals("Expecting file: URIs being converted to URIs without scheme.", "/foo", PathManager.path("file:/foo/")); - Assert.assertEquals("Expecting multiple // characters to be collapsed.", "/foo/bar", PathManager.path("//foo///bar")); - } - - /** - * Test case for {@link PathManager#absoluteToRelative(String, String)}. - */ - @Test - public void testAbsoluteToRelative() { - Assert.assertEquals("../stoneglow/stoneglow_0000", PathManager.absoluteToRelative("/relic/castle_0000", "/stoneglow/stoneglow_0000")); - Assert.assertEquals("../stoneglow/stoneglow_0000", PathManager.absoluteToRelative("/relic/", "/stoneglow/stoneglow_0000")); - } - - /** - * Test case for {@link PathManager#absoluteToRelative(String, String)}. - */ - @Test - public void testRelativeToAbsolute() { - Assert.assertEquals("/stoneglow/stoneglow_0000", PathManager.relativeToAbsolute("/relic/castle_0000", "../stoneglow/stoneglow_0000")); - Assert.assertEquals("/stoneglow/stoneglow_0000", PathManager.relativeToAbsolute("/relic/", "../stoneglow/stoneglow_0000")); - Assert.assertEquals("/stoneglow/stoneglow_0000", PathManager.relativeToAbsolute("/relic/castle_0000", "/stoneglow/stoneglow_0000")); - Assert.assertEquals("/stoneglow/stoneglow_0000", PathManager.relativeToAbsolute("/relic/", "/stoneglow/stoneglow_0000")); - } - - /** - * Test case for {@link PathManager#isRelative(String)}. - */ - @Test - public void testIsRelative() { - Assert.assertTrue(PathManager.isRelative("../stoneglow/stoneglow_0000")); - Assert.assertTrue(PathManager.isRelative("stoneglow/stoneglow_0000")); - Assert.assertFalse(PathManager.isRelative("/stoneglow/stoneglow_0000")); - Assert.assertTrue(PathManager.isRelative("")); - } - - /** - * Test case for {@link PathManager#isAbsolute(String)}. - */ - @Test - public void testIsAbsolute() { - Assert.assertFalse(PathManager.isAbsolute("../stoneglow/stoneglow_0000")); - Assert.assertFalse(PathManager.isAbsolute("stoneglow/stoneglow_0000")); - Assert.assertTrue(PathManager.isAbsolute("/stoneglow/stoneglow_0000")); - Assert.assertFalse(PathManager.isAbsolute("")); - } - -} Copied: trunk/src/model/src/test/java/net/sf/gridarta/model/io/PathManagerUtilsTest.java (from rev 9564, trunk/src/model/src/test/java/net/sf/gridarta/model/io/PathManagerTest.java) =================================================================== --- trunk/src/model/src/test/java/net/sf/gridarta/model/io/PathManagerUtilsTest.java (rev 0) +++ trunk/src/model/src/test/java/net/sf/gridarta/model/io/PathManagerUtilsTest.java 2014-02-15 12:52:58 UTC (rev 9567) @@ -0,0 +1,83 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 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.model.io; + +import org.junit.Assert; +import org.junit.Test; + +/** + * Test for {@link PathManager}. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public class PathManagerUtilsTest { + + /** + * Test case for {@link PathManagerUtils#path(CharSequence)}. + */ + @Test + public void testPath() { + Assert.assertEquals("Expecting trailing slash from directories being removed.", "/foo", PathManagerUtils.path("/foo/")); + Assert.assertEquals("Expecting file: URIs being converted to URIs without scheme.", "/foo", PathManagerUtils.path("file:/foo/")); + Assert.assertEquals("Expecting multiple // characters to be collapsed.", "/foo/bar", PathManagerUtils.path("//foo///bar")); + } + + /** + * Test case for {@link PathManagerUtils#absoluteToRelative(String, String)}. + */ + @Test + public void testAbsoluteToRelative() { + Assert.assertEquals("../stoneglow/stoneglow_0000", PathManagerUtils.absoluteToRelative("/relic/castle_0000", "/stoneglow/stoneglow_0000")); + Assert.assertEquals("../stoneglow/stoneglow_0000", PathManagerUtils.absoluteToRelative("/relic/", "/stoneglow/stoneglow_0000")); + } + + /** + * Test case for {@link PathManagerUtils#absoluteToRelative(String, String)}. + */ + @Test + public void testRelativeToAbsolute() { + Assert.assertEquals("/stoneglow/stoneglow_0000", PathManagerUtils.relativeToAbsolute("/relic/castle_0000", "../stoneglow/stoneglow_0000")); + Assert.assertEquals("/stoneglow/stoneglow_0000", PathManagerUtils.relativeToAbsolute("/relic/", "../stoneglow/stoneglow_0000")); + Assert.assertEquals("/stoneglow/stoneglow_0000", PathManagerUtils.relativeToAbsolute("/relic/castle_0000", "/stoneglow/stoneglow_0000")); + Assert.assertEquals("/stoneglow/stoneglow_0000", PathManagerUtils.relativeToAbsolute("/relic/", "/stoneglow/stoneglow_0000")); + } + + /** + * Test case for {@link PathManagerUtils#isRelative(String)}. + */ + @Test + public void testIsRelative() { + Assert.assertTrue(PathManagerUtils.isRelative("../stoneglow/stoneglow_0000")); + Assert.assertTrue(PathManagerUtils.isRelative("stoneglow/stoneglow_0000")); + Assert.assertFalse(PathManagerUtils.isRelative("/stoneglow/stoneglow_0000")); + Assert.assertTrue(PathManagerUtils.isRelative("")); + } + + /** + * Test case for {@link PathManagerUtils#isAbsolute(String)}. + */ + @Test + public void testIsAbsolute() { + Assert.assertFalse(PathManagerUtils.isAbsolute("../stoneglow/stoneglow_0000")); + Assert.assertFalse(PathManagerUtils.isAbsolute("stoneglow/stoneglow_0000")); + Assert.assertTrue(PathManagerUtils.isAbsolute("/stoneglow/stoneglow_0000")); + Assert.assertFalse(PathManagerUtils.isAbsolute("")); + } + +} Property changes on: trunk/src/model/src/test/java/net/sf/gridarta/model/io/PathManagerUtilsTest.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Modified: trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/AbstractPathParameter.java =================================================================== --- trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/AbstractPathParameter.java 2014-02-15 12:44:39 UTC (rev 9566) +++ trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/AbstractPathParameter.java 2014-02-15 12:52:58 UTC (rev 9567) @@ -22,7 +22,7 @@ import java.io.File; 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.io.PathManagerUtils; import net.sf.gridarta.model.maparchobject.MapArchObject; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -63,7 +63,7 @@ * @param file the file */ public void setFile(@NotNull final File file) { - setStringValue(PathManager.getMapPath(file, baseDir)); + setStringValue(PathManagerUtils.getMapPath(file, baseDir)); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-02-16 18:55:35
|
Revision: 9569 http://sourceforge.net/p/gridarta/code/9569 Author: akirschbaum Date: 2014-02-16 18:55:23 +0000 (Sun, 16 Feb 2014) Log Message: ----------- Replace String/File representations of map paths with MapPath/MapFile instances. Modified Paths: -------------- 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/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java 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/maincontrol/DefaultEditorFactory.java trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/mapcontrol/DefaultMapControlFactory.java trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/AbstractFlatMapRenderer.java trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java 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/maincontrol/DefaultEditorFactory.java trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/mapcontrol/DefaultMapControlFactory.java trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/validation/checks/NonAbsoluteExitPathChecker.java trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/model/mapcontrol/DefaultMapControlFactory.java trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AbstractMoveSquareAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AddBookmarkAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/AbstractServerActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/AttachTiledMaps.java trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/ExitConnectorActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/delayedmapmodel/DelayedMapModelListenerManager.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/bookmarks/MapMenuEntryIcons.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/AttributesPaneBuilder.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/GameObjectAttributesDialog.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/goexit/GoExitDialog.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/goexit/GoExitDialogManager.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/goexit/MapListCellRenderer.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gomap/GoMapDialog.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gomap/MapListCellRenderer.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/parameter/MapParameterView.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mainwindow/GameObjectTextEditorTab.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/MapFileActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/EnterMap.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/MapActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/maptilepane/FlatMapTilePane.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/maptilepane/IsoMapTilePane.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapview/DefaultMapView.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapview/ErroneousMapSquares.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapview/MapViewsManager.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/AbstractIsoMapRenderer.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/ImageCreator2.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapdesktop/WindowAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapfiles/PickmapState.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapimagecache/MapImageCache.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/AbstractMapMenuPreferences.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/BookmarksMapMenuPreferences.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenu.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenuAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenuEntryMap.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenuEntryTreeCellRenderer.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenuLoader.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenuUtils.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/RecentMapMenuPreferences.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/RecentManager.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/gameobjectattributes/ErrorListView.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/gameobjectattributes/GameObjectAttributesControl.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/pickmapchooser/PickmapChooserControl.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/pickmapchooser/PickmapChooserModel.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/pickmapchooser/PickmapChooserView.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/selectedsquare/SelectedSquareView.java trunk/src/gridarta/src/main/java/net/sf/gridarta/mainactions/MainActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/EditorFactory.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages.properties trunk/src/gridarta/src/test/java/net/sf/gridarta/action/SelectedSquareActionsTest.java trunk/src/gridarta/src/test/java/net/sf/gridarta/actions/ExitConnectorActionsTest.java trunk/src/gridarta/src/test/java/net/sf/gridarta/gui/copybuffer/CopyBufferTest.java trunk/src/gridarta/src/test/java/net/sf/gridarta/gui/map/test/TestMapControlCreatorUtils.java trunk/src/gridarta/src/test/java/net/sf/gridarta/gui/mapmenu/MapMenuManagerTest.java trunk/src/gridarta/src/test/java/net/sf/gridarta/gui/mapmenu/MapMenuPreferencesTest.java trunk/src/gridarta/src/test/java/net/sf/gridarta/gui/mapmenu/MapMenuTest.java trunk/src/gridarta/src/test/java/net/sf/gridarta/gui/mapmenu/MapMenuUtilsTest.java trunk/src/gridarta/src/test/java/net/sf/gridarta/gui/mapmenu/TestMapMenuPreferences.java trunk/src/model/src/main/java/net/sf/gridarta/model/exitconnector/ExitLocation.java trunk/src/model/src/main/java/net/sf/gridarta/model/index/MapsIndex.java trunk/src/model/src/main/java/net/sf/gridarta/model/index/MapsIndexer.java trunk/src/model/src/main/java/net/sf/gridarta/model/io/PathManager.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/main/java/net/sf/gridarta/model/mapcontrol/MapControlFactory.java trunk/src/model/src/main/java/net/sf/gridarta/model/maplocation/MapLocation.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapmanager/AbstractMapManager.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapmanager/DefaultMapManager.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapmanager/DefaultPickmapManager.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapmanager/MapManager.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/DefaultMapModel.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/MapModel.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/MapModelListener.java trunk/src/model/src/main/java/net/sf/gridarta/model/mappathnormalizer/MapPathNormalizer.java trunk/src/model/src/main/java/net/sf/gridarta/model/validation/checks/ExitChecker.java trunk/src/model/src/main/java/net/sf/gridarta/model/validation/checks/NonAbsoluteExitPathError.java trunk/src/model/src/main/java/net/sf/gridarta/model/validation/checks/TilePathsChecker.java trunk/src/model/src/test/java/net/sf/gridarta/model/index/MapsIndexTest.java trunk/src/model/src/test/java/net/sf/gridarta/model/index/MapsIndexerTest.java trunk/src/model/src/test/java/net/sf/gridarta/model/io/DefaultMapReaderTest.java trunk/src/model/src/test/java/net/sf/gridarta/model/mapcontrol/TestMapControlCreator.java trunk/src/model/src/test/java/net/sf/gridarta/model/mapcontrol/TestMapControlFactory.java trunk/src/model/src/test/java/net/sf/gridarta/model/mapmanager/DefaultMapManagerTest.java trunk/src/model/src/test/java/net/sf/gridarta/model/mapmodel/DefaultMapModelTest.java trunk/src/plugin/src/test/java/net/sf/gridarta/plugin/parameter/PluginParameterCodecTest.java trunk/src/project/src/main/java/net/sf/gridarta/project/ProjectModel.java Added Paths: ----------- trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/DifferentMapBaseException.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/MapFile.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/MapPath.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/MapPathUtils.java trunk/src/model/src/test/java/net/sf/gridarta/model/mapmodel/MapFileTest.java trunk/src/model/src/test/java/net/sf/gridarta/model/mapmodel/MapPathTest.java trunk/src/model/src/test/java/net/sf/gridarta/model/mapmodel/MapPathUtilsTest.java 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-02-15 16:33:25 UTC (rev 9568) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/actions/AtrinikServerActions.java 2014-02-16 18:55:23 UTC (rev 9569) @@ -25,7 +25,6 @@ import java.net.Socket; import net.sf.gridarta.actions.AbstractServerActions; import net.sf.gridarta.gui.map.mapview.MapViewManager; -import net.sf.gridarta.model.io.PathManager; import net.sf.gridarta.model.mapmanager.FileControl; import net.sf.gridarta.var.atrinik.model.archetype.Archetype; import net.sf.gridarta.var.atrinik.model.gameobject.GameObject; @@ -66,10 +65,9 @@ * @param mapViewManager the map view manager for tracking the current map * view * @param fileControl the file control for saving maps - * @param pathManager the path manager for converting path names */ - public AtrinikServerActions(@NotNull final MapViewManager<GameObject, MapArchObject, Archetype> mapViewManager, @NotNull final FileControl<GameObject, MapArchObject, Archetype> fileControl, @NotNull final PathManager pathManager) { - super(mapViewManager, fileControl, pathManager); + public AtrinikServerActions(@NotNull final MapViewManager<GameObject, MapArchObject, Archetype> mapViewManager, @NotNull final FileControl<GameObject, MapArchObject, Archetype> fileControl) { + super(mapViewManager, fileControl); } /** Modified: trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java =================================================================== --- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java 2014-02-15 16:33:25 UTC (rev 9568) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java 2014-02-16 18:55:23 UTC (rev 9569) @@ -25,7 +25,6 @@ import net.sf.gridarta.gui.dialog.mapproperties.MapPropertiesDialogFactory; import net.sf.gridarta.model.mapmanager.MapManager; import net.sf.gridarta.model.mapmodel.MapModel; -import net.sf.gridarta.model.mappathnormalizer.MapPathNormalizer; import net.sf.gridarta.model.settings.ProjectSettings; import net.sf.gridarta.var.atrinik.model.archetype.Archetype; import net.sf.gridarta.var.atrinik.model.gameobject.GameObject; @@ -52,23 +51,13 @@ private final ProjectSettings projectSettings; /** - * The {@link MapPathNormalizer} for converting map paths to {@link - * java.io.File Files}. - */ - @NotNull - private final MapPathNormalizer mapPathNormalizer; - - /** * Creates a new instance. * @param mapManager the map manager to use * @param projectSettings the project settings instance - * @param mapPathNormalizer the map path normalize for converting map paths - * to files */ - public DefaultMapPropertiesDialogFactory(@NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final ProjectSettings projectSettings, @NotNull final MapPathNormalizer mapPathNormalizer) { + public DefaultMapPropertiesDialogFactory(@NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final ProjectSettings projectSettings) { this.mapManager = mapManager; this.projectSettings = projectSettings; - this.mapPathNormalizer = mapPathNormalizer; } /** @@ -76,7 +65,7 @@ */ @Override public void showDialog(@NotNull final Component parent, @NotNull final Frame helpParent, @NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final FileFilter mapFileFilter) { - final MapPropertiesDialog pane = new MapPropertiesDialog(helpParent, mapManager, projectSettings, mapModel, mapFileFilter, mapPathNormalizer); + final MapPropertiesDialog pane = new MapPropertiesDialog(helpParent, mapManager, projectSettings, mapModel, mapFileFilter); pane.showDialog(parent); } 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-02-15 16:33:25 UTC (rev 9568) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java 2014-02-16 18:55:23 UTC (rev 9569) @@ -53,7 +53,6 @@ import net.sf.gridarta.gui.utils.TextComponentUtils; import net.sf.gridarta.model.mapmanager.MapManager; import net.sf.gridarta.model.mapmodel.MapModel; -import net.sf.gridarta.model.mappathnormalizer.MapPathNormalizer; import net.sf.gridarta.model.settings.ProjectSettings; import net.sf.gridarta.utils.ActionBuilderUtils; import net.sf.gridarta.utils.Size2D; @@ -317,10 +316,8 @@ * @param projectSettings the project settings instance * @param mapModel the map model whose properties are shown/edited. * @param mapFileFilter the Swing file filter to use - * @param mapPathNormalizer the map path normalizer for converting map paths - * to files */ - public MapPropertiesDialog(@NotNull final Frame helpParent, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final ProjectSettings projectSettings, @NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final FileFilter mapFileFilter, @NotNull final MapPathNormalizer mapPathNormalizer) { + public MapPropertiesDialog(@NotNull final Frame helpParent, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final ProjectSettings projectSettings, @NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final FileFilter mapFileFilter) { okButton.setDefaultCapable(true); final JButton helpButton = new JButton(ACTION_BUILDER.createAction(false, "mapHelp", this)); final JButton restoreButton = new JButton(ACTION_BUILDER.createAction(false, "mapRestore", this)); @@ -336,7 +333,7 @@ final Component mainPanel = createMainPanel(map); tabs.add(ActionBuilderUtils.getString(ACTION_BUILDER, "mapMapTabTitle"), mainPanel); - mapTilePane = new IsoMapTilePane<GameObject, MapArchObject, Archetype>(mapManager, projectSettings, mapModel, mapFileFilter, mapPathNormalizer); + mapTilePane = new IsoMapTilePane<GameObject, MapArchObject, Archetype>(mapManager, projectSettings, mapModel, mapFileFilter); final Component tilePanel = createTilePathPanel(mapTilePane); tabs.add(ActionBuilderUtils.getString(ACTION_BUILDER, "mapTilesTabTitle"), tilePanel); Modified: trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2014-02-15 16:33:25 UTC (rev 9568) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2014-02-16 18:55:23 UTC (rev 9569) @@ -75,7 +75,6 @@ import net.sf.gridarta.model.mapmanager.FileControl; import net.sf.gridarta.model.mapmanager.MapManager; import net.sf.gridarta.model.mapmodel.MapModelFactory; -import net.sf.gridarta.model.mappathnormalizer.MapPathNormalizer; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.match.GameObjectMatcher; import net.sf.gridarta.model.match.GameObjectMatchers; @@ -413,8 +412,8 @@ */ @NotNull @Override - public MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype> newMapPropertiesDialogFactory(@NotNull final ProjectSettings projectSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapPathNormalizer mapPathNormalizer) { - return new DefaultMapPropertiesDialogFactory(mapManager, projectSettings, mapPathNormalizer); + public MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype> newMapPropertiesDialogFactory(@NotNull final ProjectSettings projectSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager) { + return new DefaultMapPropertiesDialogFactory(mapManager, projectSettings); } /** @@ -449,8 +448,8 @@ */ @NotNull @Override - public EditorAction newServerActions(@NotNull final MapViewManager<GameObject, MapArchObject, Archetype> mapViewManager, @NotNull final FileControl<GameObject, MapArchObject, Archetype> fileControl, @NotNull final PathManager pathManager) { - return new AtrinikServerActions(mapViewManager, fileControl, pathManager); + public EditorAction newServerActions(@NotNull final MapViewManager<GameObject, MapArchObject, Archetype> mapViewManager, @NotNull final FileControl<GameObject, MapArchObject, Archetype> fileControl) { + return new AtrinikServerActions(mapViewManager, fileControl); } /** Modified: trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/mapcontrol/DefaultMapControlFactory.java =================================================================== --- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/mapcontrol/DefaultMapControlFactory.java 2014-02-15 16:33:25 UTC (rev 9568) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/mapcontrol/DefaultMapControlFactory.java 2014-02-16 18:55:23 UTC (rev 9569) @@ -19,12 +19,12 @@ package net.sf.gridarta.var.atrinik.model.mapcontrol; -import java.io.File; import java.util.List; import net.sf.gridarta.model.io.MapWriter; import net.sf.gridarta.model.mapcontrol.DefaultMapControl; import net.sf.gridarta.model.mapcontrol.MapControl; import net.sf.gridarta.model.mapcontrol.MapControlFactory; +import net.sf.gridarta.model.mapmodel.MapFile; import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.mapmodel.MapModelFactory; import net.sf.gridarta.model.settings.ProjectSettings; @@ -76,7 +76,7 @@ */ @NotNull @Override - public MapControl<GameObject, MapArchObject, Archetype> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @Nullable final File file) { + public MapControl<GameObject, MapArchObject, Archetype> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @Nullable final MapFile mapFile) { final MapModel<GameObject, MapArchObject, Archetype> mapModel = mapModelFactory.newMapModel(mapArchObject); if (objects != null) { mapModel.beginTransaction("init"); @@ -88,7 +88,7 @@ mapModel.resetModified(); } final MapControl<GameObject, MapArchObject, Archetype> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype>(mapModel, false, mapWriter, projectSettings); - mapControl.getMapModel().setMapFile(file); + mapControl.getMapModel().setMapFile(mapFile); return mapControl; } @@ -97,7 +97,7 @@ */ @NotNull @Override - public MapControl<GameObject, MapArchObject, Archetype> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @Nullable final File file) { + public MapControl<GameObject, MapArchObject, Archetype> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @Nullable final MapFile mapFile) { mapArchObject.setDifficulty(1); final MapModel<GameObject, MapArchObject, Archetype> mapModel = mapModelFactory.newMapModel(mapArchObject); if (objects != null) { @@ -110,7 +110,7 @@ mapModel.resetModified(); } final MapControl<GameObject, MapArchObject, Archetype> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype>(mapModel, true, mapWriter, projectSettings); - mapControl.getMapModel().setMapFile(file); + mapControl.getMapModel().setMapFile(mapFile); mapControl.getMapModel().resetModified(); return mapControl; } Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/AbstractFlatMapRenderer.java =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/AbstractFlatMapRenderer.java 2014-02-15 16:33:25 UTC (rev 9568) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/AbstractFlatMapRenderer.java 2014-02-16 18:55:23 UTC (rev 9569) @@ -25,7 +25,6 @@ import java.awt.Point; import java.awt.Rectangle; import java.awt.image.BufferedImage; -import java.io.File; import java.util.Collection; import java.util.HashSet; import java.util.Set; @@ -35,6 +34,7 @@ import net.sf.gridarta.model.mapgrid.MapGrid; import net.sf.gridarta.model.mapgrid.MapGridEvent; import net.sf.gridarta.model.mapgrid.MapGridListener; +import net.sf.gridarta.model.mapmodel.MapFile; import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.mapmodel.MapModelListener; import net.sf.gridarta.model.mapmodel.MapSquare; @@ -241,7 +241,7 @@ } @Override - public void mapFileChanged(@Nullable final File oldMapFile) { + public void mapFileChanged(@Nullable final MapFile oldMapFile) { // ignore } Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java 2014-02-15 16:33:25 UTC (rev 9568) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java 2014-02-16 18:55:23 UTC (rev 9569) @@ -25,7 +25,6 @@ import net.sf.gridarta.gui.dialog.mapproperties.MapPropertiesDialogFactory; import net.sf.gridarta.model.mapmanager.MapManager; import net.sf.gridarta.model.mapmodel.MapModel; -import net.sf.gridarta.model.mappathnormalizer.MapPathNormalizer; import net.sf.gridarta.model.settings.ProjectSettings; import net.sf.gridarta.var.crossfire.model.archetype.Archetype; import net.sf.gridarta.var.crossfire.model.gameobject.GameObject; @@ -52,23 +51,13 @@ private final ProjectSettings projectSettings; /** - * The {@link MapPathNormalizer} for converting map paths to {@link - * java.io.File Files}. - */ - @NotNull - private final MapPathNormalizer mapPathNormalizer; - - /** * Creates a new instance. * @param mapManager the map manager to use * @param projectSettings the project settings instance - * @param mapPathNormalizer the map path normalizer for converting map paths - * to files */ - public DefaultMapPropertiesDialogFactory(@NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final ProjectSettings projectSettings, @NotNull final MapPathNormalizer mapPathNormalizer) { + public DefaultMapPropertiesDialogFactory(@NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final ProjectSettings projectSettings) { this.mapManager = mapManager; this.projectSettings = projectSettings; - this.mapPathNormalizer = mapPathNormalizer; } /** @@ -76,7 +65,7 @@ */ @Override public void showDialog(@NotNull final Component parent, @NotNull final Frame helpParent, @NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final FileFilter mapFileFilter) { - final MapPropertiesDialog pane = new MapPropertiesDialog(helpParent, mapManager, projectSettings, mapModel, mapFileFilter, mapPathNormalizer); + final MapPropertiesDialog pane = new MapPropertiesDialog(helpParent, mapManager, projectSettings, mapModel, mapFileFilter); pane.showDialog(parent); } 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-02-15 16:33:25 UTC (rev 9568) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/MapPropertiesDialog.java 2014-02-16 18:55:23 UTC (rev 9569) @@ -45,7 +45,6 @@ import net.sf.gridarta.gui.utils.TextComponentUtils; import net.sf.gridarta.model.mapmanager.MapManager; import net.sf.gridarta.model.mapmodel.MapModel; -import net.sf.gridarta.model.mappathnormalizer.MapPathNormalizer; import net.sf.gridarta.model.settings.ProjectSettings; import net.sf.gridarta.utils.ActionBuilderUtils; import net.sf.gridarta.utils.Size2D; @@ -360,10 +359,8 @@ * @param projectSettings the project settings instance * @param mapModel the map model whose properties are shown/edited * @param mapFileFilter the Swing file filter to use - * @param mapPathNormalizer the map path normalizer for converting map paths - * to files */ - public MapPropertiesDialog(@NotNull final Frame helpParent, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final ProjectSettings projectSettings, @NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final FileFilter mapFileFilter, @NotNull final MapPathNormalizer mapPathNormalizer) { + public MapPropertiesDialog(@NotNull final Frame helpParent, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final ProjectSettings projectSettings, @NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final FileFilter mapFileFilter) { okButton.setDefaultCapable(true); final JButton helpButton = new JButton(ACTION_BUILDER.createAction(false, "mapHelp", this)); final JButton restoreButton = new JButton(ACTION_BUILDER.createAction(false, "mapRestore", this)); @@ -409,7 +406,7 @@ final Component weatherPanel = createWeatherPanel(map); tabs.add(ActionBuilderUtils.getString(ACTION_BUILDER, "mapWeatherTabTitle"), weatherPanel); - mapTilePane = new FlatMapTilePane<GameObject, MapArchObject, Archetype>(mapManager, projectSettings, mapModel, mapFileFilter, mapPathNormalizer); + mapTilePane = new FlatMapTilePane<GameObject, MapArchObject, Archetype>(mapManager, projectSettings, mapModel, mapFileFilter); final Component tilePanel = createTilePathPanel(mapTilePane); tabs.add(ActionBuilderUtils.getString(ACTION_BUILDER, "mapTilesTabTitle"), tilePanel); Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2014-02-15 16:33:25 UTC (rev 9568) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2014-02-16 18:55:23 UTC (rev 9569) @@ -70,7 +70,6 @@ import net.sf.gridarta.model.mapmanager.FileControl; import net.sf.gridarta.model.mapmanager.MapManager; import net.sf.gridarta.model.mapmodel.MapModelFactory; -import net.sf.gridarta.model.mappathnormalizer.MapPathNormalizer; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.match.GameObjectMatcher; import net.sf.gridarta.model.match.GameObjectMatchers; @@ -304,8 +303,8 @@ */ @NotNull @Override - public MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype> newMapPropertiesDialogFactory(@NotNull final ProjectSettings projectSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapPathNormalizer mapPathNormalizer) { - return new DefaultMapPropertiesDialogFactory(mapManager, projectSettings, mapPathNormalizer); + public MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype> newMapPropertiesDialogFactory(@NotNull final ProjectSettings projectSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager) { + return new DefaultMapPropertiesDialogFactory(mapManager, projectSettings); } /** @@ -340,7 +339,7 @@ */ @Nullable @Override - public EditorAction newServerActions(@NotNull final MapViewManager<GameObject, MapArchObject, Archetype> mapViewManager, @NotNull final FileControl<GameObject, MapArchObject, Archetype> fileControl, @NotNull final PathManager pathManager) { + public EditorAction newServerActions(@NotNull final MapViewManager<GameObject, MapArchObject, Archetype> mapViewManager, @NotNull final FileControl<GameObject, MapArchObject, Archetype> fileControl) { return null; // action not supported } Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/mapcontrol/DefaultMapControlFactory.java =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/mapcontrol/DefaultMapControlFactory.java 2014-02-15 16:33:25 UTC (rev 9568) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/mapcontrol/DefaultMapControlFactory.java 2014-02-16 18:55:23 UTC (rev 9569) @@ -19,12 +19,12 @@ package net.sf.gridarta.var.crossfire.model.mapcontrol; -import java.io.File; import java.util.List; import net.sf.gridarta.model.io.MapWriter; import net.sf.gridarta.model.mapcontrol.DefaultMapControl; import net.sf.gridarta.model.mapcontrol.MapControl; import net.sf.gridarta.model.mapcontrol.MapControlFactory; +import net.sf.gridarta.model.mapmodel.MapFile; import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.mapmodel.MapModelFactory; import net.sf.gridarta.model.settings.ProjectSettings; @@ -76,7 +76,7 @@ */ @NotNull @Override - public MapControl<GameObject, MapArchObject, Archetype> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @Nullable final File file) { + public MapControl<GameObject, MapArchObject, Archetype> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @Nullable final MapFile mapFile) { final MapModel<GameObject, MapArchObject, Archetype> mapModel = mapModelFactory.newMapModel(mapArchObject); if (objects != null) { mapModel.beginTransaction("init"); @@ -88,7 +88,7 @@ mapModel.resetModified(); } final MapControl<GameObject, MapArchObject, Archetype> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype>(mapModel, false, mapWriter, projectSettings); - mapControl.getMapModel().setMapFile(file); + mapControl.getMapModel().setMapFile(mapFile); return mapControl; } @@ -97,7 +97,7 @@ */ @NotNull @Override - public MapControl<GameObject, MapArchObject, Archetype> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @Nullable final File file) { + public MapControl<GameObject, MapArchObject, Archetype> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @Nullable final MapFile mapFile) { final MapModel<GameObject, MapArchObject, Archetype> mapModel = mapModelFactory.newMapModel(mapArchObject); if (objects != null) { mapModel.beginTransaction("init"); @@ -109,7 +109,7 @@ mapModel.resetModified(); } final MapControl<GameObject, MapArchObject, Archetype> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype>(mapModel, true, mapWriter, projectSettings); - mapControl.getMapModel().setMapFile(file); + mapControl.getMapModel().setMapFile(mapFile); mapControl.getMapModel().resetModified(); return mapControl; } Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/validation/checks/NonAbsoluteExitPathChecker.java =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/validation/checks/NonAbsoluteExitPathChecker.java 2014-02-15 16:33:25 UTC (rev 9568) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/validation/checks/NonAbsoluteExitPathChecker.java 2014-02-16 18:55:23 UTC (rev 9569) @@ -22,6 +22,7 @@ import net.sf.gridarta.model.maplocation.MapLocation; import net.sf.gridarta.model.maplocation.NoExitPathException; import net.sf.gridarta.model.mapmodel.MapModel; +import net.sf.gridarta.model.mapmodel.MapPath; import net.sf.gridarta.model.mapmodel.MapSquare; import net.sf.gridarta.model.match.GameObjectMatcher; import net.sf.gridarta.model.validation.AbstractValidator; @@ -79,14 +80,14 @@ return; // not on an unique map => skip } - final String exitPath; + final MapPath exitPath; try { exitPath = MapLocation.getMapPath(gameObject, true); } catch (final NoExitPathException ignored) { return; // unset exit path => skip } - if (exitPath.isEmpty() || exitPath.startsWith("/")) { - return; // unset exit path or absolute exit path => ok + if (exitPath.isAbsolute()) { + return; // absolute exit path => ok } errorCollector.collect(new NonAbsoluteExitPathError<GameObject, MapArchObject, Archetype>(gameObject, exitPath)); Modified: trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java =================================================================== --- trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java 2014-02-15 16:33:25 UTC (rev 9568) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java 2014-02-16 18:55:23 UTC (rev 9569) @@ -25,7 +25,6 @@ import net.sf.gridarta.gui.dialog.mapproperties.MapPropertiesDialogFactory; import net.sf.gridarta.model.mapmanager.MapManager; import net.sf.gridarta.model.mapmodel.MapModel; -import net.sf.gridarta.model.mappathnormalizer.MapPathNormalizer; import net.sf.gridarta.model.settings.ProjectSettings; import net.sf.gridarta.var.daimonin.model.archetype.Archetype; import net.sf.gridarta.var.daimonin.model.gameobject.GameObject; @@ -52,23 +51,13 @@ private final ProjectSettings projectSettings; /** - * The {@link MapPathNormalizer} for converting map paths to {@link - * java.io.File Files}. - */ - @NotNull - private final MapPathNormalizer mapPathNormalizer; - - /** * Creates a new instance. * @param mapManager the map manager to use * @param projectSettings the project settings instance - * @param mapPathNormalizer the map path normalize for converting map paths - * to files */ - public DefaultMapPropertiesDialogFactory(@NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final ProjectSettings projectSettings, @NotNull final MapPathNormalizer mapPathNormalizer) { + public DefaultMapPropertiesDialogFactory(@NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final ProjectSettings projectSettings) { this.mapManager = mapManager; this.projectSettings = projectSettings; - this.mapPathNormalizer = mapPathNormalizer; } /** @@ -76,7 +65,7 @@ */ @Override public void showDialog(@NotNull final Component parent, @NotNull final Frame helpParent, @NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final FileFilter mapFileFilter) { - final MapPropertiesDialog pane = new MapPropertiesDialog(helpParent, mapManager, projectSettings, mapModel, mapFileFilter, mapPathNormalizer); + final MapPropertiesDialog pane = new MapPropertiesDialog(helpParent, mapManager, projectSettings, mapModel, mapFileFilter); pane.showDialog(parent); } Modified: trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java =================================================================== --- trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java 2014-02-15 16:33:25 UTC (rev 9568) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java 2014-02-16 18:55:23 UTC (rev 9569) @@ -54,7 +54,6 @@ import net.sf.gridarta.gui.utils.TextComponentUtils; import net.sf.gridarta.model.mapmanager.MapManager; import net.sf.gridarta.model.mapmodel.MapModel; -import net.sf.gridarta.model.mappathnormalizer.MapPathNormalizer; import net.sf.gridarta.model.settings.ProjectSettings; import net.sf.gridarta.utils.ActionBuilderUtils; import net.sf.gridarta.utils.Size2D; @@ -311,10 +310,8 @@ * @param projectSettings the project settings instance * @param mapModel the map model whose properties are shown/edited. * @param mapFileFilter the Swing file filter to use - * @param mapPathNormalizer the map path normalizer for converting map paths - * to files */ - public MapPropertiesDialog(@NotNull final Frame helpParent, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final ProjectSettings projectSettings, @NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final FileFilter mapFileFilter, @NotNull final MapPathNormalizer mapPathNormalizer) { + public MapPropertiesDialog(@NotNull final Frame helpParent, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final ProjectSettings projectSettings, @NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final FileFilter mapFileFilter) { okButton.setDefaultCapable(true); final JButton helpButton = new JButton(ACTION_BUILDER.createAction(false, "mapHelp", this)); final JButton restoreButton = new JButton(ACTION_BUILDER.createAction(false, "mapRestore", this)); @@ -331,7 +328,7 @@ final Component mainPanel = createMainPanel(map); tabs.add(ActionBuilderUtils.getString(ACTION_BUILDER, "mapMapTabTitle"), mainPanel); - mapTilePane = new IsoMapTilePane<GameObject, MapArchObject, Archetype>(mapManager, projectSettings, mapModel, mapFileFilter, mapPathNormalizer); + mapTilePane = new IsoMapTilePane<GameObject, MapArchObject, Archetype>(mapManager, projectSettings, mapModel, mapFileFilter); final Component tilePanel = createTilePathPanel(mapTilePane); tabs.add(ActionBuilderUtils.getString(ACTION_BUILDER, "mapTilesTabTitle"), tilePanel); Modified: trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2014-02-15 16:33:25 UTC (rev 9568) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2014-02-16 18:55:23 UTC (rev 9569) @@ -75,7 +75,6 @@ import net.sf.gridarta.model.mapmanager.FileControl; import net.sf.gridarta.model.mapmanager.MapManager; import net.sf.gridarta.model.mapmodel.MapModelFactory; -import net.sf.gridarta.model.mappathnormalizer.MapPathNormalizer; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.match.GameObjectMatcher; import net.sf.gridarta.model.match.GameObjectMatchers; @@ -412,8 +411,8 @@ */ @NotNull @Override - public MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype> newMapPropertiesDialogFactory(@NotNull final ProjectSettings projectSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapPathNormalizer mapPathNormalizer) { - return new DefaultMapPropertiesDialogFactory(mapManager, projectSettings, mapPathNormalizer); + public MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype> newMapPropertiesDialogFactory(@NotNull final ProjectSettings projectSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager) { + return new DefaultMapPropertiesDialogFactory(mapManager, projectSettings); } /** @@ -448,7 +447,7 @@ */ @Nullable @Override - public EditorAction newServerActions(@NotNull final MapViewManager<GameObject, MapArchObject, Archetype> mapViewManager, @NotNull final FileControl<GameObject, MapArchObject, Archetype> fileControl, @NotNull final PathManager pathManager) { + public EditorAction newServerActions(@NotNull final MapViewManager<GameObject, MapArchObject, Archetype> mapViewManager, @NotNull final FileControl<GameObject, MapArchObject, Archetype> fileControl) { return null; // action not supported } Modified: trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/model/mapcontrol/DefaultMapControlFactory.java =================================================================== --- trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/model/mapcontrol/DefaultMapControlFactory.java 2014-02-15 16:33:25 UTC (rev 9568) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/model/mapcontrol/DefaultMapControlFactory.java 2014-02-16 18:55:23 UTC (rev 9569) @@ -19,12 +19,12 @@ package net.sf.gridarta.var.daimonin.model.mapcontrol; -import java.io.File; import java.util.List; import net.sf.gridarta.model.io.MapWriter; import net.sf.gridarta.model.mapcontrol.DefaultMapControl; import net.sf.gridarta.model.mapcontrol.MapControl; import net.sf.gridarta.model.mapcontrol.MapControlFactory; +import net.sf.gridarta.model.mapmodel.MapFile; import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.mapmodel.MapModelFactory; import net.sf.gridarta.model.settings.ProjectSettings; @@ -76,7 +76,7 @@ */ @NotNull @Override - public MapControl<GameObject, MapArchObject, Archetype> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @Nullable final File file) { + public MapControl<GameObject, MapArchObject, Archetype> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @Nullable final MapFile mapFile) { final MapModel<GameObject, MapArchObject, Archetype> mapModel = mapModelFactory.newMapModel(mapArchObject); if (objects != null) { mapModel.beginTransaction("init"); @@ -88,7 +88,7 @@ mapModel.resetModified(); } final MapControl<GameObject, MapArchObject, Archetype> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype>(mapModel, false, mapWriter, projectSettings); - mapControl.getMapModel().setMapFile(file); + mapControl.getMapModel().setMapFile(mapFile); return mapControl; } @@ -97,7 +97,7 @@ */ @NotNull @Override - public MapControl<GameObject, MapArchObject, Archetype> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @Nullable final File file) { + public MapControl<GameObject, MapArchObject, Archetype> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @Nullable final MapFile mapFile) { mapArchObject.setDifficulty(1); final MapModel<GameObject, MapArchObject, Archetype> mapModel = mapModelFactory.newMapModel(mapArchObject); if (objects != null) { @@ -110,7 +110,7 @@ mapModel.resetModified(); } final MapControl<GameObject, MapArchObject, Archetype> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype>(mapModel, true, mapWriter, projectSettings); - mapControl.getMapModel().setMapFile(file); + mapControl.getMapModel().setMapFile(mapFile); mapControl.getMapModel().resetModified(); return mapControl; } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AbstractMoveSquareAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AbstractMoveSquareAction.java 2014-02-15 16:33:25 UTC (rev 9568) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AbstractMoveSquareAction.java 2014-02-16 18:55:23 UTC (rev 9569) @@ -19,7 +19,6 @@ package net.sf.gridarta.action; -import java.io.File; import java.util.Set; import javax.swing.Action; import net.sf.gridarta.gui.panel.selectedsquare.SelectedSquareModel; @@ -30,6 +29,7 @@ import net.sf.gridarta.model.mapcontrol.MapControl; import net.sf.gridarta.model.mapmanager.MapManager; import net.sf.gridarta.model.mapmanager.MapManagerListener; +import net.sf.gridarta.model.mapmodel.MapFile; import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.mapmodel.MapModelListener; import net.sf.gridarta.model.mapmodel.MapSquare; @@ -119,7 +119,7 @@ } @Override - public void mapFileChanged(@Nullable final File oldMapFile) { + public void mapFileChanged(@Nullable final MapFile oldMapFile) { } @Override Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AddBookmarkAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AddBookmarkAction.java 2014-02-15 16:33:25 UTC (rev 9568) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AddBookmarkAction.java 2014-02-16 18:55:23 UTC (rev 9569) @@ -19,7 +19,6 @@ package net.sf.gridarta.action; -import java.io.File; import javax.swing.Action; import net.sf.gridarta.gui.dialog.bookmarks.EditBookmarkDialog; import net.sf.gridarta.gui.map.mapview.MapView; @@ -31,6 +30,7 @@ import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.mapcontrol.MapControl; +import net.sf.gridarta.model.mapmodel.MapFile; import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.utils.EditorAction; import net.sf.japi.swing.action.ActionMethod; @@ -131,7 +131,7 @@ final MapControl<G, A, R> mapControl = mapView.getMapControl(); final MapModel<G, A, R> mapModel = mapControl.getMapModel(); - final File mapFile = mapModel.getMapFile(); + final MapFile mapFile = mapModel.getMapFile(); if (mapFile == null) { return false; } 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-02-15 16:33:25 UTC (rev 9568) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/AbstractServerActions.java 2014-02-16 18:55:23 UTC (rev 9569) @@ -20,7 +20,6 @@ package net.sf.gridarta.actions; import java.awt.Point; -import java.io.File; import java.io.IOException; import javax.swing.Action; import net.sf.gridarta.gui.map.mapview.MapView; @@ -28,14 +27,12 @@ import net.sf.gridarta.gui.map.mapview.MapViewManagerListener; 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; +import net.sf.gridarta.model.mapmodel.MapFile; import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.utils.EditorAction; -import net.sf.japi.swing.action.ActionBuilder; -import net.sf.japi.swing.action.ActionBuilderFactory; import net.sf.japi.swing.action.ActionMethod; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -48,12 +45,6 @@ public abstract class AbstractServerActions<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements EditorAction { /** - * Action Builder to create Actions. - */ - @NotNull - private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); - - /** * The currently active map or <code>null</code> if no map is active. */ @Nullable @@ -66,12 +57,6 @@ private final FileControl<G, A, R> fileControl; /** - * The {@link PathManager} for converting path names. - */ - @NotNull - private final PathManager pathManager; - - /** * The action for "open in client". * @noinspection ThisEscapedInObjectConstruction */ @@ -109,11 +94,9 @@ * @param mapViewManager the map view manager for tracking the current map * view * @param fileControl the file control for saving maps - * @param pathManager the path manager for converting path names */ - protected AbstractServerActions(@NotNull final MapViewManager<G, A, R> mapViewManager, @NotNull final FileControl<G, A, R> fileControl, @NotNull final PathManager pathManager) { + protected AbstractServerActions(@NotNull final MapViewManager<G, A, R> mapViewManager, @NotNull final FileControl<G, A, R> fileControl) { this.fileControl = fileControl; - this.pathManager = pathManager; mapViewManager.addMapViewManagerListener(mapViewManagerListener); currentMapView = mapViewManager.getActiveMapView(); } @@ -149,16 +132,11 @@ final MapControl<G, A, R> mapControl = mapView.getMapControl(); final MapModel<G, A, R> mapModel = mapControl.getMapModel(); - final File mapFile = mapModel.getMapFile(); + final MapFile mapFile = mapModel.getMapFile(); if (mapFile == null) { return false; } - final String mapPath = pathManager.getMapPath2(mapFile); - if (mapPath == null) { - return false; - } - if (performAction) { if (mapModel.isModified() && !fileControl.save(mapControl)) { return false; @@ -167,6 +145,7 @@ final Point cursor = mapView.getMapCursor().getLocation(); final int mapX = cursor.x; final int mapY = cursor.y; + final String mapPath = mapFile.getMapPath().toString(); try { teleportCharacterToMap(mapPath, mapX, mapY); } catch (final IOException ex) { Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/AttachTiledMaps.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/AttachTiledMaps.java 2014-02-15 16:33:25 UTC (rev 9568) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/AttachTiledMaps.java 2014-02-16 18:55:23 UTC (rev 9569) @@ -31,12 +31,9 @@ import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.mapcontrol.MapControl; import net.sf.gridarta.model.mapmanager.MapManager; +import net.sf.gridarta.model.mapmodel.MapFile; import net.sf.gridarta.model.mapmodel.MapModel; -import net.sf.gridarta.model.mappathnormalizer.IOErrorException; -import net.sf.gridarta.model.mappathnormalizer.InvalidPathException; -import net.sf.gridarta.model.mappathnormalizer.MapPathNormalizer; -import net.sf.gridarta.model.mappathnormalizer.RelativePathOnUnsavedMapException; -import net.sf.gridarta.model.mappathnormalizer.SameMapException; +import net.sf.gridarta.model.mapmodel.MapPathUtils; import net.sf.gridarta.model.tiles.MapLink; import net.sf.gridarta.model.tiles.TileLink; import net.sf.gridarta.utils.Size2D; @@ -64,23 +61,13 @@ private final TileLink[] tileLinks; /** - * The {@link MapPathNormalizer} for converting map paths to {@link File - * Files}. - */ - @NotNull - private final MapPathNormalizer mapPathNormalizer; - - /** * Creates a new instance. * @param mapManager the map manager to use * @param tileLinks the tile links to use - * @param mapPathNormalizer the map path normalizer for converting map paths - * the files */ - public AttachTiledMaps(@NotNull final MapManager<G, A, R> mapManager, @NotNull final TileLink[] tileLinks, @NotNull final MapPathNormalizer mapPathNormalizer) { + public AttachTiledMaps(@NotNull final MapManager<G, A, R> mapManager, @NotNull final TileLink[] tileLinks) { this.mapManager = mapManager; this.tileLinks = tileLinks.clone(); - this.mapPathNormalizer = mapPathNormalizer; } /** @@ -167,9 +154,9 @@ mapControl.save(); } } catch (final IOException e) { - final File mapFile = mapControl.getMapModel().getMapFile(); + final MapFile mapFile = mapControl.getMapModel().getMapFile(); assert mapFile != null; - throw new CannotSaveMapFileException(mapFile, e); + throw new CannotSaveMapFileException(mapFile.getFile(), e); } } } @@ -220,10 +207,11 @@ final Size2D mapSize = mapModel.getMapArchObject().getMapSize(); for (final MapControl<G, A, R> mapControl : mapControls) { if (mapControl != null) { - final MapArchObject<A> otherMap = mapControl.getMapModel().getMapArchObject(); + final MapModel<G, A, R> tmpMapModel = mapControl.getMapModel(); + final MapArchObject<A> otherMap = tmpMapModel.getMapArchObject(); final Size2D otherMapSize = otherMap.getMapSize(); if (!mapSize.equals(otherMapSize)) { - throw new MapSizeMismatchException(mapControl.getMapModel().getMapFile(), mapSize, otherMapSize); + throw new MapSizeMismatchException(tmpMapModel.getMapFile().getFile(), mapSize, otherMapSize); } for (int ii = 0; ii < 2; ii++) { // TODO: check links @@ -246,19 +234,19 @@ final MapControl<G, A, R> mapControl = mapControls.get(i); if (mapControl != null) { // generate a valid path relative to both map positions - final File mapFile1 = mapModel.getMapFile(); + final MapFile mapFile1 = mapModel.getMapFile(); final String canonicalMapPath1; try { - canonicalMapPath1 = mapFile1.getCanonicalPath(); + canonicalMapPath1 = mapFile1.getFile().getCanonicalPath(); } catch (final IOException ex) { - throw new InvalidPathNameException(mapFile1, ex); + throw new InvalidPathNameException(mapFile1.getFile(), ex); } - final File mapFile2 = mapControl.getMapModel().getMapFile(); + final MapFile mapFile2 = mapControl.getMapModel().getMapFile(); final String canonicalMapPath2; try { - canonicalMapPath2 = mapFile2.getCanonicalPath(); + canonicalMapPath2 = mapFile2.getFile().getCanonicalPath(); } catch (final IOException ex) { - throw new InvalidPathNameException(mapFile2, ex); + throw new InvalidPathNameException(mapFile2.getFile(), ex); } final String link1 = getTilePath(canonicalMapPath1, canonicalMapPath2, mapsDirectory); // set the link of our source map to the map around @@ -291,19 +279,12 @@ */ @Nullable private MapControl<G, A, R> loadMapControl(@NotNull final MapModel<G, A, R> mapModel, @NotNull final String path) throws IOException { - final File file; - try { - file = mapPathNormalizer.normalizeMapPath(mapModel, path); - } catch (final InvalidPathException ignored) { + final MapFile mapFile = mapModel.getMapFile(); + if (mapFile == null) { + // unsaved map: should not happen => ignore return null; - } catch (final IOErrorException ignored) { - return null; - } catch (final RelativePathOnUnsavedMapException ignored) { - return null; - } catch (final SameMapException ignored) { - return null; } - return mapManager.openMapFile(file, false); + return mapManager.openMapFile(new MapFile(mapFile, MapPathUtils.newMapPath(path)), false); } /** Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/ExitConnectorActions.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/ExitConnectorActions.java 2014-02-15 16:33:25 UTC (rev 9568) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/ExitConnectorAction... [truncated message content] |
From: <aki...@us...> - 2014-02-16 18:56:39
|
Revision: 9570 http://sourceforge.net/p/gridarta/code/9570 Author: akirschbaum Date: 2014-02-16 18:56:34 +0000 (Sun, 16 Feb 2014) Log Message: ----------- Add nullable annotations. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapview/MapViewsManager.java trunk/src/model/src/main/java/net/sf/gridarta/model/scripts/ScriptUtils.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapview/MapViewsManager.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapview/MapViewsManager.java 2014-02-16 18:55:23 UTC (rev 9569) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapview/MapViewsManager.java 2014-02-16 18:56:34 UTC (rev 9570) @@ -87,6 +87,7 @@ * The listener tracking alpha types changes to repaint map views after * changes. */ + @NotNull private final MapViewSettingsListener mapViewSettingsListener = new MapViewSettingsListener() { @Override Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/scripts/ScriptUtils.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/scripts/ScriptUtils.java 2014-02-16 18:55:23 UTC (rev 9569) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/scripts/ScriptUtils.java 2014-02-16 18:56:34 UTC (rev 9570) @@ -97,6 +97,7 @@ * @param pathManager the path manager for converting path names * @return a nice default script name without whitespaces */ + @NotNull public static String chooseDefaultScriptName(@NotNull final File baseDir, final String archetypeName, final String scriptEnding, @NotNull final PathManager pathManager) { String defScriptName = archetypeName.trim(); final int i = defScriptName.indexOf(' '); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-02-16 19:28:48
|
Revision: 9572 http://sourceforge.net/p/gridarta/code/9572 Author: akirschbaum Date: 2014-02-16 19:28:44 +0000 (Sun, 16 Feb 2014) Log Message: ----------- Extract duplicated code into function. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/EnterMap.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/DefaultMapModel.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/MapModel.java trunk/src/model/src/main/java/net/sf/gridarta/model/validation/checks/ExitChecker.java trunk/src/model/src/main/java/net/sf/gridarta/model/validation/checks/TilePathsChecker.java Added Paths: ----------- trunk/src/model/src/main/java/net/sf/gridarta/model/mappathnormalizer/UnsavedMapException.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/EnterMap.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/EnterMap.java 2014-02-16 19:01:53 UTC (rev 9571) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/EnterMap.java 2014-02-16 19:28:44 UTC (rev 9572) @@ -37,7 +37,8 @@ import net.sf.gridarta.model.mapmanager.FileControl; import net.sf.gridarta.model.mapmodel.MapFile; import net.sf.gridarta.model.mapmodel.MapPath; -import net.sf.gridarta.model.mapmodel.MapPathUtils; +import net.sf.gridarta.model.mappathnormalizer.SameMapException; +import net.sf.gridarta.model.mappathnormalizer.UnsavedMapException; import net.sf.gridarta.utils.Size2D; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; @@ -104,20 +105,20 @@ * @return whether the destination map has been entered */ public boolean enterMap(@NotNull final MapView<G, A, R> mapView, @NotNull final MapPath mapPath, @NotNull final Direction direction, @Nullable final Point destinationPoint) { - final MapFile mapFile = mapView.getMapControl().getMapModel().getMapFile(); - if (mapFile == null) { - ACTION_BUILDER.showMessageDialog(parent, "enterExitNotSaved", mapPath); - return false; - } - final MapPath newMapPath = MapPathUtils.append(mapFile.getMapPath(), mapPath); - if (newMapPath.equals(mapFile.getMapPath())) { + final MapFile mapFile; + try { + mapFile = mapView.getMapControl().getMapModel().getMapFile(mapPath); + } catch (final SameMapException ignored) { // path points to the same map if (destinationPoint != null) { showLocation(mapView, destinationPoint); } return true; + } catch (final UnsavedMapException ignored) { + ACTION_BUILDER.showMessageDialog(parent, "enterExitNotSaved", mapPath); + return false; } - return enterMap(mapView, new MapFile(mapFile, newMapPath), destinationPoint, direction); + return enterMap(mapView, mapFile, destinationPoint, direction); } /** Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/DefaultMapModel.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/DefaultMapModel.java 2014-02-16 19:01:53 UTC (rev 9571) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/DefaultMapModel.java 2014-02-16 19:28:44 UTC (rev 9572) @@ -38,6 +38,8 @@ import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.maparchobject.MapArchObjectListener; +import net.sf.gridarta.model.mappathnormalizer.SameMapException; +import net.sf.gridarta.model.mappathnormalizer.UnsavedMapException; import net.sf.gridarta.model.match.GameObjectMatchers; import net.sf.gridarta.model.match.NamedGameObjectMatcher; import net.sf.gridarta.model.validation.DefaultErrorCollector; @@ -1013,6 +1015,23 @@ */ @NotNull @Override + public MapFile getMapFile(@NotNull final MapPath mapPath) throws SameMapException, UnsavedMapException { + final MapFile thisMapFile = mapFile; + if (thisMapFile == null) { + throw new UnsavedMapException(); + } + final MapFile newMapFile = new MapFile(thisMapFile, mapPath); + if (newMapFile.equals(thisMapFile)) { + throw new SameMapException(); + } + return newMapFile; + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override public List<G> getAllGameObjects() { final List<G> gameObjects = new ArrayList<G>(); for (final Iterable<G> mapSquare : this) { Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/MapModel.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/MapModel.java 2014-02-16 19:01:53 UTC (rev 9571) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/MapModel.java 2014-02-16 19:28:44 UTC (rev 9572) @@ -26,6 +26,8 @@ import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.model.mappathnormalizer.SameMapException; +import net.sf.gridarta.model.mappathnormalizer.UnsavedMapException; import net.sf.gridarta.model.validation.ErrorCollector; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -401,6 +403,19 @@ MapFile getMapFile(); /** + * Returns the map file for a map that can be reached by following a {@link + * MapPath} from this map. + * @param mapPath the map path to follow + * @return the map file + * @throws SameMapException of the destination map file is the same as this + * map file + * @throws UnsavedMapException if this map is not saved and therefore its + * map file is unknown + */ + @NotNull + MapFile getMapFile(@NotNull MapPath mapPath) throws SameMapException, UnsavedMapException; + + /** * Returns all game objects. Only top-level head parts are returned; tail * parts are ignored as are objects in inventories. * @return all game objects Added: trunk/src/model/src/main/java/net/sf/gridarta/model/mappathnormalizer/UnsavedMapException.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/mappathnormalizer/UnsavedMapException.java (rev 0) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/mappathnormalizer/UnsavedMapException.java 2014-02-16 19:28:44 UTC (rev 9572) @@ -0,0 +1,33 @@ +/* + * 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.model.mappathnormalizer; + +/** + * Exception thrown if an operation is attempted on an unsaved map. + * @author Andreas Kirschbaum + */ +public class UnsavedMapException extends Exception { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + +} Property changes on: trunk/src/model/src/main/java/net/sf/gridarta/model/mappathnormalizer/UnsavedMapException.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/model/src/main/java/net/sf/gridarta/model/validation/checks/ExitChecker.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/validation/checks/ExitChecker.java 2014-02-16 19:01:53 UTC (rev 9571) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/validation/checks/ExitChecker.java 2014-02-16 19:28:44 UTC (rev 9572) @@ -24,9 +24,10 @@ import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; -import net.sf.gridarta.model.mapmodel.MapFile; +import net.sf.gridarta.model.mapmodel.MapPathUtils; import net.sf.gridarta.model.mapmodel.MapSquare; -import net.sf.gridarta.model.settings.ProjectSettings; +import net.sf.gridarta.model.mappathnormalizer.SameMapException; +import net.sf.gridarta.model.mappathnormalizer.UnsavedMapException; import net.sf.gridarta.model.validation.AbstractValidator; import net.sf.gridarta.model.validation.ErrorCollector; import net.sf.gridarta.model.validation.GameObjectValidator; @@ -41,12 +42,6 @@ public class ExitChecker<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractValidator<G, A, R> implements GameObjectValidator<G, A, R> { /** - * The {@link ProjectSettings} to use. - */ - @NotNull - private final ProjectSettings projectSettings; - - /** * The archetype type number of exits. */ private final int exitTypeNo; @@ -54,12 +49,10 @@ /** * Create a ExitChecker. * @param validatorPreferences the validator preferences to use - * @param projectSettings the project settings to use * @param exitTypeNo the archetype type number of exits */ - public ExitChecker(@NotNull final ValidatorPreferences validatorPreferences, @NotNull final ProjectSettings projectSettings, final int exitTypeNo) { + public ExitChecker(@NotNull final ValidatorPreferences validatorPreferences, final int exitTypeNo) { super(validatorPreferences); - this.projectSettings = projectSettings; this.exitTypeNo = exitTypeNo; } @@ -77,26 +70,16 @@ return; } - final File newFile; - if (path.startsWith(File.pathSeparator) || path.startsWith("/")) { - // we have an absolute path: - newFile = new File(projectSettings.getMapsDirectory().getAbsolutePath(), path.substring(1)); - } else { - // we have a relative path: - final MapSquare<G, A, R> mapSquare = gameObject.getMapSquare(); - assert mapSquare != null; - final MapFile mapFile = mapSquare.getMapModel().getMapFile(); - if (mapFile == null) { - // unsaved map => do not check - return; + final MapSquare<G, A, R> mapSquare = gameObject.getMapSquare(); + assert mapSquare != null; + try { + final File file = mapSquare.getMapModel().getMapFile(MapPathUtils.newMapPath(path)).getFile(); + if (!file.exists() || file.isDirectory()) { + errorCollector.collect(new ExitError<G, A, R>(gameObject, path)); } - newFile = new File(mapFile.getFile().getParent(), path); + } catch (final SameMapException ignored) { + } catch (final UnsavedMapException ignored) { } - if (newFile.exists() && !newFile.isDirectory()) { - return; - } - - errorCollector.collect(new ExitError<G, A, R>(gameObject, path)); } } Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/validation/checks/TilePathsChecker.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/validation/checks/TilePathsChecker.java 2014-02-16 19:01:53 UTC (rev 9571) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/validation/checks/TilePathsChecker.java 2014-02-16 19:28:44 UTC (rev 9572) @@ -24,16 +24,16 @@ import net.sf.gridarta.model.direction.Direction; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; -import net.sf.gridarta.model.mapmodel.MapFile; import net.sf.gridarta.model.mapmodel.MapModel; -import net.sf.gridarta.model.settings.ProjectSettings; +import net.sf.gridarta.model.mapmodel.MapPathUtils; +import net.sf.gridarta.model.mappathnormalizer.SameMapException; +import net.sf.gridarta.model.mappathnormalizer.UnsavedMapException; import net.sf.gridarta.model.validation.AbstractValidator; import net.sf.gridarta.model.validation.ErrorCollector; import net.sf.gridarta.model.validation.MapValidator; import net.sf.gridarta.model.validation.ValidatorPreferences; import net.sf.gridarta.model.validation.errors.TilePathsError; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; /** * Validator that checks whether all tile paths are valid. @@ -42,12 +42,6 @@ public class TilePathsChecker<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractValidator<G, A, R> implements MapValidator<G, A, R> { /** - * The {@link ProjectSettings} to use. - */ - @NotNull - private final ProjectSettings projectSettings; - - /** * The number of tile paths to check. */ private final int tilePaths; @@ -55,12 +49,10 @@ /** * Create a TilePathsChecker. * @param validatorPreferences the validator preferences to use - * @param projectSettings the project settings to use * @param tilePaths the number of tile paths to check */ - public TilePathsChecker(@NotNull final ValidatorPreferences validatorPreferences, @NotNull final ProjectSettings projectSettings, final int tilePaths) { + public TilePathsChecker(@NotNull final ValidatorPreferences validatorPreferences, final int tilePaths) { super(validatorPreferences); - this.projectSettings = projectSettings; this.tilePaths = tilePaths; } @@ -69,24 +61,19 @@ */ @Override public void validateMap(@NotNull final MapModel<G, A, R> mapModel, @NotNull final ErrorCollector<G, A, R> errorCollector) { - final MapFile mapFile = mapModel.getMapFile(); - final String mapDir = mapFile == null ? null : mapFile.getFile().getParent(); final MapArchObject<A> mapArchObject = mapModel.getMapArchObject(); final Direction[] directions = Direction.values(); for (int direction = 0; direction < tilePaths; direction++) { final String path = mapArchObject.getTilePath(directions[direction]); if (!path.isEmpty()) { - @Nullable final File newFile; - if (path.startsWith(File.pathSeparator) || path.startsWith("/")) { - // we have an absolute path: - newFile = new File(projectSettings.getMapsDirectory().getAbsolutePath(), path.substring(1)); - } else { - // we have a relative path: - newFile = mapDir == null ? null : new File(mapDir, path); + try { + final File file = mapModel.getMapFile(MapPathUtils.newMapPath(path)).getFile(); + if (!file.exists() || file.isDirectory()) { + errorCollector.collect(new TilePathsError<G, A, R>(mapModel, directions[direction], path)); + } + } catch (final SameMapException ignored) { + } catch (final UnsavedMapException ignored) { } - if (newFile != null && (!newFile.exists() || newFile.isDirectory())) { - errorCollector.collect(new TilePathsError<G, A, R>(mapModel, directions[direction], path)); - } } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-02-16 19:33:03
|
Revision: 9573 http://sourceforge.net/p/gridarta/code/9573 Author: akirschbaum Date: 2014-02-16 19:33:00 +0000 (Sun, 16 Feb 2014) Log Message: ----------- Remove MapPathNormalizer. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java Removed Paths: ------------- trunk/src/model/src/main/java/net/sf/gridarta/model/mappathnormalizer/MapPathNormalizer.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-02-16 19:28:44 UTC (rev 9572) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2014-02-16 19:33:00 UTC (rev 9573) @@ -186,7 +186,6 @@ import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.mapmodel.InsertionModeSet; -import net.sf.gridarta.model.mappathnormalizer.MapPathNormalizer; import net.sf.gridarta.model.mapviewsettings.DefaultMapViewSettings; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.match.GameObjectMatcher; @@ -362,7 +361,6 @@ final GameObjectMatcher exitGameObjectMatcherTmp = projectModel.getGameObjectMatchers().getMatcherWarn(gameObjectMatchersErrorViewCollector, "system_exit", "exit"); final GameObjectMatcher exitGameObjectMatcher = exitGameObjectMatcherTmp == null ? new TypeNrsGameObjectMatcher() : exitGameObjectMatcherTmp; final ExitMatcher<G, A, R> exitMatcher = new ExitMatcher<G, A, R>(exitGameObjectMatcher); - final MapPathNormalizer mapPathNormalizer = new MapPathNormalizer(projectModel.getProjectSettings()); final MapPropertiesDialogFactory<G, A, R> mapPropertiesDialogFactory = editorFactory.newMapPropertiesDialogFactory(projectModel.getProjectSettings(), projectModel.getMapManager()); final DelayedMapModelListenerManager<G, A, R> delayedMapModelListenerManager = new DelayedMapModelListenerManager<G, A, R>(projectModel.getMapManager(), exiter); final Control<?, G, A, R> lockedItemsControl = new LockedItemsControl<G, A, R>(mapViewManager, delayedMapModelListenerManager, editorFactory.getLockedItemsTypeNumbers()); Deleted: trunk/src/model/src/main/java/net/sf/gridarta/model/mappathnormalizer/MapPathNormalizer.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/mappathnormalizer/MapPathNormalizer.java 2014-02-16 19:28:44 UTC (rev 9572) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/mappathnormalizer/MapPathNormalizer.java 2014-02-16 19:33:00 UTC (rev 9573) @@ -1,117 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2010 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.model.mappathnormalizer; - -import java.io.File; -import java.io.IOException; -import net.sf.gridarta.model.mapmodel.MapFile; -import net.sf.gridarta.model.mapmodel.MapModel; -import net.sf.gridarta.model.settings.ProjectSettings; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * Normalizes map path specifications into {@link File Files}. - * @author Andreas Kirschbaum - */ -public class MapPathNormalizer { - - /** - * The project settings instance. - */ - @NotNull - private final ProjectSettings projectSettings; - - /** - * Creates a new instance. - * @param projectSettings the project settings instance - */ - public MapPathNormalizer(@NotNull final ProjectSettings projectSettings) { - this.projectSettings = projectSettings; - } - - /** - * Normalizes a map path relative to a {@link MapModel}. - * @param mapModel the map model to start from - * @param path the destination path - * @return the normalized destination file - * @throws InvalidPathException if the destination file is invalid - * @throws IOErrorException if an I/O error occurs - * @throws RelativePathOnUnsavedMapException if the path is relative and the - * map has not yet been saved - * @throws SameMapException if the destination path points to the source - * map - */ - @NotNull - public File normalizeMapPath(@NotNull final MapModel<?, ?, ?> mapModel, @NotNull final String path) throws InvalidPathException, IOErrorException, RelativePathOnUnsavedMapException, SameMapException { - final MapFile mapFile = mapModel.getMapFile(); - return normalizeMapPath(mapFile == null ? null : mapFile.getFile(), path); - } - - /** - * Normalizes a map path relative to a {@link File}. - * @param mapFile the file to start from - * @param path the destination path - * @return the normalized destination file - * @throws InvalidPathException if the destination file is invalid - * @throws IOErrorException if an I/O error occurs - * @throws RelativePathOnUnsavedMapException if the path is relative and the - * map has not yet been saved - * @throws SameMapException if the destination path points to the source - * map - */ - @NotNull - private File normalizeMapPath(@Nullable final File mapFile, @NotNull final String path) throws InvalidPathException, IOErrorException, RelativePathOnUnsavedMapException, SameMapException { - @NotNull final File newFile; - if (path.startsWith(File.pathSeparator) || path.startsWith("/")) { - // we have an absolute path: - newFile = new File(projectSettings.getMapsDirectory().getAbsolutePath(), path.substring(1)); - } else { - // we have a relative path: - if (mapFile == null) { - throw new RelativePathOnUnsavedMapException(path); - } - newFile = new File(mapFile.getParent(), path); - } - if (path.isEmpty() || (mapFile != null && newFile.equals(mapFile))) { - throw new SameMapException(); - } - - if (!newFile.exists() || newFile.isDirectory()) { - // The path is wrong - // TODO: Differ between non-existing paths, wrongly formatted paths and directories - give more info to the user. - throw new InvalidPathException(newFile); - } - - // its important to force the canonical file here or the - // file path is added every time we use a ../ or a ./ . - // This results in giant file names like "xx/../yy/../xx/../yy/.." - // and after some times in buffer overflows. - final File canonicalNewFile; - try { - canonicalNewFile = newFile.getCanonicalFile(); - } catch (final IOException ex) { - throw new IOErrorException(newFile, ex); - } - - return canonicalNewFile; - } - -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-02-16 19:37:37
|
Revision: 9575 http://sourceforge.net/p/gridarta/code/9575 Author: akirschbaum Date: 2014-02-16 19:37:34 +0000 (Sun, 16 Feb 2014) Log Message: ----------- Move classes to different packages. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/EnterMap.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/DefaultMapModel.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/MapModel.java trunk/src/model/src/main/java/net/sf/gridarta/model/validation/checks/ExitChecker.java trunk/src/model/src/main/java/net/sf/gridarta/model/validation/checks/TilePathsChecker.java Added Paths: ----------- trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/SameMapException.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/UnsavedMapException.java Removed Paths: ------------- trunk/src/model/src/main/java/net/sf/gridarta/model/mappathnormalizer/ Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/EnterMap.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/EnterMap.java 2014-02-16 19:35:04 UTC (rev 9574) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/EnterMap.java 2014-02-16 19:37:34 UTC (rev 9575) @@ -37,8 +37,8 @@ import net.sf.gridarta.model.mapmanager.FileControl; import net.sf.gridarta.model.mapmodel.MapFile; import net.sf.gridarta.model.mapmodel.MapPath; -import net.sf.gridarta.model.mappathnormalizer.SameMapException; -import net.sf.gridarta.model.mappathnormalizer.UnsavedMapException; +import net.sf.gridarta.model.mapmodel.SameMapException; +import net.sf.gridarta.model.mapmodel.UnsavedMapException; import net.sf.gridarta.utils.Size2D; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/DefaultMapModel.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/DefaultMapModel.java 2014-02-16 19:35:04 UTC (rev 9574) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/DefaultMapModel.java 2014-02-16 19:37:34 UTC (rev 9575) @@ -38,8 +38,6 @@ import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.maparchobject.MapArchObjectListener; -import net.sf.gridarta.model.mappathnormalizer.SameMapException; -import net.sf.gridarta.model.mappathnormalizer.UnsavedMapException; import net.sf.gridarta.model.match.GameObjectMatchers; import net.sf.gridarta.model.match.NamedGameObjectMatcher; import net.sf.gridarta.model.validation.DefaultErrorCollector; Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/MapModel.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/MapModel.java 2014-02-16 19:35:04 UTC (rev 9574) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/MapModel.java 2014-02-16 19:37:34 UTC (rev 9575) @@ -26,8 +26,6 @@ import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; -import net.sf.gridarta.model.mappathnormalizer.SameMapException; -import net.sf.gridarta.model.mappathnormalizer.UnsavedMapException; import net.sf.gridarta.model.validation.ErrorCollector; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; Copied: trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/SameMapException.java (from rev 9574, trunk/src/model/src/main/java/net/sf/gridarta/model/mappathnormalizer/SameMapException.java) =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/SameMapException.java (rev 0) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/SameMapException.java 2014-02-16 19:37:34 UTC (rev 9575) @@ -0,0 +1,33 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 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.model.mapmodel; + +/** + * Exception thrown if the destination path points to the source map. + * @author Andreas Kirschbaum + */ +public class SameMapException extends Exception { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + +} Property changes on: trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/SameMapException.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Copied: trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/UnsavedMapException.java (from rev 9574, trunk/src/model/src/main/java/net/sf/gridarta/model/mappathnormalizer/UnsavedMapException.java) =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/UnsavedMapException.java (rev 0) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/UnsavedMapException.java 2014-02-16 19:37:34 UTC (rev 9575) @@ -0,0 +1,33 @@ +/* + * 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.model.mapmodel; + +/** + * Exception thrown if an operation is attempted on an unsaved map. + * @author Andreas Kirschbaum + */ +public class UnsavedMapException extends Exception { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + +} Property changes on: trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/UnsavedMapException.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/model/src/main/java/net/sf/gridarta/model/validation/checks/ExitChecker.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/validation/checks/ExitChecker.java 2014-02-16 19:35:04 UTC (rev 9574) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/validation/checks/ExitChecker.java 2014-02-16 19:37:34 UTC (rev 9575) @@ -26,8 +26,8 @@ import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.mapmodel.MapPathUtils; import net.sf.gridarta.model.mapmodel.MapSquare; -import net.sf.gridarta.model.mappathnormalizer.SameMapException; -import net.sf.gridarta.model.mappathnormalizer.UnsavedMapException; +import net.sf.gridarta.model.mapmodel.SameMapException; +import net.sf.gridarta.model.mapmodel.UnsavedMapException; import net.sf.gridarta.model.validation.AbstractValidator; import net.sf.gridarta.model.validation.ErrorCollector; import net.sf.gridarta.model.validation.GameObjectValidator; Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/validation/checks/TilePathsChecker.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/validation/checks/TilePathsChecker.java 2014-02-16 19:35:04 UTC (rev 9574) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/validation/checks/TilePathsChecker.java 2014-02-16 19:37:34 UTC (rev 9575) @@ -26,8 +26,8 @@ import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.mapmodel.MapPathUtils; -import net.sf.gridarta.model.mappathnormalizer.SameMapException; -import net.sf.gridarta.model.mappathnormalizer.UnsavedMapException; +import net.sf.gridarta.model.mapmodel.SameMapException; +import net.sf.gridarta.model.mapmodel.UnsavedMapException; import net.sf.gridarta.model.validation.AbstractValidator; import net.sf.gridarta.model.validation.ErrorCollector; import net.sf.gridarta.model.validation.MapValidator; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-02-16 19:56:16
|
Revision: 9577 http://sourceforge.net/p/gridarta/code/9577 Author: akirschbaum Date: 2014-02-16 19:56:12 +0000 (Sun, 16 Feb 2014) Log Message: ----------- Remove redundant null checks. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/ImageCreator.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/ShiftProcessor.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/gameobjectattributes/FaceTab.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/scripts/ScriptedEventEditor.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/utils/DirectionLayout.java trunk/src/model/src/main/java/net/sf/gridarta/model/filter/FilterParser.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/map/renderer/ImageCreator.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/ImageCreator.java 2014-02-16 19:44:19 UTC (rev 9576) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/ImageCreator.java 2014-02-16 19:56:12 UTC (rev 9577) @@ -93,9 +93,6 @@ if (in.canRead()) { final MapControl<G, A, R> mapControl = mapManager.openMapFile(in, false); - if (mapControl == null) { - return; - } try { createImage(mapControl.getMapModel(), out); } finally { Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/ShiftProcessor.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/ShiftProcessor.java 2014-02-16 19:44:19 UTC (rev 9576) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/ShiftProcessor.java 2014-02-16 19:56:12 UTC (rev 9577) @@ -331,6 +331,7 @@ } assert startGameObjects.isEmpty(); assert mapGrid != null; + //noinspection ConstantConditions mapGrid.select(prevPos, startSelection ? SelectionMode.ADD : SelectionMode.SUB); } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/gameobjectattributes/FaceTab.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/gameobjectattributes/FaceTab.java 2014-02-16 19:44:19 UTC (rev 9576) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/gameobjectattributes/FaceTab.java 2014-02-16 19:56:12 UTC (rev 9577) @@ -225,6 +225,7 @@ final String tmpFaceName = gameObject.getFaceName(); if (tmpFaceName != null) { faceName = normalizeFace(tmpFaceName); + //noinspection ConstantConditions if (severity == Severity.DEFAULT) { severity = Severity.MODIFIED; } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/scripts/ScriptedEventEditor.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/scripts/ScriptedEventEditor.java 2014-02-16 19:44:19 UTC (rev 9576) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/scripts/ScriptedEventEditor.java 2014-02-16 19:56:12 UTC (rev 9577) @@ -107,9 +107,7 @@ // now see if that file really exists: if (scriptFile.exists() && scriptFile.isFile()) { final String path = scriptFile.getAbsolutePath(); - if (scriptEditControl != null) { - scriptEditControl.openScriptFile(path); - } + scriptEditControl.openScriptFile(path); } else { // file does not exist! ACTION_BUILDER.showMessageDialog(parent, "openScriptNotFound", scriptFile); Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/utils/DirectionLayout.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/utils/DirectionLayout.java 2014-02-16 19:44:19 UTC (rev 9576) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/utils/DirectionLayout.java 2014-02-16 19:56:12 UTC (rev 9577) @@ -186,9 +186,6 @@ final Direction direction; if (constraints instanceof Integer) { direction = getDirectionFromDaimonin((Integer) constraints); - if (direction == null) { - throw new IllegalArgumentException("Illegal constraint number: " + constraints); - } } else if (!(constraints instanceof Direction)) { throw new IllegalArgumentException("DirectionLayout does not support " + constraints.getClass().getName() + " constraints."); } else { 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-02-16 19:44:19 UTC (rev 9576) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/filter/FilterParser.java 2014-02-16 19:56:12 UTC (rev 9577) @@ -112,9 +112,7 @@ for (final Element filterElement : it) { final String name = filterElement.getChildTextTrim("name"); final FilterConfig<?, ?> subFilterConfig = filterConfig.getConfig(name); - if (subFilterConfig != null) { - fromXML(filterElement, subFilterConfig); - } + fromXML(filterElement, subFilterConfig); } } 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-02-16 19:44:19 UTC (rev 9576) +++ trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/JEditTextArea.java 2014-02-16 19:56:12 UTC (rev 9577) @@ -390,10 +390,6 @@ * directly. */ public void recalculateVisibleLines() { - if (painter == null) { - return; - } - final int height = painter.getHeight(); // get line height @@ -1361,10 +1357,6 @@ */ @Override public void processKeyEvent(@NotNull final KeyEvent e) { - if (inputHandler == null) { - return; - } - switch (e.getID()) { case KeyEvent.KEY_TYPED: inputHandler.keyTyped(e); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-02-16 21:46:33
|
Revision: 9580 http://sourceforge.net/p/gridarta/code/9580 Author: akirschbaum Date: 2014-02-16 21:46:14 +0000 (Sun, 16 Feb 2014) Log Message: ----------- Update comments. Modified Paths: -------------- 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/archetype/Archetype.java trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/archetype/UndefinedArchetype.java trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/gameobject/GameObject.java trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/io/ArchetypeParser.java trunk/src/atrinik/src/test/java/net/sf/gridarta/var/atrinik/gui/map/renderer/TestMapRenderer.java trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/AbstractFlatMapRenderer.java trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.java 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/archetype/Archetype.java trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/archetype/UndefinedArchetype.java trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/gameobject/GameObject.java trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/io/ArchetypeParser.java trunk/src/crossfire/src/test/java/net/sf/gridarta/var/crossfire/model/gameobject/PropagateElevationTest.java trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/model/archetype/Archetype.java trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/model/archetype/UndefinedArchetype.java trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/model/gameobject/GameObject.java trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/model/io/ArchetypeParser.java trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AbstractMapCursorAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ArchAttributesAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/action/CollectArchesAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ControlClientAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ControlServerAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/action/GrowSelectionAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/action/LightVisibleAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ManageBookmarksAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/action/OptionsAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ShrinkSelectionAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ValidateMapAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/AbstractServerActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/AttachTiledMaps.java trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/ExitConnectorActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/commands/Collector.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/data/NamedObjectsUtils.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/bookmarks/MapMenuEntryIcons.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/BrowseArchetypesDialogManager.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/errorview/DefaultErrorView.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/find/FindDialog.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/findarchetypes/FindArchetypesDialogManager.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/findarchetypes/TableModel.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/AttributesPaneBuilder.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/ConfirmErrorsDialog.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/GameObjectAttributesDialog.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/MaskChangeAL.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/gameobjectattributes/StringKeyManager.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/goexit/MapListCellRenderer.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/golocation/GoLocationDialog.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/help/Help.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/help/HtmlPane.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/newmap/AbstractMapsizeNewMapDialog.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/newmap/AbstractNewMapDialog.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/newmap/NewMapDialog.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/newmap/NewPickmapDialog.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/newmap/NewPickmapFolderDialog.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/ClosingIcon.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginViewPane.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/prefs/GUIPreferences.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/prefs/NetPreferences.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/shortcuts/KeyStrokeDialog.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/shortcuts/KeyStrokeField.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/shortcuts/ShortcutsDialog.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/exitconnector/ExitConnectorController.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/MapFileActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/MapPreviewAccessory.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/EnterMap.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/ExitIterator.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/MapActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/maptilepane/TilePanel.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapview/MapView.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapview/MapViewFactory.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapview/MapViewManager.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapview/MapViewManagerListener.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapview/MapViews.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapview/MapViewsManager.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/AbstractIsoMapRenderer.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/AbstractMapRenderer.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/MapRenderer.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/renderer/ToolTipAppender.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapdesktop/MapDesktop.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapfiles/Loader.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapfiles/MapFolder.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapfiles/MapFolderListener.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapfiles/MapFolderTree.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapfiles/MapFolderTreeAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapfiles/MapFolderTreeActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapfiles/MapFolderTreeListener.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapfiles/PickmapState.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapimagecache/MapImageCache.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapimagecache/MapImageCacheEntry.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/AutoscrollJTree.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenu.java 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/gridarta/src/main/java/net/sf/gridarta/gui/mapmenu/MapMenuManager.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapuserlistener/MapMouseListener.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/DefaultFileControl.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/MainView.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/MainViewActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/StatusBar.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/ArchetypeChooserView.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/archetypechooser/ArchetypePanel.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/connectionview/Connection.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/connectionview/MonsterControl.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/connectionview/MonsterView.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/connectionview/View.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/gameobjectattributes/AbstractGameObjectAttributesTab.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/gameobjectattributes/ErrorListView.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/gameobjectattributes/EventsTab.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/gameobjectattributes/GameObjectAttributesTab.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/objectchoicedisplay/ObjectChoiceDisplay.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/objectchooser/DefaultObjectChooser.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/objectchooser/ObjectChooser.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/objectchooser/ObjectChooserListener.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/objectchooser/ObjectChooserTab.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/pickmapchooser/PickmapChooserControl.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/pickmapchooser/PickmapChooserModel.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/pickmapchooser/PickmapChooserModelListener.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/pickmapchooser/PickmapChooserView.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/selectedsquare/ModelUpdater.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/selectedsquare/SelectedSquareModel.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/selectedsquare/SelectedSquareModelListener.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/selectedsquare/SelectedSquareView.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/tools/InsertionTool.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/tools/Tool.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/tools/ToolPalette.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/tools/ToolSelector.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/scripts/AbstractScriptArchUtils.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/scripts/ScriptArchDataUtils.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/scripts/ScriptArchEditor.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/spells/SpellsUtils.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/treasurelist/CFTreasureListTree.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/undo/UndoControl.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/utils/AsynchronousProgress.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/utils/DirectionLayout.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/utils/GList.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/utils/GSplitPane.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/utils/JFileField.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/utils/MenuUtils.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/utils/ToolTipProvider.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/utils/borderpanel/BorderPanel.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/utils/borderpanel/BorderPanelListener.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/utils/borderpanel/BorderSplitPane.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/utils/borderpanel/VerticalToggleButton.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/utils/tabbedpanel/ButtonList.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/utils/tabbedpanel/ButtonListListener.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/utils/tabbedpanel/ButtonLists.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/utils/tabbedpanel/DoubleButtonList.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/utils/tabbedpanel/Tab.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/utils/tabbedpanel/TabbedPanel.java trunk/src/gridarta/src/main/java/net/sf/gridarta/mainactions/MainActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/mainactions/RandomFillDialog.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GridartaEditor.java trunk/src/gridarta/src/main/java/net/sf/gridarta/updater/Updater.java trunk/src/gridarta/src/test/java/net/sf/gridarta/actions/ExitConnectorActionsTest.java trunk/src/model/src/main/java/net/sf/gridarta/model/anim/AnimationObject.java trunk/src/model/src/main/java/net/sf/gridarta/model/anim/AnimationParseException.java trunk/src/model/src/main/java/net/sf/gridarta/model/anim/DefaultAnimationObject.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetype/AbstractArchetype.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetype/Archetype.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypechooser/ArchetypeChooserFolder.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypechooser/ArchetypeChooserFolderListener.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypechooser/ArchetypeChooserModel.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypechooser/ArchetypeChooserModelListener.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypechooser/ArchetypeChooserPanel.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypechooser/ArchetypeChooserPanelListener.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypeset/ArchetypeSet.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypeset/DefaultArchetypeSet.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/AbstractArchetypeAttributeSpell.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttribute.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeAttributeParser.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeType.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java trunk/src/model/src/main/java/net/sf/gridarta/model/archetypetype/AttributeBitmask.java trunk/src/model/src/main/java/net/sf/gridarta/model/autojoin/AutojoinList.java trunk/src/model/src/main/java/net/sf/gridarta/model/autojoin/InsertionResult.java trunk/src/model/src/main/java/net/sf/gridarta/model/baseobject/AbstractBaseObject.java trunk/src/model/src/main/java/net/sf/gridarta/model/baseobject/Attributes.java trunk/src/model/src/main/java/net/sf/gridarta/model/baseobject/BaseObject.java trunk/src/model/src/main/java/net/sf/gridarta/model/baseobject/GameObjectContainer.java trunk/src/model/src/main/java/net/sf/gridarta/model/baseobject/GameObjectText.java trunk/src/model/src/main/java/net/sf/gridarta/model/configsource/ConfigSource.java trunk/src/model/src/main/java/net/sf/gridarta/model/connectionview/Connections.java trunk/src/model/src/main/java/net/sf/gridarta/model/data/AbstractNamedObject.java trunk/src/model/src/main/java/net/sf/gridarta/model/data/NamedObject.java trunk/src/model/src/main/java/net/sf/gridarta/model/data/NamedObjects.java trunk/src/model/src/main/java/net/sf/gridarta/model/data/NamedTreeNode.java trunk/src/model/src/main/java/net/sf/gridarta/model/errorview/ErrorViewCollectorErrorHandler.java trunk/src/model/src/main/java/net/sf/gridarta/model/exitconnector/AbstractExitConnectorModel.java trunk/src/model/src/main/java/net/sf/gridarta/model/exitconnector/ExitConnectorModel.java trunk/src/model/src/main/java/net/sf/gridarta/model/exitconnector/ExitConnectorModelListener.java trunk/src/model/src/main/java/net/sf/gridarta/model/exitconnector/ExitLocation.java trunk/src/model/src/main/java/net/sf/gridarta/model/exitconnector/ExitMatcher.java trunk/src/model/src/main/java/net/sf/gridarta/model/face/ArchFaceProvider.java trunk/src/model/src/main/java/net/sf/gridarta/model/face/CollectedFaceProvider.java trunk/src/model/src/main/java/net/sf/gridarta/model/face/DefaultFaceObject.java trunk/src/model/src/main/java/net/sf/gridarta/model/face/DefaultFaceObjects.java trunk/src/model/src/main/java/net/sf/gridarta/model/face/FaceObject.java trunk/src/model/src/main/java/net/sf/gridarta/model/face/FaceObjectProviders.java trunk/src/model/src/main/java/net/sf/gridarta/model/face/FaceObjects.java trunk/src/model/src/main/java/net/sf/gridarta/model/filter/Filter.java trunk/src/model/src/main/java/net/sf/gridarta/model/filter/FilterConfig.java trunk/src/model/src/main/java/net/sf/gridarta/model/filter/NamedFilterConfig.java trunk/src/model/src/main/java/net/sf/gridarta/model/gameobject/AbstractGameObject.java trunk/src/model/src/main/java/net/sf/gridarta/model/gameobject/GameObject.java trunk/src/model/src/main/java/net/sf/gridarta/model/gameobject/MultiArchData.java trunk/src/model/src/main/java/net/sf/gridarta/model/gameobject/NotInsideContainerException.java trunk/src/model/src/main/java/net/sf/gridarta/model/index/Index.java trunk/src/model/src/main/java/net/sf/gridarta/model/index/MapsIndexer.java trunk/src/model/src/main/java/net/sf/gridarta/model/io/AbstractArchetypeParser.java trunk/src/model/src/main/java/net/sf/gridarta/model/io/AbstractGameObjectParser.java trunk/src/model/src/main/java/net/sf/gridarta/model/io/AnimationObjectsReader.java trunk/src/model/src/main/java/net/sf/gridarta/model/io/ArchetypeParser.java trunk/src/model/src/main/java/net/sf/gridarta/model/io/AttributeListUtils.java trunk/src/model/src/main/java/net/sf/gridarta/model/io/GameObjectParser.java trunk/src/model/src/main/java/net/sf/gridarta/model/io/PathManagerUtils.java trunk/src/model/src/main/java/net/sf/gridarta/model/maparchobject/MapArchObject.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapcursor/MapCursor.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapcursor/MapCursorListener.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapgrid/MapGrid.java trunk/src/model/src/main/java/net/sf/gridarta/model/maplocation/MapLocation.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapmanager/AbstractMapManager.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapmanager/FileControl.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapmanager/MapManager.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapmanager/MapManagerListener.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/AutoInsertionMode.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/DefaultMapModel.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/FilterGameObjectIterator.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/MapModel.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/MapSquare.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/MapSquareGrid.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/MapSquareIterator.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/SavedSquares.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/TopLevelGameObjectIterator.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapviewsettings/MapViewSettings.java trunk/src/model/src/main/java/net/sf/gridarta/model/match/AndGameObjectMatcher.java trunk/src/model/src/main/java/net/sf/gridarta/model/match/AttributeGameObjectMatcher.java trunk/src/model/src/main/java/net/sf/gridarta/model/match/GameObjectMatcher.java trunk/src/model/src/main/java/net/sf/gridarta/model/match/GameObjectMatcherParser.java trunk/src/model/src/main/java/net/sf/gridarta/model/match/GameObjectMatchers.java trunk/src/model/src/main/java/net/sf/gridarta/model/match/GameObjectMatchersParser.java trunk/src/model/src/main/java/net/sf/gridarta/model/match/IntAttributeGameObjectMatcher.java trunk/src/model/src/main/java/net/sf/gridarta/model/match/MutableNameGameObjectMatcher.java trunk/src/model/src/main/java/net/sf/gridarta/model/match/MutableOrGameObjectMatcher.java trunk/src/model/src/main/java/net/sf/gridarta/model/match/NamedGameObjectMatcher.java trunk/src/model/src/main/java/net/sf/gridarta/model/match/NotGameObjectMatcher.java trunk/src/model/src/main/java/net/sf/gridarta/model/match/OrGameObjectMatcher.java trunk/src/model/src/main/java/net/sf/gridarta/model/match/SetEnabledAction.java trunk/src/model/src/main/java/net/sf/gridarta/model/match/StringAttributeGameObjectMatcher.java trunk/src/model/src/main/java/net/sf/gridarta/model/match/TypeNrsGameObjectMatcher.java trunk/src/model/src/main/java/net/sf/gridarta/model/match/ViewGameObjectMatcherManager.java trunk/src/model/src/main/java/net/sf/gridarta/model/resource/AbstractCollectedResourcesReader.java trunk/src/model/src/main/java/net/sf/gridarta/model/resource/AbstractFilesResourcesReader.java trunk/src/model/src/main/java/net/sf/gridarta/model/resource/AbstractResources.java trunk/src/model/src/main/java/net/sf/gridarta/model/resource/AbstractResourcesReader.java trunk/src/model/src/main/java/net/sf/gridarta/model/scripts/ScriptArchData.java trunk/src/model/src/main/java/net/sf/gridarta/model/scripts/ScriptArchUtils.java trunk/src/model/src/main/java/net/sf/gridarta/model/scripts/UndefinedEventArchetypeException.java trunk/src/model/src/main/java/net/sf/gridarta/model/smoothface/SmoothFaces.java trunk/src/model/src/main/java/net/sf/gridarta/model/spells/ArchetypeSetSpellLoader.java trunk/src/model/src/main/java/net/sf/gridarta/model/spells/XMLSpellLoader.java trunk/src/model/src/main/java/net/sf/gridarta/model/treasurelist/TreasureLoader.java trunk/src/model/src/main/java/net/sf/gridarta/model/treasurelist/TreasureTree.java trunk/src/model/src/main/java/net/sf/gridarta/model/undo/UndoModel.java trunk/src/model/src/main/java/net/sf/gridarta/model/undo/UndoState.java trunk/src/model/src/main/java/net/sf/gridarta/model/validation/Validator.java trunk/src/model/src/main/java/net/sf/gridarta/model/validation/checks/AbstractShopSquareChecker.java trunk/src/model/src/main/java/net/sf/gridarta/model/validation/checks/AttributeRangeChecker.java trunk/src/model/src/main/java/net/sf/gridarta/model/validation/checks/BlockedMatrix.java trunk/src/model/src/main/java/net/sf/gridarta/model/validation/checks/BlockedSpawnPointChecker.java trunk/src/model/src/main/java/net/sf/gridarta/model/validation/checks/BlockedSquareChecker.java trunk/src/model/src/main/java/net/sf/gridarta/model/validation/checks/CustomTypeChecker.java trunk/src/model/src/main/java/net/sf/gridarta/model/validation/checks/MapCheckerScriptChecker.java trunk/src/model/src/main/java/net/sf/gridarta/model/validation/checks/ValidatorFactory.java trunk/src/model/src/main/java/net/sf/gridarta/model/validation/errors/ValidationError.java trunk/src/model/src/test/java/net/sf/gridarta/model/baseobject/AbstractBaseObjectTest.java trunk/src/model/src/test/java/net/sf/gridarta/model/mapgrid/MapGridTest.java trunk/src/model/src/test/java/net/sf/gridarta/model/resource/TestFilesResourcesReader.java 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/parameter/DoubleParameter.java trunk/src/preferences/src/main/java/net/sf/gridarta/preferences/Codec.java 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/Storage.java trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/scripteditor/CFPythonPopup.java trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/scripteditor/ScriptEditControl.java trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/scripteditor/ScriptEditUndoActions.java trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/scripteditor/ScriptEditView.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/InputHandler.java trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/JEditTextArea.java trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/SyntaxStyle.java trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/SyntaxStyles.java trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/SyntaxUtilities.java trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/TextAreaPainter.java trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/TextUtilities.java trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/Token.java trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/actions/FindAgain.java 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/Replace.java trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/tokenmarker/DaimoninAITokenMarker.java trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/tokenmarker/KeywordMap.java trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/tokenmarker/Node.java trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/tokenmarker/Spec.java trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/tokenmarker/TokenMarker.java trunk/src/utils/src/main/java/net/sf/gridarta/utils/ActionBuilderUtils.java trunk/src/utils/src/main/java/net/sf/gridarta/utils/ActionUtils.java trunk/src/utils/src/main/java/net/sf/gridarta/utils/ArrayUtils.java trunk/src/utils/src/main/java/net/sf/gridarta/utils/ConfigFileUtils.java trunk/src/utils/src/main/java/net/sf/gridarta/utils/CopyReader.java trunk/src/utils/src/main/java/net/sf/gridarta/utils/FileChooserUtils.java trunk/src/utils/src/main/java/net/sf/gridarta/utils/IOUtils.java trunk/src/utils/src/main/java/net/sf/gridarta/utils/MapFileFilter.java trunk/src/utils/src/main/java/net/sf/gridarta/utils/MathUtils.java trunk/src/utils/src/main/java/net/sf/gridarta/utils/Size2D.java trunk/src/utils/src/main/java/net/sf/gridarta/utils/StringUtils.java trunk/src/utils/src/main/java/net/sf/gridarta/utils/WrappingStringBuilder.java trunk/src/utils/src/main/java/net/sf/gridarta/utils/Xtea.java trunk/src/utils/src/test/java/net/sf/gridarta/utils/StringUtilsTest.java 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-02-16 20:21:46 UTC (rev 9579) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java 2014-02-16 21:46:14 UTC (rev 9580) @@ -618,8 +618,8 @@ /** * Checks the given values and modifies the current map. - * @return <code>true</code> if the map properties were edited, - * <code>false</code> if the parameters were wrong. + * @return {@code true} if the map properties were edited, {@code false} if + * the parameters were wrong. */ private boolean modifyMapProperties() { // first check if the entries are all okay Modified: trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/archetype/Archetype.java =================================================================== --- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/archetype/Archetype.java 2014-02-16 20:21:46 UTC (rev 9579) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/archetype/Archetype.java 2014-02-16 21:46:14 UTC (rev 9580) @@ -24,7 +24,7 @@ import org.jetbrains.annotations.NotNull; /** - * <code>Archetype</code> implements Atrinik archetypes. + * Implements Atrinik archetypes. * @author Andreas Kirschbaum */ public interface Archetype extends net.sf.gridarta.model.archetype.Archetype<GameObject, MapArchObject, Archetype> { Modified: trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/archetype/UndefinedArchetype.java =================================================================== --- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/archetype/UndefinedArchetype.java 2014-02-16 20:21:46 UTC (rev 9579) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/archetype/UndefinedArchetype.java 2014-02-16 21:46:14 UTC (rev 9580) @@ -27,8 +27,7 @@ import org.jetbrains.annotations.NotNull; /** - * The class <code>UndefinedArchetype</code> implements an undefined Atrinik - * archetype. + * Implements an undefined Atrinik archetype. * @author Andreas Kirschbaum */ public class UndefinedArchetype extends AbstractArchetype<GameObject, MapArchObject, Archetype> implements Archetype { Modified: trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/gameobject/GameObject.java =================================================================== --- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/gameobject/GameObject.java 2014-02-16 20:21:46 UTC (rev 9579) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/gameobject/GameObject.java 2014-02-16 21:46:14 UTC (rev 9580) @@ -29,9 +29,8 @@ import org.jetbrains.annotations.NotNull; /** - * The <code>GameObject</code> class handles the Atrinik GameObjects. Usually, - * an GameObject that is really used is derived from a (replaceable) default - * arch. + * Handles the Atrinik GameObjects. Usually, an GameObject that is really used + * is derived from a (replaceable) default arch. * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> * @author <a href="mailto:ch...@ri...">Christian Hujer</a> Modified: trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/io/ArchetypeParser.java =================================================================== --- trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/io/ArchetypeParser.java 2014-02-16 20:21:46 UTC (rev 9579) +++ trunk/src/atrinik/src/main/java/net/sf/gridarta/var/atrinik/model/io/ArchetypeParser.java 2014-02-16 21:46:14 UTC (rev 9580) @@ -40,9 +40,8 @@ import org.jetbrains.annotations.Nullable; /** - * The <code>ArchetypeParser</code> class handles the parsing of arches. It is a - * class separated from ArchetypeSet because it is also involved in loading - * arches in map files. + * Handles the parsing of arches. It is a class separated from ArchetypeSet + * because it is also involved in loading arches in map files. * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> * @author <a href="mailto:ch...@ri...">Christian Hujer</a> Modified: trunk/src/atrinik/src/test/java/net/sf/gridarta/var/atrinik/gui/map/renderer/TestMapRenderer.java =================================================================== --- trunk/src/atrinik/src/test/java/net/sf/gridarta/var/atrinik/gui/map/renderer/TestMapRenderer.java 2014-02-16 20:21:46 UTC (rev 9579) +++ trunk/src/atrinik/src/test/java/net/sf/gridarta/var/atrinik/gui/map/renderer/TestMapRenderer.java 2014-02-16 21:46:14 UTC (rev 9580) @@ -96,7 +96,7 @@ } /** - * Appends a <code>double></code> value to {@link #sb}. + * Appends a {@code double} value to {@link #sb}. * @param value the double value */ private void appendDouble(final double value) { Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/AbstractFlatMapRenderer.java =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/AbstractFlatMapRenderer.java 2014-02-16 20:21:46 UTC (rev 9579) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/AbstractFlatMapRenderer.java 2014-02-16 21:46:14 UTC (rev 9580) @@ -390,8 +390,8 @@ * @param graphics the graphics context to paint to * @param isSnapshot true when this drawing is for a "screenshot"-image, * false for normal drawing - * @param checkClip if set, omit squares outside <code>graphics</code>'s - * clip area + * @param checkClip if set, omit squares outside {@code graphics}'s clip + * area */ protected void paintComponent(@NotNull final Graphics graphics, final boolean isSnapshot, final boolean checkClip) { graphics.setColor(getBackground()); @@ -430,8 +430,8 @@ /** * Paints the whole map. * @param graphics the graphics context to draw in - * @param checkClip if set, omit squares outside <code>graphics</code>'s - * clip area + * @param checkClip if set, omit squares outside {@code graphics}'s clip + * area */ private void paintMap(@NotNull final Graphics graphics, final boolean checkClip) { for (tmpPoint.y = 0; tmpPoint.y < mapGrid.getSize().getHeight(); tmpPoint.y++) { Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.java =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.java 2014-02-16 20:21:46 UTC (rev 9579) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.java 2014-02-16 21:46:14 UTC (rev 9580) @@ -358,10 +358,10 @@ /** * Get the back buffer image for the map. Sets {@link #backBufferRef} to - * <code>null</code> if the back buffer has been deleted by the garbage + * {@code null} if the back buffer has been deleted by the garbage * collector. - * @return the back buffer image, or <code>null</code> if the map has no - * back buffer + * @return the back buffer image, or {@code null} if the map has no back + * buffer */ @Nullable private BufferedImage getBackBufferImage() { 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-02-16 20:21:46 UTC (rev 9579) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/MapPropertiesDialog.java 2014-02-16 21:46:14 UTC (rev 9580) @@ -553,7 +553,7 @@ /** * Create the tile path panel. - * @param mapTilePane the <code>MapTilePane<code> contents + * @param mapTilePane the {@code MapTilePane} contents * @return the newly created tile path panel */ @NotNull @@ -646,8 +646,8 @@ /** * Checks the given values and modifies the current map. - * @return <code>true</code> if the map properties were edited, - * <code>false</code> if the parameters were wrong. + * @return {@code true} if the map properties were edited, {@code false} if + * the parameters were wrong. */ private boolean modifyMapProperties() { // first check if the entries are all okay Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/archetype/Archetype.java =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/archetype/Archetype.java 2014-02-16 20:21:46 UTC (rev 9579) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/archetype/Archetype.java 2014-02-16 21:46:14 UTC (rev 9580) @@ -24,7 +24,7 @@ import org.jetbrains.annotations.NotNull; /** - * <code>Archetype</code> implements Crossfire archetypes. + * Implements Crossfire archetypes. * @author Andreas Kirschbaum */ public interface Archetype extends net.sf.gridarta.model.archetype.Archetype<GameObject, MapArchObject, Archetype> { Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/archetype/UndefinedArchetype.java =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/archetype/UndefinedArchetype.java 2014-02-16 20:21:46 UTC (rev 9579) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/archetype/UndefinedArchetype.java 2014-02-16 21:46:14 UTC (rev 9580) @@ -27,8 +27,7 @@ import org.jetbrains.annotations.NotNull; /** - * The class <code>UndefinedArchetype</code> implements an undefined Crossfire - * archetype. + * Implements an undefined Crossfire archetype. * @author Andreas Kirschbaum */ public class UndefinedArchetype extends AbstractArchetype<GameObject, MapArchObject, Archetype> implements Archetype { Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/gameobject/GameObject.java =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/gameobject/GameObject.java 2014-02-16 20:21:46 UTC (rev 9579) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/gameobject/GameObject.java 2014-02-16 21:46:14 UTC (rev 9580) @@ -28,9 +28,8 @@ import org.jetbrains.annotations.NotNull; /** - * The <code>GameObject</code> class handles the Crossfire GameObjects. Usually, - * an GameObject that is really used is derived from a (replaceable) default - * arch. + * Handles the Crossfire GameObjects. Usually, an GameObject that is really used + * is derived from a (replaceable) default arch. * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> * @author <a href="mailto:ch...@ri...">Christian Hujer</a> Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/io/ArchetypeParser.java =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/io/ArchetypeParser.java 2014-02-16 20:21:46 UTC (rev 9579) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/io/ArchetypeParser.java 2014-02-16 21:46:14 UTC (rev 9580) @@ -41,9 +41,8 @@ import org.jetbrains.annotations.Nullable; /** - * The <code>ArchetypeParser</code> class handles the parsing of arches. It is a - * class separated from ArchetypeSet because it is also involved in loading - * arches in map files. + * Handles the parsing of arches. It is a class separated from ArchetypeSet + * because it is also involved in loading arches in map files. * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> * @author <a href="mailto:ch...@ri...">Christian Hujer</a> Modified: trunk/src/crossfire/src/test/java/net/sf/gridarta/var/crossfire/model/gameobject/PropagateElevationTest.java =================================================================== --- trunk/src/crossfire/src/test/java/net/sf/gridarta/var/crossfire/model/gameobject/PropagateElevationTest.java 2014-02-16 20:21:46 UTC (rev 9579) +++ trunk/src/crossfire/src/test/java/net/sf/gridarta/var/crossfire/model/gameobject/PropagateElevationTest.java 2014-02-16 21:46:14 UTC (rev 9580) @@ -307,7 +307,7 @@ * Returns the game object at a given index. * @param gameObjects the game objects to search * @param index the index - * @return the game object at <code>index</code> + * @return the game object at {@code index} */ @NotNull private static GameObject get(@NotNull final Iterable<GameObject> gameObjects, final int index) { Modified: trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java =================================================================== --- trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java 2014-02-16 20:21:46 UTC (rev 9579) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java 2014-02-16 21:46:14 UTC (rev 9580) @@ -500,7 +500,7 @@ /** * Creates the tile path panel. - * @param mapTilePane the <code>MapTilePane<code> contents + * @param mapTilePane the {@code MapTilePane} contents * @return the newly created tile path panel */ @NotNull @@ -603,8 +603,8 @@ /** * Checks the given values and modifies the current map. - * @return <code>true</code> if the map properties were edited, - * <code>false</code> if the parameters were wrong + * @return {@code true} if the map properties were edited, {@code false} if + * the parameters were wrong */ private boolean modifyMapProperties() { // first check if the entries are all okay Modified: trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/model/archetype/Archetype.java =================================================================== --- trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/model/archetype/Archetype.java 2014-02-16 20:21:46 UTC (rev 9579) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/model/archetype/Archetype.java 2014-02-16 21:46:14 UTC (rev 9580) @@ -24,7 +24,7 @@ import org.jetbrains.annotations.NotNull; /** - * <code>Archetype</code> implements Daimonin archetypes. + * Implements Daimonin archetypes. * @author Andreas Kirschbaum */ public interface Archetype extends net.sf.gridarta.model.archetype.Archetype<GameObject, MapArchObject, Archetype> { Modified: trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/model/archetype/UndefinedArchetype.java =================================================================== --- trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/model/archetype/UndefinedArchetype.java 2014-02-16 20:21:46 UTC (rev 9579) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/model/archetype/UndefinedArchetype.java 2014-02-16 21:46:14 UTC (rev 9580) @@ -27,8 +27,7 @@ import org.jetbrains.annotations.NotNull; /** - * The class <code>UndefinedArchetype</code> implements an undefined Daimonin - * archetype. + * Implements an undefined Daimonin archetype. * @author Andreas Kirschbaum */ public class UndefinedArchetype extends AbstractArchetype<GameObject, MapArchObject, Archetype> implements Archetype { Modified: trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/model/gameobject/GameObject.java =================================================================== --- trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/model/gameobject/GameObject.java 2014-02-16 20:21:46 UTC (rev 9579) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/model/gameobject/GameObject.java 2014-02-16 21:46:14 UTC (rev 9580) @@ -29,9 +29,8 @@ import org.jetbrains.annotations.NotNull; /** - * The <code>GameObject</code> class handles the Daimonin GameObjects. Usually, - * an GameObject that is really used is derived from a (replaceable) default - * arch. + * Handles the Daimonin GameObjects. Usually, an GameObject that is really used + * is derived from a (replaceable) default arch. * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> * @author <a href="mailto:ch...@ri...">Christian Hujer</a> Modified: trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/model/io/ArchetypeParser.java =================================================================== --- trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/model/io/ArchetypeParser.java 2014-02-16 20:21:46 UTC (rev 9579) +++ trunk/src/daimonin/src/main/java/net/sf/gridarta/var/daimonin/model/io/ArchetypeParser.java 2014-02-16 21:46:14 UTC (rev 9580) @@ -38,9 +38,8 @@ import org.jetbrains.annotations.Nullable; /** - * The <code>ArchetypeParser</code> class handles the parsing of arches. It is a - * class separated from ArchetypeSet because it is also involved in loading - * arches in map files. + * Handles the parsing of arches. It is a class separated from ArchetypeSet + * because it is also involved in loading arches in map files. * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> * @author <a href="mailto:ch...@ri...">Christian Hujer</a> Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AbstractMapCursorAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AbstractMapCursorAction.java 2014-02-16 20:21:46 UTC (rev 9579) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AbstractMapCursorAction.java 2014-02-16 21:46:14 UTC (rev 9580) @@ -39,7 +39,7 @@ public abstract class AbstractMapCursorAction<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { /** - * The active map view, or <code>null</code> if no map view exists. + * The active map view, or {@code null} if no map view exists. */ @Nullable private MapView<G, A, R> currentMapView; @@ -108,8 +108,8 @@ /** * Return the map cursor of the current map view if it is active. - * @return the map cursor, or <code>null</code> if the cursor is not active, - * or if no map view exists + * @return the map cursor, or {@code null} if the cursor is not active, or + * if no map view exists */ @Nullable protected MapCursor<G, A, R> getActiveMapCursor() { Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ArchAttributesAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ArchAttributesAction.java 2014-02-16 20:21:46 UTC (rev 9579) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ArchAttributesAction.java 2014-02-16 21:46:14 UTC (rev 9580) @@ -50,7 +50,7 @@ private final GameObjectAttributesDialogFactory<G, A, R> gameObjectAttributesDialogFactory; /** - * The active map view, or <code>null</code> if no map view exists. + * The active map view, or {@code null} if no map view exists. */ @Nullable private MapView<G, A, R> currentMapView; Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/CollectArchesAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/CollectArchesAction.java 2014-02-16 20:21:46 UTC (rev 9579) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/CollectArchesAction.java 2014-02-16 21:46:14 UTC (rev 9580) @@ -81,7 +81,7 @@ /** * The {@link Collector} if an archetype collection is running, or else - * <code>null</code>. + * {@code null}. */ @Nullable private volatile Collector collector; Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ControlClientAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ControlClientAction.java 2014-02-16 20:21:46 UTC (rev 9579) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ControlClientAction.java 2014-02-16 21:46:14 UTC (rev 9580) @@ -41,7 +41,7 @@ /** * The {@link ProcessRunner} instance that controls the client. Set to - * <code>null</code> if not yet created. + * {@code null} if not yet created. */ @Nullable private ProcessRunner controlClient; Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ControlServerAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ControlServerAction.java 2014-02-16 20:21:46 UTC (rev 9579) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ControlServerAction.java 2014-02-16 21:46:14 UTC (rev 9580) @@ -49,7 +49,7 @@ /** * The {@link ProcessRunner} instance that controls the server. Set to - * <code>null</code> if not yet created. + * {@code null} if not yet created. */ @Nullable private ProcessRunner controlServer; Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/GrowSelectionAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/GrowSelectionAction.java 2014-02-16 20:21:46 UTC (rev 9579) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/GrowSelectionAction.java 2014-02-16 21:46:14 UTC (rev 9580) @@ -46,7 +46,7 @@ public class GrowSelectionAction<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements EditorAction { /** - * The active map view, or <code>null</code> if no map view exists. + * The active map view, or {@code null} if no map view exists. */ @Nullable private MapView<G, A, R> currentMapView; Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/LightVisibleAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/LightVisibleAction.java 2014-02-16 20:21:46 UTC (rev 9579) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/LightVisibleAction.java 2014-02-16 21:46:14 UTC (rev 9580) @@ -96,8 +96,8 @@ /** * Action method for "light visible". - * @return <code>true</code> if the light is visible, or <code>false</code> - * if the light is invisible + * @return {@code true} if the light is visible, or {@code false} if the + * light is invisible */ @ActionMethod public boolean isLightVisible() { @@ -106,9 +106,8 @@ /** * Sets whether the light of the current map should be visible. - * @param lightVisible new visibility of light in current map, - * <code>true</code> if the light should be visible, <code>false</code> if - * invisible + * @param lightVisible new visibility of light in current map, {@code true} + * if the light should be visible, {@code false} if invisible * @see #isLightVisible() */ @ActionMethod @@ -128,7 +127,7 @@ * Executes the "light visible" action. * @param performAction whether the action should be performed * @param lightVisible whether the light should be visible; ignored unless - * <code>performAction</code> is set + * {@code performAction} is set * @return whether the action was or can be performed * @noinspection SameReturnValue */ Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ManageBookmarksAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ManageBookmarksAction.java 2014-02-16 20:21:46 UTC (rev 9579) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ManageBookmarksAction.java 2014-02-16 21:46:14 UTC (rev 9580) @@ -57,8 +57,8 @@ private final Component parentComponent; /** - * The {@link ManageBookmarksDialog} instance. Set to <code>null</code> if - * not yet created. + * The {@link ManageBookmarksDialog} instance. Set to {@code null} if not + * yet created. */ @Nullable private ManageBookmarksDialog<G, A, R> manageBookmarksDialog; Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/OptionsAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/OptionsAction.java 2014-02-16 20:21:46 UTC (rev 9579) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/OptionsAction.java 2014-02-16 21:46:14 UTC (rev 9580) @@ -68,8 +68,8 @@ private final Component parent; /** - * The {@link PreferencesGroup} instance. Set to <code>null</code> if not - * yet created. + * The {@link PreferencesGroup} instance. Set to {@code null} if not yet + * created. */ @Nullable private PreferencesGroup preferencesGroup; Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ShrinkSelectionAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ShrinkSelectionAction.java 2014-02-16 20:21:46 UTC (rev 9579) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ShrinkSelectionAction.java 2014-02-16 21:46:14 UTC (rev 9580) @@ -49,7 +49,7 @@ public class ShrinkSelectionAction<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements EditorAction { /** - * The active map view, or <code>null</code> if no map view exists. + * The active map view, or {@code null} if no map view exists. */ @Nullable private MapView<G, A, R> currentMapView; Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ValidateMapAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ValidateMapAction.java 2014-02-16 20:21:46 UTC (rev 9579) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ValidateMapAction.java 2014-02-16 21:46:14 UTC (rev 9580) @@ -52,7 +52,7 @@ private Action action; /** - * The last known active map, or <code>null</code> if no map is active. + * The last known active map, or {@code null} if no map is active. */ @Nullable private MapControl<G, A, R> currentMapControl; 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-02-16 20:21:46 UTC (rev 9579) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/AbstractServerActions.java 2014-02-16 21:46:14 UTC (rev 9580) @@ -45,7 +45,7 @@ public abstract class AbstractServerActions<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements EditorAction { /** - * The currently active map or <code>null</code> if no map is active. + * The currently active map or {@code null} if no map is active. */ @Nullable private MapView<G, A, R> currentMapView; Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/AttachTiledMaps.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/AttachTiledMaps.java 2014-02-16 20:21:46 UTC (rev 9579) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/AttachTiledMaps.java 2014-02-16 21:46:14 UTC (rev 9580) @@ -260,7 +260,7 @@ * Loads an adjacent {@link MapControl}, ignoring any (I/O-)errors. * @param mapModel the map model for relative map paths * @param path the map path - * @return the map control or <code>null</code> if the map cannot be loaded + * @return the map control or {@code null} if the map cannot be loaded * @throws IOException if an I/O error occurs */ @Nullable @@ -276,8 +276,7 @@ /** * Returns the map path for a tile of a map and a tile path. * @param base the map path of the map - * @param link the tile path of the map; may be relative to - * <code>base</code> + * @param link the tile path of the map; may be relative to {@code base} * @param mapsDirectory the maps directory * @return the map path * @throws CannotSaveMapFileException if an I/O error occurs @@ -317,7 +316,7 @@ * Returns the index of the last '/' or {@link File#separator} within a * string. * @param base the string - * @return the index or <code>-1</code> if not found + * @return the index or {@code -1} if not found */ private static int getLastSlashIndex(@NotNull final String base) { final int slashIndex1 = base.lastIndexOf('/'); Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/ExitConnectorActions.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/ExitConnectorActions.java 2014-02-16 20:21:46 UTC (rev 9579) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/ExitConnectorActions.java 2014-02-16 21:46:14 UTC (rev 9580) @@ -249,9 +249,9 @@ /** * Executes part of the "exit connect" action. * @param performAction whether the action should be performed - * @param targetExit the target exit game object or <code>null</code> - * @param targetArchetype the target exit archetype; <code>null</code> if - * <code>targetExit</code> is non-<code>null</code>; unused otherwise + * @param targetExit the target exit game object or {@code null} ... [truncated message content] |
From: <aki...@us...> - 2014-02-17 20:49:39
|
Revision: 9581 http://sourceforge.net/p/gridarta/code/9581 Author: akirschbaum Date: 2014-02-17 20:49:34 +0000 (Mon, 17 Feb 2014) Log Message: ----------- Split MapPath into AbsoluteMapPath and RelativeMapPath. Modified Paths: -------------- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/validation/checks/NonAbsoluteExitPathChecker.java trunk/src/model/src/main/java/net/sf/gridarta/model/exitconnector/ExitLocation.java trunk/src/model/src/main/java/net/sf/gridarta/model/maplocation/MapLocation.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/MapFile.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/MapPath.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/MapPathUtils.java trunk/src/model/src/test/java/net/sf/gridarta/model/mapmodel/MapPathTest.java trunk/src/model/src/test/java/net/sf/gridarta/model/mapmodel/MapPathUtilsTest.java Added Paths: ----------- trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/AbsoluteMapPath.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/RelativeMapPath.java Modified: trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/validation/checks/NonAbsoluteExitPathChecker.java =================================================================== --- trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/validation/checks/NonAbsoluteExitPathChecker.java 2014-02-16 21:46:14 UTC (rev 9580) +++ trunk/src/crossfire/src/main/java/net/sf/gridarta/var/crossfire/model/validation/checks/NonAbsoluteExitPathChecker.java 2014-02-17 20:49:34 UTC (rev 9581) @@ -21,6 +21,7 @@ import net.sf.gridarta.model.maplocation.MapLocation; import net.sf.gridarta.model.maplocation.NoExitPathException; +import net.sf.gridarta.model.mapmodel.AbsoluteMapPath; import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.mapmodel.MapPath; import net.sf.gridarta.model.mapmodel.MapSquare; @@ -86,7 +87,7 @@ } catch (final NoExitPathException ignored) { return; // unset exit path => skip } - if (exitPath.isAbsolute()) { + if (exitPath instanceof AbsoluteMapPath) { return; // absolute exit path => ok } Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/exitconnector/ExitLocation.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/exitconnector/ExitLocation.java 2014-02-16 21:46:14 UTC (rev 9580) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/exitconnector/ExitLocation.java 2014-02-17 20:49:34 UTC (rev 9581) @@ -21,6 +21,7 @@ import java.awt.Point; import net.sf.gridarta.model.baseobject.BaseObject; +import net.sf.gridarta.model.mapmodel.AbsoluteMapPath; import net.sf.gridarta.model.mapmodel.MapFile; import net.sf.gridarta.model.mapmodel.MapPath; import org.jetbrains.annotations.NotNull; @@ -90,7 +91,7 @@ // unsaved source map => absolute reference mapPath = targetMapPath; } else { - final MapPath sourceMapPath = sourceMapFile.getMapPath(); + final AbsoluteMapPath sourceMapPath = sourceMapFile.getMapPath(); final String sourceMapComponent = sourceMapPath.getMapComponent(); final String targetMapComponent = targetMapPath.getMapComponent(); if (sourceMapComponent == null ? targetMapComponent == null : sourceMapComponent.equals(targetMapComponent)) { Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/maplocation/MapLocation.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/maplocation/MapLocation.java 2014-02-16 21:46:14 UTC (rev 9580) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/maplocation/MapLocation.java 2014-02-17 20:49:34 UTC (rev 9581) @@ -24,6 +24,7 @@ import net.sf.gridarta.model.baseobject.Attributes; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.mapmodel.AbsoluteMapPath; import net.sf.gridarta.model.mapmodel.MapFile; import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.mapmodel.MapPath; @@ -92,20 +93,20 @@ @NotNull public static MapLocation newAbsoluteMapLocation(@NotNull final GameObject<?, ?, ?> gameObject, final boolean allowRandomMapParameters) throws NoExitPathException { final MapPath mapPath = getMapPath(gameObject, allowRandomMapParameters); - final MapPath baseMapPath; + final AbsoluteMapPath baseMapPath; final MapSquare<?, ?, ?> mapSquare = gameObject.getMapSquare(); if (mapSquare == null) { - baseMapPath = new MapPath(true); + baseMapPath = new AbsoluteMapPath(); } else { final MapModel<?, ?, ?> mapModel = mapSquare.getMapModel(); final MapFile mapFile = mapModel.getMapFile(); if (mapFile == null) { - baseMapPath = new MapPath(true); + baseMapPath = new AbsoluteMapPath(); } else { baseMapPath = mapFile.getMapPath(); } } - final MapPath canonicalMapPath = MapPathUtils.append(baseMapPath, mapPath); + final AbsoluteMapPath canonicalMapPath = MapPathUtils.append(baseMapPath, mapPath); final int mapX = getMapX(gameObject); final int mapY = getMapY(gameObject); return new MapLocation(canonicalMapPath, mapX, mapY); @@ -235,7 +236,7 @@ @Override @SuppressWarnings("CompareToUsesNonFinalVariable") public int compareTo(@NotNull final MapLocation o) { - final int cmp = mapPath.compareTo(o.mapPath); + final int cmp = mapPath.toString().compareTo(o.mapPath.toString()); if (cmp != 0) { return cmp; } Copied: trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/AbsoluteMapPath.java (from rev 9580, trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/MapPath.java) =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/AbsoluteMapPath.java (rev 0) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/AbsoluteMapPath.java 2014-02-17 20:49:34 UTC (rev 9581) @@ -0,0 +1,161 @@ +/* + * 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.model.mapmodel; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * A {@link MapPath} that is absolute, that is, it starts with a "/". + * @author Andreas Kirschbaum + */ +public class AbsoluteMapPath implements Comparable<AbsoluteMapPath>, MapPath { + + /** + * The serial versionUID,. + */ + private static final long serialVersionUID = 1L; + + /** + * The map path information. It does not include a leading "/" for absolute + * paths. + */ + @NotNull + private final String path; + + /** + * Creates a new instance. + */ + public AbsoluteMapPath() { + path = ""; + } + + /** + * Creates a new map path based on a parent map path. + * @param parent the parent map path + * @param name the name of the child; "." or ".." are allowed + */ + public AbsoluteMapPath(@NotNull final AbsoluteMapPath parent, @NotNull final String name) { + if (name.isEmpty()) { + throw new IllegalArgumentException("map file is empty"); + } + if (name.contains("/")) { + throw new IllegalArgumentException("map file contains '/': " + name); + } + if (name.equals(".")) { + path = parent.path; + } else if (name.equals("..")) { + if (parent.path.isEmpty()) { + path = ""; + } else if (parent.path.endsWith("/..") || parent.path.equals("..")) { + path = parent.path + "/.."; + } else { + final int index = parent.path.lastIndexOf('/'); + if (index == -1) { + path = ""; + } else { + path = parent.path.substring(0, index); + } + } + } else { + if (parent.path.isEmpty()) { + path = name; + } else { + path = parent.path + "/" + name; + } + } + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public String getPath() { + return path; + } + + /** + * Returns a map path of an another map path relative to this map path. + * @param mapPath the other map path + * @return the relative map path from this map path to the other map path + */ + @NotNull + public RelativeMapPath getRelativeMapPathTo(@NotNull final MapPath mapPath) { + if (mapPath instanceof RelativeMapPath) { + return (RelativeMapPath) mapPath; + } + if (mapPath instanceof AbsoluteMapPath) { + return new RelativeMapPath(this, (AbsoluteMapPath) mapPath); + } + throw new AssertionError(); + } + + /** + * {@inheritDoc} + */ + @Nullable + @Override + public String getMapComponent() { + final int index = path.indexOf('/', 1); + if (index == -1) { + return null; + } + + return path.substring(0, index); + } + + /** + * {@inheritDoc} + */ + @Override + public int compareTo(@NotNull final AbsoluteMapPath o) { + return path.compareTo(o.path); + } + + /** + * {@inheritDoc} + */ + @Override + public boolean equals(@Nullable final Object obj) { + if (obj == null || getClass() != obj.getClass()) { + return false; + } + final AbsoluteMapPath mapPath = (AbsoluteMapPath) obj; + return path.equals(mapPath.path); + } + + /** + * {@inheritDoc} + */ + @Override + public int hashCode() { + return path.hashCode(); + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return "/" + path; + } + +} Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/MapFile.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/MapFile.java 2014-02-16 21:46:14 UTC (rev 9580) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/MapFile.java 2014-02-17 20:49:34 UTC (rev 9581) @@ -45,7 +45,7 @@ * The absolute map path within {@link #mapsDir}. */ @NotNull - private final MapPath mapPath; + private final AbsoluteMapPath mapPath; /** * Creates a new instance for the maps directory. @@ -53,7 +53,7 @@ */ public MapFile(@NotNull final File mapsDir) { this.mapsDir = mapsDir; - mapPath = new MapPath(true); + mapPath = new AbsoluteMapPath(); } /** @@ -63,7 +63,7 @@ */ public MapFile(@NotNull final MapFile parent, @NotNull final String name) { mapsDir = parent.mapsDir; - mapPath = new MapPath(parent.mapPath, name); + mapPath = new AbsoluteMapPath(parent.mapPath, name); } /** @@ -90,7 +90,7 @@ * @return the map path; it is an absolute map path */ @NotNull - public MapPath getMapPath() { + public AbsoluteMapPath getMapPath() { return mapPath; } Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/MapPath.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/MapPath.java 2014-02-16 21:46:14 UTC (rev 9580) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/MapPath.java 2014-02-17 20:49:34 UTC (rev 9581) @@ -28,199 +28,30 @@ * Represents a maps directory local map path. * @author Andreas Kirschbaum */ -public class MapPath implements Comparable<MapPath>, Serializable { +public interface MapPath extends Serializable { /** - * The serial versionUID,. - */ - private static final long serialVersionUID = 1L; - - /** * A {@link Pattern} to split a map path's string representation into * components. */ @NotNull - public static final Pattern SEPARATOR = Pattern.compile("/"); + Pattern SEPARATOR = Pattern.compile("/"); /** - * Whether this map path is an absolute path. Absolute paths start with a - * "/". - */ - private final boolean absolute; - - /** - * The map path information. It does not include a leading "/" for absolute - * paths. - */ - @NotNull - private final String path; - - /** - * Creates a new instance. - * @param absolute whether to create an absolute map path - */ - public MapPath(final boolean absolute) { - this.absolute = absolute; - path = ""; - } - - /** - * Creates a new instance. - * @param absolute whether to create an absolute map path - * @param path the map path information - */ - private MapPath(final boolean absolute, @NotNull final String path) { - this.absolute = absolute; - this.path = path; - } - - /** - * Creates a new map path based on a parent map path. - * @param parent the parent map path - * @param name the name of the child; "." or ".." are allowed - */ - public MapPath(@NotNull final MapPath parent, @NotNull final String name) { - if (name.isEmpty()) { - throw new IllegalArgumentException("map file is empty"); - } - if (name.contains("/")) { - throw new IllegalArgumentException("map file contains '/': " + name); - } - absolute = parent.absolute; - if (name.equals(".")) { - path = parent.path; - } else if (name.equals("..")) { - if (parent.path.isEmpty()) { - path = absolute ? "" : ".."; - } else if (parent.path.endsWith("/..") || parent.path.equals("..")) { - path = parent.path + "/.."; - } else { - final int index = parent.path.lastIndexOf('/'); - if (index == -1) { - path = ""; - } else { - path = parent.path.substring(0, index); - } - } - } else { - if (parent.path.isEmpty()) { - path = name; - } else { - path = parent.path + "/" + name; - } - } - } - - /** - * Returns whether this map path is absolute. - * @return whether this map path is absolute - */ - public boolean isAbsolute() { - return absolute; - } - - /** * Returns the map path information. * @return the map path information; it does not include a leading "/" for * absolute paths */ @NotNull - public String getPath() { - return path; - } + String getPath(); /** - * Returns a map path of an another map path relative to this map path. - * @param mapPath the other map path - * @return the relative map path from this map path to the other map path - */ - @NotNull - public MapPath getRelativeMapPathTo(@NotNull final MapPath mapPath) { - if (!mapPath.absolute) { - return mapPath; - } - if (!absolute) { - return mapPath; - } - final String[] source = MapPath.SEPARATOR.split(path, -1); - final String[] destination = MapPath.SEPARATOR.split(mapPath.path, -1); - int begin = 0; - while (begin < source.length && begin < destination.length && source[begin].equals(destination[begin])) { - begin++; - } - if (begin == destination.length && begin > 0) { - begin--; - } - final StringBuilder sb = new StringBuilder(); - int i = source.length - 1; - while (i > begin) { - sb.append("/.."); - i--; - } - while (i < destination.length) { - sb.append("/").append(destination[i]); - i++; - } - return new MapPath(false, sb.length() > 0 ? sb.substring(1) : ""); - } - - /** * Returns the initial path component of a map path. "/path/to/map" returns * "path", "/map" returns {@code null}. Relative map paths always return * {@code null}. * @return the initial path component */ @Nullable - public String getMapComponent() { - if (!absolute) { - return null; - } + String getMapComponent(); - final int index = path.indexOf('/', 1); - if (index == -1) { - return null; - } - - return path.substring(0, index); - } - - /** - * {@inheritDoc} - */ - @Override - public int compareTo(@NotNull final MapPath o) { - if (absolute != o.absolute) { - return absolute ? -1 : +1; - } - return path.compareTo(o.path); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean equals(@Nullable final Object obj) { - if (obj == null || getClass() != obj.getClass()) { - return false; - } - final MapPath mapPath = (MapPath) obj; - return absolute == mapPath.absolute && path.equals(mapPath.path); - } - - /** - * {@inheritDoc} - */ - @Override - public int hashCode() { - return (absolute ? 1 : 0) + path.hashCode(); - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return absolute ? "/" + path : path; - } - } Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/MapPathUtils.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/MapPathUtils.java 2014-02-16 21:46:14 UTC (rev 9580) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/MapPathUtils.java 2014-02-17 20:49:34 UTC (rev 9581) @@ -41,39 +41,104 @@ */ @NotNull public static MapPath newMapPath(@NotNull final String string) { - return append(new MapPath(string.startsWith("/")), string); + if (string.startsWith("/")) { + return append(new AbsoluteMapPath(), string); + } else { + return append(new RelativeMapPath(), string); + } } /** + * Creates an {@link AbsoluteMapPath} instance from string representation. + * Ignores excess "/" characters. + * @param string the string representation + * @return the map path instance + */ + @NotNull + public static AbsoluteMapPath newAbsoluteMapPath(@NotNull final String string) { + if (!string.startsWith("/")) { + throw new IllegalArgumentException("map path '" + string + "' is not absolute"); + } + return append(new AbsoluteMapPath(), string); + } + + /** + * Creates a {@link RelativeMapPath} instance from string representation. + * Ignores excess "/" characters. + * @param string the string representation + * @return the map path instance + */ + @NotNull + public static RelativeMapPath newRelativeMapPath(@NotNull final String string) { + if (string.startsWith("/")) { + throw new IllegalArgumentException("map path '" + string + "' is not relative"); + } + return append(new RelativeMapPath(), string); + } + + /** * Appends a map path to another map path. * @param baseMapPath the base map path to append to * @param mapPath the map path to append * @return the combined path */ @NotNull - public static MapPath append(@NotNull final MapPath baseMapPath, @NotNull final MapPath mapPath) { - return mapPath.isAbsolute() ? mapPath : append(baseMapPath, mapPath.getPath()); + public static AbsoluteMapPath append(@NotNull final AbsoluteMapPath baseMapPath, @NotNull final MapPath mapPath) { + return mapPath instanceof AbsoluteMapPath ? (AbsoluteMapPath) mapPath : append(baseMapPath, mapPath.getPath()); } /** + * Appends a map path to another map path. + * @param baseMapPath the base map path to append to + * @param mapPath the map path to append + * @return the combined path + * @noinspection TypeMayBeWeakened + */ + @NotNull + public static RelativeMapPath append(@NotNull final RelativeMapPath baseMapPath, @NotNull final RelativeMapPath mapPath) { + return append(baseMapPath, mapPath.getPath()); + } + + /** * Appends a relative path to a {@link MapPath}. * @param mapPath the map path to append to * @param string the relative path to append * @return the combined path */ @NotNull - private static MapPath append(@NotNull final MapPath mapPath, @NotNull final CharSequence string) { - MapPath result = mapPath; + private static AbsoluteMapPath append(@NotNull final AbsoluteMapPath mapPath, @NotNull final CharSequence string) { + AbsoluteMapPath result = mapPath; final String tmpPath = result.getPath(); if (!tmpPath.isEmpty() && !tmpPath.equals("..") && !tmpPath.endsWith("/..")) { - result = new MapPath(result, ".."); + result = new AbsoluteMapPath(result, ".."); } for (final String path : MapPath.SEPARATOR.split(string, -1)) { if (!path.isEmpty()) { - result = new MapPath(result, path); + result = new AbsoluteMapPath(result, path); } } return result; } + /** + * Appends a relative path to a {@link MapPath}. + * @param mapPath the map path to append to + * @param string the relative path to append + * @return the combined path + */ + @NotNull + private static RelativeMapPath append(@NotNull final RelativeMapPath mapPath, @NotNull final CharSequence string) { + RelativeMapPath result = mapPath; + final String tmpPath = result.getPath(); + if (!tmpPath.isEmpty() && !tmpPath.equals("..") && !tmpPath.endsWith("/..")) { + result = new RelativeMapPath(result, ".."); + } + for (final String path : MapPath.SEPARATOR.split(string, -1)) { + if (!path.isEmpty()) { + result = new RelativeMapPath(result, path); + } + } + return result; + } + } Copied: trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/RelativeMapPath.java (from rev 9580, trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/MapPath.java) =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/RelativeMapPath.java (rev 0) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/RelativeMapPath.java 2014-02-17 20:49:34 UTC (rev 9581) @@ -0,0 +1,170 @@ +/* + * 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.model.mapmodel; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Represents a maps directory local map path. + * @author Andreas Kirschbaum + */ +public class RelativeMapPath implements Comparable<RelativeMapPath>, MapPath { + + /** + * The serial versionUID,. + */ + private static final long serialVersionUID = 1L; + + /** + * The map path information. It does not include a leading "/" for absolute + * paths. + */ + @NotNull + private final String path; + + /** + * Creates a new instance. + */ + public RelativeMapPath() { + path = ""; + } + + /** + * Creates a new map path based on a parent map path. + * @param parent the parent map path + * @param name the name of the child; "." or ".." are allowed + */ + public RelativeMapPath(@NotNull final RelativeMapPath parent, @NotNull final String name) { + if (name.isEmpty()) { + throw new IllegalArgumentException("map file is empty"); + } + if (name.contains("/")) { + throw new IllegalArgumentException("map file contains '/': " + name); + } + if (name.equals(".")) { + path = parent.path; + } else if (name.equals("..")) { + if (parent.path.isEmpty()) { + path = ".."; + } else if (parent.path.endsWith("/..") || parent.path.equals("..")) { + path = parent.path + "/.."; + } else { + final int index = parent.path.lastIndexOf('/'); + if (index == -1) { + path = ""; + } else { + path = parent.path.substring(0, index); + } + } + } else { + if (parent.path.isEmpty()) { + path = name; + } else { + path = parent.path + "/" + name; + } + } + } + + /** + * Creates a new instance as the difference between two absolute map paths. + * @param sourceMapPath the source map path to start from + * @param destinationMapPath the destination map path to point to + * @noinspection TypeMayBeWeakened + */ + public RelativeMapPath(@NotNull final AbsoluteMapPath sourceMapPath, @NotNull final AbsoluteMapPath destinationMapPath) { + final String[] source = MapPath.SEPARATOR.split(sourceMapPath.getPath(), -1); + final String[] destination = MapPath.SEPARATOR.split(destinationMapPath.getPath(), -1); + int begin = 0; + while (begin < source.length && begin < destination.length && source[begin].equals(destination[begin])) { + begin++; + } + if (begin == destination.length && begin > 0) { + begin--; + } + final StringBuilder sb = new StringBuilder(); + int i = source.length - 1; + while (i > begin) { + sb.append("/.."); + i--; + } + while (i < destination.length) { + sb.append("/").append(destination[i]); + i++; + } + path = sb.length() > 0 ? sb.substring(1) : ""; + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + + public String getPath() { + return path; + } + + /** + * {@inheritDoc} + */ + @Nullable + @Override + public String getMapComponent() { + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public int compareTo(@NotNull final RelativeMapPath o) { + return path.compareTo(o.path); + } + + /** + * {@inheritDoc} + */ + @Override + public boolean equals(@Nullable final Object obj) { + if (obj == null || getClass() != obj.getClass()) { + return false; + } + final RelativeMapPath mapPath = (RelativeMapPath) obj; + return path.equals(mapPath.path); + } + + /** + * {@inheritDoc} + */ + @Override + public int hashCode() { + return path.hashCode(); + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return path; + } + +} Modified: trunk/src/model/src/test/java/net/sf/gridarta/model/mapmodel/MapPathTest.java =================================================================== --- trunk/src/model/src/test/java/net/sf/gridarta/model/mapmodel/MapPathTest.java 2014-02-16 21:46:14 UTC (rev 9580) +++ trunk/src/model/src/test/java/net/sf/gridarta/model/mapmodel/MapPathTest.java 2014-02-17 20:49:34 UTC (rev 9581) @@ -34,16 +34,15 @@ */ @Test public void testAbsolute1() { - final MapPath p1 = check("/", new MapPath(true)); - final MapPath p2 = check("/x", new MapPath(p1, "x")); - final MapPath p3 = check("/x/y", new MapPath(p2, "y")); - final MapPath p4 = check("/x/y/z", new MapPath(p3, "z")); - final MapPath p5 = check("/x/y", new MapPath(p4, "..")); - final MapPath p6 = check("/x/y", new MapPath(p5, ".")); - final MapPath p7 = check("/x", new MapPath(p6, "..")); - final MapPath p8 = check("/", new MapPath(p7, "..")); - final MapPath p9 = check("/", new MapPath(p8, "..")); - Assert.assertTrue(p9.isAbsolute()); + final AbsoluteMapPath p1 = check("/", new AbsoluteMapPath()); + final AbsoluteMapPath p2 = check("/x", new AbsoluteMapPath(p1, "x")); + final AbsoluteMapPath p3 = check("/x/y", new AbsoluteMapPath(p2, "y")); + final AbsoluteMapPath p4 = check("/x/y/z", new AbsoluteMapPath(p3, "z")); + final AbsoluteMapPath p5 = check("/x/y", new AbsoluteMapPath(p4, "..")); + final AbsoluteMapPath p6 = check("/x/y", new AbsoluteMapPath(p5, ".")); + final AbsoluteMapPath p7 = check("/x", new AbsoluteMapPath(p6, "..")); + final AbsoluteMapPath p8 = check("/", new AbsoluteMapPath(p7, "..")); + check("/", new AbsoluteMapPath(p8, "..")); } /** @@ -51,24 +50,23 @@ */ @Test public void testRelative1() { - final MapPath p1 = check("", new MapPath(false)); - final MapPath p2 = check("x", new MapPath(p1, "x")); - final MapPath p3 = check("x/y", new MapPath(p2, "y")); - final MapPath p4 = check("x/y/z", new MapPath(p3, "z")); - final MapPath p5 = check("x/y", new MapPath(p4, "..")); - final MapPath p6 = check("x/y", new MapPath(p5, ".")); - final MapPath p7 = check("x", new MapPath(p6, "..")); - final MapPath p8 = check("", new MapPath(p7, "..")); - final MapPath p9 = check("..", new MapPath(p8, "..")); - final MapPath p10 = check("..", new MapPath(p9, ".")); - final MapPath p11 = check("../..", new MapPath(p10, "..")); - final MapPath p12 = check("../../x", new MapPath(p11, "x")); - final MapPath p13 = check("../../x", new MapPath(p12, ".")); - final MapPath p14 = check("../../x/x", new MapPath(p13, "x")); - final MapPath p15 = check("../../x", new MapPath(p14, "..")); - final MapPath p16 = check("../..", new MapPath(p15, "..")); - final MapPath p17 = check("../../..", new MapPath(p16, "..")); - Assert.assertFalse(p17.isAbsolute()); + final RelativeMapPath p1 = check("", new RelativeMapPath()); + final RelativeMapPath p2 = check("x", new RelativeMapPath(p1, "x")); + final RelativeMapPath p3 = check("x/y", new RelativeMapPath(p2, "y")); + final RelativeMapPath p4 = check("x/y/z", new RelativeMapPath(p3, "z")); + final RelativeMapPath p5 = check("x/y", new RelativeMapPath(p4, "..")); + final RelativeMapPath p6 = check("x/y", new RelativeMapPath(p5, ".")); + final RelativeMapPath p7 = check("x", new RelativeMapPath(p6, "..")); + final RelativeMapPath p8 = check("", new RelativeMapPath(p7, "..")); + final RelativeMapPath p9 = check("..", new RelativeMapPath(p8, "..")); + final RelativeMapPath p10 = check("..", new RelativeMapPath(p9, ".")); + final RelativeMapPath p11 = check("../..", new RelativeMapPath(p10, "..")); + final RelativeMapPath p12 = check("../../x", new RelativeMapPath(p11, "x")); + final RelativeMapPath p13 = check("../../x", new RelativeMapPath(p12, ".")); + final RelativeMapPath p14 = check("../../x/x", new RelativeMapPath(p13, "x")); + final RelativeMapPath p15 = check("../../x", new RelativeMapPath(p14, "..")); + final RelativeMapPath p16 = check("../..", new RelativeMapPath(p15, "..")); + check("../../..", new RelativeMapPath(p16, "..")); } /** @@ -76,7 +74,7 @@ */ @Test(expected = IllegalArgumentException.class) public void testInvalid1() { - new MapPath(new MapPath(true), ""); + new AbsoluteMapPath(new AbsoluteMapPath(), ""); } /** @@ -84,7 +82,7 @@ */ @Test(expected = IllegalArgumentException.class) public void testInvalid2() { - new MapPath(new MapPath(true), "/"); + new AbsoluteMapPath(new AbsoluteMapPath(), "/"); } /** @@ -92,22 +90,22 @@ */ @Test(expected = IllegalArgumentException.class) public void testInvalid3() { - new MapPath(new MapPath(true), "abc/def"); + new AbsoluteMapPath(new AbsoluteMapPath(), "abc/def"); } /** - * Checks that {@link MapPath#getRelativeMapPathTo(MapPath)} works as - * expected. + * Checks that {@link AbsoluteMapPath#getRelativeMapPathTo(MapPath)} works + * as expected. */ @Test public void testGetRelativeMapPathTo1() { - check("../../../x/y/a/b", MapPathUtils.newMapPath("/a/b/c/d").getRelativeMapPathTo(MapPathUtils.newMapPath("/x/y/a/b"))); - check("../x/y/z", MapPathUtils.newMapPath("/a/b/c/d").getRelativeMapPathTo(MapPathUtils.newMapPath("/a/b/x/y/z"))); - check("../../a", MapPathUtils.newMapPath("/a/b/c").getRelativeMapPathTo(MapPathUtils.newMapPath("/a"))); - check("a/b/c", MapPathUtils.newMapPath("/a").getRelativeMapPathTo(MapPathUtils.newMapPath("/a/b/c"))); - check("b/c", MapPathUtils.newMapPath("/a/b").getRelativeMapPathTo(MapPathUtils.newMapPath("/a/b/c"))); - check("b", MapPathUtils.newMapPath("/a/b").getRelativeMapPathTo(MapPathUtils.newMapPath("/a/b"))); - check("a", MapPathUtils.newMapPath("/a").getRelativeMapPathTo(MapPathUtils.newMapPath("/a"))); + check("../../../x/y/a/b", MapPathUtils.newAbsoluteMapPath("/a/b/c/d").getRelativeMapPathTo(MapPathUtils.newMapPath("/x/y/a/b"))); + check("../x/y/z", MapPathUtils.newAbsoluteMapPath("/a/b/c/d").getRelativeMapPathTo(MapPathUtils.newMapPath("/a/b/x/y/z"))); + check("../../a", MapPathUtils.newAbsoluteMapPath("/a/b/c").getRelativeMapPathTo(MapPathUtils.newMapPath("/a"))); + check("a/b/c", MapPathUtils.newAbsoluteMapPath("/a").getRelativeMapPathTo(MapPathUtils.newMapPath("/a/b/c"))); + check("b/c", MapPathUtils.newAbsoluteMapPath("/a/b").getRelativeMapPathTo(MapPathUtils.newMapPath("/a/b/c"))); + check("b", MapPathUtils.newAbsoluteMapPath("/a/b").getRelativeMapPathTo(MapPathUtils.newMapPath("/a/b"))); + check("a", MapPathUtils.newAbsoluteMapPath("/a").getRelativeMapPathTo(MapPathUtils.newMapPath("/a"))); } /** @@ -136,7 +134,7 @@ * @return the map path */ @NotNull - private static MapPath check(@NotNull final String expected, @NotNull final MapPath mapPath) { + private static <T extends MapPath> T check(@NotNull final String expected, @NotNull final T mapPath) { Assert.assertEquals(expected, mapPath.toString()); return mapPath; } Modified: trunk/src/model/src/test/java/net/sf/gridarta/model/mapmodel/MapPathUtilsTest.java =================================================================== --- trunk/src/model/src/test/java/net/sf/gridarta/model/mapmodel/MapPathUtilsTest.java 2014-02-16 21:46:14 UTC (rev 9580) +++ trunk/src/model/src/test/java/net/sf/gridarta/model/mapmodel/MapPathUtilsTest.java 2014-02-17 20:49:34 UTC (rev 9581) @@ -51,24 +51,29 @@ } /** - * Checks that {@link MapPathUtils#append(MapPath, CharSequence)} works as + * Checks that {@link MapPathUtils#append(AbsoluteMapPath, CharSequence)} works as * expected. */ @Test - public void testAppend1() { - Assert.assertEquals("a/b/d/e/f", MapPathUtils.append(MapPathUtils.newMapPath("a/b/c"), MapPathUtils.newMapPath("d/e/f")).toString()); - Assert.assertEquals("/d/e/f", MapPathUtils.append(MapPathUtils.newMapPath("a/b/c"), MapPathUtils.newMapPath("/d/e/f")).toString()); - Assert.assertEquals("/a/b/d/e/f", MapPathUtils.append(MapPathUtils.newMapPath("/a/b/c"), MapPathUtils.newMapPath("d/e/f")).toString()); - Assert.assertEquals("/d/e/f", MapPathUtils.append(MapPathUtils.newMapPath("/a/b/c"), MapPathUtils.newMapPath("/d/e/f")).toString()); + public void testAppendAbsolute1() { + Assert.assertEquals("/a/b/d/e/f", MapPathUtils.append(MapPathUtils.newAbsoluteMapPath("/a/b/c"), MapPathUtils.newMapPath("d/e/f")).toString()); + Assert.assertEquals("/d/e/f", MapPathUtils.append(MapPathUtils.newAbsoluteMapPath("/a/b/c"), MapPathUtils.newMapPath("/d/e/f")).toString()); + } - Assert.assertEquals("../a/b/d/e/f", MapPathUtils.append(MapPathUtils.newMapPath("../a/b/c"), MapPathUtils.newMapPath("d/e/f")).toString()); - Assert.assertEquals("../a/d/e/f", MapPathUtils.append(MapPathUtils.newMapPath("../a/b/c"), MapPathUtils.newMapPath("../d/e/f")).toString()); - Assert.assertEquals("../a/d/e/f", MapPathUtils.append(MapPathUtils.newMapPath("../a/b/c/d"), MapPathUtils.newMapPath("../../d/e/f")).toString()); - Assert.assertEquals("../d/e/f", MapPathUtils.append(MapPathUtils.newMapPath("../a/b/c"), MapPathUtils.newMapPath("../../d/e/f")).toString()); - Assert.assertEquals("../../d/e/f", MapPathUtils.append(MapPathUtils.newMapPath("../a/b/c"), MapPathUtils.newMapPath("../../../d/e/f")).toString()); - Assert.assertEquals("../../../d/e/f", MapPathUtils.append(MapPathUtils.newMapPath("../a/b/c"), MapPathUtils.newMapPath("../../../../d/e/f")).toString()); - Assert.assertEquals("../..", MapPathUtils.append(MapPathUtils.newMapPath(".."), MapPathUtils.newMapPath("..")).toString()); - Assert.assertEquals("/d/e/f", MapPathUtils.append(MapPathUtils.newMapPath("../a/b/c"), MapPathUtils.newMapPath("/d/e/f")).toString()); + /** + * Checks that {@link MapPathUtils#append(RelativeMapPath, CharSequence)} works as + * expected. + */ + @Test + public void testAppendRelative1() { + Assert.assertEquals("a/b/d/e/f", MapPathUtils.append(MapPathUtils.newRelativeMapPath("a/b/c"), MapPathUtils.newRelativeMapPath("d/e/f")).toString()); + Assert.assertEquals("../a/b/d/e/f", MapPathUtils.append(MapPathUtils.newRelativeMapPath("../a/b/c"), MapPathUtils.newRelativeMapPath("d/e/f")).toString()); + Assert.assertEquals("../a/d/e/f", MapPathUtils.append(MapPathUtils.newRelativeMapPath("../a/b/c"), MapPathUtils.newRelativeMapPath("../d/e/f")).toString()); + Assert.assertEquals("../a/d/e/f", MapPathUtils.append(MapPathUtils.newRelativeMapPath("../a/b/c/d"), MapPathUtils.newRelativeMapPath("../../d/e/f")).toString()); + Assert.assertEquals("../d/e/f", MapPathUtils.append(MapPathUtils.newRelativeMapPath("../a/b/c"), MapPathUtils.newRelativeMapPath("../../d/e/f")).toString()); + Assert.assertEquals("../../d/e/f", MapPathUtils.append(MapPathUtils.newRelativeMapPath("../a/b/c"), MapPathUtils.newRelativeMapPath("../../../d/e/f")).toString()); + Assert.assertEquals("../../../d/e/f", MapPathUtils.append(MapPathUtils.newRelativeMapPath("../a/b/c"), MapPathUtils.newRelativeMapPath("../../../../d/e/f")).toString()); + Assert.assertEquals("../..", MapPathUtils.append(MapPathUtils.newRelativeMapPath(".."), MapPathUtils.newRelativeMapPath("..")).toString()); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-02-18 06:53:17
|
Revision: 9582 http://sourceforge.net/p/gridarta/code/9582 Author: akirschbaum Date: 2014-02-18 06:53:11 +0000 (Tue, 18 Feb 2014) Log Message: ----------- Do not create multiple ProjectSettings instances in tests. Modified Paths: -------------- trunk/src/gridarta/src/test/java/net/sf/gridarta/gui/mapmenu/MapMenuManagerTest.java trunk/src/model/src/test/java/net/sf/gridarta/model/index/MapsIndexerTest.java Modified: trunk/src/gridarta/src/test/java/net/sf/gridarta/gui/mapmenu/MapMenuManagerTest.java =================================================================== --- trunk/src/gridarta/src/test/java/net/sf/gridarta/gui/mapmenu/MapMenuManagerTest.java 2014-02-17 20:49:34 UTC (rev 9581) +++ trunk/src/gridarta/src/test/java/net/sf/gridarta/gui/mapmenu/MapMenuManagerTest.java 2014-02-18 06:53:11 UTC (rev 9582) @@ -29,7 +29,6 @@ import net.sf.gridarta.model.maparchobject.TestMapArchObject; import net.sf.gridarta.model.mapcontrol.MapControl; import net.sf.gridarta.model.mapcontrol.TestMapControlCreator; -import net.sf.gridarta.model.settings.TestProjectSettings; import net.sf.gridarta.utils.Size2D; import org.junit.Assert; import org.junit.Test; @@ -54,7 +53,7 @@ final TestMapControlCreator testMapControlCreator = new TestMapControlCreator(); final File file = File.createTempFile("gridarta", null); - final MapMenuPreferences mapMenuPreferences = new TestMapMenuPreferences(new PathManager(new TestProjectSettings())); + final MapMenuPreferences mapMenuPreferences = new TestMapMenuPreferences(new PathManager(testMapControlCreator.getProjectSettings())); try { final PathManager pathManager = testMapControlCreator.getPathManager(); final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl1 = testMapControlCreator.newMapControl(pathManager.getMapFile(file), "name1", new Size2D(1, 1)); Modified: trunk/src/model/src/test/java/net/sf/gridarta/model/index/MapsIndexerTest.java =================================================================== --- trunk/src/model/src/test/java/net/sf/gridarta/model/index/MapsIndexerTest.java 2014-02-17 20:49:34 UTC (rev 9581) +++ trunk/src/model/src/test/java/net/sf/gridarta/model/index/MapsIndexerTest.java 2014-02-18 06:53:11 UTC (rev 9582) @@ -32,7 +32,6 @@ import net.sf.gridarta.model.mapmodel.MapFile; import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.settings.ProjectSettings; -import net.sf.gridarta.model.settings.TestProjectSettings; import net.sf.gridarta.utils.StringUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -52,9 +51,9 @@ */ @Test public void test1() throws InterruptedException, IOException { - final ProjectSettings projectSettings = new TestProjectSettings(); final TestMapControlCreator mapControlCreator = new TestMapControlCreator(); final MapManager<TestGameObject, TestMapArchObject, TestArchetype> mapManager = mapControlCreator.newMapManager(); + final ProjectSettings projectSettings = mapControlCreator.getProjectSettings(); final File mapsDirectory = createMapsDirectory(mapControlCreator, projectSettings, "map1:Map1", "path/map2:Map Name2"); try { final MapsIndex index = new MapsIndex(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-02-18 20:52:14
|
Revision: 9585 http://sourceforge.net/p/gridarta/code/9585 Author: akirschbaum Date: 2014-02-18 20:52:07 +0000 (Tue, 18 Feb 2014) Log Message: ----------- Do not create excess DefaultMapManager instances during tests. Modified Paths: -------------- trunk/src/gridarta/src/test/java/net/sf/gridarta/actions/UndoActionsTest.java trunk/src/model/src/test/java/net/sf/gridarta/model/index/MapsIndexerTest.java trunk/src/model/src/test/java/net/sf/gridarta/model/mapcontrol/TestMapControlCreator.java Modified: trunk/src/gridarta/src/test/java/net/sf/gridarta/actions/UndoActionsTest.java =================================================================== --- trunk/src/gridarta/src/test/java/net/sf/gridarta/actions/UndoActionsTest.java 2014-02-18 19:02:35 UTC (rev 9584) +++ trunk/src/gridarta/src/test/java/net/sf/gridarta/actions/UndoActionsTest.java 2014-02-18 20:52:07 UTC (rev 9585) @@ -31,7 +31,6 @@ import net.sf.gridarta.model.maparchobject.TestMapArchObject; import net.sf.gridarta.model.mapcontrol.MapControl; import net.sf.gridarta.model.mapcontrol.TestMapControlCreator; -import net.sf.gridarta.model.mapmanager.MapManager; import net.sf.gridarta.model.mapmodel.CannotInsertGameObjectException; import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.mapmodel.MapSquare; @@ -69,12 +68,11 @@ } autojoinListsHelper.newAutojoinLists("a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "a10", "a11", "a12", "a13", "a14", "a15"); - final MapManager<TestGameObject, TestMapArchObject, TestArchetype> mapManager = mapControlCreator.newMapManager(); - final UndoControl<TestGameObject, TestMapArchObject, TestArchetype> undoControl = new UndoControl<TestGameObject, TestMapArchObject, TestArchetype>(mapManager, mapModelCreator.getGameObjectFactory(), mapModelCreator.getGameObjectMatchers()); + final UndoControl<TestGameObject, TestMapArchObject, TestArchetype> undoControl = new UndoControl<TestGameObject, TestMapArchObject, TestArchetype>(mapControlCreator.getMapManager(), mapModelCreator.getGameObjectFactory(), mapModelCreator.getGameObjectMatchers()); final TestMapArchObject mapArchObject = new TestMapArchObject(); mapArchObject.setMapSize(new Size2D(2, 1)); - final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl = mapManager.newMap(null, mapArchObject, null, true); + final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl = mapControlCreator.getMapManager().newMap(null, mapArchObject, null, true); final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = mapControl.getMapModel(); final TestMapModelHelper testMapModelHelper = mapModelCreator.newTestMapModelHelper(); Modified: trunk/src/model/src/test/java/net/sf/gridarta/model/index/MapsIndexerTest.java =================================================================== --- trunk/src/model/src/test/java/net/sf/gridarta/model/index/MapsIndexerTest.java 2014-02-18 19:02:35 UTC (rev 9584) +++ trunk/src/model/src/test/java/net/sf/gridarta/model/index/MapsIndexerTest.java 2014-02-18 20:52:07 UTC (rev 9585) @@ -27,7 +27,6 @@ import net.sf.gridarta.model.gameobject.TestGameObject; import net.sf.gridarta.model.maparchobject.TestMapArchObject; import net.sf.gridarta.model.mapcontrol.TestMapControlCreator; -import net.sf.gridarta.model.mapmanager.MapManager; import net.sf.gridarta.model.mapmodel.MapFile; import net.sf.gridarta.model.settings.ProjectSettings; import org.jetbrains.annotations.NotNull; @@ -48,12 +47,11 @@ @Test public void test1() throws InterruptedException, IOException { final TestMapControlCreator mapControlCreator = new TestMapControlCreator(); - final MapManager<TestGameObject, TestMapArchObject, TestArchetype> mapManager = mapControlCreator.newMapManager(); final ProjectSettings projectSettings = mapControlCreator.getProjectSettings(); final File mapsDirectory = mapControlCreator.createMapsDirectory("map1:Map1", "path/map2:Map Name2"); try { final MapsIndex index = new MapsIndex(); - final MapsIndexer<TestGameObject, TestMapArchObject, TestArchetype> indexer = new MapsIndexer<TestGameObject, TestMapArchObject, TestArchetype>(index, mapManager, projectSettings); + final MapsIndexer<TestGameObject, TestMapArchObject, TestArchetype> indexer = new MapsIndexer<TestGameObject, TestMapArchObject, TestArchetype>(index, mapControlCreator.getMapManager(), projectSettings); indexer.start(); indexer.waitForIdle(); indexer.stop(); 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-02-18 19:02:35 UTC (rev 9584) +++ trunk/src/model/src/test/java/net/sf/gridarta/model/mapcontrol/TestMapControlCreator.java 2014-02-18 20:52:07 UTC (rev 9585) @@ -104,12 +104,6 @@ private final GameObjectParser<TestGameObject, TestMapArchObject, TestArchetype> gameObjectParser; /** - * The {@link MapReaderFactory} instance. - */ - @NotNull - private final MapReaderFactory<TestGameObject, TestMapArchObject> mapReaderFactory; - - /** * The {@link ProjectSettings} instance. */ @NotNull @@ -128,12 +122,6 @@ private final MapModelFactory<TestGameObject, TestMapArchObject, TestArchetype> mapModelFactory; /** - * The {@link MapControlFactory} instance. - */ - @NotNull - private final MapControlFactory<TestGameObject, TestMapArchObject, TestArchetype> mapControlFactory; - - /** * The {@link TestMapModelCreator} instance. */ @NotNull @@ -153,13 +141,13 @@ exitMatcher = new ExitMatcher<TestGameObject, TestMapArchObject, TestArchetype>(exitGameObjectMatcher); mapArchObjectParserFactory = new TestMapArchObjectParserFactory(); gameObjectParser = mapModelCreator.newGameObjectParser(); - mapReaderFactory = new TestMapReaderFactory(mapArchObjectParserFactory, mapArchObjectFactory, gameObjectParser); + final MapReaderFactory<TestGameObject, TestMapArchObject> mapReaderFactory = new TestMapReaderFactory(mapArchObjectParserFactory, mapArchObjectFactory, gameObjectParser); projectSettings = new TestProjectSettings(); mapWriter = new DefaultMapWriter<TestGameObject, TestMapArchObject, TestArchetype>(mapArchObjectParserFactory, gameObjectParser); final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype> archetypeChooserModel = new ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype>(); pathManager = new PathManager(projectSettings); mapModelFactory = new MapModelFactory<TestGameObject, TestMapArchObject, TestArchetype>(archetypeChooserModel, mapModelCreator.getAutojoinLists(), mapModelCreator.getGameObjectFactory(), mapModelCreator.getGameObjectMatchers(), mapModelCreator.getTopmostInsertionMode()); - mapControlFactory = new TestMapControlFactory(mapWriter, projectSettings, mapModelFactory); + final MapControlFactory<TestGameObject, TestMapArchObject, TestArchetype> mapControlFactory = new TestMapControlFactory(mapWriter, projectSettings, mapModelFactory); final AbstractMapManager<TestGameObject, TestMapArchObject, TestArchetype> tmpMapManager = new DefaultMapManager<TestGameObject, TestMapArchObject, TestArchetype>(mapReaderFactory, mapControlFactory, projectSettings, mapModelCreator.getFaceObjectProviders(), pathManager); final FileControl<TestGameObject, TestMapArchObject, TestArchetype> fileControl = new TestFileControl(); tmpMapManager.setFileControl(fileControl); @@ -265,15 +253,6 @@ } /** - * Returns a new {@link MapManager} instance. - * @return the map manager instance - */ - @NotNull - public MapManager<TestGameObject, TestMapArchObject, TestArchetype> newMapManager() { - return new DefaultMapManager<TestGameObject, TestMapArchObject, TestArchetype>(mapReaderFactory, mapControlFactory, projectSettings, mapModelCreator.getFaceObjectProviders(), pathManager); - } - - /** * Returns the {@link MapArchObjectFactory} instance. * @return the test map arch object factory instance */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-02-19 21:18:31
|
Revision: 9588 http://sourceforge.net/p/gridarta/code/9588 Author: akirschbaum Date: 2014-02-19 21:18:16 +0000 (Wed, 19 Feb 2014) Log Message: ----------- Remove implementation for plugin parameters of type net.sf.gridarta.model.filter.NamedFilterConfig as the existing implementation was but a stub. 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/plugin/parameter/PluginParameterViewFactory.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/main/java/net/sf/gridarta/plugin/parameter/PluginParameterVisitor.java trunk/src/plugin/src/test/java/net/sf/gridarta/plugin/parameter/PluginParameterCodecTest.java Removed Paths: ------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/parameter/FilterParameterView.java trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/FilterParameter.java Modified: trunk/src/atrinik/ChangeLog =================================================================== --- trunk/src/atrinik/ChangeLog 2014-02-19 17:56:46 UTC (rev 9587) +++ trunk/src/atrinik/ChangeLog 2014-02-19 21:18:16 UTC (rev 9588) @@ -1,3 +1,9 @@ +2014-02-19 Andreas Kirschbaum + + * Remove implementation for plugin parameters of type + net.sf.gridarta.model.filter.NamedFilterConfig as the existing + implementation was but a stub. + 2014-02-15 Andreas Kirschbaum * Fix File|Options... to actually show the setting dialog. Modified: trunk/src/crossfire/ChangeLog =================================================================== --- trunk/src/crossfire/ChangeLog 2014-02-19 17:56:46 UTC (rev 9587) +++ trunk/src/crossfire/ChangeLog 2014-02-19 21:18:16 UTC (rev 9588) @@ -1,3 +1,9 @@ +2014-02-19 Andreas Kirschbaum + + * Remove implementation for plugin parameters of type + net.sf.gridarta.model.filter.NamedFilterConfig as the existing + implementation was but a stub. + 2014-02-15 Andreas Kirschbaum * Fix File|Options... to actually show the setting dialog. Modified: trunk/src/daimonin/ChangeLog =================================================================== --- trunk/src/daimonin/ChangeLog 2014-02-19 17:56:46 UTC (rev 9587) +++ trunk/src/daimonin/ChangeLog 2014-02-19 21:18:16 UTC (rev 9588) @@ -1,3 +1,9 @@ +2014-02-19 Andreas Kirschbaum + + * Remove implementation for plugin parameters of type + net.sf.gridarta.model.filter.NamedFilterConfig as the existing + implementation was but a stub. + 2014-02-15 Andreas Kirschbaum * Fix File|Options... to actually show the setting dialog. Deleted: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/parameter/FilterParameterView.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/parameter/FilterParameterView.java 2014-02-19 17:56:46 UTC (rev 9587) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/parameter/FilterParameterView.java 2014-02-19 21:18:16 UTC (rev 9588) @@ -1,62 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2011 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package net.sf.gridarta.gui.dialog.plugin.parameter; - -import javax.swing.JComponent; -import javax.swing.JPanel; -import net.sf.gridarta.gui.filter.MenuItemCreator; -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.FilterParameter; -import org.jetbrains.annotations.NotNull; - -public class FilterParameterView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements PluginParameterView<G, A, R> { - - @NotNull - private final JComponent value; - - @NotNull - private final JComponent config = new JPanel(); - - public FilterParameterView(@NotNull final FilterParameter<G, A, R> param) { - value = new MenuItemCreator(param.getValue()).getMenuItem(); - value.setName("Choose filters"); - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override - public JComponent getValueComponent() { - return value; - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override - public JComponent getConfigComponent() { - return config; - } - -} Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/parameter/PluginParameterViewFactory.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/parameter/PluginParameterViewFactory.java 2014-02-19 17:56:46 UTC (rev 9587) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/parameter/PluginParameterViewFactory.java 2014-02-19 21:18:16 UTC (rev 9588) @@ -31,7 +31,6 @@ import net.sf.gridarta.plugin.parameter.ArchetypeParameter; import net.sf.gridarta.plugin.parameter.BooleanParameter; import net.sf.gridarta.plugin.parameter.DoubleParameter; -import net.sf.gridarta.plugin.parameter.FilterParameter; import net.sf.gridarta.plugin.parameter.IntegerParameter; import net.sf.gridarta.plugin.parameter.MapParameter; import net.sf.gridarta.plugin.parameter.MapPathParameter; @@ -94,12 +93,6 @@ @NotNull @Override - public PluginParameterView<G, A, R> visit(@NotNull final FilterParameter<G, A, R> parameter) { - return new FilterParameterView<G, A, R>(parameter); - } - - @NotNull - @Override public PluginParameterView<G, A, R> visit(@NotNull final IntegerParameter<G, A, R> parameter) { return new IntegerParameterView<G, A, R>(parameter); } Deleted: trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/FilterParameter.java =================================================================== --- trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/FilterParameter.java 2014-02-19 17:56:46 UTC (rev 9587) +++ trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/FilterParameter.java 2014-02-19 21:18:16 UTC (rev 9588) @@ -1,73 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2010 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.plugin.parameter; - -import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.filter.NamedFilter; -import net.sf.gridarta.model.filter.NamedFilterConfig; -import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.maparchobject.MapArchObject; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -public class FilterParameter<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractStringPluginParameter<G, A, R, NamedFilterConfig> { - - @NotNull - public static final String PARAMETER_TYPE = NamedFilterConfig.class.getName(); - - @NotNull - private final NamedFilter defaultFilterList; - - /** - * Creates a new instance. - */ - public FilterParameter(@NotNull final NamedFilter defaultFilterList) { - super(""); - this.defaultFilterList = defaultFilterList; - } - - /** - * {@inheritDoc} - */ - @Nullable - @Override - public NamedFilterConfig getValue() { - return null; // XXX: not implemented - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override - public <T> T visit(@NotNull final PluginParameterVisitor<G, A, R, T> visitor) { - return visitor.visit(this); - } - - /** - * {@inheritDoc} - */ - @NotNull - @Override - public String getParameterType() { - return PARAMETER_TYPE; - } - -} 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-02-19 17:56:46 UTC (rev 9587) +++ trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/PluginParameterCodec.java 2014-02-19 21:18:16 UTC (rev 9588) @@ -20,8 +20,6 @@ package net.sf.gridarta.plugin.parameter; import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.filter.FilterParser; -import net.sf.gridarta.model.filter.NamedFilterConfig; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; import org.jdom.Element; @@ -105,14 +103,6 @@ @NotNull @Override - public Element visit(@NotNull final FilterParameter<G, A, R> parameter) { - final Element e = toXML(parameter); - e.addContent(new FilterParser().toXML(parameter.getValue())); - return e; - } - - @NotNull - @Override public Element visit(@NotNull final IntegerParameter<G, A, R> parameter) { final Element e = toXML(parameter); final Element v = new Element("value"); @@ -211,15 +201,6 @@ @NotNull @Override - public PluginParameter<G, A, R, ?> visit(@NotNull final FilterParameter<G, A, R> parameter) { - fromXML(parameter); - final NamedFilterConfig conf = parameter.getValue(); - new FilterParser().fromXML(e, conf); - return parameter; - } - - @NotNull - @Override public PluginParameter<G, A, R, ?> visit(@NotNull final IntegerParameter<G, A, R> parameter) { fromXML(parameter); try { 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-02-19 17:56:46 UTC (rev 9587) +++ trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/PluginParameterFactory.java 2014-02-19 21:18:16 UTC (rev 9588) @@ -101,9 +101,6 @@ if (type.equals(MapPathParameter.PARAMETER_TYPE)) { return new MapPathParameter<G, A, R>(projectSettings.getMapsDirectory()); } - if (type.equals(FilterParameter.PARAMETER_TYPE)) { - return new FilterParameter<G, A, R>(defaultFilterList); - } throw new NoSuchParameterException(type); } @@ -116,7 +113,7 @@ @NotNull public String[] getTypes() { - return new String[] { StringParameter.PARAMETER_TYPE, IntegerParameter.PARAMETER_TYPE, DoubleParameter.PARAMETER_TYPE, BooleanParameter.PARAMETER_TYPE, ArchetypeParameter.PARAMETER_TYPE, MapParameter.PARAMETER_TYPE, FilterParameter.PARAMETER_TYPE, MapPathParameter.PARAMETER_TYPE, }; + return new String[] { StringParameter.PARAMETER_TYPE, IntegerParameter.PARAMETER_TYPE, DoubleParameter.PARAMETER_TYPE, BooleanParameter.PARAMETER_TYPE, ArchetypeParameter.PARAMETER_TYPE, MapParameter.PARAMETER_TYPE, MapPathParameter.PARAMETER_TYPE, }; } } Modified: trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/PluginParameterVisitor.java =================================================================== --- trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/PluginParameterVisitor.java 2014-02-19 17:56:46 UTC (rev 9587) +++ trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/PluginParameterVisitor.java 2014-02-19 21:18:16 UTC (rev 9588) @@ -56,14 +56,6 @@ T visit(@NotNull DoubleParameter<G, A, R> parameter); /** - * Called for {@link FilterParameter} instances. - * @param parameter the parameter instance - * @return an implementation-specific return value - */ - @NotNull - T visit(@NotNull FilterParameter<G, A, R> parameter); - - /** * Called for {@link IntegerParameter} instances. * @param parameter the parameter instance * @return an implementation-specific return value 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-02-19 17:56:46 UTC (rev 9587) +++ trunk/src/plugin/src/test/java/net/sf/gridarta/plugin/parameter/PluginParameterCodecTest.java 2014-02-19 21:18:16 UTC (rev 9588) @@ -27,7 +27,6 @@ import java.util.Collections; import net.sf.gridarta.model.archetype.TestArchetype; import net.sf.gridarta.model.filter.NamedFilter; -import net.sf.gridarta.model.filter.NamedFilterConfig; import net.sf.gridarta.model.gameobject.TestGameObject; import net.sf.gridarta.model.maparchobject.TestMapArchObject; import net.sf.gridarta.model.mapcontrol.MapControl; @@ -211,62 +210,6 @@ } /** - * Checks that a {@link FilterParameter} instance is correctly encoded. - * @throws IOException if the test fails - */ - @Ignore - @Test - public void testFilterToXml1() throws IOException { - final Iterable<NamedGameObjectMatcher> matchers = Collections.emptyList(); - final NamedFilter namedFilter = new NamedFilter(matchers); - final PluginParameter<TestGameObject, TestMapArchObject, TestArchetype, ?> parameter = new FilterParameter<TestGameObject, TestMapArchObject, TestArchetype>(namedFilter); - parameter.setName("Name"); - parameter.setDescription("Description"); - 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.filter.NamedFilterConfig</type>\r\n"); - sb.append(" <value>\r\n"); - sb.append(" <enabled>false</enabled>\r\n"); - sb.append(" <inverted>false</inverted>\r\n"); - sb.append(" </value>\r\n"); - sb.append("</parameter>\r\n"); - sb.append("\r\n"); - Assert.assertEquals(sb.toString(), toXML(parameter)); - } - - /** - * Checks that a {@link FilterParameter} instance is correctly encoded. - * @throws IOException if the test fails - */ - @Ignore - @Test - public void testFilterToXml2() throws IOException { - final Iterable<NamedGameObjectMatcher> matchers = Collections.emptyList(); - final NamedFilter namedFilter = new NamedFilter(matchers); - final PluginParameter<TestGameObject, TestMapArchObject, TestArchetype, ?> parameter = new FilterParameter<TestGameObject, TestMapArchObject, TestArchetype>(namedFilter); - final NamedFilterConfig config = namedFilter.createConfig(); - config.setInverted(true); - config.setEnabled(true); - //XXX:parameter.setValue(config); - 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.filter.NamedFilterConfig</type>\r\n"); - sb.append(" <value>\r\n"); - sb.append(" <enabled>true</enabled>\r\n"); - sb.append(" <inverted>true</inverted>\r\n"); - sb.append(" </value>\r\n"); - sb.append("</parameter>\r\n"); - sb.append("\r\n"); - Assert.assertEquals(sb.toString(), toXML(parameter)); - } - - /** * Checks that an {@link IntegerParameter} instance is correctly encoded. * @throws IOException if the test fails */ @@ -671,76 +614,6 @@ } /** - * Checks that a {@link FilterParameter} is correctly decoded. - * @throws IOException if the test fails - * @throws JDOMException if the test fails - * @throws NoSuchParameterException if the test fails - */ - @Ignore - @Test - public void testFilterFromXml1() throws IOException, JDOMException, NoSuchParameterException { - 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.filter.NamedFilterConfig</type>\r\n"); - sb.append(" <value>\r\n"); - sb.append(" <enabled>false</enabled>\r\n"); - sb.append(" <inverted>false</inverted>\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 FilterParameter); - //noinspection TypeMayBeWeakened - final FilterParameter<?, ?, ?> filterParameter = (FilterParameter<?, ?, ?>) parameter; - Assert.assertEquals("Name", parameter.getName()); - Assert.assertEquals("net.sf.gridarta.model.filter.NamedFilterConfig", parameter.getParameterType()); - Assert.assertEquals("Description", parameter.getDescription()); - final NamedFilterConfig value = filterParameter.getValue(); - Assert.assertNotNull(value); - Assert.assertFalse(value.isEnabled()); - Assert.assertFalse(value.isInverted()); - } - - /** - * Checks that a {@link FilterParameter} is correctly decoded. - * @throws IOException if the test fails - * @throws JDOMException if the test fails - * @throws NoSuchParameterException if the test fails - */ - @Ignore - @Test - public void testFilterFromXml2() throws IOException, JDOMException, NoSuchParameterException { - 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.filter.NamedFilterConfig</type>\r\n"); - sb.append(" <value>\r\n"); - sb.append(" <enabled>true</enabled>\r\n"); - sb.append(" <inverted>true</inverted>\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 FilterParameter); - //noinspection TypeMayBeWeakened - final FilterParameter<?, ?, ?> filterParameter = (FilterParameter<?, ?, ?>) parameter; - Assert.assertEquals("Name", parameter.getName()); - Assert.assertEquals("net.sf.gridarta.model.filter.NamedFilterConfig", parameter.getParameterType()); - Assert.assertEquals("Description", parameter.getDescription()); - final NamedFilterConfig value = filterParameter.getValue(); - Assert.assertNotNull(value); - Assert.assertTrue(value.isEnabled()); - Assert.assertTrue(value.isInverted()); - } - - /** * Checks that an {@link IntegerParameter} is correctly decoded. * @throws IOException if the test fails * @throws JDOMException if the test fails This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-02-20 22:18:50
|
Revision: 9589 http://sourceforge.net/p/gridarta/code/9589 Author: akirschbaum Date: 2014-02-20 22:18:44 +0000 (Thu, 20 Feb 2014) Log Message: ----------- Remove unused parameters. Modified Paths: -------------- 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 trunk/src/project/src/main/java/net/sf/gridarta/project/ProjectModel.java 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-02-19 21:18:16 UTC (rev 9588) +++ trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/parameter/PluginParameterFactory.java 2014-02-20 22:18:44 UTC (rev 9589) @@ -21,7 +21,6 @@ import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.archetypeset.ArchetypeSet; -import net.sf.gridarta.model.filter.NamedFilter; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.mapmanager.MapManager; @@ -42,9 +41,6 @@ private final MapManager<G, A, R> mapManager; @NotNull - private final NamedFilter defaultFilterList; - - @NotNull private final ProjectSettings projectSettings; /** @@ -54,10 +50,9 @@ @NotNull private final PluginParameterCodec<G, A, R> codec = new PluginParameterCodec<G, A, R>(); - public PluginParameterFactory(@NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final MapManager<G, A, R> mapManager, @NotNull final NamedFilter defaultFilterList, @NotNull final ProjectSettings projectSettings) { + public PluginParameterFactory(@NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final MapManager<G, A, R> mapManager, @NotNull final ProjectSettings projectSettings) { this.archetypeSet = archetypeSet; this.mapManager = mapManager; - this.defaultFilterList = defaultFilterList; this.projectSettings = projectSettings; } 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-02-19 21:18:16 UTC (rev 9588) +++ trunk/src/plugin/src/test/java/net/sf/gridarta/plugin/parameter/PluginParameterCodecTest.java 2014-02-20 22:18:44 UTC (rev 9589) @@ -24,16 +24,13 @@ import java.io.StringReader; import java.io.StringWriter; import java.io.Writer; -import java.util.Collections; import net.sf.gridarta.model.archetype.TestArchetype; -import net.sf.gridarta.model.filter.NamedFilter; import net.sf.gridarta.model.gameobject.TestGameObject; import net.sf.gridarta.model.maparchobject.TestMapArchObject; import net.sf.gridarta.model.mapcontrol.MapControl; import net.sf.gridarta.model.mapcontrol.TestMapControlCreator; import net.sf.gridarta.model.mapmodel.MapFile; import net.sf.gridarta.model.mapmodel.TestMapModelCreator; -import net.sf.gridarta.model.match.NamedGameObjectMatcher; import net.sf.gridarta.utils.Size2D; import org.jdom.Document; import org.jdom.Element; @@ -769,9 +766,7 @@ 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); final Document document = builder.build(new StringReader(string)); - final Iterable<NamedGameObjectMatcher> matchers = Collections.emptyList(); - final NamedFilter filterList = new NamedFilter(matchers); - final PluginParameterFactory<TestGameObject, TestMapArchObject, TestArchetype> parameterFactory = new PluginParameterFactory<TestGameObject, TestMapArchObject, TestArchetype>(mapControlCreator.getArchetypeSet(), mapControlCreator.getMapManager(), filterList, mapControlCreator.getProjectSettings()); + final PluginParameterFactory<TestGameObject, TestMapArchObject, TestArchetype> parameterFactory = new PluginParameterFactory<TestGameObject, TestMapArchObject, TestArchetype>(mapControlCreator.getArchetypeSet(), mapControlCreator.getMapManager(), mapControlCreator.getProjectSettings()); final Element element = document.getRootElement(); return parameterFactory.createParameter(element); } Modified: trunk/src/project/src/main/java/net/sf/gridarta/project/ProjectModel.java =================================================================== --- trunk/src/project/src/main/java/net/sf/gridarta/project/ProjectModel.java 2014-02-19 21:18:16 UTC (rev 9588) +++ trunk/src/project/src/main/java/net/sf/gridarta/project/ProjectModel.java 2014-02-20 22:18:44 UTC (rev 9589) @@ -260,7 +260,7 @@ final Map<String, TreasureTreeNode> specialTreasureLists = loadSpecialTreasureLists(errorView, xmlHelper.getDocumentBuilder(), projectSettings); treasureTree = TreasureLoader.parseTreasures(errorView, specialTreasureLists, configSource, projectSettings); final NamedFilter defaultFilterList = new NamedFilter(Collections.<NamedGameObjectMatcher>emptyList()); - final PluginParameterFactory<G, A, R> pluginParameterFactory = new PluginParameterFactory<G, A, R>(archetypeSet, mapManager, defaultFilterList, projectSettings); + final PluginParameterFactory<G, A, R> pluginParameterFactory = new PluginParameterFactory<G, A, R>(archetypeSet, mapManager, projectSettings); final PluginModelParser<G, A, R> pluginModelParser = new PluginModelParser<G, A, R>(pluginParameterFactory); pluginModel = PluginModelLoader.loadPlugins(pluginParameterFactory, pluginModelParser, errorView, scriptsFile); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-02-21 20:33:48
|
Revision: 9590 http://sourceforge.net/p/gridarta/code/9590 Author: akirschbaum Date: 2014-02-21 20:33:41 +0000 (Fri, 21 Feb 2014) Log Message: ----------- Rename identifiers. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginEditor.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/parameter/ArchParameterView.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/parameter/BooleanParameterView.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/parameter/DoubleParameterView.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/parameter/MapParameterView.java trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/Plugin.java trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/PluginExecutor.java trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/SyntaxStyle.java trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/tokenmarker/DaimoninAITokenMarker.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginEditor.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginEditor.java 2014-02-20 22:18:44 UTC (rev 9589) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginEditor.java 2014-02-21 20:33:41 UTC (rev 9590) @@ -88,7 +88,7 @@ private final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory; @NotNull - private final JPanel paramTable = new JPanel(new GridBagLayout()); + private final JPanel parameterTable = new JPanel(new GridBagLayout()); @NotNull private final PluginModel<G, A, R> pluginModel; @@ -97,16 +97,16 @@ private final Plugin<G, A, R> plugin; @NotNull - private final Map<PluginParameter<G, A, R, ?>, ParameterNameEditor<G, A, R>> paramNameEditors = new HashMap<PluginParameter<G, A, R, ?>, ParameterNameEditor<G, A, R>>(); + private final Map<PluginParameter<G, A, R, ?>, ParameterNameEditor<G, A, R>> parameterNameEditors = new HashMap<PluginParameter<G, A, R, ?>, ParameterNameEditor<G, A, R>>(); @NotNull - private final Map<PluginParameter<G, A, R, ?>, ParameterDescriptionEditor<G, A, R>> paramDescriptionEditors = new HashMap<PluginParameter<G, A, R, ?>, ParameterDescriptionEditor<G, A, R>>(); + private final Map<PluginParameter<G, A, R, ?>, ParameterDescriptionEditor<G, A, R>> parameterDescriptionEditors = new HashMap<PluginParameter<G, A, R, ?>, ParameterDescriptionEditor<G, A, R>>(); @NotNull - private final Map<PluginParameter<G, A, R, ?>, ParameterTypeEditor<G, A, R>> paramTypeEditors = new HashMap<PluginParameter<G, A, R, ?>, ParameterTypeEditor<G, A, R>>(); + private final Map<PluginParameter<G, A, R, ?>, ParameterTypeEditor<G, A, R>> parameterTypeEditors = new HashMap<PluginParameter<G, A, R, ?>, ParameterTypeEditor<G, A, R>>(); @NotNull - private final Map<PluginParameter<G, A, R, ?>, PluginParameterView<G, A, R>> paramViews = new HashMap<PluginParameter<G, A, R, ?>, PluginParameterView<G, A, R>>(); + private final Map<PluginParameter<G, A, R, ?>, PluginParameterView<G, A, R>> parameterViews = new HashMap<PluginParameter<G, A, R, ?>, PluginParameterView<G, A, R>>(); private int selectedRow = -1; @@ -174,10 +174,10 @@ final Container optionsTab = new JPanel(new GridBagLayout()); final GridBagConstraints gbc = new GridBagConstraints(); - final Container paramButtons = new JPanel(); - paramButtons.setLayout(new StackLayout(5)); - paramButtons.add(new JButton(ACTION_BUILDER.createAction(false, "pluginEditorReRegister", this))); - paramButtons.add(new JButton(ACTION_BUILDER.createAction(false, "pluginEditorExport", this))); + final Container parameterButtons = new JPanel(); + parameterButtons.setLayout(new StackLayout(5)); + parameterButtons.add(new JButton(ACTION_BUILDER.createAction(false, "pluginEditorReRegister", this))); + parameterButtons.add(new JButton(ACTION_BUILDER.createAction(false, "pluginEditorExport", this))); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridx = 0; @@ -218,7 +218,7 @@ gbc.fill = GridBagConstraints.NONE; gbc.gridy = 4; - optionsTab.add(paramButtons, gbc); + optionsTab.add(parameterButtons, gbc); gbc.gridx = 0; gbc.gridy = 5; @@ -241,10 +241,10 @@ } }); - final Container paramButtons = new JPanel(); - paramButtons.setLayout(new StackLayout(5)); - paramButtons.add(new JButton(ACTION_BUILDER.createAction(false, "pluginEditorAddParameter", this))); - paramButtons.add(new JButton(ACTION_BUILDER.createAction(false, "pluginEditorRemoveParameter", this))); + final Container parameterButtons = new JPanel(); + parameterButtons.setLayout(new StackLayout(5)); + parameterButtons.add(new JButton(ACTION_BUILDER.createAction(false, "pluginEditorAddParameter", this))); + parameterButtons.add(new JButton(ACTION_BUILDER.createAction(false, "pluginEditorRemoveParameter", this))); final GridBagConstraints gbc = new GridBagConstraints(); @@ -256,9 +256,9 @@ gbc.anchor = GridBagConstraints.WEST; final Container parameterTab = new JPanel(new GridBagLayout()); - parameterTab.add(new JScrollPane(paramTable), gbc); + parameterTab.add(new JScrollPane(parameterTable), gbc); gbc.gridy++; - parameterTab.add(paramButtons, gbc); + parameterTab.add(parameterButtons, gbc); gbc.gridy++; gbc.weighty = 1.0; gbc.fill = GridBagConstraints.BOTH; @@ -309,7 +309,7 @@ } public void selectTableComponent(@NotNull final Component c) { - final GridBagLayout l = (GridBagLayout) paramTable.getLayout(); + final GridBagLayout l = (GridBagLayout) parameterTable.getLayout(); final GridBagConstraints gbc = l.getConstraints(c); if (gbc != null) { selectedRow = gbc.gridy - 1; @@ -318,16 +318,16 @@ private void redrawTable() { final GridBagConstraints gbc = new GridBagConstraints(0, 0, 1, 1, 0.1, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 5, 0); - paramTable.removeAll(); - paramTable.add(ActionBuilderUtils.newLabel(ACTION_BUILDER, "pluginEditorTitleName.text"), gbc); + parameterTable.removeAll(); + parameterTable.add(ActionBuilderUtils.newLabel(ACTION_BUILDER, "pluginEditorTitleName.text"), gbc); gbc.gridx = 1; - paramTable.add(ActionBuilderUtils.newLabel(ACTION_BUILDER, "pluginEditorTitleDescription.text"), gbc); + parameterTable.add(ActionBuilderUtils.newLabel(ACTION_BUILDER, "pluginEditorTitleDescription.text"), gbc); gbc.gridx = 2; - paramTable.add(ActionBuilderUtils.newLabel(ACTION_BUILDER, "pluginEditorTitleType.text"), gbc); + parameterTable.add(ActionBuilderUtils.newLabel(ACTION_BUILDER, "pluginEditorTitleType.text"), gbc); gbc.gridx = 3; - paramTable.add(ActionBuilderUtils.newLabel(ACTION_BUILDER, "pluginEditorTitleConfig.text"), gbc); + parameterTable.add(ActionBuilderUtils.newLabel(ACTION_BUILDER, "pluginEditorTitleConfig.text"), gbc); gbc.gridx = 4; - paramTable.add(ActionBuilderUtils.newLabel(ACTION_BUILDER, "pluginEditorTitleDefault.text"), gbc); + parameterTable.add(ActionBuilderUtils.newLabel(ACTION_BUILDER, "pluginEditorTitleDefault.text"), gbc); int i = 0; for (final PluginParameter<G, A, R, ?> parameter : plugin) { gbc.gridy = i + 1; @@ -343,73 +343,73 @@ } @NotNull - private Component getParameterNameEditor(@NotNull final PluginParameter<G, A, R, ?> param) { - final Component existingParameterNameEditor = paramNameEditors.get(param); + private Component getParameterNameEditor(@NotNull final PluginParameter<G, A, R, ?> parameter) { + final Component existingParameterNameEditor = parameterNameEditors.get(parameter); if (existingParameterNameEditor != null) { return existingParameterNameEditor; } - final ParameterNameEditor<G, A, R> newParameterNameEditor = new ParameterNameEditor<G, A, R>(param); - paramNameEditors.put(param, newParameterNameEditor); + final ParameterNameEditor<G, A, R> newParameterNameEditor = new ParameterNameEditor<G, A, R>(parameter); + parameterNameEditors.put(parameter, newParameterNameEditor); newTableComponent(newParameterNameEditor); return newParameterNameEditor; } @NotNull - private Component getParameterDescriptionEditor(@NotNull final PluginParameter<G, A, R, ?> param) { - final Component existingParameterDescriptionEditor = paramDescriptionEditors.get(param); + private Component getParameterDescriptionEditor(@NotNull final PluginParameter<G, A, R, ?> parameter) { + final Component existingParameterDescriptionEditor = parameterDescriptionEditors.get(parameter); if (existingParameterDescriptionEditor != null) { return existingParameterDescriptionEditor; } - final ParameterDescriptionEditor<G, A, R> newParameterDescriptionEditor = new ParameterDescriptionEditor<G, A, R>(param); + final ParameterDescriptionEditor<G, A, R> newParameterDescriptionEditor = new ParameterDescriptionEditor<G, A, R>(parameter); newTableComponent(newParameterDescriptionEditor); - paramDescriptionEditors.put(param, newParameterDescriptionEditor); + parameterDescriptionEditors.put(parameter, newParameterDescriptionEditor); return newParameterDescriptionEditor; } @NotNull - private Component getParameterTypeEditor(@NotNull final PluginParameter<G, A, R, ?> param) { - final Component existingParameterTypeEditor = paramTypeEditors.get(param); + private Component getParameterTypeEditor(@NotNull final PluginParameter<G, A, R, ?> parameter) { + final Component existingParameterTypeEditor = parameterTypeEditors.get(parameter); if (existingParameterTypeEditor != null) { return existingParameterTypeEditor; } - final ParameterTypeEditor<G, A, R> newParameterTypeEditor = new ParameterTypeEditor<G, A, R>(pluginModel, plugin, param); - paramTypeEditors.put(param, newParameterTypeEditor); + final ParameterTypeEditor<G, A, R> newParameterTypeEditor = new ParameterTypeEditor<G, A, R>(pluginModel, plugin, parameter); + parameterTypeEditors.put(parameter, newParameterTypeEditor); newTableComponent(newParameterTypeEditor); return newParameterTypeEditor; } @NotNull - private PluginParameterView<G, A, R> getParameterView(@NotNull final PluginParameter<G, A, R, ?> param) { - final PluginParameterView<G, A, R> existingPluginParameterView = paramViews.get(param); + private PluginParameterView<G, A, R> getParameterView(@NotNull final PluginParameter<G, A, R, ?> parameter) { + final PluginParameterView<G, A, R> existingPluginParameterView = parameterViews.get(parameter); if (existingPluginParameterView != null) { return existingPluginParameterView; } - final PluginParameterView<G, A, R> newPluginParameterView = pluginParameterViewFactory.getView(paramTable, param); + final PluginParameterView<G, A, R> newPluginParameterView = pluginParameterViewFactory.getView(parameterTable, parameter); newTableComponent(newPluginParameterView.getConfigComponent()); newTableComponent(newPluginParameterView.getValueComponent()); - paramViews.put(param, newPluginParameterView); + parameterViews.put(parameter, newPluginParameterView); return newPluginParameterView; } - private void putRow(@NotNull final GridBagConstraints gbc, @NotNull final PluginParameter<G, A, R, ?> param) { + private void putRow(@NotNull final GridBagConstraints gbc, @NotNull final PluginParameter<G, A, R, ?> parameter) { gbc.gridx = 0; - paramTable.add(getParameterNameEditor(param), gbc); + parameterTable.add(getParameterNameEditor(parameter), gbc); gbc.gridx = 1; gbc.weightx = 0.5; - paramTable.add(getParameterDescriptionEditor(param), gbc); + parameterTable.add(getParameterDescriptionEditor(parameter), gbc); gbc.gridx = 2; gbc.weightx = 0.1; - paramTable.add(getParameterTypeEditor(param), gbc); + parameterTable.add(getParameterTypeEditor(parameter), gbc); gbc.gridx = 3; - paramTable.add(getParameterView(param).getConfigComponent(), gbc); + parameterTable.add(getParameterView(parameter).getConfigComponent(), gbc); gbc.gridx = 4; - paramTable.add(getParameterView(param).getValueComponent(), gbc); + parameterTable.add(getParameterView(parameter).getValueComponent(), gbc); } /** Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/parameter/ArchParameterView.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/parameter/ArchParameterView.java 2014-02-20 22:18:44 UTC (rev 9589) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/parameter/ArchParameterView.java 2014-02-21 20:33:41 UTC (rev 9590) @@ -50,10 +50,10 @@ * @param faceObjectProviders the face object providers for looking up * faces */ - public ArchParameterView(@NotNull final ArchetypeParameter<G, A, R> param, @NotNull final GameObjectAttributesModel<G, A, R> gameObjectAttributesModel, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final FaceObjectProviders faceObjectProviders) { + public ArchParameterView(@NotNull final ArchetypeParameter<G, A, R> parameter, @NotNull final GameObjectAttributesModel<G, A, R> gameObjectAttributesModel, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final FaceObjectProviders faceObjectProviders) { value = new ArchComboBox<G, A, R>(gameObjectAttributesModel, archetypeSet, objectChooser, faceObjectProviders); - parameter = param; - value.setSelectedItem(param.getValue()); + this.parameter = parameter; + value.setSelectedItem(parameter.getValue()); value.addItemListener(new ItemListener() { @Override @@ -62,7 +62,7 @@ //JComboBox does not use type parameters @SuppressWarnings("unchecked") final Archetype<G, A, R> archetype = (Archetype<G, A, R>) value.getSelectedItem(); - parameter.setStringValue(archetype.getArchetypeName()); + ArchParameterView.this.parameter.setStringValue(archetype.getArchetypeName()); } } }); Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/parameter/BooleanParameterView.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/parameter/BooleanParameterView.java 2014-02-20 22:18:44 UTC (rev 9589) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/parameter/BooleanParameterView.java 2014-02-21 20:33:41 UTC (rev 9590) @@ -43,8 +43,8 @@ @NotNull private final BooleanParameter<G, A, R> parameter; - public BooleanParameterView(@NotNull final BooleanParameter<G, A, R> param) { - parameter = param; + public BooleanParameterView(@NotNull final BooleanParameter<G, A, R> parameter) { + this.parameter = parameter; value = new JCheckBox(); value.setActionCommand("toggle"); value.addActionListener(this); Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/parameter/DoubleParameterView.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/parameter/DoubleParameterView.java 2014-02-20 22:18:44 UTC (rev 9589) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/parameter/DoubleParameterView.java 2014-02-21 20:33:41 UTC (rev 9590) @@ -49,19 +49,19 @@ @NotNull private final DoubleParameter<G, A, R> parameter; - public DoubleParameterView(@NotNull final DoubleParameter<G, A, R> param) { - parameter = param; - final SpinnerModel mdl = new SpinnerNumberModel(0.0, param.getMin(), param.getMax(), (param.getMax() - param.getMin()) / 100.0); + public DoubleParameterView(@NotNull final DoubleParameter<G, A, R> parameter) { + this.parameter = parameter; + final SpinnerModel mdl = new SpinnerNumberModel(0.0, parameter.getMin(), parameter.getMax(), (parameter.getMax() - parameter.getMin()) / 100.0); value = new TooltipSpinner(mdl); try { - value.setValue(param.getValue()); + value.setValue(parameter.getValue()); } catch (final IllegalArgumentException e) { } value.addChangeListener(new ChangeListener() { @Override public void stateChanged(final ChangeEvent e) { - parameter.setValue((Double) ((SpinnerNumberModel) value.getModel()).getNumber()); + DoubleParameterView.this.parameter.setValue((Double) ((SpinnerNumberModel) value.getModel()).getNumber()); } }); config = new JButton("..."); Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/parameter/MapParameterView.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/parameter/MapParameterView.java 2014-02-20 22:18:44 UTC (rev 9589) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/parameter/MapParameterView.java 2014-02-21 20:33:41 UTC (rev 9590) @@ -45,8 +45,8 @@ @NotNull private final JComboBox value; - public MapParameterView(@NotNull final MapParameter<G, A, R> param, @NotNull final MapManager<G, A, R> mapManager) { - parameter = param; + public MapParameterView(@NotNull final MapParameter<G, A, R> parameter, @NotNull final MapManager<G, A, R> mapManager) { + this.parameter = parameter; value = new JComboBox(); final ComboBoxModel myModel = new MapParameterComboBoxModel<G, A, R>(mapManager); value.setModel(myModel); @@ -57,7 +57,7 @@ public void itemStateChanged(final ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { if (value.getSelectedIndex() == 0) { - parameter.setValueToCurrent(); + MapParameterView.this.parameter.setValueToCurrent(); } else { final MapControl<?, ?, ?> mapControl = (MapControl<?, ?, ?>) value.getSelectedItem(); final String stringValue; @@ -67,12 +67,12 @@ final MapFile mapFile = mapControl.getMapModel().getMapFile(); stringValue = mapFile == null ? "" : mapFile.getMapPath().getPath(); } - parameter.setStringValue(stringValue); + MapParameterView.this.parameter.setStringValue(stringValue); } } } }); - value.setSelectedItem(parameter.getValue()); + value.setSelectedItem(this.parameter.getValue()); } /** 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-02-20 22:18:44 UTC (rev 9589) +++ trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/Plugin.java 2014-02-21 20:33:41 UTC (rev 9590) @@ -190,13 +190,13 @@ /** * Returns the index for a plugin parameter name. - * @param paramName the plugin parameter name + * @param parameterName the plugin parameter name * @return the index or {@code -1} if the parameter name does not exist */ - public int getParameter(@NotNull final String paramName) { + public int getParameter(@NotNull final String parameterName) { int index = 0; for (final PluginParameter<G, A, R, ?> parameter : parameters) { - if (parameter.getName().equals(paramName)) { + if (parameter.getName().equals(parameterName)) { return index; } index++; @@ -281,10 +281,10 @@ model.file = file; model.modified = modified; for (final PluginParameter<G, A, R, ?> parameter : parameters) { - final Element paramXml = codec.toXML(parameter); + final Element parameterXml = codec.toXML(parameter); final PluginParameter<G, A, R, ?> clonedParam; try { - clonedParam = pluginParameterFactory.createParameter(paramXml); + clonedParam = pluginParameterFactory.createParameter(parameterXml); } catch (final NoSuchParameterException ex) { throw new AssertionError(ex); } Modified: trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/PluginExecutor.java =================================================================== --- trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/PluginExecutor.java 2014-02-20 22:18:44 UTC (rev 9589) +++ trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/PluginExecutor.java 2014-02-21 20:33:41 UTC (rev 9590) @@ -68,10 +68,10 @@ /** * Executes an editor plugin. * @param plugin the plugin name to execute - * @param params the plugin parameters + * @param parameters the plugin parameters * @return whether an error occurred */ - public int executePlugin(@NotNull final String plugin, @NotNull final Iterable<String> params) { + public int executePlugin(@NotNull final String plugin, @NotNull final Iterable<String> parameters) { final Plugin<G, A, R> modelTemplate = pluginModel.getPlugin(plugin); if (modelTemplate == null) { System.err.println("plugin " + plugin + " does not exist"); @@ -80,10 +80,10 @@ final Plugin<G, A, R> clonedPlugin = modelTemplate.clonePlugin(); - for (final String param : params) { - final String[] tmp = StringUtils.PATTERN_EQUAL.split(param, 2); + for (final String parameter : parameters) { + final String[] tmp = StringUtils.PATTERN_EQUAL.split(parameter, 2); if (tmp.length != 2) { - System.err.println("syntax error: " + param); + System.err.println("syntax error: " + parameter); return 1; } @@ -91,22 +91,22 @@ if (index == -1) { final StringBuilder sb = new StringBuilder(); boolean firstParameter = true; - for (final PluginParameter<?, ?, ?, ?> parameter : clonedPlugin) { + for (final PluginParameter<?, ?, ?, ?> clonedParameter : clonedPlugin) { sb.append(firstParameter ? " " : ", "); - sb.append(parameter.getName()); + sb.append(clonedParameter.getName()); firstParameter = false; } System.err.println("plugin " + plugin + " has no parameter " + tmp[0] + "; available parameters:" + sb); return 1; } - final PluginParameter<G, A, R, ?> parameter; + final PluginParameter<G, A, R, ?> clonedParameter; try { - parameter = clonedPlugin.getParameter(index); + clonedParameter = clonedPlugin.getParameter(index); } catch (final NoSuchParameterException ex) { throw new AssertionError(ex); } - if (!parameter.setStringValue(tmp[1])) { + if (!clonedParameter.setStringValue(tmp[1])) { System.out.println("invalid value " + tmp[1] + " for parameter " + tmp[0]); return 1; } Modified: trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/SyntaxStyle.java =================================================================== --- trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/SyntaxStyle.java 2014-02-20 22:18:44 UTC (rev 9589) +++ trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/SyntaxStyle.java 2014-02-21 20:33:41 UTC (rev 9590) @@ -110,7 +110,7 @@ */ private Font getStyledFont(final Font font) { if (font == null) { - throw new IllegalArgumentException("font param must not be null"); + throw new IllegalArgumentException("font parameter must not be null"); } updateStyledFont(font); @@ -125,7 +125,7 @@ */ public FontMetrics getFontMetrics(final Font font, final Graphics g) { if (font == null) { - throw new IllegalArgumentException("font param must not be null"); + throw new IllegalArgumentException("font parameter must not be null"); } updateStyledFont(font); Modified: trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/tokenmarker/DaimoninAITokenMarker.java =================================================================== --- trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/tokenmarker/DaimoninAITokenMarker.java 2014-02-20 22:18:44 UTC (rev 9589) +++ trunk/src/textedit/src/main/java/net/sf/gridarta/textedit/textarea/tokenmarker/DaimoninAITokenMarker.java 2014-02-21 20:33:41 UTC (rev 9590) @@ -128,23 +128,23 @@ offset2 += spacesLength1; while (it.hasNext()) { - final int paramLength = it.next(); - final String[] tmp = StringUtils.PATTERN_EQUAL.split(new String(array, offset2, paramLength), 2); + final int parameterLength = it.next(); + final String[] tmp = StringUtils.PATTERN_EQUAL.split(new String(array, offset2, parameterLength), 2); if (tmp.length == 2) { - final String param = tmp[0]; - final String arg = tmp[1]; + final String parameterString = tmp[0]; + final String valueString = tmp[1]; - final Parameter parameter = spec != null ? spec.getParameter(param) : null; + final Parameter parameter = spec != null ? spec.getParameter(parameterString) : null; final boolean parameterValid = parameter != null; - final boolean valueValid = parameter == null || parameter.getParameterType().getPattern().matcher(arg).matches(); - addToken(param.length(), parameterValid ? parameter.getId() : Token.INVALID); - addToken(1, (param.isEmpty() && !parameterValid) || (arg.isEmpty() && !valueValid) ? Token.INVALID : Token.OPERATOR); - addToken(arg.length(), valueValid ? Token.NULL : Token.INVALID); + final boolean valueValid = parameter == null || parameter.getParameterType().getPattern().matcher(valueString).matches(); + addToken(parameterString.length(), parameterValid ? parameter.getId() : Token.INVALID); + addToken(1, (parameterString.isEmpty() && !parameterValid) || (valueString.isEmpty() && !valueValid) ? Token.INVALID : Token.OPERATOR); + addToken(valueString.length(), valueValid ? Token.NULL : Token.INVALID); } else { // missing '=' sign ==> syntax error - addToken(paramLength, Token.INVALID); + addToken(parameterLength, Token.INVALID); } - offset2 += paramLength; + offset2 += parameterLength; final int spacesLength2 = it.next(); addToken(spacesLength2, Token.NULL); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |