You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(103) |
Jun
(121) |
Jul
(16) |
Aug
(67) |
Sep
(126) |
Oct
(161) |
Nov
(164) |
Dec
(588) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(394) |
Feb
(181) |
Mar
(131) |
Apr
(180) |
May
(255) |
Jun
(11) |
Jul
(79) |
Aug
(70) |
Sep
(274) |
Oct
(138) |
Nov
(195) |
Dec
(8) |
2008 |
Jan
(3) |
Feb
(142) |
Mar
(162) |
Apr
(124) |
May
(148) |
Jun
(157) |
Jul
(425) |
Aug
(373) |
Sep
(264) |
Oct
(315) |
Nov
(225) |
Dec
(6) |
2009 |
Jan
(67) |
Feb
(78) |
Mar
(279) |
Apr
(294) |
May
(92) |
Jun
(65) |
Jul
(134) |
Aug
(41) |
Sep
(138) |
Oct
(125) |
Nov
(126) |
Dec
(122) |
2010 |
Jan
(15) |
Feb
(48) |
Mar
(9) |
Apr
(195) |
May
(373) |
Jun
(507) |
Jul
(42) |
Aug
(16) |
Sep
(38) |
Oct
(81) |
Nov
(64) |
Dec
(18) |
2011 |
Jan
(13) |
Feb
(12) |
Mar
(39) |
Apr
(1) |
May
(2) |
Jun
(27) |
Jul
(27) |
Aug
(31) |
Sep
(14) |
Oct
(102) |
Nov
(20) |
Dec
(37) |
2012 |
Jan
(22) |
Feb
(1) |
Mar
(1) |
Apr
(2) |
May
(2) |
Jun
(18) |
Jul
(6) |
Aug
(1) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2013 |
Jan
(1) |
Feb
(2) |
Mar
(1) |
Apr
(1) |
May
(47) |
Jun
(7) |
Jul
(107) |
Aug
|
Sep
|
Oct
(112) |
Nov
(31) |
Dec
(17) |
2014 |
Jan
(29) |
Feb
(111) |
Mar
(34) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(18) |
Dec
(10) |
From: <der...@us...> - 2006-06-17 08:40:16
|
Revision: 159 Author: derdanny Date: 2006-06-17 01:40:12 -0700 (Sat, 17 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=159&view=rev Log Message: ----------- Removed unused field. Modified Paths: -------------- trunk/daimonin/src/daieditor/gui/map/tools/ToolSelector.java Modified: trunk/daimonin/src/daieditor/gui/map/tools/ToolSelector.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/tools/ToolSelector.java 2006-06-17 08:35:09 UTC (rev 158) +++ trunk/daimonin/src/daieditor/gui/map/tools/ToolSelector.java 2006-06-17 08:40:12 UTC (rev 159) @@ -1,20 +1,18 @@ package daieditor.gui.map.tools; -import javax.swing.JPanel; -import javax.swing.Action; -import javax.swing.JToggleButton; -import javax.swing.AbstractAction; -import javax.swing.JFrame; -import javax.swing.ButtonGroup; import java.awt.BorderLayout; +import java.awt.CardLayout; import java.awt.Component; import java.awt.FlowLayout; -import java.awt.CardLayout; import java.awt.event.ActionEvent; -import java.util.HashMap; -import java.util.Map; -import org.jetbrains.annotations.Nullable; +import javax.swing.AbstractAction; +import javax.swing.Action; +import javax.swing.ButtonGroup; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JToggleButton; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * User interface for selecting a tool and displaying its options. @@ -34,9 +32,6 @@ /** The pane with the options of a tool. */ @NotNull private final JPanel optionsPane = new JPanel(optionCards); - /** The options views of the registered tools. */ - @NotNull private final Map<Tool, Component> optionViews = new HashMap<Tool, Component>(); - /** The currently selected tool. */ @NotNull private Tool selectedTool; @@ -65,7 +60,6 @@ @NotNull final Action selectionAction = new SelectionAction(tool); @NotNull final JToggleButton toggleButton = new JToggleButton(selectionAction); @NotNull final Component optionsView = createOptionsView(tool); - optionViews.put(tool, optionsView); selectionButtonGroup.add(toggleButton); selectionPane.add(toggleButton); optionsPane.add(optionsView, tool.getId()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <der...@us...> - 2006-06-17 08:35:40
|
Revision: 158 Author: derdanny Date: 2006-06-17 01:35:09 -0700 (Sat, 17 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=158&view=rev Log Message: ----------- Implemented a tools framework (unfinnished). Moved map user interface events to a package of their own. (Cher) Modified Paths: -------------- trunk/daimonin/src/daieditor/CopyBuffer.java trunk/daimonin/src/daieditor/gui/map/MapPreviewAccessory.java trunk/daimonin/src/daieditor/gui/map/MapUserListener.java trunk/daimonin/src/daieditor/gui/map/MapViewSettings.java trunk/daimonin/src/daieditor/map/DefaultMapModel.java trunk/daimonin/src/daieditor/map/MapControl.java trunk/daimonin/src/daieditor/map/MapModel.java Added Paths: ----------- trunk/daimonin/src/daieditor/gui/map/event/ trunk/daimonin/src/daieditor/gui/map/event/MapViewSettingsEvent.java trunk/daimonin/src/daieditor/gui/map/event/MapViewSettingsListener.java trunk/daimonin/src/daieditor/gui/map/event/MouseOpAdapter.java trunk/daimonin/src/daieditor/gui/map/event/MouseOpEvent.java trunk/daimonin/src/daieditor/gui/map/event/MouseOpListener.java trunk/daimonin/src/daieditor/gui/map/event/package.html trunk/daimonin/src/daieditor/gui/map/tools/ trunk/daimonin/src/daieditor/gui/map/tools/AbstractTool.java trunk/daimonin/src/daieditor/gui/map/tools/BasicAbstractTool.java trunk/daimonin/src/daieditor/gui/map/tools/DeletionTool.java trunk/daimonin/src/daieditor/gui/map/tools/InsertionTool.java trunk/daimonin/src/daieditor/gui/map/tools/SelectionTool.java trunk/daimonin/src/daieditor/gui/map/tools/Tool.java trunk/daimonin/src/daieditor/gui/map/tools/ToolSelector.java trunk/daimonin/src/daieditor/gui/map/tools/VoidTool.java trunk/daimonin/src/daieditor/gui/map/tools/action.properties trunk/daimonin/src/daieditor/gui/map/tools/package.html Removed Paths: ------------- trunk/daimonin/src/daieditor/gui/map/MapViewSettingsEvent.java trunk/daimonin/src/daieditor/gui/map/MapViewSettingsListener.java Modified: trunk/daimonin/src/daieditor/CopyBuffer.java =================================================================== --- trunk/daimonin/src/daieditor/CopyBuffer.java 2006-06-16 09:25:40 UTC (rev 157) +++ trunk/daimonin/src/daieditor/CopyBuffer.java 2006-06-17 08:35:09 UTC (rev 158) @@ -224,7 +224,7 @@ // first we clone the head clone = arch.createClone(pos.x, pos.y); // second we insert a default multi on the map - if (mapControl.addArchToMap(arch.getArchName(), pos, -1)) { + if (mapControl.addArchToMap(arch.getArchName(), pos, true)) { // third we chop off the default head and attach our clone final ArchObject oldHead = mapControl.getMapModel().getMapSquare(pos).getLast(); if (oldHead != null && oldHead.hasSameDefaultArch(arch)) { @@ -291,7 +291,7 @@ final ArchObject arch = archList.get(rnd.nextInt(archList.size())); final boolean isDefarch = arch.isDefaultArch(); if (isDefarch) { - mapControl.addArchToMap(mainControl.getPanelArchName(), p, 0, fillBelow); + mapControl.addArchToMap(mainControl.getPanelArchName(), p, false, fillBelow); } else { // insert arch-clone from pickmap mapControl.addArchObjectToMap(arch.createClone(p.x, p.y), fillBelow); @@ -435,7 +435,7 @@ final ArchObject arch = archList.get(rnd.nextInt(archList.size())); final boolean isDefArch = arch.isDefaultArch(); if (isDefArch) { - mapControl.addArchToMap(arch.getArchName(), p, 0); + mapControl.addArchToMap(arch.getArchName(), p, false); } else { mapControl.addArchObjectToMap(arch.createClone(p.x, p.y)); } Modified: trunk/daimonin/src/daieditor/gui/map/MapPreviewAccessory.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapPreviewAccessory.java 2006-06-16 09:25:40 UTC (rev 157) +++ trunk/daimonin/src/daieditor/gui/map/MapPreviewAccessory.java 2006-06-17 08:35:09 UTC (rev 158) @@ -56,7 +56,7 @@ /** * Preview Accessory for previewing maps in JFileChoosers. - * @author <a href="mailto:Chr...@it...">Christian Hujer</a> + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ public class MapPreviewAccessory extends JComponent implements PropertyChangeListener { Modified: trunk/daimonin/src/daieditor/gui/map/MapUserListener.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapUserListener.java 2006-06-16 09:25:40 UTC (rev 157) +++ trunk/daimonin/src/daieditor/gui/map/MapUserListener.java 2006-06-17 08:35:09 UTC (rev 158) @@ -23,13 +23,17 @@ import daieditor.CMainControl; import daieditor.CMapViewBasic; -import daieditor.arch.ArchObject; +import daieditor.gui.map.event.MouseOpEvent; +import daieditor.gui.map.event.MouseOpListener; +import daieditor.gui.map.tools.SelectionTool; +import daieditor.gui.map.tools.VoidTool; +import daieditor.gui.map.tools.InsertionTool; +import daieditor.gui.map.tools.DeletionTool; import daieditor.map.MapControl; import java.awt.Point; import static java.awt.event.InputEvent.BUTTON1_MASK; import static java.awt.event.InputEvent.BUTTON2_MASK; import static java.awt.event.InputEvent.BUTTON3_MASK; -import static java.awt.event.InputEvent.CTRL_MASK; import static java.awt.event.InputEvent.SHIFT_MASK; import java.awt.event.MouseEvent; import static java.awt.event.MouseEvent.BUTTON1; @@ -38,23 +42,21 @@ import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import net.sf.gridarta.gui.map.MapCursor; -import net.sf.gridarta.gui.map.MapGrid; import org.jetbrains.annotations.Nullable; public final class MapUserListener implements MouseListener, MouseMotionListener { /** Mouse Operation bound to the left mouse button. */ - private MouseOperation lmbOp = new SelectionMouseOperation(); + private MouseOpListener lmbOp = new SelectionTool(); /** Mouse Operation bound to the middle mouse button. */ - private MouseOperation mmbOp = new DeletionMouseOperation(); + private MouseOpListener mmbOp = new DeletionTool(); /** Mouse Operation bound to the right mouse button. */ - private MouseOperation rmbOp = new InsertionMouseOperation(); + private MouseOpListener rmbOp = new InsertionTool(); /** Mouse Operation stub doing nothing. */ - private MouseOperation stub = new MouseOperationAdapter() { - }; + private MouseOpListener stub = new VoidTool(); private MapCursor mapCursor; private DefaultLevelRenderer renderer; @@ -65,7 +67,7 @@ private final Point tmpPoint = new Point(); - private int mod; + private final MouseOpEvent mouseOpEvent = new MouseOpEvent(); public MapUserListener(final CMainControl mainControl, final MapControl mapControl, final CMapViewBasic mapView) { this.mainControl = mainControl; @@ -76,9 +78,17 @@ /** {@inheritDoc} */ public void mouseClicked(final MouseEvent event) { - getMouseOperation(event).clicked(getMapLocation(event)); + getMouseOperation(event).clicked(mouseOpEvent); } + private void initEvent(final MouseEvent event) { + mouseOpEvent.setMapLocation(getMapLocation(event)); + mouseOpEvent.setMapCursor(mapCursor); + mouseOpEvent.setModifiers(event.getModifiers()); + mouseOpEvent.setClickCount(event.getClickCount()); + mouseOpEvent.setMapControl(mapControl); + } + /** {@inheritDoc} */ public void mouseEntered(final MouseEvent event) { /* ignore */ @@ -91,29 +101,28 @@ /** {@inheritDoc} */ public void mouseDragged(final MouseEvent event) { - getMouseOperation(event).dragged(getMapLocation(event)); + getMouseOperation(event).dragged(mouseOpEvent); } /** {@inheritDoc} */ public void mouseMoved(final MouseEvent event) { - getMouseOperation(event).moved(getMapLocation(event)); + getMouseOperation(event).moved(mouseOpEvent); } /** {@inheritDoc} */ public void mousePressed(final MouseEvent event) { // in "locked pickmaps" mode, pickmaps react only to leftclicks - final Point p = getMapLocation(event); assert mapControl != null; if (mapControl.isPickmap() && mainControl.isLockAllPickmaps() && !(event.getModifiers() == MouseEvent.BUTTON1_MASK && !event.isShiftDown() && !event.isControlDown())) { return; } - getMouseOperation(event).pressed(p); + getMouseOperation(event).pressed(mouseOpEvent); } /** {@inheritDoc} */ public void mouseReleased(final MouseEvent event) { - getMouseOperation(event).released(getMapLocation(event)); + getMouseOperation(event).released(mouseOpEvent); } /** @@ -121,8 +130,9 @@ * @param event MouseEvent to get mouse operation for * @return mouse operation for <var>event</var> */ - private MouseOperation getMouseOperation(final MouseEvent event) { - mod = event.getModifiers(); + private MouseOpListener getMouseOperation(final MouseEvent event) { + initEvent(event); + final int mod = event.getModifiers(); switch (event.getButton()) { case BUTTON1: return lmbOp; @@ -131,7 +141,6 @@ case BUTTON3: return (mod & SHIFT_MASK) == SHIFT_MASK ? mmbOp : rmbOp; // quickfix for michtoen default: // other mouse buttons are not supported yet, so there's nothing todo. - } if ((mod & BUTTON1_MASK) == BUTTON1_MASK) { return lmbOp; @@ -155,214 +164,4 @@ return renderer.getTileLocationAt(event.getPoint(), tmpPoint); } - /** MouseOperationAdapter. */ - public abstract class MouseOperationAdapter implements MouseOperation { - - /** {@inheritDoc} */ - public void clicked(final Point p) { - /* empty base implementation. */ - } - - /** {@inheritDoc} */ - public void dragged(final Point p) { - /* empty base implementation. */ - } - - /** {@inheritDoc} */ - public void moved(final Point p) { - /* empty base implementation. */ - } - - /** {@inheritDoc} */ - public void pressed(final Point p) { - /* empty base implementation. */ - } - - /** {@inheritDoc} */ - public void released(final Point p) { - if (mapCursor.isOnGrid(p)) { - if ((mod & SHIFT_MASK) != 0) { - if ((mod & CTRL_MASK) != 0) { - mapCursor.dragSelect(MapGrid.SelectionMode.ADD); - } else { - mapCursor.dragSelect(MapGrid.SelectionMode.SUB); - } - } else { - mapCursor.dragSelect(MapGrid.SelectionMode.FLIP); - } - } else { - mapCursor.dragRelease(); - } - } - - } // class MouseOperationAdapter - - /** Interface for Mouse Operations. */ - public interface MouseOperation { - - /** - * Mouse was clicked. - * @param p map coordinates of the click point - */ - void clicked(final Point p); - - /** - * Mouse was dragged. - * @param p map coordinates of the last drag point (implementor must take care himself of previous drag points or start drag point) - */ - void dragged(final Point p); - - /** - * Mouse was moved. - * @param p map coordinates of the last move point (implementor must take care himself of previous move points or start move point) - */ - void moved(final Point p); - - /** - * Mouse was pressed. - * @param p map coordinates of the press point - */ - void pressed(final Point p); - - /** - * Mouse was released. - * @param p map coordinates of the last release point - */ - void released(final Point p); - - } // interface MouseOperation - - /** MouseOperation for selection */ - public class SelectionMouseOperation extends MouseOperationAdapter { - - /** {@inheritDoc} */ - @Override public void pressed(final Point p) { - eventSelectTiles(p); - } - - /** {@inheritDoc} */ - @Override public void dragged(final Point p) { - relSelect(p); - } - - /** - * This method is invoked when the user decided to select a region. - * @param temp - */ - private void relSelect(final Point temp) { - mapCursor.dragTo(temp); - } - - /** - * Select tiles. - * @param mapLoc - */ - private void eventSelectTiles(final Point mapLoc) { - // left mouse button: select tiles - final boolean selChange = mapCursor.isActive(); - // Throw away old selection if CTRL is not pressed - if ((mod & CTRL_MASK) == 0) { - mapCursor.deactivate(); - } - mapCursor.setLocation(mapLoc); - mapCursor.dragStart(); - if (mapCursor.isActive() && renderer.isPickmap()) { - // an arch of a pickmap was selected - mainControl.showArchPanelQuickObject(mapControl.getMapModel().getMapSquare(mapLoc).getFirst()); - } - // Change edit menu if there was a selection before and has gone or the other way around - if (!(selChange == mapCursor.isActive())) { - mainControl.getMainView().refreshMenus(); - } - } - - } // class SelectionMouseOperation - - /** MouseOperation for insertion. */ - public class InsertionMouseOperation extends MouseOperationAdapter { - - /** {@inheritDoc} */ - @Override public void pressed(final Point p) { - if (p != null) { - if (mapControl.isPickmap()) { - // insert on pickmap - mapControl.insertMapArchToPickmap(p); - } else { - // insert on normal map - mapControl.insertSelArchToMap(p, true); - if (!mapCursor.setLocation(p)) { - // mapTileList has to be updated when arch war inserted without moving cursor - mainControl.getMainView().setMapTileList(mainControl.getCurrentMap(), null); - } - } - } - } - - - /** {@inheritDoc} */ - @Override public void dragged(final Point p) { - if (mapCursor.setLocationSafe(p)) { - mapControl.insertSelArchToMap(p, false); - } - } - } // Class InsertMouseOperation - - /** MouseOperation for deletion. */ - private class DeletionMouseOperation extends MapUserListener.MouseOperationAdapter { - - /** {@inheritDoc} */ - @Override public void pressed(final Point p) { - eventDeleteArch(p); - } - - /** {@inheritDoc} */ - @Override public void dragged(final Point p) { - relDeleteAbove(p); - } - - /** - * This method is invoked when the user wants to delete the topmost arch on the current tile. - * @param mapLoc position to delete topmost arch at - */ - private void relDeleteAbove(final Point mapLoc) { - if (mapCursor.setLocationSafe(mapLoc)) { - // delete the topmost arch (matching the view settings) on that square and redraw the map - deleteArch(mapLoc); - //mainControl.getMainView().setMapTileList(mainControl.getCurrentMap(), null); - } - } - - /** - * Delete an arch. - * @param mapLoc position to delete topmost arch at - */ - private void eventDeleteArch(final Point mapLoc) { - mapCursor.setLocationSafe(mapLoc); - if (mapLoc != null && mapCursor.isActive()) { - // delete the topmost arch (matching the view settings) on that square and redraw the map - deleteArch(mapLoc); - // update mapArch panel - mainControl.getMainView().setMapTileList(mainControl.getCurrentMap(), null); - } - } - - /** - * Delete an arch. - * @param mapLoc position to delete topmost arch at - */ - private void deleteArch(final Point mapLoc) { - ArchObject delArch = null; - for (final ArchObject searchArch : mapControl.getMapModel().getMapSquare(mapLoc).reverse()) { - if (mainControl.isTileEdit(searchArch)) { - delArch = searchArch; - break; - } - } - if (delArch != null) { - mapControl.deleteMapArch(delArch, mapLoc.x, mapLoc.y, false); - } - } - - } // class DeletionMouseOperation - } // class MapUserListener Modified: trunk/daimonin/src/daieditor/gui/map/MapViewSettings.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapViewSettings.java 2006-06-16 09:25:40 UTC (rev 157) +++ trunk/daimonin/src/daieditor/gui/map/MapViewSettings.java 2006-06-17 08:35:09 UTC (rev 158) @@ -22,6 +22,8 @@ package daieditor.gui.map; import daieditor.arch.match.ViewArchObjectMatcherManager; +import daieditor.gui.map.event.MapViewSettingsEvent; +import daieditor.gui.map.event.MapViewSettingsListener; import javax.swing.event.EventListenerList; /** Deleted: trunk/daimonin/src/daieditor/gui/map/MapViewSettingsEvent.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapViewSettingsEvent.java 2006-06-16 09:25:40 UTC (rev 157) +++ trunk/daimonin/src/daieditor/gui/map/MapViewSettingsEvent.java 2006-06-17 08:35:09 UTC (rev 158) @@ -1,46 +0,0 @@ -/* - * Daimonin Java Editor. - * Copyright (C) 2005 Christian Hujer - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - */ - -package daieditor.gui.map; - -import java.util.EventObject; - -/** - * Event Object encapsulating events on MapViewSettings. - * @author <a href="mailto:ch...@it...">Christian Hujer</a> - */ -public class MapViewSettingsEvent extends EventObject { - - /** - * Constructs a MapViewSettingsEvent. - * @param source The object (MapViewSettings) on which the Event initially occurred. - * @throws IllegalArgumentException if source is null. - */ - public MapViewSettingsEvent(final MapViewSettings source) { - super(source); - } - - /** {@inheritDoc} */ - @Override public MapViewSettings getSource() { - return (MapViewSettings) super.getSource(); - } - -} // class MapViewSettings Deleted: trunk/daimonin/src/daieditor/gui/map/MapViewSettingsListener.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapViewSettingsListener.java 2006-06-16 09:25:40 UTC (rev 157) +++ trunk/daimonin/src/daieditor/gui/map/MapViewSettingsListener.java 2006-06-17 08:35:09 UTC (rev 158) @@ -1,39 +0,0 @@ -/* - * Daimonin Java Editor. - * Copyright (C) 2005 Christian Hujer - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - */ - -package daieditor.gui.map; - -import java.util.EventListener; - -/** - * Interface for event listeners that are interested in changes on {@link MapViewSettings}. - * Usually you would implement this class in renderers for Maps. - * @author <a href="mailto:ch...@it...">Christian Hujer</a> - */ -public interface MapViewSettingsListener extends EventListener { - - /** - * This event handler is called when {@link MapViewSettings} have changed. - * @param e MapViewSettingsEvent - */ - void mapViewSettingsChanged(MapViewSettingsEvent e); - -} // interface MapViewSettingsListener Copied: trunk/daimonin/src/daieditor/gui/map/event/MapViewSettingsEvent.java (from rev 156, trunk/daimonin/src/daieditor/gui/map/MapViewSettingsEvent.java) =================================================================== --- trunk/daimonin/src/daieditor/gui/map/event/MapViewSettingsEvent.java (rev 0) +++ trunk/daimonin/src/daieditor/gui/map/event/MapViewSettingsEvent.java 2006-06-17 08:35:09 UTC (rev 158) @@ -0,0 +1,47 @@ +/* + * Daimonin Java Editor. + * Copyright (C) 2005 Christian Hujer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + */ + +package daieditor.gui.map.event; + +import java.util.EventObject; +import daieditor.gui.map.MapViewSettings; + +/** + * Event Object encapsulating events on MapViewSettings. + * @author <a href="mailto:ch...@it...">Christian Hujer</a> + */ +public class MapViewSettingsEvent extends EventObject { + + /** + * Constructs a MapViewSettingsEvent. + * @param source The object (MapViewSettings) on which the Event initially occurred. + * @throws IllegalArgumentException if source is null. + */ + public MapViewSettingsEvent(final MapViewSettings source) { + super(source); + } + + /** {@inheritDoc} */ + @Override public MapViewSettings getSource() { + return (MapViewSettings) super.getSource(); + } + +} // class MapViewSettings Property changes on: trunk/daimonin/src/daieditor/gui/map/event/MapViewSettingsEvent.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Copied: trunk/daimonin/src/daieditor/gui/map/event/MapViewSettingsListener.java (from rev 156, trunk/daimonin/src/daieditor/gui/map/MapViewSettingsListener.java) =================================================================== --- trunk/daimonin/src/daieditor/gui/map/event/MapViewSettingsListener.java (rev 0) +++ trunk/daimonin/src/daieditor/gui/map/event/MapViewSettingsListener.java 2006-06-17 08:35:09 UTC (rev 158) @@ -0,0 +1,40 @@ +/* + * Daimonin Java Editor. + * Copyright (C) 2005 Christian Hujer + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + */ + +package daieditor.gui.map.event; + +import java.util.EventListener; +import daieditor.gui.map.event.MapViewSettingsEvent; + +/** + * Interface for event listeners that are interested in changes on {@link daieditor.gui.map.MapViewSettings}. + * Usually you would implement this class in renderers for Maps. + * @author <a href="mailto:ch...@it...">Christian Hujer</a> + */ +public interface MapViewSettingsListener extends EventListener { + + /** + * This event handler is called when {@link daieditor.gui.map.MapViewSettings} have changed. + * @param e MapViewSettingsEvent + */ + void mapViewSettingsChanged(MapViewSettingsEvent e); + +} // interface MapViewSettingsListener Property changes on: trunk/daimonin/src/daieditor/gui/map/event/MapViewSettingsListener.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/daimonin/src/daieditor/gui/map/event/MouseOpAdapter.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/event/MouseOpAdapter.java (rev 0) +++ trunk/daimonin/src/daieditor/gui/map/event/MouseOpAdapter.java 2006-06-17 08:35:09 UTC (rev 158) @@ -0,0 +1,52 @@ +package daieditor.gui.map.event; + +import net.sf.gridarta.gui.map.MapCursor; +import net.sf.gridarta.gui.map.MapGrid; +import java.awt.event.InputEvent; + +/** + * Event Listener Adapater for {@link MouseOpListener}. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public abstract class MouseOpAdapter implements MouseOpListener { + + /** {@inheritDoc} */ + public void clicked(final MouseOpEvent e) { + /* empty base implementation. */ + } + + /** {@inheritDoc} */ + public void dragged(final MouseOpEvent e) { + /* empty base implementation. */ + } + + /** {@inheritDoc} */ + public void moved(final MouseOpEvent e) { + /* empty base implementation. */ + } + + /** {@inheritDoc} */ + public void pressed(final MouseOpEvent e) { + /* empty base implementation. */ + } + + /** {@inheritDoc} */ + public void released(final MouseOpEvent e) { + final MapCursor mapCursor = e.getMapCursor(); + final int modifiers = e.getModifiers(); + if (mapCursor.isOnGrid(e.getMapLocation())) { + if ((modifiers & InputEvent.SHIFT_MASK) != 0) { + if ((modifiers & InputEvent.CTRL_MASK) != 0) { + mapCursor.dragSelect(MapGrid.SelectionMode.ADD); + } else { + mapCursor.dragSelect(MapGrid.SelectionMode.SUB); + } + } else { + mapCursor.dragSelect(MapGrid.SelectionMode.FLIP); + } + } else { + mapCursor.dragRelease(); + } + } + +} // class MouseOpAdapter Property changes on: trunk/daimonin/src/daieditor/gui/map/event/MouseOpAdapter.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/daimonin/src/daieditor/gui/map/event/MouseOpEvent.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/event/MouseOpEvent.java (rev 0) +++ trunk/daimonin/src/daieditor/gui/map/event/MouseOpEvent.java 2006-06-17 08:35:09 UTC (rev 158) @@ -0,0 +1,108 @@ +package daieditor.gui.map.event; + +import java.awt.Point; +import java.util.EventObject; +import daieditor.map.MapModel; +import daieditor.map.MapControl; +import net.sf.gridarta.gui.map.MapCursor; + +/** + * A MouseOpEvent is an event triggered for a MouseOpListener. + * Note that MouseOpEvent objects may be reused. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public class MouseOpEvent extends EventObject { + + /** The cursor to use for this event. */ + private MapCursor mapCursor; + + /** The map control for this event. */ + private MapControl mapControl; + + /** The location of the point on the map model. */ + private Point mapLocation; + + /** + * The modifiers during this event. + * @see java.awt.event.MouseEvent#getModifiers() + */ + private int modifiers; + + /** + * The number of consecutive mouse clicks (only valid for click events). + */ + private int clickCount; + + /** Create an empty MouseOpEvent. */ + public MouseOpEvent() { + super(""); + } + + /** Create a MouseOpEvent. + * @param source The object on which the Event initially occurred + * @param mapCursor The map cursor to control cursor and selection + * @param mapLocation The location of the point on the map model + * @param modifiers The event modifiers (keys like shift or ctrl being pressed while this event was triggered) + * @param clickCount The number of consecutive mouse clicks (only valid for click events) + * @see java.awt.event.MouseEvent#getModifiers() + */ + public MouseOpEvent(final MapModel source, final MapCursor mapCursor, final Point mapLocation, final int modifiers, final int clickCount) { + super(source); + this.mapCursor = mapCursor; + this.mapLocation = mapLocation; + this.modifiers = modifiers; + this.clickCount = clickCount; + } + + /** Create a MouseOpEvent. + * @param source The object on which the Event initially occurred + * @param mapCursor The map cursor to control cursor and selection + * @param mapLocation The location of the point on the map model + * @param modifiers The event modifiers (keys like shift or ctrl being pressed while this event was triggered) + * @see java.awt.event.MouseEvent#getModifiers() + */ + public MouseOpEvent(final MapModel source, final MapCursor mapCursor, final Point mapLocation, final int modifiers) { + this(source, mapCursor, mapLocation, modifiers, 0); + } + + public Point getMapLocation() { + return mapLocation; + } + + public int getModifiers() { + return modifiers; + } + + public MapCursor getMapCursor() { + return mapCursor; + } + + public int getClickCount() { + return clickCount; + } + + public void setMapCursor(MapCursor mapCursor) { + this.mapCursor = mapCursor; + } + + public void setMapLocation(Point mapLocation) { + this.mapLocation = mapLocation; + } + + public void setModifiers(int modifiers) { + this.modifiers = modifiers; + } + + public void setClickCount(int clickCount) { + this.clickCount = clickCount; + } + + public MapControl getMapControl() { + return mapControl; + } + + public void setMapControl(MapControl mapControl) { + this.mapControl = mapControl; + } + +} // class MouseOpEvent Property changes on: trunk/daimonin/src/daieditor/gui/map/event/MouseOpEvent.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/daimonin/src/daieditor/gui/map/event/MouseOpListener.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/event/MouseOpListener.java (rev 0) +++ trunk/daimonin/src/daieditor/gui/map/event/MouseOpListener.java 2006-06-17 08:35:09 UTC (rev 158) @@ -0,0 +1,33 @@ +package daieditor.gui.map.event; + +import daieditor.gui.map.event.MouseOpEvent; + +/** Interface for Mouse Operations. */ +public interface MouseOpListener { + + /** + * Mouse was clicked. + */ + void clicked(MouseOpEvent e); + + /** + * Mouse was dragged. + */ + void dragged(MouseOpEvent e); + + /** + * Mouse was moved. + */ + void moved(MouseOpEvent e); + + /** + * Mouse was pressed. + */ + void pressed(MouseOpEvent e); + + /** + * Mouse was released. + */ + void released(MouseOpEvent e); + +} // interface MouseOpListener Property changes on: trunk/daimonin/src/daieditor/gui/map/event/MouseOpListener.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/daimonin/src/daieditor/gui/map/event/package.html =================================================================== --- trunk/daimonin/src/daieditor/gui/map/event/package.html (rev 0) +++ trunk/daimonin/src/daieditor/gui/map/event/package.html 2006-06-17 08:35:09 UTC (rev 158) @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de"> + <head> + <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> + <title></title> + </head> + <body> + <p> + The package <code>daieditor.gui.map.event</code> handles classes and interfaces that occur in the context of displaying and manipulating maps. + </p> + </body> +</html> Property changes on: trunk/daimonin/src/daieditor/gui/map/event/package.html ___________________________________________________________________ Name: svn:mime-type + text/html Name: svn:eol-style + LF Added: trunk/daimonin/src/daieditor/gui/map/tools/AbstractTool.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/tools/AbstractTool.java (rev 0) +++ trunk/daimonin/src/daieditor/gui/map/tools/AbstractTool.java 2006-06-17 08:35:09 UTC (rev 158) @@ -0,0 +1,16 @@ +package daieditor.gui.map.tools; + +import daieditor.gui.map.event.MouseOpAdapter; + +/** + * Base class for tools. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +@SuppressWarnings({"AbstractClassWithOnlyOneDirectInheritor"}) +public abstract class AbstractTool extends MouseOpAdapter implements Tool { + + /** Create an AbstractTool. */ + protected AbstractTool() { + } + +} // class AbstractTool Property changes on: trunk/daimonin/src/daieditor/gui/map/tools/AbstractTool.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/daimonin/src/daieditor/gui/map/tools/BasicAbstractTool.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/tools/BasicAbstractTool.java (rev 0) +++ trunk/daimonin/src/daieditor/gui/map/tools/BasicAbstractTool.java 2006-06-17 08:35:09 UTC (rev 158) @@ -0,0 +1,50 @@ +package daieditor.gui.map.tools; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.NonNls; +import javax.swing.Action; +import java.awt.Component; +import net.sf.japi.swing.ActionFactory; + +/** + * Base class for the default provided tools. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +class BasicAbstractTool extends AbstractTool { + + /** Action Factory. */ + private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("daieditor.gui.map.tools"); + + /** The ID of this tool. */ + @SuppressWarnings({"InstanceVariableNamingConvention"}) + @NonNls private final String id; + + /** The Action for choosing this tool. */ + private final Action chooseAction; + + /** + * Create a BasicAbstractTool. + * @param id ID (used for {@link #getId()} as well as for the ActionFactory) + */ + protected BasicAbstractTool(final String id) { + this.id = id; + chooseAction = ACTION_FACTORY.createAction(false, id); + } + + /** {@inheritDoc} */ + @NotNull public Action getChooseAction() { + return chooseAction; + } + + /** {@inheritDoc} */ + @Nullable public Component createOptionsView() { + return null; + } + + /** {@inheritDoc} */ + public String getId() { + return id; + } + +} // class BasicAbstractTool Property changes on: trunk/daimonin/src/daieditor/gui/map/tools/BasicAbstractTool.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/daimonin/src/daieditor/gui/map/tools/DeletionTool.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/tools/DeletionTool.java (rev 0) +++ trunk/daimonin/src/daieditor/gui/map/tools/DeletionTool.java 2006-06-17 08:35:09 UTC (rev 158) @@ -0,0 +1,62 @@ +package daieditor.gui.map.tools; + +import daieditor.CMainControl; +import daieditor.arch.ArchObject; +import daieditor.gui.map.event.MouseOpEvent; +import daieditor.map.MapControl; +import java.awt.Point; +import net.sf.gridarta.gui.map.MapCursor; + +/** MouseOpListener for deletion. */ +public class DeletionTool extends BasicAbstractTool { + + /** Create a DeletionTool. */ + public DeletionTool() { + super("deletion"); + } + + /** {@inheritDoc} */ + @Override public void pressed(final MouseOpEvent e) { + final Point mapLoc = e.getMapLocation(); + final MapCursor mapCursor = e.getMapCursor(); + final MapControl mapControl = e.getMapControl(); + mapCursor.setLocationSafe(mapLoc); + if (mapLoc != null && mapCursor.isActive()) { + // delete the topmost arch (matching the view settings) on that square and redraw the map + deleteArch(mapLoc, mapControl); + // update mapArch panel + CMainControl.getInstance().getMainView().setMapTileList(CMainControl.getInstance().getCurrentMap(), null); + } + } + + /** {@inheritDoc} */ + @Override public void dragged(final MouseOpEvent e) { + final Point mapLoc = e.getMapLocation(); + final MapCursor mapCursor = e.getMapCursor(); + final MapControl mapControl = e.getMapControl(); + if (mapCursor.setLocationSafe(mapLoc)) { + // delete the topmost arch (matching the view settings) on that square and redraw the map + deleteArch(mapLoc, mapControl); + //mainControl.getMainView().setMapTileList(mainControl.getCurrentMap(), null); + } + } + + /** + * Delete an arch. + * @param mapLoc position to delete topmost arch at + * @param mapControl map control of map to delete arch from + */ + private static void deleteArch(final Point mapLoc, final MapControl mapControl) { + ArchObject delArch = null; + for (final ArchObject searchArch : mapControl.getMapModel().getMapSquare(mapLoc).reverse()) { + if (CMainControl.getInstance().isTileEdit(searchArch)) { + delArch = searchArch; + break; + } + } + if (delArch != null) { + mapControl.deleteMapArch(delArch, mapLoc.x, mapLoc.y, false); + } + } + +} // class DeletionTool Property changes on: trunk/daimonin/src/daieditor/gui/map/tools/DeletionTool.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/daimonin/src/daieditor/gui/map/tools/InsertionTool.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/tools/InsertionTool.java (rev 0) +++ trunk/daimonin/src/daieditor/gui/map/tools/InsertionTool.java 2006-06-17 08:35:09 UTC (rev 158) @@ -0,0 +1,49 @@ +package daieditor.gui.map.tools; + +import daieditor.CMainControl; +import daieditor.gui.map.event.MouseOpEvent; +import daieditor.map.MapControl; +import java.awt.Point; +import net.sf.gridarta.gui.map.MapCursor; + +/** MouseOpListener for insertion. */ +public class InsertionTool extends BasicAbstractTool { + + /** + * Create a BasicAbstractTool. + */ + public InsertionTool() { + super("insertion"); + } + + /** {@inheritDoc} */ + @Override public void pressed(final MouseOpEvent e) { + final Point p = e.getMapLocation(); + final MapCursor mapCursor = e.getMapCursor(); + final MapControl mapControl = e.getMapControl(); + if (p != null) { + if (mapControl.isPickmap()) { + // insert on pickmap + mapControl.insertMapArchToPickmap(p); + } else { + // insert on normal map + mapControl.insertSelArchToMap(p, true); + if (!mapCursor.setLocation(p)) { + // mapTileList has to be updated when arch war inserted without moving cursor + CMainControl.getInstance().getMainView().setMapTileList(CMainControl.getInstance().getCurrentMap(), null); + } + } + } + } + + /** {@inheritDoc} */ + @Override public void dragged(final MouseOpEvent e) { + final Point p = e.getMapLocation(); + final MapCursor mapCursor = e.getMapCursor(); + final MapControl mapControl = e.getMapControl(); + if (mapCursor.setLocationSafe(p)) { + mapControl.insertSelArchToMap(p, false); + } + } + +} // Class InsertMouseOperation Property changes on: trunk/daimonin/src/daieditor/gui/map/tools/InsertionTool.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/daimonin/src/daieditor/gui/map/tools/SelectionTool.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/tools/SelectionTool.java (rev 0) +++ trunk/daimonin/src/daieditor/gui/map/tools/SelectionTool.java 2006-06-17 08:35:09 UTC (rev 158) @@ -0,0 +1,49 @@ +package daieditor.gui.map.tools; + +import daieditor.CMainControl; +import daieditor.gui.map.event.MouseOpEvent; +import daieditor.map.MapControl; +import java.awt.Point; +import java.awt.event.InputEvent; +import net.sf.gridarta.gui.map.MapCursor; + +/** MouseOpListener for selection */ +public class SelectionTool extends BasicAbstractTool { + + /** + * Create a BasicAbstractTool. + */ + public SelectionTool() { + super("selection"); + } + + /** {@inheritDoc} */ + @Override public void pressed(final MouseOpEvent e) { + final Point mapLoc = e.getMapLocation(); + final int mod = e.getModifiers(); + final MapCursor mapCursor = e.getMapCursor(); + final MapControl mapControl = e.getMapControl(); + // left mouse button: select tiles + final boolean selChange = mapCursor.isActive(); + // Throw away old selection if CTRL is not pressed + if ((mod & InputEvent.CTRL_MASK) == 0) { + mapCursor.deactivate(); + } + mapCursor.setLocation(mapLoc); + mapCursor.dragStart(); + if (mapCursor.isActive() && mapControl.isPickmap()) { + // an arch of a pickmap was selected + CMainControl.getInstance().showArchPanelQuickObject(mapControl.getMapModel().getMapSquare(mapLoc).getFirst()); + } + // Change edit menu if there was a selection before and has gone or the other way around + if (!(selChange == mapCursor.isActive())) { + CMainControl.getInstance().getMainView().refreshMenus(); + } + } + + /** {@inheritDoc} */ + @Override public void dragged(final MouseOpEvent e) { + e.getMapCursor().dragTo(e.getMapLocation()); + } + +} // class SelectionTool Property changes on: trunk/daimonin/src/daieditor/gui/map/tools/SelectionTool.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/daimonin/src/daieditor/gui/map/tools/Tool.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/tools/Tool.java (rev 0) +++ trunk/daimonin/src/daieditor/gui/map/tools/Tool.java 2006-06-17 08:35:09 UTC (rev 158) @@ -0,0 +1,33 @@ +package daieditor.gui.map.tools; + +import javax.swing.Action; +import java.awt.Component; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Interface for tools that are used to manipulate maps. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public interface Tool { + + /** + * Get the action for choosing this tool. + * @return action for choosing this tool or <code>null</code> if this tool cannot be chosen + */ + @NotNull Action getChooseAction(); + + /** + * Create a view for changing the options of this tool + * @return view for changing the options of this tool or <code>null</code> if this tool hasn't any options + */ + @Nullable Component createOptionsView(); + + /** + * Get the id of this tool. + * Each tool needs a unique id which distinguishes this tool from other tools. + * @return id of this tool + */ + String getId(); + +} // interface Tool Property changes on: trunk/daimonin/src/daieditor/gui/map/tools/Tool.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/daimonin/src/daieditor/gui/map/tools/ToolSelector.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/tools/ToolSelector.java (rev 0) +++ trunk/daimonin/src/daieditor/gui/map/tools/ToolSelector.java 2006-06-17 08:35:09 UTC (rev 158) @@ -0,0 +1,139 @@ +package daieditor.gui.map.tools; + +import javax.swing.JPanel; +import javax.swing.Action; +import javax.swing.JToggleButton; +import javax.swing.AbstractAction; +import javax.swing.JFrame; +import javax.swing.ButtonGroup; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.FlowLayout; +import java.awt.CardLayout; +import java.awt.event.ActionEvent; +import java.util.HashMap; +import java.util.Map; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.NotNull; + +/** + * User interface for selecting a tool and displaying its options. + * Note: A ToolSelector automatically has always at least one Tool, the VoidTool. + */ +public final class ToolSelector extends JPanel { + + /** The pane with the selections. */ + @NotNull private final JPanel selectionPane = new JPanel(new FlowLayout()); + + /** The CardLayout for the pane that shows a tool's options. */ + @NotNull private final CardLayout optionCards = new CardLayout(); + + /** The ButtonGroup for the toggle buttons. */ + @NotNull private final ButtonGroup selectionButtonGroup = new ButtonGroup(); + + /** The pane with the options of a tool. */ + @NotNull private final JPanel optionsPane = new JPanel(optionCards); + + /** The options views of the registered tools. */ + @NotNull private final Map<Tool, Component> optionViews = new HashMap<Tool, Component>(); + + /** The currently selected tool. */ + @NotNull private Tool selectedTool; + + /** Create a ToolSelector component. */ + public ToolSelector() { + createUI(); + final Tool voidTool = new VoidTool(); + selectedTool = voidTool; + add(voidTool); + setSelectedTool(voidTool); + } + + /** Create the user interface elements of the ToolSelector. */ + private void createUI() { + setLayout(new BorderLayout()); + add(selectionPane, BorderLayout.NORTH); + add(optionsPane, BorderLayout.CENTER); + } + + /** + * Add a tool to this tool selector. + * @param tool Tool to add + */ + @SuppressWarnings({"MethodOverloadsMethodOfSuperclass"}) + public void add(@NotNull final Tool tool) { + @NotNull final Action selectionAction = new SelectionAction(tool); + @NotNull final JToggleButton toggleButton = new JToggleButton(selectionAction); + @NotNull final Component optionsView = createOptionsView(tool); + optionViews.put(tool, optionsView); + selectionButtonGroup.add(toggleButton); + selectionPane.add(toggleButton); + optionsPane.add(optionsView, tool.getId()); + } + + /** + * Create the options view for a tool. + * This method is a delegate to {@link Tool#createOptionsView()} but will provide a fallback if the tool doesn't provide tweaking its options. + * @param tool Tool to create options view for + * @return options view (the tool's options view or a dummy fallback if the tool doesn't provide an options view) + */ + @NotNull private static Component createOptionsView(@NotNull final Tool tool) { + @Nullable final Component optionsView = tool.createOptionsView(); + return optionsView != null ? optionsView : new JPanel(); + } + + /** + * Make a tool the currently selected tool to edit its options. + * @pre the tool must be controlled by this toolselector. + * @param tool Tool to select + */ + public void setSelectedTool(@NotNull final Tool tool) { + selectedTool = tool; + optionCards.show(optionsPane, tool.getId()); + } + + /** + * Get the tool that is currently selected. + * @return the currently selected tool. + */ + @NotNull public Tool getSelectedTool() { + return selectedTool; + } + + /** + * Action for selecting a tool. + */ + private final class SelectionAction extends AbstractAction { + + /** The tool to select with this action. */ + @NotNull private final Tool tool; + + /** + * Create a SelectionAction + * @param tool Tool to select with this action + */ + SelectionAction(@NotNull final Tool tool) { + this.tool = tool; + @NotNull final Action chooseAction = tool.getChooseAction(); + putValue(NAME, chooseAction.getValue(NAME)); + } + + /** {@inheritDoc} */ + public void actionPerformed(@NotNull final ActionEvent actionEvent) { + setSelectedTool(tool); + } + + } // class SelectionAction + + public static void main(final String[] args) { + final JFrame frame = new JFrame(); + final ToolSelector selector = new ToolSelector(); + selector.add(new DeletionTool()); + selector.add(new InsertionTool()); + selector.add(new SelectionTool()); + frame.add(selector, BorderLayout.EAST); + frame.setVisible(true); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + } + +} // class ToolSelector Property changes on: trunk/daimonin/src/daieditor/gui/map/tools/ToolSelector.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/daimonin/src/daieditor/gui/map/tools/VoidTool.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/tools/VoidTool.java (rev 0) +++ trunk/daimonin/src/daieditor/gui/map/tools/VoidTool.java 2006-06-17 08:35:09 UTC (rev 158) @@ -0,0 +1,16 @@ +package daieditor.gui.map.tools; + +/** + * The VoidTool is a tool that does nothing. + * It's used as a fallback dummy tool in case no other tool is active. + */ +public class VoidTool extends BasicAbstractTool { + + /** + * Create a BasicAbstractTool. + */ + public VoidTool() { + super("void"); + } + +} // class VoidTool Property changes on: trunk/daimonin/src/daieditor/gui/map/tools/VoidTool.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/daimonin/src/daieditor/gui/map/tools/action.properties =================================================================== --- trunk/daimonin/src/daieditor/gui/map/tools/action.properties (rev 0) +++ trunk/daimonin/src/daieditor/gui/map/tools/action.properties 2006-06-17 08:35:09 UTC (rev 158) @@ -0,0 +1,4 @@ +selection.text=SEL +deletion.text=DEL +insertion.text=INS +void.text=VOID \ No newline at end of file Property changes on: trunk/daimonin/src/daieditor/gui/map/tools/action.properties ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/daimonin/src/daieditor/gui/map/tools/package.html =================================================================== --- trunk/daimonin/src/daieditor/gui/map/tools/package.html (rev 0) +++ trunk/daimonin/src/daieditor/gui/map/tools/package.html 2006-06-17 08:35:09 UTC (rev 158) @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de"> + <head> + <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> + <title></title> + </head> + <body> + <p> + The package <code>daieditor.gui.map.tools</code> handles tools for manipulating maps. + Examples for such tools are Selection, Deletion and Insertion. + </p> + </body> +</html> Property changes on: trunk/daimonin/src/daieditor/gui/map/tools/package.html ___________________________________________________________________ Name: svn:mime-type + text/html Name: svn:eol-style + LF Modified: trunk/daimonin/src/daieditor/map/DefaultMapModel.java =================================================================== --- trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-06-16 09:25:40 UTC (rev 157) +++ trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-06-17 08:35:09 UTC (rev 158) @@ -218,15 +218,15 @@ return mapSize; } - // this sucker test for map fit. Multi tiles can't be set if going out of borders - public boolean isArchFittingToMap(final String archname, final Point pos, final int intern) { + /** {@inheritDoc} */ + public boolean isMultiArchFittingToMap(final String archname, final Point pos, final boolean allowDouble) { final ArchObject head = mainControl.getArchObjectStack().getArch(archname); final Point mapH = new Point(head.getMultiRefX(), head.getMultiRefY()); mapH.translate(pos.x, pos.y); if (mapH.x < 0 || mapH.y < 0 || mapH.x >= mapSize.width || mapH.y >= mapSize.height) { return false; } - for (ArchObject tail : head.getTailList()) { + for (final ArchObject tail : head.getTailList()) { final Point mapT = new Point(tail.getMultiRefX(), tail.getMultiRefY()); mapT.translate(pos.x, pos.y); // outside map @@ -234,8 +234,8 @@ return false; } - if (intern != -1) { - for (ArchObject node : mapGrid[mapT.x][mapT.y]) { + if (!allowDouble) { + for (final ArchObject node : mapGrid[mapT.x][mapT.y]) { if (node.getArchName().equals(tail.getArchName())) { return false; } @@ -245,22 +245,12 @@ return true; } - /** - * Add a new arch to the map. Including multi tile arches. This function - * allows only to choose from the default arches (->archname). - * @param archname ID from a default arch on the ArchObjectStack - * @param pos insert-location on this map - * @param intern if NOT '-1': only one arch of the same kind can be - * inserted per square - * @param insertBelow true: new arch is inserted on top, false: new arch is - * inserted below - * @return true if insertion successful, false if not - */ - public boolean addArchToMap(final String archname, final Point pos, final int intern, final boolean insertBelow) { + /** {@inheritDoc} */ + public boolean addArchToMap(final String archname, final Point pos, final boolean allowDouble, final boolean insertBelow) { if (archname == null || archname.length() == 0 || pos.x == -1 || pos.y == -1 || pos.x >= mapSize.width || pos.y >= mapSize.height) { return false; } - if (!isArchFittingToMap(archname, pos, intern)) { + if (!isMultiArchFittingToMap(archname, pos, allowDouble)) { return false; } @@ -303,21 +293,7 @@ } /** - * Insert a new arch to the map at a specified position. This function - * allows either to choose from the default arches (->archnr) or to insert - * a copy from an existing arch (->newarch). It also works for - * container-inventory. - * @param newarch A clone copy of this ArchObject gets inserted to the map. - * It can be an arch directly from a pickmap or even a - * default arch. if ('newarch'==null) the default arch of - * number 'archnr' gets inserted - * @param archname ID from a default arch to get inserted. This value gets - * used ONLY when 'newarch' is null - * @param next the new arch gets inserted before 'next' if - * ('next'==null) the arch gets inserted at bottom - * -> 'next' must be an arch from the map! (or null) - * @param pos map position to insert the new arch - * @return true if insertion was successful + * {@inheritDoc} * @xxx I'm too complex */ public boolean insertArchToMap(ArchObject newarch, String archname, final ArchObject next, final Point pos) { @@ -335,7 +311,7 @@ archname = newarch.getArchName(); } // insert a new instance of the default arch (number 'archnr') - if (mapControl.addArchToMap(archname, pos, -1)) { + if (mapControl.addArchToMap(archname, pos, true)) { return false; } } else { Modified: trunk/daimonin/src/daieditor/map/MapControl.java =================================================================== --- trunk/daimonin/src/daieditor/map/MapControl.java 2006-06-16 09:25:40 UTC (rev 157) +++ trunk/daimonin/src/daieditor/map/MapControl.java 2006-06-17 08:35:09 UTC (rev 158) @@ -110,8 +110,6 @@ */ private boolean isPickmap; - private final int drawInternCount = 0; - /** * Each view of this map will get a unique number. */ @@ -208,15 +206,15 @@ return levelClosing; } - public boolean addArchToMap(final String archname, final Point pos, final int intern, final boolean insertBelow) { - return mapModel.addArchToMap(archname, pos, intern, insertBelow); + public boolean addArchToMap(final String archname, final Point pos, final boolean allowDouble, final boolean insertBelow) { + return mapModel.addArch... [truncated message content] |
From: <der...@us...> - 2006-06-16 09:25:45
|
Revision: 157 Author: derdanny Date: 2006-06-16 02:25:40 -0700 (Fri, 16 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=157&view=rev Log Message: ----------- Fixed placement of small tile images. Modified Paths: -------------- trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java Modified: trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java 2006-06-14 23:06:26 UTC (rev 156) +++ trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java 2006-06-16 09:25:40 UTC (rev 157) @@ -331,10 +331,7 @@ if (mainControl.isTileEdit(node) || isPickmap) { final ImageIcon img = "trans.101".equals(node.getFaceObjName()) ? unknownTileIcon : mainControl.isAlphaType(node.getEditType()) ? node.getTransparentImage() : node.getNormalImage(); - int yoff = 0; - if (img.getIconHeight() > IGUIConstants.TILE_ISO_YLEN) { - yoff = img.getIconHeight() - IGUIConstants.TILE_ISO_YLEN; - } + final int yoff = img.getIconHeight() - IGUIConstants.TILE_ISO_YLEN; if (node.isMulti() && node.getMultiRefCount() > 0) { // multipart images have to be painted with correct offset // TODO: This should be improved, especially regarding multi arch mobs inside spawn points. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-06-14 23:06:49
|
Revision: 156 Author: akirschbaum Date: 2006-06-14 16:06:26 -0700 (Wed, 14 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=156&view=rev Log Message: ----------- Unify comments and whitespace. Modified Paths: -------------- trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java trunk/crossfire/src/cfeditor/arch/anim/AnimationObjects.java trunk/crossfire/src/cfeditor/map/DefaultMapModel.java trunk/crossfire/src/cfeditor/map/MapArchObject.java trunk/crossfire/src/cfeditor/map/MapControl.java trunk/daimonin/src/daieditor/arch/ArchObjectParser.java trunk/daimonin/src/daieditor/arch/ArchObjectStack.java trunk/daimonin/src/daieditor/arch/anim/AnimationObject.java trunk/daimonin/src/daieditor/arch/anim/AnimationObjects.java trunk/daimonin/src/daieditor/map/DefaultMapModel.java trunk/daimonin/src/daieditor/map/MapArchObject.java trunk/daimonin/src/daieditor/map/MapControl.java Modified: trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java 2006-06-14 23:05:21 UTC (rev 155) +++ trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java 2006-06-14 23:06:26 UTC (rev 156) @@ -46,13 +46,16 @@ import org.jetbrains.annotations.Nullable; /** - * The <code>ArchObjectParser</code> class handles the parsing of arches. + * The <code>ArchObjectParser</code> class handles the parsing of arches. It is + * a class separated from ArchObjectStack 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> */ public final class ArchObjectParser { + /** Logger. */ private static final Logger LOG = Logger.getLogger(ArchObjectParser.class); // name of the system-arch containing path of starting map @@ -151,7 +154,7 @@ } /** - * Read a default arch from a file + * Read a default arch from a file. * @param fname filename of the arch definition file (*.arc) * @param index current subdirectory-index on the ArchPanel (-> ComboBoxes) */ @@ -502,7 +505,7 @@ } } - // default arches don't get an edit_type (not worth the time) + // default arches don't get an editType (not worth the time) // they get one assigned as soon as put on a map though. arch.setEditType(IGUIConstants.TILE_EDIT_NONE); } @@ -588,7 +591,7 @@ arch.addArchText("mina\n"); } - // Finally, we calculate the desired edit_type of the arch + // Finally, we calculate the desired editType of the arch if (arch.getRefFlag() && arch.getMapMultiHead() != null) { arch.setEditType(arch.getMapMultiHead().getEditType()); // copy from head } else if (editType != 0) { @@ -730,12 +733,12 @@ /** * Calculate the lowest part of this multi-arch. This lowest part is needed - * because in ISO view, the big image is drawn for it's lowest part, in order - * to get the overlappings correct. + * because in ISO view, the big image is drawn for it's lowest part, in + * order to get the overlappings correct. * <p/> - * (TODO: This method is called repeatedly for each multipart. It would be - * better if it was called only once per multipart.) * @param arch last tail part of this multi + * @todo This method is called repeatedly for each multipart. It would be + * better if it was called only once per multipart. */ private void calcLowestMulti(final ArchObject arch) { ArchObject tmp = arch; Modified: trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java 2006-06-14 23:05:21 UTC (rev 155) +++ trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java 2006-06-14 23:06:26 UTC (rev 156) @@ -105,6 +105,10 @@ private int folderLevel; + /** + * Create the ArchObject stack. + * @param mainControl reference to CMainControl + */ public ArchObjectStack(final CMainControl mainControl) { this.mainControl = mainControl; archNodeListCount = 0; @@ -207,7 +211,13 @@ return arch; } - // add a arch to our list + /** + * Adds an ArchObject to the stack. + * Only invoke this method if the ArchObject is a default arch. + * Do not invoke this method on map arches. + * @param data ArchObject with DefaultArch to add + * @todo check whether the ArchObject is a default arch and reject no default arches with an exception + */ public void addArchToList(final ArchObject data) { final ArchObjectNode newnode = new ArchObjectNode(data); newnode.arch.setNodeNr(archNodeListCount); @@ -295,8 +305,8 @@ } /** - * this method loads the arches & faces recursively by - * looping through the arch folder, collecting all the trash + * This method loads the arches & faces recursively by looping through + * the arch folder, collecting all the trash. * @param f file path where we currently are * @param index counter for arches */ @@ -318,7 +328,6 @@ } folderLevel++; - final String[] children = f.list(); for (int i = 0; i < children.length; i++) { loadArchFromFiles(new File(f, children[i]), index); @@ -351,8 +360,8 @@ } /** - * Parsing face files (*.face). I think such files are no - * longer used and so is this code. + * Parsing face files (*.face). I think such files are no longer used and + * so is this code. * @param fname filename */ private void parseDefFace(final String fname) { @@ -542,8 +551,8 @@ } /** - * Load a png from the file, convert it to IconImage - * and attach it to the facelist. + * Load a png from the file, convert it to IconImage and attach it to the + * facelist. * @param fname filename, absolute path * @param name name of the png (e.g. blocked.111.png) */ @@ -602,19 +611,18 @@ } /** - * Wrapper method for arch collecting. Either CF or Daimonin method for - * collecting arches is chosen here. + * Wrapper method for arch collecting. Either Crossfire or Daimonin method + * for collecting arches is chosen here. */ public void collectArches() { collectCFArches(); } /** - * Collect the existing arches and create archive-files for editor use - * as well as the CF server. The arches also get a special path variable - * included which is used in the editor to cathegorize the arches. - * <p/> - * Output is: "archetypes", "crossfire.png" + * Collect the existing arches and create archive-files for editor use as + * well as the Crossfire server. The arches also get a special path + * variable included which is used in the editor to cathegorize the arches. + * <p/> Output is: "archetypes", "crossfire.png" */ private void collectCFArches() { CMainStatusbar.getInstance().setText("Collect Archfile: write archetypes"); Modified: trunk/crossfire/src/cfeditor/arch/anim/AnimationObjects.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/anim/AnimationObjects.java 2006-06-14 23:05:21 UTC (rev 155) +++ trunk/crossfire/src/cfeditor/arch/anim/AnimationObjects.java 2006-06-14 23:06:26 UTC (rev 156) @@ -33,7 +33,8 @@ /** * The <code>AnimationObject</code>. * <p/> - * WARNING: This class uses two indexes which are independent of each other: index of animation object and index of animation name. + * WARNING: This class uses two indexes which are independent of each other: + * index of animation object and index of animation name. * @author <a href="mailto:mic...@no...">Michael Toennies</a> */ public class AnimationObjects implements Iterable<AnimationObject> { Modified: trunk/crossfire/src/cfeditor/map/DefaultMapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-06-14 23:05:21 UTC (rev 155) +++ trunk/crossfire/src/cfeditor/map/DefaultMapModel.java 2006-06-14 23:06:26 UTC (rev 156) @@ -65,10 +65,10 @@ /** Flag that indicates if the level has been changed since last save. */ private boolean m_fLevelChanged = false; - /** The main controller. Is never null. */ + /** CMainControl. */ private final CMainControl mainControl; - /** The controller of this view. Is never null. */ + /** MapControl. */ private final MapControl mapControl; /** @@ -193,14 +193,14 @@ /** * Returns the height of the level. - * @return The height of the level. + * @return the height of the level */ @Deprecated public int getMapHeight() { return mapSize.height; } /** Return the map size of this level. - * @return Map size of this level. + * @return map size of this level */ public Dimension getMapSize() { return mapSize; @@ -536,16 +536,17 @@ * allows either to choose from the default arches (->archnr) or to insert * a copy from an existing arch (->newarch). It also works for * container-inventory. - * @param newarch A clone copy of this ArchObject gets inserted to the map. - * It can be an arch directly from a pickmap or even a default arch. if - * ('newarch'==null) the default arch of number 'archnr' gets inserted - * @param archnr ID from a default arch to get inserted. This value gets - * used ONLY when 'newarch' is null - * @param next the new arch gets inserted before 'next' if ('next'==null) - * the arch gets inserted at bottom -> 'next' must be an arch from the map! - * (or null) - * @param pos map position to insert the new arch - * @param join if set to JOIN_ENABLE auto-joining is supported + * @param newarch A clone copy of this ArchObject gets inserted to the map. + * It can be an arch directly from a pickmap or even a + * default arch. if ('newarch'==null) the default arch of + * number 'archnr' gets inserted + * @param archnr ID from a default arch to get inserted. This value gets + * used ONLY when 'newarch' is null + * @param next the new arch gets inserted before 'next' if + * ('next'==null) the arch gets inserted at bottom + * -> 'next' must be an arch from the map! (or null) + * @param pos map position to insert the new arch + * @param join if set to JOIN_ENABLE auto-joining is supported * @return true if insertion was successful */ public boolean insertArchToMap(ArchObject newarch, int archnr, final ArchObject next, final Point pos, final boolean join) { @@ -623,8 +624,8 @@ * Link an existing arch to the map. Including multi tile arches. This * function allows to insert any given arch (can be non-default). Make sure * that the given 'arch' is a new and unlinked object. - * @param arch the new arch to be linked onto the map. (Dest. coordinates - * must be set (arch.mapx/y)!) + * @param arch the new arch to be linked onto the map. (Dest. + * coordinates must be set (arch.mapx/y)!) * @param insert_below true: new arch is inserted on top, false: new arch * is inserted below */ @@ -695,7 +696,7 @@ } /** * Get the arch from the map with the specified 'id', at location pos. - * @param pos Location of ArchObject. + * @param pos Location of ArchObject * @param id ID number of arch (-> <code>arch.getMyID()</code>) * @return the specified arch, or null if not found */ @@ -760,7 +761,7 @@ * inventory.) * @param id ID of the arch to be removed (->arch.getMyID()) * @param pos location of the arch to be removed - * @param refresh_map If true, mapview is redrawn after deletion. keep in + * @param refresh_map If true, mapview is redrawn after deletion. Keep in * mind: drawing consumes time! * @param join if set to JOIN_ENABLE auto-joining is supported */ @@ -942,7 +943,7 @@ /** * Check whether the given coordinate is within map bounds. - * @param pos the coordinates to check. + * @param pos the coordinates to check * @return true=the given coordinates are within map bounds */ public boolean pointValid(final Point pos) { @@ -989,9 +990,10 @@ @Deprecated public boolean checkResizeMap(final int newWidth, final int newHeight) { return checkResizeMap(new Dimension(newWidth, newHeight)); } + /** * Check if objects get cut off if the map was resized to the given bounds. - * @param newSize the new level size. + * @param newSize the new level size * @return true if objects would be cut off */ public boolean checkResizeMap(final Dimension newSize) { @@ -1028,7 +1030,7 @@ * Resize this map to the new size. If any bounds are smaller than before, * the map gets cut on the right and bottom side. Accordingly, new space is * attached to right and bottom. - * @param newSize new map size. + * @param newSize new map size */ public void resizeMap(final Dimension newSize) { // don't allow negative values @@ -1167,7 +1169,7 @@ /* * Gets the level data from the level file. * - * @param levelFile The level file that is used as the data source. + * @param levelFile The level file that is used as the data source */ /* void setLevelCellData(final int x, final int y, final int data) { @@ -1222,4 +1224,5 @@ } } */ -} + +} // class DefaultMapModel Modified: trunk/crossfire/src/cfeditor/map/MapArchObject.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapArchObject.java 2006-06-14 23:05:21 UTC (rev 155) +++ trunk/crossfire/src/cfeditor/map/MapArchObject.java 2006-06-14 23:06:26 UTC (rev 156) @@ -31,11 +31,10 @@ import java.awt.Dimension; /** - * MapArchObject contains the specific data about a map that is stored - * in the map-arch, at the very beginning of the map file. (width, - * height, difficulty level... etc) In former days, this used to be - * put into an ordinary ArchObject, but that's just no longer - * appropriate. + * MapArchObject contains the specific meta data about a map that is stored in + * the map-arch, at the very beginning of the map file. (width, height, + * difficulty level... etc) In former days, this used to be put into an + * ordinary ArchObject, but that's just no longer appropriate. * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ public final class MapArchObject { @@ -74,78 +73,123 @@ /** Size of this map. */ private Dimension mapSize = new Dimension(); - private int enter_x, enter_y; // default enter coordinates (usage not recommended) + /** Default enter coordinates (usage not recommended). */ + private int enter_x, enter_y; - private int reset_timeout; // number of seconds that need to elapse + /** Number of seconds that need to elapse before this map will be reset. */ + private int reset_timeout; - // before this map will be reset. - private int swap_time; // number of ticks that must elapse after the + /** + * Number of ticks that must elapse after tha map has not been used before + * it gets swapped out. + */ + private int swap_time; - // map has not been used before it gets swapped out. - private int difficulty; // map difficulty. If null, server calculates something + /** + * Map difficulty. If zero, server calculates something. + */ + private int difficulty; - private boolean fixed_resettime; // If nonzero, the map reset time will not + /** + * If nonzero, the map reset time will not be updated when someone enters / + * exits the map. + */ + private boolean fixed_resettime; - // be updated when someone enters/exits the map. - private int darkness; // light/darnkess of map (overall). Zero means fully bright + /** + * Light / darkness of map (overall). Zero means fully bright. + */ + private int darkness; - private boolean unique; // if set, this entire map is unique. + /** If set, this entire map is unique. */ + private boolean unique; - private boolean template; // if set, this entire map is a template map. + /** If set, this entire map is a template map. */ + private boolean template; - private boolean outdoor; // if set, this is an outdoor map. + /** If set, this is an outdoor map. */ + private boolean outdoor; - private boolean nosmooth; // if set, this entire map is nosmooth. + /** If set, this entire map is nosmooth. */ + private boolean nosmooth; - // Weather variables: - private int temp; // temperature + /** Weather variable: temperature. */ + private int temp; - private int pressure; // pressure + /** Weather variable: pressure. */ + private int pressure; - private int humid; // humidity (water in the air) + /** Weather variable: humidity (water in the air). */ + private int humid; - private int windspeed; // wind speed + /** Weather variable: wind speed. */ + private int windspeed; - private int winddir; // wind direction + /** Weather variable: wind direction. */ + private int winddir; - private int sky; // sky settings + /** Weather variable: sky settings. */ + private int sky; - private String shopitems = ""; // The item spec for the shop, if there is one. + /** The item spec for the shop, if there is one. */ + private String shopitems = ""; - private String shoprace = ""; // The prefered race of the shop. + /** The prefered race of the shop. */ + private String shoprace = ""; - private double shopgreed; // The greed of the shop. + /** The greed of the shop. */ + private double shopgreed; - private int shopmin; // The minimum price the shop will trade for + /** The minimum price the shop will trade for. */ + private int shopmin; - private int shopmax; // The maximum price the shop will trade for + /** The maximum price the shop will trade for. */ + private int shopmax; - // only for iso: - private boolean no_magic; // no magic spells + /** No magic spells. */ + private boolean no_magic; - private boolean no_priest; // no prayers + /** No prayers. */ + private boolean no_priest; - private boolean no_harm; // no harmful spells allowed + /** No harmful spells allowed. */ + private boolean no_harm; - private boolean no_summon; // no summoning + /** No summoning allowed. */ + private boolean no_summon; - private boolean fixed_login; // check map reset status after re-login + /** Check map reset status after re-login. */ + private boolean fixed_login; - private boolean perm_death; // permanent death with revivable corpses + /** Permanent death with revivable corpses. */ + private boolean perm_death; - private boolean ultra_death; // permanent death with corpses temporarily available + /** Permament death with corpses temporarily available. */ + private boolean ultra_death; - private boolean ultimate_death; // permanent death with instant character deletion + /** Permanent death with instant character deletion. */ + private boolean ultimate_death; - private boolean pvp; // PVP combat allowed + /** Player vs Player combat allowed. */ + private boolean pvp; - private String name; // map name (this is the name that appears in the game) + /** Map name (this is the name that appears in the game). */ + private String name; - private String filename; // name of the map file + /** + * Name of the map file. + * @todo check whether this is redundant. + */ + private String filename; - private String region = ""; // the region the map is in + /** The region the map is in. */ + private String region = ""; - private final String[] tile_path = new String[MAX_TILE]; // Used with map tiling. 0=north, 1=east, 2=south, 3=west + /** + * The map tile paths used for map tiling. + * 0 = north, 1 = east, 2 = south, 3 = west. + */ + private final String[] tile_path = new String[MAX_TILE]; /** * Constructor, set default values @@ -185,7 +229,8 @@ } /** - * This is for Daimonin: The background music is attached to the map name. + * Get the map name without the background music that is attached to the + * map name. (This is for Daimonin only.) * @return map name without attached music string */ public String getMapNameWithoutMusic() { @@ -196,26 +241,41 @@ return name; } - // get/set attributes + /** + * Get the map width. + * @return map width + */ @Deprecated public int getWidth() { return mapSize.width; } + /** + * Set the map width. + * @param x new map width + */ @Deprecated public void setWidth(final int x) { mapSize.width = x; } + /** + * Get the map height. + * @return map height + */ @Deprecated public int getHeight() { return mapSize.height; } + /** + * Set the map height. + * @param y new map height + */ @Deprecated public void setHeight(final int y) { mapSize.height = y; } /** * Set map size. - * @param mapSize New map size. + * @param mapSize new map size */ public void setMapSize(final Dimension mapSize) { this.mapSize.setSize(mapSize); @@ -225,18 +285,34 @@ return mapSize; } + /** + * Get the map name. + * @return map name + */ public String getMapName() { return name; } + /** + * Set the map name. + * @param new_name new map name + */ public void setMapName(final String new_name) { name = new_name; } + /** + * Get the map filename. + * @return map filename + */ public String getFileName() { return filename; } + /** + * Set the map filename. + * @param new_name new map filename + */ public void setFileName(final String new_name) { filename = new_name; } @@ -896,4 +972,5 @@ } stream.write("end\n"); } -} + +} // class MapArchObject Modified: trunk/crossfire/src/cfeditor/map/MapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapControl.java 2006-06-14 23:05:21 UTC (rev 155) +++ trunk/crossfire/src/cfeditor/map/MapControl.java 2006-06-14 23:06:26 UTC (rev 156) @@ -46,13 +46,19 @@ */ public final class MapControl { - /** The main controller of this subcontroller. */ + /** + * The main controller of this subcontroller. + */ private final CMainControl mainControl; - /** model (= map data of this level) */ + /** + * model (= map data of this level). + */ private final MapModel mapModel; - /** the view of the map */ + /** + * Main view of this map. + */ private final CMapViewIFrame mapView; private File mapFile; @@ -63,10 +69,14 @@ */ private int activeEditType; - /** Flag that indicates whether the level is closing or not. */ + /** + * Flag that indicates whether the level is closing or not. + */ private boolean levelClosing = false; - /** Flag that indicates whether this is a pickmap or not. */ + /** + * Flag that indicates whether this is a pickmap or not. + */ private final boolean isPickmap; /** @@ -87,7 +97,7 @@ /** * Constructs a new Map. - * @param mainControl the controller of this map + * @param mainControl the CMainControl * @param maparch the <code>MapArchObject</code> of the map * @param startObj chained list of Objects (ArchObjects) which should be * filled in map @@ -114,8 +124,8 @@ } /** - * Returns flag that indicates whether this is a pickmap or not. - * @return flag that indicates whether this is a pickmap or not. + * Return flag that indicates whether this is a pickmap or not. + * @return flag that indicates whether this is a pickmap or not */ public boolean isPickmap() { return isPickmap; @@ -130,7 +140,7 @@ } /** - * Returns contains the edit types that have already been (requested and) + * Return contains the edit types that have already been (requested and) * calculated (edit types get calculated only when needed to save time) * @return contains the edit types that have already been (requested and) */ @@ -189,7 +199,7 @@ /** * Notifies that a view has been closed. - * @param view The view that was closed. + * @param view the view that was closed */ public void viewCloseNotify(final CMapViewBasic view) { if (!levelClosing) { @@ -217,8 +227,8 @@ /** * Shows the given message in the UI. - * @param strTitle The title of the message. - * @param strMessage The message to be shown. + * @param strTitle the title of the message + * @param strMessage the message to be shown */ public void showMessage(final String strTitle, final String strMessage) { mainControl.showMessage(strTitle, strMessage); @@ -234,7 +244,9 @@ mapModel.levelCloseNotify(); } - /** @return true when this map has been closed */ + /** + * @return true when this map has been closed + */ public boolean isClosing() { return levelClosing; } @@ -318,21 +330,22 @@ } /** - * Returns whether the level has changed since it was last saved or not. - * @return True if level has changed, false if not. + * Return whether the level has changed since it was last saved or not. + * @return <code>true</code> if level has changed, <code>false</code> if + * not */ public boolean isLevelChanged() { return mapModel.isLevelChanged(); } /** - * Returns whether the level can be just saved (true) or does it need - * to be saved as (false). - * @return True if level can be just saved, false if not. + * Return whether the level can be just saved (true) or does it need to be + * saved as (false). + * @return <code>true</code> if level can be just saved, <code>false</code> + * if not */ public boolean isPlainSaveEnabled() { - return mainControl.getCurrentMap().getMapFileName() != null && - mainControl.getCurrentMap().getMapFileName().compareTo(IGUIConstants.DEF_MAPFNAME) != 0; + return mainControl.getCurrentMap().getMapFileName() != null && mainControl.getCurrentMap().getMapFileName().compareTo(IGUIConstants.DEF_MAPFNAME) != 0; } /** @@ -358,69 +371,79 @@ notifyViews(); // update } - /** Undoes a change in the level. */ + /** + * Undoes a change in the level. + */ public void undo() { CUndoStack.getInstance(this).undo(); } - /** Redoes a change in the level. */ + /** + * Redoes a change in the level. + */ public void redo() { CUndoStack.getInstance(this).redo(); } /** - * Returns the name of the undo operation. - * @return Name of the undo operation. + * Return the name of the undo operation. + * @return the name of the undo operation */ public String getUndoName() { return CUndoStack.getInstance(this).getUndoName(); } /** - * Returns the name of the redo operation. - * @return Name of the redo operation. + * Return the name of the redo operation. + * @return the name of the redo operation */ public String getRedoName() { return CUndoStack.getInstance(this).getRedoName(); } /** - * Returns whether undo is possible or not. - * @return True if undo is possible, false if not possible. + * Return whether undo is possible or not. + * @return <code>true</code> if undo is possible, <code>false</code> if not + * possible */ public boolean isUndoPossible() { return CUndoStack.getInstance(this).canUndo(); } /** - * Returns whether redo is possible or not. - * @return True if redo is possible, false if not possible. + * Return whether redo is possible or not. + * @return <code>true</code> if redo is possible, <code>false</code> if not + * possible */ public boolean isRedoPossible() { return CUndoStack.getInstance(this).canRedo(); } - /** Repaints the view. */ + /** + * Repaints the view. + */ public void repaint() { mapView.modelChanged(); } - /** Notifies the view that data has changed in the model. */ + /** + * Notifies the view that data has changed in the model. + */ void notifyViews() { mapView.refreshDataFromModel(); } /** - * Returns the map size of the mapModel. - * @return map size + * Return the size of the level. + * @return the map size */ public Dimension getMapSize() { return mapModel.getMapSize(); } /** - * Returns the width of the level. - * @return map width + * Return the width of the level. + * @return the map width * @deprecated use {@link #getMapSize()} instead. */ @Deprecated public int getMapWidth() { @@ -428,8 +451,8 @@ } /** - * Returns the height of the level. - * @return map height + * Return the height of the level. + * @return the map height * @deprecated use {@link #getMapSize()} instead. */ @Deprecated public int getMapHeight() { @@ -445,7 +468,7 @@ } /** - * Returns the width of the level + neighbors tile maps if any. + * Return the width of the level + neighbors tile maps if any. * @return global width */ // TODO implement this @@ -458,7 +481,7 @@ } /** - * Returns the height of the level + neighbors tile maps if any. + * Return the height of the level + neighbors tile maps if any. * @return global height */ int getDisplayMapHeight() { @@ -491,6 +514,14 @@ } } + /** + * Check if the coordinates posx, posy are valid (located within the + * borders of the map). + * @param posx the x-coordinate + * @param posy the y-coordinate + * @return <code>true</code> if this point is located within the map + * boundaries + */ @Deprecated public boolean pointValid(final int posx, final int posy) { return pointValid(new Point(posx, posy)); } @@ -511,7 +542,7 @@ /** * Resize the map. - * @param size the new level size. + * @param size the new level size */ void resizeMap(final Dimension size) { mapModel.resizeMap(size); @@ -528,8 +559,8 @@ } /** - * Sets the level name. - * @param strName The level name. + * Set the level name. + * @param strName the level name */ public void setMapName(final String strName) { mapModel.setMapName(strName); @@ -556,7 +587,9 @@ mapModel.setLevelChangedFlag(); } - /** Saves the level to a file. */ + /** + * Save the level to a file. + */ public void save() { if (isPickmap()) { CMainStatusbar.getInstance().setText("Saving pickmap '" + getMapFileName() + "'..."); @@ -569,8 +602,8 @@ } /** - * Saves the file with the given file name. - * @param file The file to be saved to. + * Save the file with the given file name. + * @param file the file to be saved to */ public void saveAs(final File file) { CMainStatusbar.getInstance().setText("Saving the map to a file..."); @@ -594,4 +627,5 @@ public File getMapFile() { return mapFile; } -} + +} // class MapControl Modified: trunk/daimonin/src/daieditor/arch/ArchObjectParser.java =================================================================== --- trunk/daimonin/src/daieditor/arch/ArchObjectParser.java 2006-06-14 23:05:21 UTC (rev 155) +++ trunk/daimonin/src/daieditor/arch/ArchObjectParser.java 2006-06-14 23:06:26 UTC (rev 156) @@ -43,8 +43,9 @@ import org.jetbrains.annotations.Nullable; /** - * The <code>ArchObjectParser</code> class handles the parsing of arches. - * It is a class separated from ArchObjectStack because it is also involved in loading arches in map files. + * The <code>ArchObjectParser</code> class handles the parsing of arches. It is + * a class separated from ArchObjectStack 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:Chr...@it...">Christian Hujer</a> @@ -61,7 +62,7 @@ /** * Constructor - * @param mainControl Main Control + * @param mainControl main control */ public ArchObjectParser(final CMainControl mainControl) { this.mainControl = mainControl; @@ -219,8 +220,9 @@ } else if (thisLine.startsWith("Object")) { logger.log(Level.WARNING, "inventoryInDefArch", thisLine); } else if (thisLine.startsWith("end")) { - //if (arch.getArchTypNr() == 0) + //if (arch.getArchTypNr() == 0) { //System.err.println("Arch "+ arch.getArchName()+" has no type info!"); + //} // we got full arch parsearch = false; // we write this sucker @@ -422,8 +424,8 @@ if (arch.getArchTypNr() == ArchObject.TYPE_UNSET) { arch.setArchTypNr(0); } + boolean scriptflag = false; - for (int i = 0, s = 0; i < len; i++) { if (text.charAt(i) == '\n') { @@ -449,7 +451,7 @@ } } - // default arches don't get an edit_type (not worth the time) + // default arches don't get an editType (not worth the time) // they get one assigned as soon as put on a map though. // TODO: This should be changed. arch.setEditType(IGUIConstants.TILE_EDIT_NONE); @@ -589,7 +591,8 @@ * This is neccessary to assure multiparts are always on top. * @param objects list of objects * @return the same list sorted (for convenience) - * @note This method assumes that all pieces of one multipart are listed in a row, which is okay as long as the loader puts it that way. + * @note This method assumes that all pieces of one multipart are listed in + * a row, which is okay as long as the loader puts it that way. * @note The returned list is the same list, not a new list. */ public static List<ArchObject> sortTempList(final List<ArchObject> objects) { @@ -605,10 +608,13 @@ } /** - * Calculate the lowest part of this multi-arch. - * This lowest part is needed because in ISO view, the big image is drawn for it's lowest part, in order to get the overlappings correct. + * Calculate the lowest part of this multi-arch. This lowest part is needed + * because in ISO view, the big image is drawn for it's lowest part, in + * order to get the overlappings correct. + * <p/> * @param arch last tail part of this multi - * @todo This method is called repeatedly for each multipart, it would be better if it was called only once per multipart. + * @todo This method is called repeatedly for each multipart. It would be + * better if it was called only once per multipart. */ private void calcLowestMulti(final ArchObject arch) { final ArchObject head = arch.getHead(); Modified: trunk/daimonin/src/daieditor/arch/ArchObjectStack.java =================================================================== --- trunk/daimonin/src/daieditor/arch/ArchObjectStack.java 2006-06-14 23:05:21 UTC (rev 155) +++ trunk/daimonin/src/daieditor/arch/ArchObjectStack.java 2006-06-14 23:06:26 UTC (rev 156) @@ -108,7 +108,7 @@ /** * Create the ArchObject stack. - * @param mainControl Reference to CMainControl + * @param mainControl reference to CMainControl */ public ArchObjectStack(final CMainControl mainControl) { this.mainControl = mainControl; @@ -377,8 +377,8 @@ private File currentFile; /** - * This method loads the arches & faces recursively by - * looping through the arch folder, collecting all the face, arc and png files.. + * This method loads the arches & faces recursively by looping through + * the arch folder, collecting all the face, arc and png files.. * @param f file path where we currently are * @param index counter for arches * @param noPanel if <var>true</var> no arch panels will be generated @@ -393,10 +393,12 @@ mainControl.addArchPanel(name); mainControl.addArchPanelCombo("show all"); } + if (folderLevel > 0 && folderLevel < 3) { // add first folders as panels index = mainControl.addArchPanelCombo(name); // mainControl.showMessage("LOAD FILE", "name: "+name+" index: "+index); } + folderLevel++; final String[] entries = f.list(); if (entries != null) { @@ -433,13 +435,13 @@ animFiles.add(f); } } - } /** - * This method loads animations that are separately defined by looping through all files that were previously collected by - * {@link #loadArchFromFiles(File,int,boolean)}. - * Do not invoke this method if loadArchFromFiles() wasn't invoked. + * This method loads animations that are separately defined by looping + * through all files that were previously collected by {@link + * #loadArchFromFiles(File,int,boolean)}. Do not invoke this method if + * loadArchFromFiles() wasn't invoked. */ private void loadAnimsFromFiles() { final AnimationObjects anims = mainControl.getAnimationObjects(); @@ -512,8 +514,8 @@ } /** - * Collect the existing arches and create archive-files for editor use - * as well as the Daimonin server. The arches also get a special path variable + * Collect the existing arches and create archive-files for editor use as + * well as the Daimonin server. The arches also get a special path variable * included which is used in the editor to cathegorize the arches. * <p/> * Output is: "archetypes", "daimonin.0", "animations", "bmaps" Modified: trunk/daimonin/src/daieditor/arch/anim/AnimationObject.java =================================================================== --- trunk/daimonin/src/daieditor/arch/anim/AnimationObject.java 2006-06-14 23:05:21 UTC (rev 155) +++ trunk/daimonin/src/daieditor/arch/anim/AnimationObject.java 2006-06-14 23:06:26 UTC (rev 156) @@ -60,14 +60,16 @@ private final int frameCount; /** - * Create an AnimationObject. - * Therefore animList is parsed. - * Do not invoke this constructor directly, use {@link AnimationObjects#addAnimationObject(String,String)} instead. - * If you invoke this constructor directly, the created AnimationObject will not be registered. + * Create an AnimationObject. Therefore animList is parsed. Do not invoke + * this constructor directly, use {@link + * AnimationObjects#addAnimationObject(String,String)} instead. If you + * invoke this constructor directly, the created AnimationObject will not + * be registered. * @param animName name of animation - * @param animList list of animation as found between "anim" and "mina", separated with "\n", including "facings" but including neither "anim" nor - * "mina" - * @param path path of file where the animation was found in + * @param animList list of animation as found between "anim" and "mina", + * separated with "\n", including "facings" but including neither "anim" + * nor "mina" + * @param path path of file where the animation was found in */ AnimationObject(final String animName, final String animList, final String path) { super(path); Modified: trunk/daimonin/src/daieditor/arch/anim/AnimationObjects.java =================================================================== --- trunk/daimonin/src/daieditor/arch/anim/AnimationObjects.java 2006-06-14 23:05:21 UTC (rev 155) +++ trunk/daimonin/src/daieditor/arch/anim/AnimationObjects.java 2006-06-14 23:06:26 UTC (rev 156) @@ -73,7 +73,8 @@ } /** - * Adds a new animation object. If <code>path == null</code> path will be read from {@link #animMap}. + * Adds a new animation object. If <code>path == null</code> path will be + * read from {@link #animMap}. * @param animName name of the animation object to add * @param list String with animation list data * @param path Path relative to the arch directory @@ -116,9 +117,10 @@ } /** - * Loads any number of animations from a reader. - * It is not neccessary to provide a BufferedReader for buffering. - * This method will always wrap the supplied <var>reader</var> with a BufferedReader if the supplied reader isn't already a BufferedReader itself. + * Loads any number of animations from a reader. It is not neccessary to + * provide a BufferedReader for buffering. This method will always wrap the + * supplied <var>reader</var> with a BufferedReader if the supplied reader + * isn't already a BufferedReader itself. * @param reader Reader to load animations from * @param path Path relative to the arch directory * @throws IOException in case of I/O errors @@ -210,4 +212,4 @@ } } -} // class AnimationObject +} // class AnimationObjects Modified: trunk/daimonin/src/daieditor/map/DefaultMapModel.java =================================================================== --- trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-06-14 23:05:21 UTC (rev 155) +++ trunk/daimonin/src/daieditor/map/DefaultMapModel.java 2006-06-14 23:06:26 UTC (rev 156) @@ -177,7 +177,7 @@ } } - /** Resets the level changed flag to false. */ + /** Reset the level changed flag to false. */ public void resetLevelChangedFlag() { if (levelChanged) { // change status and update title bar @@ -188,7 +188,7 @@ } } - /** Sets the level changed flag to true. */ + /** Set the level changed flag to true. */ public void setLevelChangedFlag() { if (!levelChanged) { // change status and update title bar @@ -207,7 +207,8 @@ /** * Returns whether the level has changed since it was last saved or not. - * @return True if level has changed, false if not. + * @return <code>true</code> if level has changed, <code>false</code> if + * not. */ public boolean isLevelChanged() { return levelChanged; @@ -245,13 +246,14 @@ } /** - * Add a new arch to the map. Including multi tile arches. - * This function allows only to choose from the default arches (->archname). - * @param archname ID from a default arch on the ArchObjectStack - * @param pos insert-location on this map - * @param intern if NOT '-1': only one arch of the same kind can be - * inserted per square - * @param insertBelow true: new arch is inserted on top, false: new arch is inserted below + * Add a new arch to the map. Including multi tile arches. This function + * allows only to choose from the default arches (->archname). + * @param archname ID from a default arch on the ArchObjectStack + * @param pos insert-location on this map + * @param intern if NOT '-1': only one arch of the same kind can be + * inserted per square + * @param insertBelow true: new arch is inserted on top, false: new arch is + * inserted below * @return true if insertion successful, false if not */ public boolean addArchToMap(final String archname, final Point pos, final int intern, final boolean insertBelow) { @@ -294,23 +296,25 @@ ArchObjectParser.postParseMapArch(tail, mapControl.getActiveEditType()); tail.setObjectFace(); } + // Level data has changed setLevelChangedFlag(); return true; } /** - * Insert a new arch to the map at a specified position. This - * function allows either to choose from the default arches (->archnr) - * or to insert a copy from an existing arch (->newarch). - * It also works for container-inventory. + * Insert a new arch to the map at a specified position. This function + * allows either to choose from the default arches (->archnr) or to insert + * a copy from an existing arch (->newarch). It also works for + * container-inventory. * @param newarch A clone copy of this ArchObject gets inserted to the map. - * It can be an arch directly from a pickmap or even a default arch. - * if ('newarch'==null) the default arch of number 'archnr' gets inserted + * It can be an arch directly from a pickmap or even a + * default arch. if ('newarch'==null) the default arch of + * number 'archnr' gets inserted * @param archname ID from a default arch to get inserted. This value gets * used ONLY when 'newarch' is null - * @param next the new arch gets inserted before 'next' - * if ('next'==null) the arch gets inserted at bottom + * @param next the new arch gets inserted before 'next' if + * ('next'==null) the arch gets inserted at bottom * -> 'next' must be an arch from the map! (or null) * @param pos map position to insert the new arch * @return true if insertion was successful @@ -383,13 +387,13 @@ } /** - * Link an existing arch to the map. - * Including multi tile arches. - * This function allows to insert any given arch (can be non-default). - * Make sure that the given 'arch' is a new and unlinked object. - * @param arch the new arch to be linked onto the map. - * (Dest. coordinates must be set (arch.mapx/y)!) - * @param insertBelow true: new arch is inserted on top, false: new arch is inserted below + * Link an existing arch to the map. Including multi tile arches. This + * function allows to insert any given arch (can be non-default). Make sure + * that the given 'arch' is a new and unlinked object. + * @param arch the new arch to be linked onto the map. (Dest. + * coordinates must be set (arch.mapx/y)!) + * @param insertBelow true: new arch is inserted on top, false: new arch + * is inserted below */ public void addArchObjectToMap(final ArchObject arch, final boolean insertBelow) { // Make sure this arch has the proper edit_type @@ -427,16 +431,17 @@ } /** - * Delete an existing arch from the map. (If the specified - * arch doesn't exist, nothing happens.) - * (This includes deletion of multiparts and inventory.) + * Delete an existing arch from the map. (If the specified arch doesn't + * exist, nothing happens.) (This includes deletion of multiparts and + * inventory.) * <p/> - * XXX This method looks extremely strange. We have xx and yy and the arch, yet we look whether the arch is on the current square! - * Probably this method is not just bogus but also not neccessary. - * @param arch Arch to be removed - * @param pos location of the arch to be removed - * @param refreshMap If true, mapview is redrawn after deletion. - * keep in mind: drawing consumes time! + * XXX This method looks extremely strange. We have xx and yy and the arch, + * yet we look whether the arch is on the current square! Probably this + * method is not just bogus but also not neccessary. + * @param arch Arch to be removed + * @param pos location of the arch to be removed + * @param refreshMap If true, mapview is redrawn after deletion. Keep in + * mind: drawing consumes time! */ public void deleteMapArch(final ArchObject arch, final Point pos, final boolean refreshMap) { // Okay, it's in an inventory then @@ -469,9 +474,9 @@ } /** - * Searching for a valid exit at the highlighted map-spot. - * (This can be a teleporter, exit, pit etc.) - * selected Arch - this method should NOT retrieve that data itself. + * Searching for a valid exit at the highlighted map-spot. (This can be a + * teleporter, exit, pit etc.) selected Arch - this method should NOT + * retrieve that data itself. * @param hspot Point to get exit at * @return ArchObject exit-arch if existent, otherwise null */ @@ -489,7 +494,7 @@ /** * Check if objects get cut off if the map was resized to the given bounds. - * @param newSize the new level size. + * @param newSize the new level size * @return true if objects would be cut off */ public boolean isCutoffUnsafe(final Dimension newSize) { @@ -503,6 +508,7 @@ } } } + if (mapSize.width > newSize.height) { // search the bottom stripe (as far as being cut off) for (int y = newSize.height; y < mapSize.height; y++) { @@ -513,13 +519,14 @@ } } } + return false; } /** - * Resize this map to the new size. If any bounds are smaller than - * before, the map gets cut on the right and bottom side. - * Accordingly, new space is attached to right and bottom. + * Resize this map to the new size. If any bounds are smaller than before, + * the map gets cut on the right and bottom side. Accordingly, new space is + * attached to right and bottom. * @param newSize new map size * @throws IllegalArgumentException in case newWidth or newHeight < 0 */ @@ -690,4 +697,4 @@ } } -} // class MapModel +} // class DefaultMapModel Modified: trunk/daimonin/src/daieditor/map/MapArchObject.java =================================================================== --- trunk/daimonin/src/daieditor/map/MapArchObject.java 2006-06-14 23:05:21 UTC (rev 155) +++ trunk/daimonin/src/daieditor/map/MapArchObject.java 2006-06-14 23:06:26 UTC (rev 156) @@ -30,12 +30,16 @@ import java.io.IOException; /** - * MapArchObject contains the specific meta data about a map that is stored in the map-arch, at the very beginning of the map file. - * The map metadata is information like width, height, difficulty level, darkness etc.). + * MapArchObject contains the specific meta data about a map that is stored in + * the map-arch, at the very beginning of the map file. The map metadata is + * information like width, height, difficulty level, darkness etc.). * @author <a href="mailto:and...@gm...">Andreas Vogl</a> * @author <a href="mailto:ch...@it...">Christian Hujer</a> - * @note Though this class is named MapArchObject, it is <strong>not a subclass of ArchObject</strong>; the name is for technical reasons, not for semantic / inheritance! - * @todo This class should be changed so map attributes are reflected in a more generic way like arch attributes. + * @note Though this class is named MapArchObject, it is <strong>not a subclass + * of ArchObject</strong>; the name is for technical reasons, not for semantic + * / inheritance! + * @todo This class should be changed so map attributes are reflected in a more + * generic way like arch attributes. */ public final class MapArchObject { @@ -59,21 +63,25 @@ /** Number of seconds that need to elapse before this map will be reset. */ private int resetTimeout; - /** Number of ticks that must elapse after tha map has not been used before it gets swapped out. */ + /** + * Number of ticks that must elapse after tha map has not been used before + * it gets swapped out. + */ private int swapTime; /** - * Map difficulty. - * If zero, server calculates something. + * Map difficulty. If zero, server calculates something. */ private int difficulty; - /** If nonzero, the map reset time will not be updated when someone enters / exits the map. */ + /** + * If nonzero, the map reset time will not be updated when someone enters / + * exits the map. + */ private boolean fixedReset; /** - * Light / darkness of map (overall). - * Zero means fully bright. + * Light / darkness of map (overall). Zero means fully bright. */ private int darkness = -1; @@ -151,7 +159,8 @@ } /** - * Get the map name without the background music that is attached to the map name. + * Get the map name without the background music that is attached to the + * map name. * @return map name without attached music string */ public String getMapNameWithoutMusic() { @@ -402,14 +411,14 @@ } /** - * append 'text' to the map text + * Append 'text' to the map text. * @param text string to add */ public void addText(final String text) { msgText.append(text); } - /** delete maptext */ + /** Delete maptext. */ public void resetText() { msgText.delete(0, msgText.length()); } @@ -428,13 +437,13 @@ } /** - * Parsing the MapArchObject. This special object has it's own parser - * now because it must be easily expandable for possible features. Who knows + * Parsing the MapArchObject. This special object has it's own parser now + * because it must be easily expandable for possible features. Who knows * how much information this Object might contain in future? * @param reader <code>BufferedReader</code> to the mapfile * @param fname file name of the mapfile (relative name, no path) - * @return true if reading the MapArchObject succeeded with sane - * results, otherwise false + * @return true if reading the MapArchObject succeeded with sane results, + * otherwise false */ public boolean parseMapArch(final BufferedReader reader, final String fname) { filename = fname; // store file name @@ -560,7 +569,6 @@ archflag = true; } } - } } catch (final IOException e) { // if we reach eof here, the mapfile is corrupt @@ -580,7 +588,9 @@ if (s.lastIndexOf(" ") > 0) { return Integer.valueOf(s.substring(s.lastIndexOf(" ") + 1)); } - } catch (final NumberFormatException e) { /* ignore (really?) */ } + } catch (final NumberFormatException e) { + /* ignore (really?) */ + } return 0; } @@ -689,4 +699,5 @@ stream.write("end\n"); stream.flush(); } + } // class MapArchObject Modified: trunk/daimonin/src/daieditor/map/MapControl.java =================================================================== --- trunk/daimonin/src/daieditor/map/MapControl.java 2006-06-14 23:05:21 UTC (rev 155) +++ trunk/daimonin/src/daieditor/map/MapControl.java 2006-06-14 23:06:26 UTC (rev 156) @@ -169,10 +169,9 @@ } /** - * Add edit type to the bitmask of active types. If this is a - * new type, it gets calculated for every arch on the map. - * Once it is calculated, we save that state in 'activeEditType' - * so we don't need to do it again. + * Add edit type to the bitmask of active types. If this is a new type, it + * gets calculated for every arch on the map. Once it is calculated, we + * save that state in 'activeEditType' so we don't need to do it again. * @param editType new edit type */ public void addEditType(final int editType) { @@ -237,17 +236,19 @@ } /** - * Returns whether the level has changed since it was last saved or not. - * @return True if level has changed, false if not. + * Return whether the level has changed since it was last saved or not. + * @return <code>true</code> if level has changed, <code>false</code> if + * not */ public boolean isLevelChanged() { return mapModel.isLevelChanged(); } /** - * Returns whether the level can be just saved (true) or does it need - * to be saved as (false). - * @return True if level can be just saved, false if not. + * Return whether the level can be just saved (true) or does it need to be + * saved as (false). + * @return <code>true</code> if level can be just saved, <code>false</code> + * if not */ public boolean isPlainSaveEnabled() { return !(mainControl.getCurrentMap().mapFile == null || mainControl.getCurrentMap().getMapFileName() == null || mainControl.getCurrentMap().getMapFileName().compareTo(IGUIConstants.DEF_MAPFNAME) == 0); @@ -275,32 +276,34 @@ } /** - * Returns the name of the undo operation. - * @return Name of the undo operation. + * Return the name of the undo operation. + * @return the name of the undo operation */ public String getUndoName() { return CUndoStack.getInstance(this).getUndoName(); } /** - * Returns the name of the redo operation. - * @return Name of the redo operation. + * Return the name of the redo operation. + * @return the name of the redo operation */ public String getRedoName() { return CUndoStack.getInstance(this).getRedoName(); } /** - * Returns whether undo is possible or not. - * @return True if undo is possible, false if not possible. + * Return whether undo is possible or not. + * @return <code>true</code> if undo is possible, <code>false</code> if not + * possible */ public boolean isUndoPossible() { return CUndoStack.getInstance(this).canUndo(); } /** - * Returns whether redo is possible or not. - * @return True if redo is possible, false if not possible. + * Return whether redo is possible or not. + * @return <code>true</code> if redo is possible, <code>false</code> if not + * possible */ public boolean isRedoPossible() { return CUndoStack.getInstance(this).canRedo(); @@ -315,18 +318,20 @@ } /** - * Returns the size of the level. - * @return map size. + * Ret... [truncated message content] |
From: <aki...@us...> - 2006-06-14 23:05:32
|
Revision: 155 Author: akirschbaum Date: 2006-06-14 16:05:21 -0700 (Wed, 14 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=155&view=rev Log Message: ----------- Fix typo. Modified Paths: -------------- trunk/daimonin/resource/HelpFiles/tut_copypaste.html Modified: trunk/daimonin/resource/HelpFiles/tut_copypaste.html =================================================================== --- trunk/daimonin/resource/HelpFiles/tut_copypaste.html 2006-06-14 23:04:18 UTC (rev 154) +++ trunk/daimonin/resource/HelpFiles/tut_copypaste.html 2006-06-14 23:05:21 UTC (rev 155) @@ -41,7 +41,7 @@ </P> <P><B>Fill:</B><br> -There are two fill comands: "Fill Below" and "Fill Above". The difference +There are two fill commands: "Fill Below" and "Fill Above". The difference between those two should be pretty obvious: If any selected map squares are not empty, the new arches will get inserted either above top (-> Fill Above), or below bottom (-> Fill below). This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-06-14 23:04:35
|
Revision: 154 Author: akirschbaum Date: 2006-06-14 16:04:18 -0700 (Wed, 14 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=154&view=rev Log Message: ----------- Fix typos. Modified Paths: -------------- trunk/crossfire/patches/README trunk/crossfire/resource/HelpFiles/tut_copypaste.html trunk/crossfire/resource/conf/types.xml trunk/crossfire/src/cfeditor/CMapViewBasic.java Modified: trunk/crossfire/patches/README =================================================================== --- trunk/crossfire/patches/README 2006-06-14 16:34:52 UTC (rev 153) +++ trunk/crossfire/patches/README 2006-06-14 23:04:18 UTC (rev 154) @@ -18,7 +18,7 @@ layout.diff: This re-arranges the layout of some of the subpanels. The left side of the editor will remain the same, with the map area being given the full vertical height, and the right side will have -the map stacking as well as selected space arch panel in a statcked +the map stacking as well as selected space arch panel in a stacked vertical fashion. This layout can be useful if you have a high vertical resolution. Modified: trunk/crossfire/resource/HelpFiles/tut_copypaste.html =================================================================== --- trunk/crossfire/resource/HelpFiles/tut_copypaste.html 2006-06-14 16:34:52 UTC (rev 153) +++ trunk/crossfire/resource/HelpFiles/tut_copypaste.html 2006-06-14 23:04:18 UTC (rev 154) @@ -41,7 +41,7 @@ </P> <P><B>Fill:</B><br> -There are two fill comands: "Fill Below" and "Fill Above". The difference +There are two fill commands: "Fill Below" and "Fill Above". The difference between those two should be pretty obvious: If any selected map squares are not empty, the new arches will get inserted either above top (-> Fill Above), or below bottom (-> Fill below). Modified: trunk/crossfire/resource/conf/types.xml =================================================================== --- trunk/crossfire/resource/conf/types.xml 2006-06-14 16:34:52 UTC (rev 153) +++ trunk/crossfire/resource/conf/types.xml 2006-06-14 23:04:18 UTC (rev 154) @@ -1645,8 +1645,8 @@ loosing rate of 2/3 = 67%. ]]> </use> <attribute arch="other_arch" editor="target arch" type="string"> - Only objects of matching archtype, lying ontop of the dublicator will be - dublicated, multiplied or removed. All other objects will be ignored. + Only objects of matching archtype, lying ontop of the duplicator will be + duplicated, multiplied or removed. All other objects will be ignored. </attribute> <attribute arch="level" editor="multiply factor" type="int"> The number of items in the target pile will be multiplied by the @@ -2270,7 +2270,7 @@ high or higher than this value. In that way, some altars can not be re-consecrated, while other altars, like those in dungeons, could be. - Altars located in temples should have at least <reconsecrate level> 100. + Altars located in temples should have at least <reconsecrate level> 120. Some characters might need those altars, they would be very unhappy to see them re-consecrated to another cult. </attribute> @@ -3960,7 +3960,7 @@ <!--####################################################################--> <type number="14" name="Shooting Weapon"> <description><![CDATA[ - Schooting weapons like bows/crossbows are used to shoot projectiles + Shooting weapons like bows/crossbows are used to shoot projectiles (arrows/bolts). Shooting weapons and normal (melee) weapons can be wielded both at the same time. Like with any other equipment, stats/bonuses from shooting weapons are directly inherited to the player. @@ -3972,7 +3972,7 @@ <use><![CDATA[ Shooting weapons should not add bonuses in general. There's already enough "equipment-slots" doing that: swords, rings, amulets, girdles etc. - Schooting weapons should especially not add bonuses to the player + Shooting weapons should especially not add bonuses to the player that have nothing to do with schooting. A Wisdom bonus on a bow is crap for example! A name like "Longbow of great Wisdom" doesn't help - still crap. ]]> Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-06-14 16:34:52 UTC (rev 153) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-06-14 23:04:18 UTC (rev 154) @@ -305,9 +305,9 @@ } /** - * Highlight the tile at given koordinates (just as + * Highlight the tile at given coordinates (just as * if it had been selected with leftclick). Besides, the mapview is - * always centered on the koordinates as far as possible. + * always centered on the coordinates as far as possible. * @param dx x-coordinate * @param dy y-coordinate */ @@ -1555,7 +1555,7 @@ } else if ((insArch = insArch.getDefaultArch()) != null) { insertArchName = mainControl.getArchPanelSelection().getArchName(); } else { - insertArchName = "unkown"; + insertArchName = "unknown"; } } else { insertArchName = "nothing"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <der...@us...> - 2006-06-14 16:35:06
|
Revision: 153 Author: derdanny Date: 2006-06-14 09:34:52 -0700 (Wed, 14 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=153&view=rev Log Message: ----------- Prevention of NPEs while replacing. Modified Paths: -------------- trunk/daimonin/src/daieditor/ReplaceDialog.java Modified: trunk/daimonin/src/daieditor/ReplaceDialog.java =================================================================== --- trunk/daimonin/src/daieditor/ReplaceDialog.java 2006-06-14 08:19:51 UTC (rev 152) +++ trunk/daimonin/src/daieditor/ReplaceDialog.java 2006-06-14 16:34:52 UTC (rev 153) @@ -290,15 +290,14 @@ * @return number of arches that have been replaced */ private int doReplace(final int matchCriteria, final String matchString, final boolean entireMap, final boolean deleteOnly) { - int replaceCount = 0; // count how many arches have been replaced final List<ArchObject> replaceList; switch (lastSelectedIndex) { case 0: - if (replaceArch != null) { + if (replaceArch == null) { + replaceList = null; + } else { replaceList = new ArrayList<ArchObject>(1); replaceList.add(replaceArch); - } else { - replaceList = new ArrayList<ArchObject>(0); } break; case 1: @@ -310,14 +309,18 @@ default: replaceList = null; } - for (MapSquare square : entireMap ? mc.getMapModel() : mc.getMapViewFrame().view.getSelectedSquares()) { + final CMapViewIFrame mapViewIFrame = mc.getMapViewFrame(); + assert mapViewIFrame != null; + int replaceCount = 0; + final int replaceListSize = replaceList == null ? 0 : replaceList.size(); + for (MapSquare square : entireMap ? mc.getMapModel() : mapViewIFrame.view.getSelectedSquares()) { for (ArchObject node : square) { if ((!node.isMulti() || node.getMultiRefCount() > 0) && (matchCriteria == MATCH_ARCH_NAME && node.getArchName() != null && node.getArchName().equalsIgnoreCase(matchString) || matchCriteria == MATCH_OBJ_NAME && node.getBestName().equalsIgnoreCase(matchString))) { - if (replaceList != null && replaceList.size() > 0 && !deleteOnly) { + if (replaceListSize > 0 && !deleteOnly) { ArchObject randomArch; - if (replaceList.size() == 1) { + if (replaceListSize == 1) { randomArch = replaceList.get(0); } else { randomArch = replaceList.get(CMainControl.rnd.nextInt(replaceList.size())); @@ -402,10 +405,11 @@ final boolean deleteOnly = replaceWithBox.getSelectedIndex() == 3; final boolean entireMap = replaceEntireBox.getSelectedIndex() == 0; + final CMapViewIFrame mapViewIFrame = mc.getMapViewFrame(); if (mc == null || mc.isClosing()) { setVisible(false); ACTION_FACTORY.showMessageDialog(this, "replaceMapGone", mc.getMapFileName()); - } else if (!entireMap && !mc.getMapViewFrame().isHighlight()) { + } else if (!entireMap && (mapViewIFrame == null || !mapViewIFrame.isHighlight())) { // user selected "replace highlighted" but nothing is highlighted ACTION_FACTORY.showMessageDialog(this, "replaceMapNoSelection", mc.getMapFileName()); } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-06-14 08:20:08
|
Revision: 152 Author: akirschbaum Date: 2006-06-14 01:19:51 -0700 (Wed, 14 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=152&view=rev Log Message: ----------- Unify comments and whitespace. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMapArchPanel.java trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/ReplaceDialog.java trunk/crossfire/src/cfeditor/ScriptArchData.java trunk/crossfire/src/cfeditor/arch/ArchObject.java trunk/daimonin/src/daieditor/IGUIConstants.java trunk/daimonin/src/daieditor/ReplaceDialog.java trunk/daimonin/src/daieditor/ScriptArchData.java trunk/daimonin/src/daieditor/arch/ArchObject.java Modified: trunk/crossfire/src/cfeditor/CMapArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-06-13 22:43:08 UTC (rev 151) +++ trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-06-14 08:19:51 UTC (rev 152) @@ -820,7 +820,7 @@ doc.insertString(doc.getLength(), arch.diffArchText(mainControl.getArchObjectStack().getArch(arch.getNodeNr()).getArchText(), true), currentAttributes); } } catch (final BadLocationException e) { - // TODO + // TODO } archEdit.setCaretPosition(0); Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-06-13 22:43:08 UTC (rev 151) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-06-14 08:19:51 UTC (rev 152) @@ -600,7 +600,7 @@ */ public final class CFlatLevelRenderer extends JComponent implements CLevelRenderer { - /** Serial Version UID. */ + /** Serial Version UID. */ private static final long serialVersionUID = 1L; private final MapModel _model; Modified: trunk/crossfire/src/cfeditor/ReplaceDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/ReplaceDialog.java 2006-06-13 22:43:08 UTC (rev 151) +++ trunk/crossfire/src/cfeditor/ReplaceDialog.java 2006-06-14 08:19:51 UTC (rev 152) @@ -48,7 +48,7 @@ import javax.swing.JTextField; /** - * This dialog manages the replace action + * This dialog manages the replace action. * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ public final class ReplaceDialog extends JDialog { @@ -61,6 +61,7 @@ public static final int MATCH_OBJ_NAME = 1; + /** Singleton Instance. */ private static ReplaceDialog instance = null; private final CMainControl mainControl; @@ -89,7 +90,7 @@ /** * Construct instance. - * @param mainControl + * @param mainControl MainControl */ private ReplaceDialog(final CMainControl mainControl) { super(mainControl.getMainView(), "Replace", false); @@ -252,8 +253,8 @@ * Update which arch is displayed as replace object. * @param newArch the new 'replaceArch' to be shown and stored * @param alwaysPack if false, the frame is packed only when icon size - * changed if true, the frame is always packed (packing resizes but also - * causes flicker) + * changed if true, the frame is always packed (packing + * resizes but also causes flicker) */ public void updateArchSelection(final ArchObject newArch, final boolean alwaysPack) { if (isShowing() && replaceWithBox.getSelectedIndex() == 0) { @@ -281,11 +282,11 @@ /** * This method performs the actual replace action on a map. - * @param mapControl MapControl of the map where the action was invoked + * @param mapControl MapControl of the map where the action was invoked * @param matchCriteria matching criteria for replace * @param matchString this is what to search for - * @param entireMap if true, the entire map is affected - if false, only - * highlighted area + * @param entireMap if true, the entire map is affected - if false, + * only highlighted area * @param deleteOnly if true matching arches get only deleted and not * replaced * @return number of arches that have been replaced Modified: trunk/crossfire/src/cfeditor/ScriptArchData.java =================================================================== --- trunk/crossfire/src/cfeditor/ScriptArchData.java 2006-06-13 22:43:08 UTC (rev 151) +++ trunk/crossfire/src/cfeditor/ScriptArchData.java 2006-06-14 08:19:51 UTC (rev 152) @@ -178,7 +178,7 @@ /** * This method is called for each arch after loading a map. It checks - * wether all events have enough data to be valid. Invalid or insufficient + * whether all events have enough data to be valid. Invalid or insufficient * ScriptedEvent objects get removed. * @return true when at least one valid event remains, false when all * events were invalid (and deleted) @@ -227,6 +227,7 @@ /** * Set all ScriptedEvents to appear in the given JList This method should * be fast because it may be executed when user clicks on map objects. + * @param list JList */ public void addEventsToJList(final JList list) { final String[] content = new String[eventList.size()]; Modified: trunk/crossfire/src/cfeditor/arch/ArchObject.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObject.java 2006-06-13 22:43:08 UTC (rev 151) +++ trunk/crossfire/src/cfeditor/arch/ArchObject.java 2006-06-14 08:19:51 UTC (rev 152) @@ -53,11 +53,14 @@ private static final Logger LOG = Logger.getLogger(ArchObject.class); - public static final int TYPE_UNSET = -666; // means the arch has no type set + /** Special constant that's used if an arch has no arch type set. */ + public static final int TYPE_UNSET = -666; - private static ArchObjectStack archstack; // static reference to the archstack (-> default arches) + /** Static reference to the archstack (default arches). */ + private static ArchObjectStack archstack; - private static CFArchTypeList typelist; // static reference to the typelist (-> find syntax errors) + /** Static reference to the typeList (find syntax errors). */ + private static CFArchTypeList typelist; private static int myIdCounter = 0; @@ -70,10 +73,27 @@ private String objName; - private StringBuffer archText; // the arch text (contains only the differences from default arch) + /** + * The archText. + * <p/> + * It only contains the differences from the default arch. + * <p/> + * Note: It's a rule that every line ends with a '\n', including the last + * line. + */ + private StringBuffer archText; - // it is a rule that every line ends with a '\n', including the last line - private StringBuffer msgText; // msg text buffer + /** + * The msgText. + * <p/> + * Note: It's a rule that every line ends with a '\n', including the last + * line. + * <p/> + * Another rule (unconfirmed): If the value is <code>null</code>, the arch + * has no message text, if the value exists but is empty, the arch has an + * empty message text. + */ + private StringBuffer msgText; private StringBuffer animText; // anim text buffer @@ -84,13 +104,23 @@ private int nodenr; // we are (internal) arch nr in node list // the nodenr determines the (default) archetype - private int mapx; // if on map, we are here + /** Map x position if on map. */ + private int mapx; + /** Map y position if on map. */ private int mapy; - private MultiArchData multi; // data for multi-arches - null for single-square arches + /** + * Data for multitile-arches. + * Stays null for singlesquare-arches. + */ + private MultiArchData multi; - private ScriptArchData script; // data for scripted events - null if no events defined + /** + * Data for scripted events. + * Stays null if no events defined. + */ + private ScriptArchData script; private boolean noface; // if true, arch has no face as default @@ -124,13 +154,14 @@ private int internTemp; // used for drawing + /** Edit Type. */ private int editType; // for view settings private AutojoinList join; // if nonzero, pointing to the list of autojoining archetypes private final HashMap cachedAttribute = new HashMap(); - /** ArchObject constructor */ + /** Create an ArchObject. */ public ArchObject() { multi = null; // this object stays 'null' for all single-tile arches script = null; // this object stays 'null' unless there are events defined @@ -173,36 +204,46 @@ typelist = tlist; } + /** + * Returns edit Type. + * @return edit Type + */ // edit type is the editable value from arch // here it is used to identify the layer type public int getEditType() { return editType; } - /** @return the default <code>ArchObject</code> for this arch */ + /** + * Get the default arch of this arch. + * @return the default <code>ArchObject</code> for this arch + */ public ArchObject getDefaultArch() { return archstack.getArch(nodenr); } - /** @return true when this ArchObject is a default arch from the stack */ + /** + * Check whether this ArchObject is a default arch. + * @return <code>true</code> when this ArchObject is a default arch (from + * the {@link ArchObjectStack}), otherwise <code>false</code> + */ public boolean isDefaultArch() { return archstack.getArch(nodenr) == this; } /** - * Get the EditType of an ArchObject (e.g. floor, monster, etc). - * These are determined by the various attributes of the arch - * (->archText). + * Get the EditType of an ArchObject (e.g. floor, monster, etc). These are + * determined by the various attributes of the arch (->archText). * @param checkType bitmask containing the edit type(s) to be calculated * @return new editType for this arch */ public int calculateEditType(final int checkType) { final ArchObject defarch = getDefaultArch(); // default arch - /* if one of the types in check_type already is in editType, + /* if one of the types in checkType already is in editType, // we exclude that one - if ((check_type&editType) != 0) { - check_type -= (check_type&editType); + if ((checkType&editType) != 0) { + checkType -= (checkType&editType); } */ @@ -214,59 +255,52 @@ if (editType == IGUIConstants.TILE_EDIT_NONE) { editType = 0; } else if (editType != 0) { - // all flags from 'check_type' must be unset in this arch because they get recalculated now + // all flags from 'checkType' must be unset in this arch because they get recalculated now editType &= ~checkType; } - if ((checkType & IGUIConstants.TILE_EDIT_BACKGROUND) != 0 && - getAttributeValue("is_floor", defarch) == 1 && - getAttributeValue("no_pick", defarch) == 1) { + if ((checkType & IGUIConstants.TILE_EDIT_BACKGROUND) != 0 + && getAttributeValue("is_floor", defarch) == 1 + && getAttributeValue("no_pick", defarch) == 1) { // Backgroud: floors editType |= IGUIConstants.TILE_EDIT_BACKGROUND; } - if ((checkType & IGUIConstants.TILE_EDIT_MONSTER) != 0 && - getAttributeValue("alive", defarch) == 1 && - (getAttributeValue("monster", defarch) == 1 || - getAttributeValue("generator", defarch) == 1)) { + if ((checkType & IGUIConstants.TILE_EDIT_MONSTER) != 0 + && getAttributeValue("alive", defarch) == 1 + && (getAttributeValue("monster", defarch) == 1 || getAttributeValue("generator", defarch) == 1)) { // Monster: monsters/npcs/generators editType |= IGUIConstants.TILE_EDIT_MONSTER; } - if ((checkType & IGUIConstants.TILE_EDIT_WALL) != 0 && - archType == 0 && getAttributeValue("no_pass", defarch) == 1) { + if ((checkType & IGUIConstants.TILE_EDIT_WALL) != 0 + && archType == 0 + && getAttributeValue("no_pass", defarch) == 1) { // Walls editType |= IGUIConstants.TILE_EDIT_WALL; } - if ((checkType & IGUIConstants.TILE_EDIT_CONNECTED) != 0 && - getAttributeValue("connected", defarch) != 0) { + if ((checkType & IGUIConstants.TILE_EDIT_CONNECTED) != 0 + && getAttributeValue("connected", defarch) != 0) { // Connected Objects editType |= IGUIConstants.TILE_EDIT_CONNECTED; } - if ((checkType & IGUIConstants.TILE_EDIT_EXIT) != 0 && - archType == 66 || archType == 41 || archType == 95) { + if ((checkType & IGUIConstants.TILE_EDIT_EXIT) != 0 + && archType == 66 || archType == 41 || archType == 95) { // Exit: teleporter/exit/trapdoors editType |= IGUIConstants.TILE_EDIT_EXIT; } - if ((checkType & IGUIConstants.TILE_EDIT_TREASURE) != 0 && - getAttributeValue("no_pick", defarch) == 0 && (archType == 4 || - archType == 5 || archType == 36 || archType == 60 || - archType == 85 || archType == 111 || archType == 123 || - archType == 124 || archType == 130)) { + if ((checkType & IGUIConstants.TILE_EDIT_TREASURE) != 0 + && getAttributeValue("no_pick", defarch) == 0 + && (archType == 4 || archType == 5 || archType == 36 || archType == 60 || archType == 85 || archType == 111 || archType == 123 || archType == 124 || archType == 130)) { // Treasure: randomtreasure/money/gems/potions/spellbooks/scrolls editType |= IGUIConstants.TILE_EDIT_TREASURE; } - if ((checkType & IGUIConstants.TILE_EDIT_DOOR) != 0 && - archType == 20 || archType == 23 || archType == 26 || - archType == 91 || archType == 21 || archType == 24) { + if ((checkType & IGUIConstants.TILE_EDIT_DOOR) != 0 + && archType == 20 || archType == 23 || archType == 26 || archType == 91 || archType == 21 || archType == 24) { // Door: door/special door/gates + keys editType |= IGUIConstants.TILE_EDIT_DOOR; } - if ((checkType & IGUIConstants.TILE_EDIT_EQUIP) != 0 && - getAttributeValue("no_pick", defarch) == 0 && ((archType >= 13 && - archType <= 16) || archType == 33 || archType == 34 || - archType == 35 || archType == 39 || archType == 70 || - archType == 87 || archType == 99 || archType == 100 || - archType == 104 || archType == 109 || archType == 113 || - archType == 122 || archType == 3)) { + if ((checkType & IGUIConstants.TILE_EDIT_EQUIP) != 0 + && getAttributeValue("no_pick", defarch) == 0 + && ((archType >= 13 && archType <= 16) || archType == 33 || archType == 34 || archType == 35 || archType == 39 || archType == 70 || archType == 87 || archType == 99 || archType == 100 || archType == 104 || archType == 109 || archType == 113 || archType == 122 || archType == 3)) { // Equipment: weapons/armour/wands/rods editType |= IGUIConstants.TILE_EDIT_EQUIP; } @@ -275,21 +309,19 @@ } /** - * Get the value of an arch attribute from the archText - * both of the arch itself and if n.e. in it's default arch. - * If the attribute doesn't exist in either one, or the value is - * not a number, zero is returned. + * Get the value of an arch attribute from the archText both of the arch + * itself and if n.e. in it's default arch. If the attribute doesn't exist + * in either one, or the value is not a number, zero is returned. * @param attr search for "attr <value>" - * @param defarch default arch of 'this' arch - * defarch=null means this *is* a default arch, or - * we just want to ignore the default arch + * @param defarch default arch of this arch, or <code>null</code> if this + * arch is a default arch or the default arch should be ignored * @return <value>, zero if not found */ public int getAttributeValue(String attr, final ArchObject defarch) { String aText = archText.toString(); // The "real" Archtext from arch & defarch int j; - // Add all attributes from defarch that don't already exist in AText + // Add all attributes from defarch that don't already exist in aText if (defarch != null) { aText = aText + diffArchText(defarch.getArchText(), true); } @@ -323,14 +355,12 @@ } /** - * Get the String of an arch attribute from the archText - * both of the arch itself and if n.e. in it's default arch. - * If the attribute doesn't exist in either one, an empty - * String "" is returned. + * Get the String of an arch attribute from the archText both of the arch + * itself and if n.e. in it's default arch. If the attribute doesn't exist + * in either one, an empty String "" is returned. * @param attr search for "attr <string>" - * @param defarch deault arch of 'this' arch - * defarch=null means this *is* a default arch, or - * we just want to ignore the default arch + * @param defarch default arch of this arch, or <code>null</code> if this + * arch is a default arch or the default arch should be ignored * @return <string>, "" if not found */ public String getAttributeString(String attr, @Nullable final ArchObject defarch) { @@ -345,7 +375,7 @@ } result = ""; } - // Add all attributes from defarch that don't already exist in AText + // Add all attributes from defarch that don't already exist in aText if (defarch != null) { aText = aText + diffArchText(defarch.getArchText(), true); } @@ -507,7 +537,7 @@ } /** - * Get the topmost container that 'this' arch is in. + * Get the topmost container of this ArchObject. * @return the topmost container */ public ArchObject getTopContainer() { @@ -637,6 +667,7 @@ //if (multi == null) { // multi = new MultiArchData(); //} + multi.setRefMaxxm(x); } @@ -644,6 +675,7 @@ //if (multi == null) { // multi = new MultiArchData(); //} + multi.setRefMaxym(y); } @@ -667,6 +699,7 @@ if (y < 0 && y < multi.getRefMaxym()) { multi.setRefMaxym(y); } + if (y > multi.getRefMaxy()) { multi.setRefMaxy(y); } @@ -676,6 +709,7 @@ //if (multi == null) { // multi = new MultiArchData(); //} + multi.setRefflag(bool); } @@ -880,10 +914,12 @@ mapy = y; } + /** {@inheritDoc} */ public int getMapX() { return mapx; } + /** {@inheritDoc} */ public int getMapY() { return mapy; } @@ -940,11 +976,18 @@ return nodenr; } - // Arch name + /** + * Sets arch name. + * @param name arch name + */ public void setArchName(final String name) { archName = name != null ? name.intern() : null; } + /** + * Returns arch name. + * @return the arch name + */ public String getArchName() { return archName; } @@ -988,7 +1031,7 @@ } /** - * append 'text' to the archText of this arch + * Append <var>text</var> to the arch text of this arch. * @param text text to add */ public void addArchText(final String text) { @@ -996,8 +1039,8 @@ } /** - * set 'text' = archText of this arch - * @param text set this text + * Set <var>text</var> as arch text of this arch. + * @param text text to set as arch text */ public void setArchText(final String text) { archText.delete(0, archText.length()); @@ -1006,14 +1049,14 @@ } /** - * returns the archText of this arch as String - * @return the archtext + * Returns the arch text of this arch as String. + * @return the arch text */ public String getArchText() { return archText.toString(); } - /** deletes the archText of this arch */ + /** Clears the arch text of this arch. */ public void resetArchText() { archText.delete(0, archText.length()); } @@ -1115,11 +1158,12 @@ return null; } - + /** Delete message text by nullification. */ public void deleteMsgText() { msgText = null; } + /** Delete message text by emptying. */ public void resetMsgText() { if (msgText == null) { return; @@ -1128,19 +1172,30 @@ msgText.delete(0, msgText.length()); } - // MSGText! + /** + * Add a line of message text. This is used when creating the ArchObject + * from the ArchObjectParser. Special: invoking this method with + * <code>null</code> creates an empty string. + * @param text text to append to message text + */ public void addMsgText(final String text) { if (msgText == null) { msgText = new StringBuffer(); } - if (text == null) { // special, this adds a clear string + if (text == null) { + // special, this adds a clear string + // That's why it's after checking msgText for null. return; } msgText.append(text); } + /** + * Get the complete message text. + * @return message text + */ @Nullable public String getMsgText() { if (msgText == null) { return null; @@ -1194,10 +1249,9 @@ } /** - * returns a new ArchObject, containing a copy of 'this' arch. - * References of course cannot be copied that way! - * This does NOT work for multipart objects. - * Also note that the returned clone is not linked to any map. + * Returns a new ArchObject, containing a copy of 'this' arch. References + * of course cannot be copied that way! This does NOT work for multipart + * objects. Also note that the returned clone is not linked to any map. * @param posx map x coords. for the returned clone * @param posy map y coords. for the returned clone * @return clone instance of this <code>ArchObject</code> @@ -1298,8 +1352,8 @@ } /** - * Check wether all events have enough data to be valid. - * Invalid or insufficient ScriptedEvent objects get removed. + * Check whether all events have enough data to be valid. Invalid or + * insufficient ScriptedEvent objects get removed. */ public void validateAllEvents() { if (script != null) { @@ -1337,11 +1391,12 @@ } /** - * If there is a scripted event of the specified type, the script pad - * is opened and the appropriate script displayed. + * If there is a scripted event of the specified type, the script pad is + * opened and the appropriate script displayed. * @param eventType type of event * @param task ID number for task (open script/ edit path/ remove) - * @param eventList JList from the MapArchPanel (script tab) which displays the events + * @param eventList JList from the MapArchPanel (script tab) which displays + * the events * @param mapanel the MapArchPanel */ public void modifyEventScript(final String eventType, final int task, final JList eventList, final CMapArchPanel mapanel) { @@ -1356,9 +1411,10 @@ } /** - * A popup is opened and the user can create a new scripting event - * which gets attached to this arch. - * @param eventList JList from the MapArchPanel (script tab) which displays the events + * A popup is opened and the user can create a new scripting event which + * gets attached to this arch. + * @param eventList JList from the MapArchPanel (script tab) which displays + * the events * @param mapanel the MapArchPanel */ public void addEventScript(final JList eventList, final CMapArchPanel mapanel) { @@ -1377,18 +1433,18 @@ } /** - * This method checks the archText for syntax errors. More - * precisely: It reads every line in the archText and looks if - * it matches the type-definitions (-> see CFArchTypeList) for this - * arch. If there is no match, the line is considered wrong. - * Of course the type-definitions will never be perfect, this - * should be kept in mind. - * Note that the default arch is ignored in the check. The default - * arches should be correct, and even if not - it isn't the mapmaker to blame. - * @param type the type structure belonging to this arch. - * if null, the type is calculated in this function - * @return A String with all lines which don't match the type-definitions.<br> - * If no such "errors" encountered, null is returned. + * This method checks the archText for syntax errors. More precisely: It + * reads every line in the archText and looks if it matches the + * type-definitions (-> see CFArchTypeList) for this arch. If there is no + * match, the line is considered wrong. Of course the type-definitions will + * never be perfect, this should be kept in mind. + * <p/> + * Note that the default arch is ignored in the check. The default arches + * should be correct, and even if not - it isn't the mapmaker to blame. + * @param type the type structure belonging to this arch. if null, the type + * is calculated in this function + * @return A String with all lines which don't match the + * type-definitions.<br> If no such "errors" encountered, null is returned. */ @Nullable public String getSyntaxErrors(CFArchType type) { Modified: trunk/daimonin/src/daieditor/IGUIConstants.java =================================================================== --- trunk/daimonin/src/daieditor/IGUIConstants.java 2006-06-13 22:43:08 UTC (rev 151) +++ trunk/daimonin/src/daieditor/IGUIConstants.java 2006-06-14 08:19:51 UTC (rev 152) @@ -122,7 +122,7 @@ int DEF_PICKMAP_HEIGHT = 20; // default height for pickmaps - /** The directory that contains the common-use icons.*/ + /** The directory that contains the common-use icons.*/ String ICON_DIR = "resource" + File.separator + "icons"; /** The directory that contains the system icons. */ Modified: trunk/daimonin/src/daieditor/ReplaceDialog.java =================================================================== --- trunk/daimonin/src/daieditor/ReplaceDialog.java 2006-06-13 22:43:08 UTC (rev 151) +++ trunk/daimonin/src/daieditor/ReplaceDialog.java 2006-06-14 08:19:51 UTC (rev 152) @@ -105,7 +105,7 @@ private int lastSelectedIndex; /** - * Construct instance + * Construct instance. * @param mainControl MainControl */ private ReplaceDialog(final CMainControl mainControl) { @@ -128,7 +128,7 @@ } /** - * Replace objects on the map + * Replace objects on the map. * @param mapControl MapControl of the active map where the action was invoked */ public void display(final MapControl mapControl) { @@ -251,8 +251,9 @@ /** * Update which arch is displayed as replace object. * @param newArch the new 'replaceArch' to be shown and stored - * @param alwaysPack if false, the frame is packed only when icon size changed - * if true, the frame is always packed (packing resizes but also causes flicker) + * @param alwaysPack if false, the frame is packed only when icon size + * changed if true, the frame is always packed (packing + * resizes but also causes flicker) */ public void updateArchSelection(final ArchObject newArch, final boolean alwaysPack) { if (isShowing() && replaceWithBox.getSelectedIndex() == 0) { @@ -282,8 +283,10 @@ * This method performs the actual replace action on a map. * @param matchCriteria matching criteria for replace * @param matchString this is what to search for - * @param entireMap if true, the entire map is affected - if false, only highlighted area - * @param deleteOnly if true matching arches get only deleted and not replaced + * @param entireMap if true, the entire map is affected - if false, + * only highlighted area + * @param deleteOnly if true matching arches get only deleted and not + * replaced * @return number of arches that have been replaced */ private int doReplace(final int matchCriteria, final String matchString, final boolean entireMap, final boolean deleteOnly) { Modified: trunk/daimonin/src/daieditor/ScriptArchData.java =================================================================== --- trunk/daimonin/src/daieditor/ScriptArchData.java 2006-06-13 22:43:08 UTC (rev 151) +++ trunk/daimonin/src/daieditor/ScriptArchData.java 2006-06-14 08:19:51 UTC (rev 152) @@ -114,15 +114,16 @@ } /* - * Event data: - * name = plugin name - * slaying = options - * sub_type = event type - * race = script name (path) - */ + * Event data: + * name = plugin name + * slaying = options + * sub_type = event type + * race = script name (path) + */ /** - * Search 'eventList' for an existing ScriptedEvent of the specified event type. + * Search 'eventList' for an existing ScriptedEvent of the specified event + * type. * @param eventType look for a ScriptedEvent of this type * @return index of ScriptedEvent in 'eventList' if found, -1 if not found */ @@ -136,9 +137,9 @@ } /** - * This method is called for each arch after loading a map. - * It checks whether all events have enough data to be valid. - * Invalid or insufficient ScriptedEvent objects get removed. + * This method is called for each arch after loading a map. It checks + * whether all events have enough data to be valid. Invalid or insufficient + * ScriptedEvent objects get removed. */ public void validateAllEvents() { for (ArchObject tmp : owner) { @@ -155,8 +156,8 @@ } /** - * Set all ScriptedEvents to appear in the given JList - * This method should be fast because it may be executed when user clicks on map objects + * Set all ScriptedEvents to appear in the given JList This method should + * be fast because it may be executed when user clicks on map objects. * @param list JList */ public void addEventsToJList(final JList list) { @@ -166,16 +167,18 @@ content.add(' ' + typeName(tmp.getAttributeInt("sub_type", owner.getDefaultArch()))); } } + list.setListData(content); list.setSelectedIndex(0); } /** - * If there is a scripted event of the specified type, the script pad - * is opened and the appropriate script displayed. + * If there is a scripted event of the specified type, the script pad is + * opened and the appropriate script displayed. * @param eventIndex index of event in the owner's inventory * @param task ID number for task (open script/ edit path/ remove) - * @param panelList JList from the MapArchPanel (script tab) which displays the events + * @param panelList JList from the MapArchPanel (script tab) which + * displays the events * @return true if a change was done, false otherwise. */ public boolean modifyEventScript(int eventIndex, final int task, final JList panelList) { @@ -425,7 +428,7 @@ /** * The user has chosen to create a new event, now it is to be done. - * @param frame the parent window of the create-new-event dialog. + * @param frame the parent window of the create-new-event dialog */ public boolean createNewEvent(final JDialog frame) { final CMainControl mainControl = CMainControl.getInstance(); // main control @@ -583,7 +586,7 @@ /** * Validate this event object: Check if there is sufficient data. - * @return true if this object is valid, otherwise false. + * @return true if this object is valid, otherwise false */ public boolean isValid() { final String options = getOptions(); @@ -711,8 +714,8 @@ } /** - * Set event path and plgin name according to user input - * from popup dialog + * Set event path and plgin name according to user input from popup + * dialog. */ public void modifyEventPath() { final String newPath = inputFPath.getText().trim(); Modified: trunk/daimonin/src/daieditor/arch/ArchObject.java =================================================================== --- trunk/daimonin/src/daieditor/arch/ArchObject.java 2006-06-13 22:43:08 UTC (rev 151) +++ trunk/daimonin/src/daieditor/arch/ArchObject.java 2006-06-14 08:19:51 UTC (rev 152) @@ -49,8 +49,11 @@ * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> * @author <a href="mailto:Chr...@it...">Christian Hujer</a> - * @todo the archobject should be directly asked for a face, and eventually it should cache faces itself ; that would speed up painting maps - * @todo this class maybe could be split into 3 classes: AbstractArchObject as abstract base class, DefArchObject for default arches and ArchObject for normal arches. + * @todo the archobject should be directly asked for a face, and eventually it + * should cache faces itself ; that would speed up painting maps + * @todo this class maybe could be split into 3 classes: AbstractArchObject as + * abstract base class, DefArchObject for default arches and ArchObject for + * normal arches. */ public final class ArchObject /*extends NamedObject*/ extends ArchObjectContainer implements Cloneable, net.sf.gridarta.arch.ArchObject { @@ -89,15 +92,22 @@ /** * The archText. + * <p/> * It only contains the differences from the default arch. - * Note: It's a rule that every line ends with a '\n', including the last line. + * <p/> + * Note: It's a rule that every line ends with a '\n', including the last + * line. */ private StringBuffer archText; /** * The msgText. - * Note: It's a rule that every line ends with a '\n', including the last line. - * Another rule (unconfirmed): If the value is <code>null</code>, the arch has no message text, if the value exists but is empty, the arch has an + * <p/> + * Note: It's a rule that every line ends with a '\n', including the last + * line. + * <p/> + * Another rule (unconfirmed): If the value is <code>null</code>, the arch + * has no message text, if the value exists but is empty, the arch has an * empty message text. */ private StringBuffer msgText; @@ -112,8 +122,8 @@ private int mapy; /** - * Data for miltitile-arches. - * Stays zero for singlesquare-arches. + * Data for multitile-arches. + * Stays null for singlesquare-arches. */ private MultiArchData multi; @@ -127,8 +137,8 @@ private FaceDesc faceobjdesc; /** - * Whether the direction is set. - * <code>true</code> if direction is set, otherwise <code>false</code>. + * Whether the direction is set. <code>true</code> if direction is set, + * otherwise <code>false</code>. */ private boolean directionSet; @@ -137,8 +147,9 @@ private boolean noface; /** - * If this flag is set, the arch is not a "real" arch but comes from the artifacts file. - * Such ArchObject instances are not included in the arch collection, since the artifacts file is the same for editor and server. + * If this flag is set, the arch is not a "real" arch but comes from the + * artifacts file. Such ArchObject instances are not included in the arch + * collection, since the artifacts file is the same for editor and server. */ private boolean artifact; @@ -197,7 +208,7 @@ /** * Returns edit Type. - * @return edit Type. + * @return edit Type */ // edit type is the editable value from arch // here it is used to identify the layer type @@ -228,7 +239,8 @@ /** * Check whether this ArchObject is a default arch. - * @return <code>true</code> when this ArchObject is a default arch (from the {@link ArchObjectStack}), otherwise <code>false</code> + * @return <code>true</code> when this ArchObject is a default arch (from + * the {@link ArchObjectStack}), otherwise <code>false</code> */ public boolean isDefaultArch() { return defaultArch == this; @@ -236,33 +248,37 @@ /** * Check whether this ArchObject has a default arch. - * @return <code>true</code> when this ArchObject has a default arch or is a default arch itself, otherwise <code>false</code> + * @return <code>true</code> when this ArchObject has a default arch or is + * a default arch itself, otherwise <code>false</code> */ public boolean hasDefaultArch() { return defaultArch != null; } /** - * Check whether this ArchObject has the same default arch as another ArchObject. + * Check whether this ArchObject has the same default arch as another + * ArchObject. * @param other other ArchObject - * @return <code>true</code> when this ArchObject has the same default arch as the other ArchObject, otherwise <code>false</code> + * @return <code>true</code> when this ArchObject has the same default arch + * as the other ArchObject, otherwise <code>false</code> */ public boolean hasSameDefaultArch(final ArchObject other) { return defaultArch == other.defaultArch; } /** - * Get the EditType of an ArchObject (e.g. floor, monster, etc). - * These are determined by the various attributes of the arch - * (->archText). + * Get the EditType of an ArchObject (e.g. floor, monster, etc). These are + * determined by the various attributes of the arch (->archText). * @param checkType bitmask containing the edit type(s) to be calculated - * @return new edit_type for this arch + * @return new editType for this arch */ public int calculateEditType(final int checkType) { - /* if one of the types in checkType already is in edit_type, + /* if one of the types in checkType already is in editType, // we exclude that one - if ((checkType & edit_type) != 0) - checkType -= (checkType & edit_type);*/ + if ((checkType & editType) != 0) { + checkType -= (checkType & editType); + } + */ // bail out if nothing to do if (checkType == 0) { @@ -276,43 +292,47 @@ editType &= ~checkType; } - if ((checkType & IGUIConstants.TILE_EDIT_BACKGROUND) != 0 && getAttributeInt("is_floor", true) == 1 + if ((checkType & IGUIConstants.TILE_EDIT_BACKGROUND) != 0 + && getAttributeInt("is_floor", true) == 1 && getAttributeInt("no_pick", true) == 1) { // Backgroud: floors editType |= IGUIConstants.TILE_EDIT_BACKGROUND; } if ((checkType & IGUIConstants.TILE_EDIT_MONSTER) != 0 - && (getAttributeInt("monster", true) == 1 || archType == 80 - || archType == 81 || archType == 83 || getAttributeInt("generator", true) == 1)) { + && (getAttributeInt("monster", true) == 1 || archType == 80 || archType == 81 || archType == 83 || getAttributeInt("generator", true) == 1)) { // Monster: monsters/npcs/generators and spawn points editType |= IGUIConstants.TILE_EDIT_MONSTER; } - if ((checkType & IGUIConstants.TILE_EDIT_WALL) != 0 && (archType == 77 || archType == 79) && getAttributeInt("no_pass", true) == 1) { + if ((checkType & IGUIConstants.TILE_EDIT_WALL) != 0 + && (archType == 77 || archType == 79) + && getAttributeInt("no_pass", true) == 1) { // Walls editType |= IGUIConstants.TILE_EDIT_WALL; } - if ((checkType & IGUIConstants.TILE_EDIT_CONNECTED) != 0 && getAttributeInt("connected", true) != 0) { + if ((checkType & IGUIConstants.TILE_EDIT_CONNECTED) != 0 + && getAttributeInt("connected", true) != 0) { // Connected Objects editType |= IGUIConstants.TILE_EDIT_CONNECTED; } - if ((checkType & IGUIConstants.TILE_EDIT_EXIT) != 0 && archType == 66 || archType == 41 || archType == 95 || archType == 94 || archType == 69) { + if ((checkType & IGUIConstants.TILE_EDIT_EXIT) != 0 + && archType == 66 || archType == 41 || archType == 95 || archType == 94 || archType == 69) { // Exit: teleporter/exit/trapdoors/pit/shopmat editType |= IGUIConstants.TILE_EDIT_EXIT; } - if ((checkType & IGUIConstants.TILE_EDIT_TREASURE) != 0 && getAttributeInt("no_pick", true) == 0 - && (archType == 4 || archType == 5 || archType == 36 || archType == 60 || archType == 85 - || archType == 111 || archType == 123 || archType == 124 || archType == 130)) { + if ((checkType & IGUIConstants.TILE_EDIT_TREASURE) != 0 + && getAttributeInt("no_pick", true) == 0 + && (archType == 4 || archType == 5 || archType == 36 || archType == 60 || archType == 85 || archType == 111 || archType == 123 || archType == 124 || archType == 130)) { // Treasure: randomtreasure/money/gems/potions/spellbooks/scrolls editType |= IGUIConstants.TILE_EDIT_TREASURE; } - if ((checkType & IGUIConstants.TILE_EDIT_DOOR) != 0 && archType == 20 - || archType == 23 || archType == 26 || archType == 91 || archType == 21 || archType == 24) { + if ((checkType & IGUIConstants.TILE_EDIT_DOOR) != 0 + && archType == 20 || archType == 23 || archType == 26 || archType == 91 || archType == 21 || archType == 24) { // Door: door/special door/gates + keys editType |= IGUIConstants.TILE_EDIT_DOOR; } - if ((checkType & IGUIConstants.TILE_EDIT_EQUIP) != 0 && getAttributeInt("no_pick", true) == 0 && (archType >= 13 && archType <= 16 - || archType == 33 || archType == 34 || archType == 35 || archType == 39 || archType == 70 || archType == 87 || archType == 99 - || archType == 100 || archType == 104 || archType == 109 || archType == 113 || archType == 122 || archType == 3)) { + if ((checkType & IGUIConstants.TILE_EDIT_EQUIP) != 0 + && getAttributeInt("no_pick", true) == 0 + && (archType >= 13 && archType <= 16 || archType == 33 || archType == 34 || archType == 35 || archType == 39 || archType == 70 || archType == 87 || archType == 99 || archType == 100 || archType == 104 || archType == 109 || archType == 113 || archType == 122 || archType == 3)) { // Equipment: weapons/armour/wands/rods editType |= IGUIConstants.TILE_EDIT_EQUIP; } @@ -321,10 +341,12 @@ } /** - * Get the value of an arch attribute from the archText both of the arch itself and if n.e. in it's default arch. - * If the attribute doesn't exist in either one, or the value is not a number, zero is returned. + * Get the value of an arch attribute from the archText both of the arch + * itself and if n.e. in it's default arch. If the attribute doesn't exist + * in either one, or the value is not a number, zero is returned. * @param attr search for "attr <value>" - * @param defarch default arch of this arch, or <code>null</code> if this arch is a default arch or the default arch should be ignored + * @param defarch default arch of this arch, or <code>null</code> if this + * arch is a default arch or the default arch should be ignored * @return <value>, zero if not found */ public int getAttributeInt(final String attr, final ArchObject defarch) { @@ -348,10 +370,12 @@ } /** - * Get the value of an arch attribute from the archText both of the arch itself and if n.e. in it's default arch. - * If the attribute doesn't exist in either one, or the value is not a number, zero is returned. + * Get the value of an arch attribute from the archText both of the arch + * itself and if n.e. in it's default arch. If the attribute doesn't exist + * in either one, or the value is not a number, zero is returned. * @param attr search for "attr <value>" - * @param useDefArch <code>true</code> if the default arch of this ArchObject should be queried as well, <code>false</code> to ignore it + * @param useDefArch <code>true</code> if the default arch of this + * ArchObject should be queried as well, <code>false</code> to ignore it * @return <value>, zero if not found */ public int getAttributeInt(final String attr, final boolean useDefArch) { @@ -359,10 +383,12 @@ } /** - * Get the value of an arch attribute from the archText both of the arch itself and eventually its default arch. - * If the attribute doesn't exist in either one, or the value is not a number, zero is returned. + * Get the value of an arch attribute from the archText both of the arch + * itself and eventually its default arch. If the attribute doesn't exist + * in either one, or the value is not a number, zero is returned. * @param attr search for "attr <value>" - * @param defarch default arch of this arch, or <code>null</code> if this arch is a default arch or the default arch should be ignored + * @param defarch default arch of this arch, or <code>null</code> if this + * arch is a default arch or the default arch should be ignored * @return <value>, zero if not found */ public long getAttributeLong(final String attr, final ArchObject defarch) { @@ -386,10 +412,12 @@ } /** - * Get the value of an arch attribute from the archText both of the arch itself and eventually its default arch. - * If the attribute doesn't exist in either one, or the value is not a number, zero is returned. + * Get the value of an arch attribute from the archText both of the arch + * itself and eventually its default arch. If the attribute doesn't exist + * in either one, or the value is not a number, zero is returned. * @param attr search for "attr <value>" - * @param useDefArch <code>true</code> if the default arch of this ArchObject should be queried as well, <code>false</code> to ignore it + * @param useDefArch <code>true</code> if the default arch of this + * ArchObject should be queried as well, <code>false</code> to ignore it * @return <value>, zero if not found */ public long getAttributeLong(final String attr, final boolean useDefArch) { @@ -397,10 +425,12 @@ } /** - * Get the value of an arch attribute from the archText both of the arch itself and eventually its default arch. - * If the attribute doesn't exist in either one, or the value is not a number, zero is returned. + * Get the value of an arch attribute from the archText both of the arch + * itself and eventually its default arch. If the attribute doesn't exist + * in either one, or the value is not a number, zero is returned. * @param attr search for "attr <value>" - * @param defarch default arch of this arch, or <code>null</code> if this arch is a default arch or the default arch should be ignored + * @param defarch default arch of this arch, or <code>null</code> if this + * arch is a default arch or the default arch should be ignored * @return <value>, zero if not found */ public double getAttributeDouble(final String attr, final ArchObject defarch) { @@ -424,10 +454,12 @@ } /** - * Get the value of an arch attribute from the archText both of the arch itself and eventually its default arch. - * If the attribute doesn't exist in either one, or the value is not a number, zero is returned. + * Get the value of an arch attribute from the archText both of the arch + * itself and eventually its default arch. If the attribute doesn't exist + * in either one, or the value is not a number, zero is returned. * @param attr search for "attr <value>" - * @param useDefArch <code>true</code> if the default arch of this ArchObject should be queried as well, <code>false</code> to ignore it + * @param useDefArch <code>true</code> if the default arch of this + * ArchObject should be queried as well, <code>false</code> to ignore it * @return <value>, zero if not found */ public double getAttributeDouble(final String attr, final boolean useDefArch) { @@ -435,10 +467,12 @@ } /** - * Get the String of an arch attribute from the archText both of the arch itself and if n.e. in it's default arch. - * If the attribute doesn't exist in either one, an empty String "" is returned. + * Get the String of an arch attribute from the archText both of the arch + * itself and if n.e. in it's default arch. If the attribute doesn't exist + * in either one, an empty String "" is returned. * @param attr search for "attr <value>" - * @param defarch default arch of this arch, or <code>null</code> if this arch is a default arch or the default arch should be ignored + * @param defarch default arch of this arch, or <code>null</code> if this + * arch is a default arch or the default arch should be ignored * @return <string>, "" if not found */ public String getAttributeString(final String attr, final ArchObject defarch) { @@ -485,15 +519,19 @@ } /** - * Check whether this ArchObject is in a Container (in Daimonin sense, which means being in a MapSquare isn't, but being in an ArchObject is). - * @return <code>true</code> if this ArchObject has a Container and the Container is an ArchObject, otherwise (no Container or Container is not an ArchObject) false + * Check whether this ArchObject is in a Container (in Daimonin sense, + * which means being in a MapSquare isn't, but being in an ArchObject is). + * @return <code>true</code> if this ArchObject has a Container and the + * Container is an ArchObject, otherwise (no Container or Container is not + * an ArchObject) false */ public boolean isInContainer() { return container != null && container instanceof ArchObject; } /** - * Get the topmost container of this ArchObject (in Daimonin sense, which means being in a MapSquare isn't, but being in an ArchObject is). + * Get the topmost container of this ArchObject (in Daimonin sense, which + * means being in a MapSquare isn't, but being in an ArchObject is). * @return the topmost container but always ArchObject, never MapSquare */ public ArchObject getTopContainer() { @@ -506,8 +544,10 @@ } /** - * Sets if this flag is set, the arch is not a "real" arch but comes from the artifacts file. - * Such ArchObject instances are not included in the arch collection, since the artifacts file is the same for editor and server. + * Sets if this flag is set, the arch is not a "real" arch but comes from + * the artifacts file. Such ArchObject instances are not included in the + * arch collection, since the artifacts file is the same for editor and + * server. * @param artifact if this flag is set, the arch is not a "real" arch but comes from the artifacts file. */ public void setArtifact(final boolean artifact) { @@ -515,9 +555,12 @@ } /** - * Returns if this flag is set, the arch is not a "real" arch but comes from the artifacts file. - * Such ArchObject instances are not included in the arch collection, since the artifacts file is the same for editor and server. - * @return if this flag is set, the arch is not a "real" arch but comes from the artifacts file. + * Returns if this flag is set, the arch is not a "real" arch but comes + * from the artifacts file. Such ArchObject instances are not included in + * the arch collection, since the artifacts file is the same for editor and + * server. + * @return if this flag is set, the arch is not a "real" arch but comes + * from the artifacts file. */ public boolean isArtifact() { return artifact; @@ -596,17 +639,25 @@ } public void setRefMaxMX(final int x) { - //if (multi == null) multi = new MultiArchData(); + //if (multi == null) { + // multi = new MultiArchData(); + //} + multi.setRefMaxxm(x); } public void setRefMaxMY(final int y) { - //if (multi == null) multi = new MultiArchData(); + //if (multi == null) { + // multi = new MultiArchData(); + //} + multi.setRefMaxym(y); } public void setRefMaxX(final int x) { - //if (multi == null) multi = new MultiArchData(); + //if (multi == null) { + // multi = new MultiArchData(); + //} if (x < 0 && x < multi.getRefMaxxm()) { multi.setRefMaxxm(x); @@ -616,18 +667,24 @@ } public void setRefMaxY(final int y) { - //if (multi == null) multi = new MultiArchData(); + //if (multi == null) { + // multi = new MultiArchData(); + //} if (y < 0 && y < multi.getRefMaxym()) { multi.setRefMaxym(y); } + if (y > multi.getRefMaxy()) { multi.setRefMaxy(y); } } public void setReferenced(final boolean referenced) { - //if (multi == null) multi = new MultiArchData(); + //if (multi == null) { + // multi = new MultiArchData(); + //} + multi.setReferenced(referenced); } @@ -643,12 +700,14 @@ if (multi == null) { multi = new MultiArchData(); } + multi.setHead(arch); // this points to head. Heads DON'T points to himself } /** - * For normal arches returns the arch itself, for multiheads returns the head. - * Invoke this method if you need to be sure to have the single / head arch. + * For normal arches returns the arch itself, for multiheads returns the + * head. Invoke this method if you need to be sure to have the single / + * head arch. * @return head for multiheads, this for normal arches */ public ArchObject getHead() { @@ -671,6 +730,7 @@ if (multi == null) { multi = new MultiArchData(); } + multi.setMultiShapeID(value); } @@ -682,6 +742,7 @@ if (multi == null) { multi = new MultiArchData(); } + multi.setMultiPartNr(value); } @@ -693,6 +754,7 @@ if (multi == null) { multi = new MultiArchData(); } + multi.setLowestPart(state); } @@ -701,6 +763,7 @@ if (multi == null) { multi = new MultiArchData(); } + multi.setRefX(xoff); } @@ -708,12 +771,14 @@ if (multi == null) { multi = new MultiArchData(); } + multi.setRefY(yoff); } /** * Get the multitile arch offset. - * @return multitile arch x offset or 0 on multitile heads and singletile arches + * @return multitile arch x offset or 0 on multitile heads and singletile + * arches */ public int getMultiRefX() { return multi != null ? multi.getRefX() : 0; @@ -721,17 +786,19 @@ /** * Get the multitile arch offset. - * @return multitile arch y offset or 0 on multitile heads and singletile arches + * @return multitile arch y offset or 0 on multitile heads and singletile + * arches */ public int getMultiRefY() { return multi != null ? multi.getRefY() : 0; } /** - * Returns number of parts for multipart heads. - * (*.getMultiRefCount() > 0) is often used as way to find multi-heads. + * Returns number of parts for multipart heads. (*.getMultiRefCount() > 0) + * is often used as way to find multi-heads. * @return number of parts - * @todo rename me, "Ref" is a term in Java short for "Reference" and this is not about "References" but about multi-tile arches. + * @todo rename me, "Ref" is a term in Java short for "Reference" and this + * is not about "References" but about multi-tile arches. */ public int getMultiRefCount() { return multi != null ? multi.getMultiRefCount() : 0; @@ -741,7 +808,10 @@ return multi != null; } - /** Initialize the multipart data object - must only be called for multipart arches */ + /** + * Initialize the multipart data object - must only be called for multipart + * arches. + */ public void initMultiData() { if (multi == null) { multi = new MultiArchData(); @@ -864,7 +934,7 @@ /** * Sets arch name. - * @param archName arch name. + * @param archName arch name */ public void setArchName(final String archName) { this.archName = archName != null ? archName.intern() : null; @@ -872,7 +942,7 @@ /** * Returns arch name. - * @return arch name. + * @return the arch name */ public String getArchName() { return archName; @@ -880,7 +950,7 @@ /** * Name which is best appropriate to describe this arch. (This can be - * arch/object name or default arch/object name) + * arch/object name or default arch/object name) * @return best suitable descriptive name */ public String getBestName() { @@ -950,7 +1020,7 @@ /** * Returns the arch text of this arch as String. - * @return arch text + * @return the arch text */ public String getArchText() { return archText.toString(); @@ -962,11 +1032,9 @@ } /** - * Set The "face >name>" field of a object. - * We need this for fast access. - * We set here the string name, the face number - * and we will handle invalid/double names - * including comparing with a default arch. + * Set The "face >name>" field of a object. We need this for fast + * access. We set here the string name, the face number and we will handle + * invalid/double names including comparing with a default arch. * @param name */ public boolean setRealFace(final String name) { @@ -984,11 +1052,12 @@ } /** - * We set here the real face of the objects, depending on the set face and the set animation. - * The rule is, that a active animation will overrule the default face. - * We will catch it here. - * This method should always be invoked after the face or animation has changed and no other change is expected right now, so the changes to - * animatio... [truncated message content] |
From: <der...@us...> - 2006-06-13 22:43:17
|
Revision: 151 Author: derdanny Date: 2006-06-13 15:43:08 -0700 (Tue, 13 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=151&view=rev Log Message: ----------- Fixed Mantis #419: Using the Replace feature throws NPE. Modified Paths: -------------- trunk/daimonin/src/daieditor/CMapViewBasic.java trunk/daimonin/src/daieditor/CopyBuffer.java trunk/daimonin/src/daieditor/ReplaceDialog.java trunk/daimonin/src/daieditor/map/MapControl.java Modified: trunk/daimonin/src/daieditor/CMapViewBasic.java =================================================================== --- trunk/daimonin/src/daieditor/CMapViewBasic.java 2006-06-13 14:16:33 UTC (rev 150) +++ trunk/daimonin/src/daieditor/CMapViewBasic.java 2006-06-13 22:43:08 UTC (rev 151) @@ -317,22 +317,6 @@ } /** - * Get Iterable of all MapSquares - * @return Iterable of all MapSquares - */ - public Iterable<MapSquare> getAllSquares() { - final Dimension mapSize = mapModel.getMapSize(); - final List<MapSquare> selection = new ArrayList<MapSquare>(mapSize.width * mapSize.height); - final Point pos = new Point(); - for (pos.x = 0; pos.x < mapSize.width; pos.x++) { - for (pos.y = 0; pos.y < mapSize.height; pos.y++) { - selection.add(mapModel.getMapSquare(pos)); - } - } - return selection; - } - - /** * Highlight the tile at given coordinates (just as if it had been selected with leftclick). * Besides, the mapview is always centered on the coordinates as far as possible. * @param pos coordinate Modified: trunk/daimonin/src/daieditor/CopyBuffer.java =================================================================== --- trunk/daimonin/src/daieditor/CopyBuffer.java 2006-06-13 14:16:33 UTC (rev 150) +++ trunk/daimonin/src/daieditor/CopyBuffer.java 2006-06-13 22:43:08 UTC (rev 151) @@ -362,12 +362,17 @@ if (mapControl == null) { return null; } - final List<MapSquare> selectedMapSquares = mapControl.getMapViewFrame().view.getSelectedSquares(); + final CMapViewIFrame mapViewIFrame = mapControl.getMapViewFrame(); final Iterable<MapSquare> mapSquares; - if (selectedMapSquares.size() == 0) { - mapSquares = mapControl.getMapViewFrame().view.getAllSquares(); + if (mapViewIFrame == null) { + mapSquares = mapControl.getAllSquares(); } else { - mapSquares = selectedMapSquares; + final List<MapSquare> selectedMapSquares = mapViewIFrame.view.getSelectedSquares(); + if (selectedMapSquares.size() == 0) { + mapSquares = mapControl.getAllSquares(); + } else { + mapSquares = selectedMapSquares; + } } final List<ArchObject> objects = new ArrayList<ArchObject>(max); for (final MapSquare mapSquare : mapSquares) { @@ -473,7 +478,7 @@ * Returns mapControl for{@link #copyMap}. * @return mapControl for */ - public MapControl getCopyMapCtrl() { + @Nullable public MapControl getCopyMapCtrl() { return copyMapCtrl; } Modified: trunk/daimonin/src/daieditor/ReplaceDialog.java =================================================================== --- trunk/daimonin/src/daieditor/ReplaceDialog.java 2006-06-13 14:16:33 UTC (rev 150) +++ trunk/daimonin/src/daieditor/ReplaceDialog.java 2006-06-13 22:43:08 UTC (rev 151) @@ -25,7 +25,6 @@ package daieditor; -import static net.sf.japi.swing.ActionFactory.getFactory; import daieditor.arch.ArchObject; import daieditor.map.MapControl; import daieditor.map.MapSquare; @@ -47,6 +46,7 @@ import javax.swing.JTextField; import static javax.swing.WindowConstants.HIDE_ON_CLOSE; import net.sf.japi.swing.ActionFactory; +import static net.sf.japi.swing.ActionFactory.getFactory; /** * This dialog manages the replace action. @@ -137,7 +137,7 @@ replaceCopyBuffer = CopyBuffer.getMapArchList(mainControl.getCopyMapCtrl(), 100); if (!isBuilt) { - this.mc = mapControl; + mc = mapControl; final JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 2, 5)); @@ -148,7 +148,8 @@ line1.add(labelon); line1.add(Box.createVerticalStrut(3)); replaceEntireBox = new JComboBox(new String[]{ACTION_FACTORY.getString("replaceOnMap"), ACTION_FACTORY.getString("replaceOnSelection")}); - if (mapControl.getMapViewFrame().isHighlight()) { + final CMapViewIFrame mapViewIFrame = mapControl.getMapViewFrame(); + if (mapViewIFrame != null && mapViewIFrame.isHighlight()) { replaceEntireBox.setSelectedIndex(1); } else { replaceEntireBox.setSelectedIndex(0); @@ -222,7 +223,7 @@ rfHeading.setText('\"' + mapControl.getMapFileName() + "\":"); replaceInput1.setText(""); - this.mc = mapControl; + mc = mapControl; if (replaceArch == null) { replaceWithBox.setSelectedIndex(1); iconLabel.setIcon(null); @@ -234,7 +235,8 @@ rfArchName.setText(' ' + replaceArch.getBestName()); colonLabel.setText(":"); } - if (mapControl.getMapViewFrame().isHighlight()) { + final CMapViewIFrame mapViewIFrame = mapControl.getMapViewFrame(); + if (mapViewIFrame != null && mapViewIFrame.isHighlight()) { replaceEntireBox.setSelectedIndex(1); // selected squares } else { replaceEntireBox.setSelectedIndex(0); // entire map Modified: trunk/daimonin/src/daieditor/map/MapControl.java =================================================================== --- trunk/daimonin/src/daieditor/map/MapControl.java 2006-06-13 14:16:33 UTC (rev 150) +++ trunk/daimonin/src/daieditor/map/MapControl.java 2006-06-13 22:43:08 UTC (rev 151) @@ -660,11 +660,11 @@ mapViewFrame = new CMapViewIFrame(mainControl, this, ++viewCounter); mapViewIFrames.add(mapViewFrame); if (!isPickmap) { - assert mapViewFrame != null; mainControl.getMainView().addLevelView(mapViewFrame); assert mapViewFrame != null; mapViewFrame.setAutoscrolls(true); } + assert mapViewFrame != null; return mapViewFrame; } @@ -718,4 +718,12 @@ public void setFocus(final CMapViewIFrame view) { mapViewFrame = view; } + + /** + * Get Iterable of all MapSquares. + * @return Iterable of all MapSquares + */ + public Iterable<MapSquare> getAllSquares() { + return mapModel; + } } // class MapControl This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <der...@us...> - 2006-06-13 14:16:48
|
Revision: 150 Author: derdanny Date: 2006-06-13 07:16:33 -0700 (Tue, 13 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=150&view=rev Log Message: ----------- Added function to menu that allows opening multiple views of a map. Modified Paths: -------------- trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/CMainView.java trunk/daimonin/src/daieditor/action.properties trunk/daimonin/src/daieditor/messages.properties Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-06-13 12:27:40 UTC (rev 149) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-06-13 14:16:33 UTC (rev 150) @@ -36,8 +36,6 @@ import daieditor.arch.face.FaceObjects; import daieditor.arch.match.MutableOrArchObjectMatcher; import daieditor.arch.match.ViewArchObjectMatcherManager; -import net.sf.gridarta.gui.HideFileFilterProxy; -import net.sf.gridarta.GridderException; import daieditor.gui.MapFileFilter; import daieditor.gui.map.MapCursorControl; import daieditor.gui.map.MapPreviewAccessory; @@ -111,6 +109,8 @@ import static javax.swing.JOptionPane.showMessageDialog; import static javax.swing.KeyStroke.getKeyStroke; import javax.swing.filechooser.FileFilter; +import net.sf.gridarta.GridderException; +import net.sf.gridarta.gui.HideFileFilterProxy; import net.sf.japi.swing.ActionFactory; import static net.sf.japi.swing.ActionFactory.getFactory; import net.sf.japi.swing.TipOfTheDayManager; @@ -1491,6 +1491,11 @@ } } + /** Invoked when user wants to create a new view of the current level. */ + public void mapCreateView() { + currentMap.createView(); + } + /** Invoked when user wants to see/edit the level properties. */ public void mapProperties() { showMapProperties(currentMap); Modified: trunk/daimonin/src/daieditor/CMainView.java =================================================================== --- trunk/daimonin/src/daieditor/CMainView.java 2006-06-13 12:27:40 UTC (rev 149) +++ trunk/daimonin/src/daieditor/CMainView.java 2006-06-13 14:16:33 UTC (rev 150) @@ -767,6 +767,8 @@ private final Action aEnterExit = ACTION_FACTORY.createAction(true, "enterExit", mainControl); + private final Action aMapCreateView = ACTION_FACTORY.createAction(true, "mapCreateView", mainControl); + private final Action aMapProperties = ACTION_FACTORY.createAction(true, "mapProperties", mainControl); private final Action aAddNewPickmap = ACTION_FACTORY.createAction(true, "addNewPickmap", mainControl); @@ -832,6 +834,7 @@ aClose.setEnabled(fLevelEdited); aSave.setEnabled(mapState && mainControl.isPlainSaveEnabled()); aSaveAs.setEnabled(fLevelEdited); + aMapCreateView.setEnabled(mapState); aMapProperties.setEnabled(mapState); aReplace.setEnabled(mapState); aSelectAll.setEnabled(mapState); Modified: trunk/daimonin/src/daieditor/action.properties =================================================================== --- trunk/daimonin/src/daieditor/action.properties 2006-06-13 12:27:40 UTC (rev 149) +++ trunk/daimonin/src/daieditor/action.properties 2006-06-13 14:16:33 UTC (rev 150) @@ -10,7 +10,7 @@ main.menubar=file edit map cursor pickmaps resources tools view window help file.menu=createNew open recent close closeAll - save saveAs revert createImg - options - exit edit.menu=undo redo - clear cut copy paste - replace fillAbove fillBelow randFillAbove randFillBelow - selectAll -map.menu=enterExit enterNorthMap enterEastMap enterSouthMap enterWestMap enterNorthEastMap enterSouthEastMap enterSouthWestMap enterNorthWestMap - mapProperties +map.menu=enterExit enterNorthMap enterEastMap enterSouthMap enterWestMap enterNorthEastMap enterSouthEastMap enterSouthWestMap enterNorthWestMap - mapCreateView mapProperties cursor.menu=moveCursor - selectTile startStopDrag addToSelection subFromSelection releaseDrag - insertArch deleteArch - selectArchAbove selectArchBelow - archAttributes pickmaps.menu=lockAllPickmaps - addNewPickmap closePickmap - openPickmapMap - savePickmap revertPickmap Modified: trunk/daimonin/src/daieditor/messages.properties =================================================================== --- trunk/daimonin/src/daieditor/messages.properties 2006-06-13 12:27:40 UTC (rev 149) +++ trunk/daimonin/src/daieditor/messages.properties 2006-06-13 14:16:33 UTC (rev 150) @@ -523,6 +523,8 @@ enterNorthWestMap.text=Enter Northwest Map enterNorthWestMap.accel=ctrl pressed NUMPAD8 +mapCreateView.text=Create View + mapProperties.text=Map Properties mapProperties.accel=ctrl pressed M @@ -783,7 +785,7 @@ about.mnemonic=A about.title=About DaimoninEditor BETA3 v0.966 -about=<html><h1 align="center">Daimonin Editor</h1><h2 align="center">Version BETA3 v0.966</h2><table><tr><td valign="top" align="right" width="50%">Copyright \xA9 2001-2006</td><td width="50%">Michael Toennies<br>Andreas Vogl<br>Peter Plischewsky<br>Gecko<br>Christian Hujer<br>Daniel Viegas</td></tr><tr><td align="right">Java version:</td><td>{0}</td></tr><tr><td align="right">Build number:</td><td>{1}</td></tr><tr><td align="right">by:</td><td>{2}</td></tr><tr><td align="right">at:</td><td>{3}</td></tr></table></html> +about=<html><h1 align="center">Daimonin Editor</h1><h2 align="center">Version BETA3 v0.966</h2><table><tr><td valign="top" align="right" width="50%">Copyright � 2001-2006</td><td width="50%">Michael Toennies<br>Andreas Vogl<br>Peter Plischewsky<br>Gecko<br>Christian Hujer<br>Daniel Viegas</td></tr><tr><td align="right">Java version:</td><td>{0}</td></tr><tr><td align="right">Build number:</td><td>{1}</td></tr><tr><td align="right">by:</td><td>{2}</td></tr><tr><td align="right">at:</td><td>{3}</td></tr></table></html> aboutTab.title=About license.text=License... This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <der...@us...> - 2006-06-13 12:27:49
|
Revision: 149 Author: derdanny Date: 2006-06-13 05:27:40 -0700 (Tue, 13 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=149&view=rev Log Message: ----------- Fixed Mantis #421: Attribute editor doesn't like zero ("0" or "0.0") values for speed. Modified Paths: -------------- trunk/daimonin/src/daieditor/CAttribDialog.java Modified: trunk/daimonin/src/daieditor/CAttribDialog.java =================================================================== --- trunk/daimonin/src/daieditor/CAttribDialog.java 2006-06-13 04:24:56 UTC (rev 148) +++ trunk/daimonin/src/daieditor/CAttribDialog.java 2006-06-13 12:27:40 UTC (rev 149) @@ -44,8 +44,6 @@ import daieditor.arch.ArchObject; import daieditor.arch.NamedObject; import daieditor.arch.NamedObjects; -import net.sf.gridarta.help.Help; -import net.sf.gridarta.GridderException; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Color; @@ -107,6 +105,8 @@ import javax.swing.text.Style; import javax.swing.text.StyleConstants; import javax.swing.text.StyleContext; +import net.sf.gridarta.GridderException; +import net.sf.gridarta.help.Help; import net.sf.japi.swing.ActionFactory; import static net.sf.japi.swing.ActionFactory.getFactory; import static net.sf.japi.util.Arrays2.linearSearch; @@ -1069,7 +1069,7 @@ } else if (dType == INT || dType == LONG || dType == FLOAT) { // an int attribute if ("0".equals(((DialogAttrib<JFormattedTextField>) attr).input.getText())) { - if (defarch.getAttributeInt(attr.ref.getNameOld(), false) != 0) { + if (defarch.getAttributeDouble(attr.ref.getNameOld(), false) != 0) { newArchText = newArchText + attr.ref.getNameOld() + " " + (dType == FLOAT ? "0.0" : "0") + "\n"; } } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-06-13 04:25:28
|
Revision: 148 Author: akirschbaum Date: 2006-06-12 21:24:56 -0700 (Mon, 12 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=148&view=rev Log Message: ----------- Unify comments and whitespace. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMapArchPanel.java trunk/crossfire/src/cfeditor/CMapFileDecode.java trunk/crossfire/src/cfeditor/CMapFileEncode.java trunk/crossfire/src/cfeditor/CMapTileList.java trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/CMapViewIFrame.java trunk/crossfire/src/cfeditor/CMapViewInterface.java trunk/crossfire/src/cfeditor/CNewMapDialog.java trunk/crossfire/src/cfeditor/CPickmapPanel.java trunk/crossfire/src/cfeditor/CopyBuffer.java trunk/crossfire/src/cfeditor/IGUIConstants.java trunk/crossfire/src/cfeditor/MultiArchData.java trunk/crossfire/src/cfeditor/MultiPositionData.java trunk/daimonin/src/daieditor/CMapArchPanel.java trunk/daimonin/src/daieditor/CMapFileDecode.java trunk/daimonin/src/daieditor/CMapFileEncode.java trunk/daimonin/src/daieditor/CMapTileList.java trunk/daimonin/src/daieditor/CMapViewBasic.java trunk/daimonin/src/daieditor/CMapViewIFrame.java trunk/daimonin/src/daieditor/CMapViewInterface.java trunk/daimonin/src/daieditor/CNewMapDialog.java trunk/daimonin/src/daieditor/CPickmapPanel.java trunk/daimonin/src/daieditor/CopyBuffer.java trunk/daimonin/src/daieditor/IGUIConstants.java trunk/daimonin/src/daieditor/MultiPositionData.java Modified: trunk/crossfire/src/cfeditor/CMapArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-06-12 21:07:14 UTC (rev 147) +++ trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-06-13 04:24:56 UTC (rev 148) @@ -84,10 +84,12 @@ /** Serial Version UID. */ private static final long serialVersionUID = 1L; + /** {@inheritDoc} */ @Override public boolean getScrollableTracksViewportWidth() { return getSize().width < getParent().getSize().width; } + /** {@inheritDoc} */ @Override public void setSize(final Dimension d) { if (d.width < getParent().getSize().width) { d.width = getParent().getSize().width; @@ -818,6 +820,7 @@ doc.insertString(doc.getLength(), arch.diffArchText(mainControl.getArchObjectStack().getArch(arch.getNodeNr()).getArchText(), true), currentAttributes); } } catch (final BadLocationException e) { + // TODO } archEdit.setCaretPosition(0); Modified: trunk/crossfire/src/cfeditor/CMapFileDecode.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapFileDecode.java 2006-06-12 21:07:14 UTC (rev 147) +++ trunk/crossfire/src/cfeditor/CMapFileDecode.java 2006-06-13 04:24:56 UTC (rev 148) @@ -55,7 +55,7 @@ /* first arch for multis (last arch not being "more") */ //private ArchObject firstArch; - /** contains the map arch (see MapArchObject class) */ + /** Contains the map arch (see MapArchObject class). */ private MapArchObject maparch; public CMapFileDecode() { @@ -127,7 +127,7 @@ /** - * our recursive accessible arch reader + * Our recursive accessible arch reader. * <p/> * WARNING: this implementation should fail with multi head settings * if there are multi part items in the inventory (but this is not yet @@ -318,4 +318,5 @@ return null; // this happens when the file end is reached } -} + +} // class CMapFileDecode Modified: trunk/crossfire/src/cfeditor/CMapFileEncode.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapFileEncode.java 2006-06-12 21:07:14 UTC (rev 147) +++ trunk/crossfire/src/cfeditor/CMapFileEncode.java 2006-06-13 04:24:56 UTC (rev 148) @@ -59,12 +59,13 @@ private String fname; + /** Create a CMapFileEncode instance. */ public CMapFileEncode(final CMainControl mainControl) { this.mainControl = mainControl; } /** - * write the whole map-data into a file + * Write the whole map-data into a file. * @param file mapfile * @param mapModel the MapModel to encode */ @@ -99,9 +100,9 @@ return; } } - } - } - } + } // node + } // y + } // x // second, we drop the multi part suckers out for (pos.x = 0; pos.x < size.width; pos.x++) { @@ -129,9 +130,9 @@ return; } } - } - } - } + } // node + } // y + } // x bufferedWriter.close(); fileWriter.close(); @@ -143,7 +144,7 @@ } /** - * Walk through the inventory of an arch and write everything into the file + * Walk through the inventory of an arch and write everything into the file. * @param start the container arch whose inventory is to be written * @return true if all writing actions successful */ @@ -584,4 +585,5 @@ private static void addKey(final String key) { keys.put(key, new Integer(idKey++)); } -} + +} // class CMapFileEncode Modified: trunk/crossfire/src/cfeditor/CMapTileList.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapTileList.java 2006-06-12 21:07:14 UTC (rev 147) +++ trunk/crossfire/src/cfeditor/CMapTileList.java 2006-06-13 04:24:56 UTC (rev 148) @@ -80,13 +80,15 @@ private int listCounter = 0; - // time of last click in the panel (value in msec by Date.getTime()) - // and arch-ID of arch that received last click + /** + * Time of last click in the panel (value in msec by Date.getTime()) + * and arch-ID of arch that received last click. + */ private long lastClick = -1; private int lastClickId = -1; - /* Build Panel */ + /** Build Panel */ CMapTileList(final CMainControl mainControl, final CMainView mainView) { this.mainControl = mainControl; this.mainView = mainView; @@ -490,5 +492,7 @@ return this; } - } -} + + } // class MyCellRenderer + +} // class CMapTileList Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-06-12 21:07:14 UTC (rev 147) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-06-13 04:24:56 UTC (rev 148) @@ -61,6 +61,17 @@ * different types of frames). An instance of this class must only exist in * "wrapper classes" like CMapViewIFrame which create a frame, showing the * mapview. + * <p/> + * Note for developers: To avoid confusion regarding terminology, please use + * the following consistent terminology: + * <dl> + * <dt>map coordinates</dt> + * <dd>coordinates within the map, ranging from <code>0</code> to + * <code><var>mapWidth</var></code> resp. + * <code><var>mapHeight</var></code></dd> + * <dt>mouse coordinates</dt> + * <dd>coordinates of the mouse as delivered by the AWT/Swing events</dd> + * </dl> * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ @@ -2008,4 +2019,5 @@ return "Paint"; } } -} + +} // class CMapViewBasic Modified: trunk/crossfire/src/cfeditor/CMapViewIFrame.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewIFrame.java 2006-06-12 21:07:14 UTC (rev 147) +++ trunk/crossfire/src/cfeditor/CMapViewIFrame.java 2006-06-13 04:24:56 UTC (rev 148) @@ -53,7 +53,7 @@ /** The controller of this view. */ private final MapControl mapControl; - /** the underlying mapview object */ + /** The underlying mapview object. */ private final CMapViewBasic view; /** @@ -228,4 +228,5 @@ * iframe*/ view.freeMap(); } -} + +} // class CMapViewIFrame Modified: trunk/crossfire/src/cfeditor/CMapViewInterface.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewInterface.java 2006-06-12 21:07:14 UTC (rev 147) +++ trunk/crossfire/src/cfeditor/CMapViewInterface.java 2006-06-13 04:24:56 UTC (rev 148) @@ -27,12 +27,13 @@ /** * A mapview consists of two classes: The CMapViewBasic instance which contains * the real mapview, and the wrapper frame class which extends a frame - * displaying the mapview. - * <p/> - * Now the communication "frame -> basic mapview" is no problem, but "basic - * mapview -> frame" can only be realized with this interface. + * displaying the mapview. Now the communication "frame -> basic mapview" is no + * problem, but "basic mapview -> frame" can only be realized with this + * interface. */ public interface CMapViewInterface { - void updateTitle(); // update the title on the frame -} + /** Update the title on the frame. */ + void updateTitle(); + +} // interface CMapViewInterface Modified: trunk/crossfire/src/cfeditor/CNewMapDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CNewMapDialog.java 2006-06-12 21:07:14 UTC (rev 147) +++ trunk/crossfire/src/cfeditor/CNewMapDialog.java 2006-06-13 04:24:56 UTC (rev 148) @@ -57,9 +57,10 @@ /** Serial Version UID. */ private static final long serialVersionUID = 1L; - // map types: + /** Map types. */ public static final int TYPE_CFMAP = 0; + /** Map types. */ public static final int TYPE_PICKMAP = 1; /** The key value used to store the last used tile width to INI file. */ Modified: trunk/crossfire/src/cfeditor/CPickmapPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CPickmapPanel.java 2006-06-12 21:07:14 UTC (rev 147) +++ trunk/crossfire/src/cfeditor/CPickmapPanel.java 2006-06-13 04:24:56 UTC (rev 148) @@ -57,10 +57,10 @@ private JTabbedPane tabpane = null; // tab pane with pickmaps - /** all open pickmaps (the map controllers get stored in the vector). */ + /** All open pickmaps (the map controllers get stored in the vector). */ private final Map<String, MapControl> pickmaps = new HashMap<String, MapControl>(); - /** the current active pickmap ontop */ + /** The current active pickmap ontop. */ private MapControl currentPickMap; /** Constructor */ @@ -121,7 +121,7 @@ } /** - * Open and load a pickmap from the given file + * Open and load a pickmap from the given file. * @param mapFile the map file * @return true when pickmap was opened successfully */ @@ -199,7 +199,7 @@ } /** - * add a new pickmap + * Add a new pickmap. * @param start first ArchObject of the pickmap * @param maparch the maparch of the pickmap * @return basic mapview @@ -289,6 +289,7 @@ /** * Add the PickmapSelectionListener to the pickmap tabbed panel * @param pickpane the panel with pickmaps + * @todo this method's name is a Bad Thing */ public void addPickmapSelectionListener(final JTabbedPane pickpane) { pickpane.addChangeListener(new PickmapSelectionListener( @@ -299,13 +300,13 @@ * Add the ArchNPickChangeListener to the panel containing both * arcglist and pickmaps. * @param pane the left-side panel + * @todo this method's name is a Bad Thing */ public void addArchNPickChangeListener(final JTabbedPane pane) { - pane.addChangeListener(new ArchNPickChangeListener( - mainControl.getMainView(), pane)); + pane.addChangeListener(new ArchNPickChangeListener(mainControl.getMainView(), pane)); } - // ------------------------ subclasses ------------------------ + // ------------------------ nested and inner classes ------------------------ /** listener class to keep track of the currently active pickmap */ public final class PickmapSelectionListener implements ChangeListener { @@ -324,8 +325,9 @@ updateActivePickmap(); } } - } + } // class PickmapSelectionListener + /** * In the left-side panel, archlist and pickmaps are exclusive * (only the one being displayed is active). @@ -363,6 +365,7 @@ selectedIndex = tabpane.getSelectedIndex(); // save new state } } + } // class ArchNPickChangeListener } // class CPickmapPanel Modified: trunk/crossfire/src/cfeditor/CopyBuffer.java =================================================================== --- trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-06-12 21:07:14 UTC (rev 147) +++ trunk/crossfire/src/cfeditor/CopyBuffer.java 2006-06-13 04:24:56 UTC (rev 148) @@ -34,20 +34,22 @@ import org.apache.log4j.Logger; /** - * This class manages the cut/copy/paste actions in maps. The data is - * stored in an ordinary map-object. The CopyBuffer instance is - * currently attached to CMainControl. + * This class manages the cut/copy/paste actions in maps. The data is stored in + * an ordinary but invisible map-object. The CopyBuffer instance is currently + * attached to CMainControl. * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ public final class CopyBuffer { private static final Logger LOG = Logger.getLogger(CopyBuffer.class); - // Constants for the CopyNCut function + /** Clear the selection. */ private static final int DO_CLEAR = 1; + /** Cut the selection. */ private static final int DO_CUT = 2; + /** Copy the selection. */ private static final int DO_COPY = 3; private final CMainControl mainControl; // reference to main control @@ -65,7 +67,7 @@ private int bufHeight; // buffer's height (counted in tiles) /** - * Konstructor + * Create the copy buffer. * @param mainControl main control */ public CopyBuffer(final CMainControl mainControl) { @@ -84,8 +86,9 @@ } /** - * Get the info weither CopyBuffer is empty. - * @return true if the copybuffer is empty + * Return whether this CopyBuffer is empty. + * @return <code>true</code> if this CopyBuffer is empty, otherwise + * <code>false</code> */ public boolean isEmpty() { return isEmpty; @@ -116,7 +119,7 @@ } /** - * CopyNCut implements clear, cut and copy in one function (since they are + * copyNCut implements clear, cut and copy in one function (since they are * so similar). * @param mapControl MapControl of the active map where we copy from * @param mode defines if we have a cut, copy or paste action @@ -305,7 +308,7 @@ * Excecuting the Fill command. * @param mapControl MapControl of the active map we paste on * @param fillBelow if true, the filling content is placed *below* the - * existing map + * existing map */ public void fill(final MapControl mapControl, final boolean fillBelow) { final Point startp = mapControl.getMapView().getHighlightStart(); // start of highlighted rect Modified: trunk/crossfire/src/cfeditor/IGUIConstants.java =================================================================== --- trunk/crossfire/src/cfeditor/IGUIConstants.java 2006-06-12 21:07:14 UTC (rev 147) +++ trunk/crossfire/src/cfeditor/IGUIConstants.java 2006-06-13 04:24:56 UTC (rev 148) @@ -138,7 +138,7 @@ /** * The directory that contains all configuration files (careful - if you - * change this, check directory creation for file writing) + * change this, check directory creation for file writing). */ String CONFIG_DIR = "resource" + File.separator + "conf"; @@ -163,18 +163,18 @@ String ARTIFACTS_FILE = ""; - // Application image definitions + /** Application image definitions. */ String STARTUP_IMAGE = "CFIntro.gif"; /** Background Color (for the Panels). */ Color BG_COLOR = new Color(100, 219, 169); - // color for float/int values (AttribDialog) + /** Color for float/int values (AttribDialog). */ Color FLOAT_COLOR = new Color(19, 134, 0); Color INT_COLOR = new Color(74, 70, 156); - // application icon definitions (icon-dir) + /** Application icon definitions (icon-dir). */ String APP_ICON = "CFIcon.gif"; String NEW_LEVEL_ICON = "NewLevelIcon.gif"; @@ -269,7 +269,7 @@ String TILE_TR_NO = "treasure_no.png"; // --- misc. constants --- - // directions + // directions (don't change the values. see tile_path[] in MapArchObject) int NORTH = 0; int EAST = 1; @@ -283,4 +283,5 @@ int BOTTOM = 5; int DIRECTIONS = 6; -} + +} // interface IGUIConstants Modified: trunk/crossfire/src/cfeditor/MultiArchData.java =================================================================== --- trunk/crossfire/src/cfeditor/MultiArchData.java 2006-06-12 21:07:14 UTC (rev 147) +++ trunk/crossfire/src/cfeditor/MultiArchData.java 2006-06-13 04:24:56 UTC (rev 148) @@ -27,7 +27,7 @@ import cfeditor.arch.ArchObject; /** - * Subclass of ArchObject to store multipart information. + * Class related to ArchObject to store multipart information. * This data is only needed by multiparts. When the editor is running, * usually a big number of ArchObjects exist - most of them single-tile * objects. The encapsulation of this "multpart-only" data can save @@ -216,4 +216,5 @@ public void setNext(final ArchObject node) { nextref = node; } -} + +} // class MultiArchData Modified: trunk/crossfire/src/cfeditor/MultiPositionData.java =================================================================== --- trunk/crossfire/src/cfeditor/MultiPositionData.java 2006-06-12 21:07:14 UTC (rev 147) +++ trunk/crossfire/src/cfeditor/MultiPositionData.java 2006-06-13 04:24:56 UTC (rev 148) @@ -124,13 +124,13 @@ } /** - * Calculate the X-offset from the leftmost pixel of the big face image and - * the default X-position (The default position is where a single-tile + * Calculate the x-offset from the leftmost pixel of the big face image and + * the default x-position (The default position is where a single-tile * image would be put). - * @param shapeID ID number for the multisquare shape (-> rows in position - * data file) + * @param shapeID ID number for the multisquare shape (-> rows in position + * data file) * @param positionID number of tile in the big bunch - * @return X-offset + * @return x-offset */ public static synchronized int getXOffset(final int shapeID, final int positionID) { if (instance != null) { @@ -140,13 +140,13 @@ } /** - * Calculate the Y-offset from the topmost pixel of the big face image and - * the default Y-position (The default position is where a single-tile + * Calculate the y-offset from the topmost pixel of the big face image and + * the default y-position (The default position is where a single-tile * image would be put). - * @param shapeID ID number for the multisquare shape (-> rows in position - * data file) + * @param shapeID ID number for the multisquare shape (-> rows in position + * data file) * @param positionID number of tile in the big bunch - * @return Y-offset + * @return y-offset */ public static synchronized int getYOffset(final int shapeID, final int positionID) { if (instance != null) { Modified: trunk/daimonin/src/daieditor/CMapArchPanel.java =================================================================== --- trunk/daimonin/src/daieditor/CMapArchPanel.java 2006-06-12 21:07:14 UTC (rev 147) +++ trunk/daimonin/src/daieditor/CMapArchPanel.java 2006-06-13 04:24:56 UTC (rev 148) @@ -73,8 +73,8 @@ import static net.sf.japi.swing.ActionFactory.getFactory; /** - * <code>CMapArchPanel</code> implements the panel that holds information - * about the currently selected ArchObject on the map. + * <code>CMapArchPanel</code> implements the panel that holds information about + * the currently selected ArchObject on the map. * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> * @author <a href="mailto:ch...@it...">Christian Hujer</a> @@ -146,9 +146,11 @@ private final Document document; - private final JPanel archPanel; // panel with name/face etc + /** panel with name/face etc */ + private final JPanel archPanel; - private JPanel textPanel; // panel with message text + /** panel with message text */ + private JPanel textPanel; private final JPanel animationPanel; @@ -158,9 +160,11 @@ /** The JPanel holding the error information. */ private final ErrorListView errorListView = new ErrorListView(); - private final JTextArea archTextArea = new JTextArea(4, 25); // arch text field + /** arch text field */ + private final JTextArea archTextArea = new JTextArea(4, 25); - private final JTextField archNameField = new JTextField(14); // arch name field + /** arch name field */ + private final JTextField archNameField = new JTextField(14); // private JLabel archInvCount = new JLabel(); private final JLabel archMapPos = new JLabel(); @@ -801,6 +805,7 @@ } return; } + // If the active arch is part of a multi, the mutli-head's stats // are displayed (Only the head can store information!). final ArchObject arch; @@ -1013,9 +1018,10 @@ } /** - * This method is invoked when the user pressed the "edit script"/"path"/"remove" - * button from the script panel. - * If there is a valid selection in the event list, the appropriate action for this script is triggered. + * This method is invoked when the user pressed the "edit + * script"/"path"/"remove" button from the script panel. If there is a + * valid selection in the event list, the appropriate action for this + * script is triggered. */ public void editScriptWanted(final int task) { ArchObject arch = mainControl.getMainView().getMapTileSelection(); // get selected arch Modified: trunk/daimonin/src/daieditor/CMapFileDecode.java =================================================================== --- trunk/daimonin/src/daieditor/CMapFileDecode.java 2006-06-12 21:07:14 UTC (rev 147) +++ trunk/daimonin/src/daieditor/CMapFileDecode.java 2006-06-13 04:24:56 UTC (rev 148) @@ -53,7 +53,8 @@ /** ArchObjects that are read from the map. */ private List<ArchObject> objects; - private MapArchObject maparch; // contains the map arch (see MapArchObject class) + /** Contains the map arch (see MapArchObject class). */ + private MapArchObject maparch; public CMapFileDecode() { } @@ -233,6 +234,7 @@ System.err.println("Read Error while trying to load map: " + maparch.getFileName()); throw e; // we simply pass this exception to the calling function } + return null; // this happens when the file end is reached } Modified: trunk/daimonin/src/daieditor/CMapFileEncode.java =================================================================== --- trunk/daimonin/src/daieditor/CMapFileEncode.java 2006-06-12 21:07:14 UTC (rev 147) +++ trunk/daimonin/src/daieditor/CMapFileEncode.java 2006-06-13 04:24:56 UTC (rev 148) @@ -60,7 +60,7 @@ /** * Write the whole map-data into a file. * @param file mapfile - * @param mapModel map header (<code>MapArchObject</code>) + * @param mapModel the MapModel to encode */ public void encodeMapFile(final File file, final MapModel mapModel) throws FileNotFoundException, IOException { final MapArchObject mapArch = mapModel.getMapArch(); @@ -176,6 +176,7 @@ } arch.setArchText(newArchText.toString()); } + // now append the type to the archtext writer.write("type "); writer.write(Integer.toString(arch.getArchTypNr())); Modified: trunk/daimonin/src/daieditor/CMapTileList.java =================================================================== --- trunk/daimonin/src/daieditor/CMapTileList.java 2006-06-12 21:07:14 UTC (rev 147) +++ trunk/daimonin/src/daieditor/CMapTileList.java 2006-06-13 04:24:56 UTC (rev 148) @@ -436,8 +436,10 @@ } } } + return this; } + } // class MyCellRenderer } // class CMapTileList Modified: trunk/daimonin/src/daieditor/CMapViewBasic.java =================================================================== --- trunk/daimonin/src/daieditor/CMapViewBasic.java 2006-06-12 21:07:14 UTC (rev 147) +++ trunk/daimonin/src/daieditor/CMapViewBasic.java 2006-06-13 04:24:56 UTC (rev 148) @@ -56,16 +56,19 @@ import org.jetbrains.annotations.Nullable; /** - * <code>CMapViewBasic</code> is the true mapview object. However, - * it is not bound to a certain type of frame (in order to allow maps - * be displayed in different types of frames). - * An instance of this class must only exist in "wrapper classes" - * like CMapViewIFrame which create a frame, showing the mapview. + * <code>CMapViewBasic</code> is the true mapview object. However, it is not + * bound to a certain type of frame (in order to allow maps be displayed in + * different types of frames). An instance of this class must only exist in + * "wrapper classes" like CMapViewIFrame which create a frame, showing the + * mapview. * <p/> - * Note for developers: To avoid confusion regarding terminology, please use the following consistent terminology: + * Note for developers: To avoid confusion regarding terminology, please use + * the following consistent terminology: * <dl> * <dt>map coordinates</dt> - * <dd>coordinates within the map, ranging from <code>0</code> to <code><var>mapWidth</var></code> resp. <code><var>mapHeight</var></code></dd> + * <dd>coordinates within the map, ranging from <code>0</code> to + * <code><var>mapWidth</var></code> resp. + * <code><var>mapHeight</var></code></dd> * <dt>mouse coordinates</dt> * <dd>coordinates of the mouse as delivered by the AWT/Swing events</dd> * </dl> @@ -493,4 +496,5 @@ public void mapCursorChangedMode(final MapCursorEvent e) { // Ignore mode change events } + } // class CMapViewBasic Modified: trunk/daimonin/src/daieditor/CMapViewIFrame.java =================================================================== --- trunk/daimonin/src/daieditor/CMapViewIFrame.java 2006-06-12 21:07:14 UTC (rev 147) +++ trunk/daimonin/src/daieditor/CMapViewIFrame.java 2006-06-13 04:24:56 UTC (rev 148) @@ -38,12 +38,13 @@ import static javax.swing.KeyStroke.getKeyStroke; /** - * The <code>CMapViewIFrame</code> is mainly a wrapper class which - * creates a basic mapview (-> CMapViewBasic) and displays it in a + * The <code>CMapViewIFrame</code> is mainly a wrapper class which creates a + * basic mapview (-> CMapViewBasic) and displays it in a * <code>JInternalFrame</code>. - * Admittedly the implementation is not as clean as it could be, - * because the CMapViewBasic is still tied with this object to a - * certain degree. Full seperation would be nasty to do. + * <p/> + * Admittedly the implementation is not as clean as it could be, because the + * CMapViewBasic is still tied with this object to a certain degree. Full + * seperation would be nasty to do. * @author <a href="mailto:and...@gm...">Andreas Vogl</a> * @fixme these are also created for Pickmaps */ @@ -58,7 +59,8 @@ /** The controller of this view. */ private final CMainControl mainControl; - public final CMapViewBasic view; // the underlying mapview object + /** The underlying mapview object. */ + public final CMapViewBasic view; /** Number of this view. */ private final int viewNumber; @@ -90,8 +92,8 @@ /** * Okay, this is a bit of a hack. True seperation of mapview and - * frame-component would really mess up the code, or maybe make - * it "cleaner" but blow things up tenfold. + * frame-component would really mess up the code, or maybe make it + * "cleaner" but blow things up tenfold. * @return basic view component */ public CMapViewBasic getBasicView() { @@ -131,6 +133,10 @@ return view.getActiveEditType(); } + /** + * Returns the controller of this view. + * @return the controller of this view. + */ public MapControl getMapControl() { return mapControl; } Modified: trunk/daimonin/src/daieditor/CMapViewInterface.java =================================================================== --- trunk/daimonin/src/daieditor/CMapViewInterface.java 2006-06-12 21:07:14 UTC (rev 147) +++ trunk/daimonin/src/daieditor/CMapViewInterface.java 2006-06-13 04:24:56 UTC (rev 148) @@ -25,11 +25,11 @@ package daieditor; /** - * A mapview consists of two classes: The CMapViewBasic instance which - * contains the real mapview, and the wrapper frame class which extends - * a frame displaying the mapview. - * Now the communication "frame -> basic mapview" is no problem, - * but "basic mapview -> frame" can only be realized with this interface. + * A mapview consists of two classes: The CMapViewBasic instance which contains + * the real mapview, and the wrapper frame class which extends a frame + * displaying the mapview. Now the communication "frame -> basic mapview" is no + * problem, but "basic mapview -> frame" can only be realized with this + * interface. */ public interface CMapViewInterface { Modified: trunk/daimonin/src/daieditor/CNewMapDialog.java =================================================================== --- trunk/daimonin/src/daieditor/CNewMapDialog.java 2006-06-12 21:07:14 UTC (rev 147) +++ trunk/daimonin/src/daieditor/CNewMapDialog.java 2006-06-13 04:24:56 UTC (rev 148) @@ -51,9 +51,9 @@ import net.sf.japi.swing.ActionFactory; /** - * Dialog used to ask the user the properties for the new level. - * Contains a tabbed pane for creating a level either based on a template - * or from a scratch. + * Dialog used to ask the user the properties for the new level. Contains a + * tabbed pane for creating a level either based on a template or from a + * scratch. * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> * @author <a href="mailto:Chr...@it...">Christian Hujer</a> Modified: trunk/daimonin/src/daieditor/CPickmapPanel.java =================================================================== --- trunk/daimonin/src/daieditor/CPickmapPanel.java 2006-06-12 21:07:14 UTC (rev 147) +++ trunk/daimonin/src/daieditor/CPickmapPanel.java 2006-06-13 04:24:56 UTC (rev 148) @@ -59,10 +59,10 @@ private JTabbedPane tabpane; // tab pane with pickmaps - /** all open pickmaps (the map controllers get stored in the vector). */ + /** All open pickmaps (the map controllers get stored in the vector). */ private final List<MapControl> pickmaps = new ArrayList<MapControl>(); - /** the current active pickmap ontop */ + /** The current active pickmap ontop. */ private MapControl currentPickMap; /** Constructor */ @@ -255,7 +255,7 @@ } /** - * Get tab index of a pickmap in the JTabbedPane + * Get tab index of a pickmap in the JTabbedPane. * @param map control * @return tab index of pickmap, or -1 if it doesn't exist */ @@ -269,7 +269,7 @@ } /** - * Get tab index of a pickmap in the JTabbedPane by absolut file name + * Get tab index of a pickmap in the JTabbedPane by absolut file name. * @return tab index of pickmap, or -1 if it doesn't exist */ public int getPickmapTabIndexByName(final String name) { @@ -370,8 +370,9 @@ getInstance().getCurrentPickmap().getMapViewFrame().unHighlight(); mainControl.showArchPanelQuickObject(null); // send it to quick view } - } + } // class PickmapSelectionListener + /** * In the left-side panel, archlist and pickmaps are exclusive * (only the one being displayed is active). @@ -409,5 +410,7 @@ selectedIndex = tabpane.getSelectedIndex(); // save new state } } - } -} + + } // class ArchNPickChangeListener + +} // class CPickmapPanel Modified: trunk/daimonin/src/daieditor/CopyBuffer.java =================================================================== --- trunk/daimonin/src/daieditor/CopyBuffer.java 2006-06-12 21:07:14 UTC (rev 147) +++ trunk/daimonin/src/daieditor/CopyBuffer.java 2006-06-13 04:24:56 UTC (rev 148) @@ -38,8 +38,8 @@ import org.jetbrains.annotations.Nullable; /** - * This class manages the cut/copy/paste actions in maps. - * The data is stored in an ordinary but invisible map-object. + * This class manages the cut/copy/paste actions in maps. The data is stored in + * an ordinary but invisible map-object. * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ public final class CopyBuffer { @@ -87,14 +87,15 @@ /** * Return whether this CopyBuffer is empty. - * @return <code>true</code> if this CopyBuffer is empty, otherwise <code>false</code> + * @return <code>true</code> if this CopyBuffer is empty, otherwise + * <code>false</code> */ public boolean isEmpty() { return copyMap == null; } /** - * Executing the Clear command + * Executing the Clear command. * @param mapControl MapControl of the active map where we copy from */ public void clear(final MapControl mapControl) { @@ -102,7 +103,7 @@ } /** - * Excecuting the Cut command + * Excecuting the Cut command. * @param mapControl MapControl of the active map where we copy from */ public void cut(final MapControl mapControl) { @@ -110,7 +111,7 @@ } /** - * Excecuting the Copy command + * Excecuting the Copy command. * @param mapControl MapControl of the active map where we copy from */ public void copy(final MapControl mapControl) { @@ -118,8 +119,8 @@ } /** - * copyNCut implements clear, cut and copy in one function - * (since they are so similar). + * copyNCut implements clear, cut and copy in one function (since they are + * so similar). * @param mapControl MapControl of the active map where we copy from * @param mode defines if we have a cut, copy or paste action */ @@ -186,7 +187,7 @@ } /** - * Excecuting the Paste command + * Excecuting the Paste command. * @param mapControl MapControl of the active map we paste on * @todo paste only subregions when a region is selected */ @@ -248,9 +249,10 @@ } /** - * Excecuting the Fill command + * Excecuting the Fill command. * @param mapControl MapControl of the active map we paste on - * @param fillBelow if true, the filling content is placed *below* the existing map + * @param fillBelow if true, the filling content is placed *below* the + * existing map */ public void fill(final MapControl mapControl, final boolean fillBelow, final MapControl seed, final int rand) { Modified: trunk/daimonin/src/daieditor/IGUIConstants.java =================================================================== --- trunk/daimonin/src/daieditor/IGUIConstants.java 2006-06-12 21:07:14 UTC (rev 147) +++ trunk/daimonin/src/daieditor/IGUIConstants.java 2006-06-13 04:24:56 UTC (rev 148) @@ -122,18 +122,20 @@ int DEF_PICKMAP_HEIGHT = 20; // default height for pickmaps - // The directory that contains the common-use icons. + /** The directory that contains the common-use icons.*/ String ICON_DIR = "resource" + File.separator + "icons"; - // The directory that contains the system icons. + /** The directory that contains the system icons. */ String SYSTEM_DIR = "resource" + File.separator + "system"; - // The directory that contains all pickmaps. + /** The directory that contains all pickmaps. */ // public static final String PICKMAP_DIR = "resource"+File.separator+"pickmaps"; String PICKMAP_DIR = "dev" + File.separator + "editor" + File.separator + "pickmaps"; - // The directory that contains all configuration files - // (careful - if you change this, check directory creation for file writing) + /** + * The directory that contains all configuration files (careful - if you + * change this, check directory creation for file writing). + */ // public static final String CONFIG_DIR = "resource"+File.separator+"conf"; String CONFIG_DIR = "dev" + File.separator + "editor" + File.separator + "conf"; @@ -165,15 +167,15 @@ String ARTIFACTS_FILE = "artifacts"; // file with artifact definitions - // Background Color (for the Panels) + /** Background Color (for the Panels). */ Color BG_COLOR = new Color(100, 219, 169); - // color for float/int values (AttribDialog) + /** Color for float/int values (AttribDialog). */ Color FLOAT_COLOR = new Color(19, 134, 0); Color INT_COLOR = new Color(74, 70, 156); - // application icon definitions (icon-dir) + /** Application icon definitions (icon-dir). */ String APP_ICON = "CFIcon.gif"; // tile icons from the system dir: Modified: trunk/daimonin/src/daieditor/MultiPositionData.java =================================================================== --- trunk/daimonin/src/daieditor/MultiPositionData.java 2006-06-12 21:07:14 UTC (rev 147) +++ trunk/daimonin/src/daieditor/MultiPositionData.java 2006-06-13 04:24:56 UTC (rev 148) @@ -53,8 +53,8 @@ } /** - * This is the static init method. It is called once - * in the global initialization phase. + * This is the static init method. It is called once in the global + * initialization phase. */ public static synchronized void init() { if (instance == null) { @@ -64,8 +64,8 @@ } /** - * Load the array-data from file. An error is reported when the numbers - * in the file don't match expected array dimensions. + * Load the array-data from file. An error is reported when the numbers in + * the file don't match expected array dimensions. */ private void load() { CFileReader reader = null; @@ -135,8 +135,10 @@ /** * Calculate the x-offset from the leftmost pixel of the big face image and - * the default x-position (The default position is where a single-tile image would be put). - * @param shapeID ID number for the multisquare shape (-> rows in position data file) + * the default x-position (The default position is where a single-tile + * image would be put). + * @param shapeID ID number for the multisquare shape (-> rows in position + * data file) * @param positionID number of tile in the big bunch * @return x-offset */ @@ -149,8 +151,10 @@ /** * Calculate the y-offset from the topmost pixel of the big face image and - * the default y-position (The default position is where a single-tile image would be put). - * @param shapeID ID number for the multisquare shape (-> rows in position data file) + * the default y-position (The default position is where a single-tile + * image would be put). + * @param shapeID ID number for the multisquare shape (-> rows in position + * data file) * @param positionID number of tile in the big bunch * @return y-offset */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-06-12 21:07:42
|
Revision: 147 Author: akirschbaum Date: 2006-06-12 14:07:14 -0700 (Mon, 12 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=147&view=rev Log Message: ----------- Unify comments and whitespace. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CAttribBitmask.java trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/crossfire/src/cfeditor/CFArchAttrib.java trunk/crossfire/src/cfeditor/CFArchType.java trunk/crossfire/src/cfeditor/CFArchTypeList.java trunk/crossfire/src/cfeditor/CFJavaEditor.java trunk/crossfire/src/cfeditor/CFTreasureListTree.java trunk/crossfire/src/cfeditor/CFileInputStream.java trunk/crossfire/src/cfeditor/CFileReader.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMainView.java trunk/daimonin/src/daieditor/CAttribDialog.java trunk/daimonin/src/daieditor/CFArchType.java trunk/daimonin/src/daieditor/CFArchTypeList.java trunk/daimonin/src/daieditor/CFJavaEditor.java trunk/daimonin/src/daieditor/CFTreasureListTree.java trunk/daimonin/src/daieditor/CFileInputStream.java trunk/daimonin/src/daieditor/CFileReader.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/CMainView.java Modified: trunk/crossfire/src/cfeditor/CAttribBitmask.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribBitmask.java 2006-06-12 13:44:44 UTC (rev 146) +++ trunk/crossfire/src/cfeditor/CAttribBitmask.java 2006-06-12 21:07:14 UTC (rev 147) @@ -233,7 +233,9 @@ return textf; } - /** Open a popup frame to select bitmask-entries via chooseboxes. */ + /** + * Open a popup frame to select bitmask-entries via chooseboxes. + */ public void popupFrame(final CAttribDialog attrDialog, final CAttribDialog.BitmaskAttrib guiAttr) { final String title = "Choose " + guiAttr.ref.getNameNew().substring(0, 1).toUpperCase() + guiAttr.ref.getNameNew().substring(1); final JDialog frame = new JDialog(attrDialog, title, true); Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-06-12 13:44:44 UTC (rev 146) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-06-12 21:07:14 UTC (rev 147) @@ -72,7 +72,7 @@ import org.jetbrains.annotations.Nullable; /** - * CAttribDialog poses the GUI for CF object attributes + * CAttribDialog poses the GUI for Crossfire object attributes. * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ public final class CAttribDialog extends JDialog { @@ -139,15 +139,16 @@ private JButton applyButton; + /** The Button for cancel. */ private JButton cancelButton; - // central tabbed pane (the place where all the attribute tabs are) + /** Central tabbed pane (the place where all the attribute tabs are). */ private JTabbedPane tabbedPane; - // central pane, this is the parent component of above tabbed pane + /** Central pane, this is the parent component of above tabbed pane. */ private final JScrollPane paneCenter; - // text pane where the summary is displayed + /** Text pane where the summary is displayed. */ private final JTextPane summaryTP; /** @@ -336,7 +337,7 @@ } /** - * Construct the Combo box of the available arch-types + * Construct the Combo box of the available archetypes. * @param boxWidth width of the JChooseBox in pixels * @return a <code>JPanel</code> with the combo box in it */ @@ -372,11 +373,12 @@ } /** - * Construct the Combo box of the available spells - * @param attr spell-attribute + * Construct the Combo box of the available spells. + * @param attr spell attribute * @return the completed <code>JComboBox</code> */ private JComboBox buildSpellBox(final CFArchAttrib attr) { + // first parse the spell-number value from arch int spnum = arch.getAttributeValue(attr.getNameOld(), defarch); // spell number @@ -413,7 +415,7 @@ } /** - * Construct the Combo box for arrays of "list data" (this is used for T_LIST) + * Construct the Combo box for arrays of "list data" (this is used for T_LIST). * @param attr list attribute * @param listData Vector with list items and corresponding values * @return the completed <code>JComboBox</code> @@ -550,8 +552,8 @@ } /** - * Construct the central part of the attribute dialog, - * containing the object's arch attributes. + * Construct the central part of the attribute dialog, containing the + * object's arch attributes. * @return When this method is called the first time: a <code>JScrollPane</code> * with the central part of the dialog window. * All further calls rebuild the existing tabbedpane and return null. @@ -590,8 +592,8 @@ } /** - * This method creates an attribute panel for one section - * of attributes. If the section is empty, null is returned. + * This method creates an attribute panel for one section of attributes. If + * the section is empty, null is returned. * @param secId the identifier of the section * @return a <code>Component</code> containing the attribute panel */ @@ -975,7 +977,7 @@ } /** - * Looks up the section name from the ID + * Looks up the section name from the ID. * @param secId ID of the section * @return name of that section */ @@ -987,7 +989,6 @@ if (s.length() > 1) { s = s.substring(0, 1).toUpperCase() + s.substring(1); } - return s; } } @@ -1074,8 +1075,7 @@ } /** - * Spawns a popup-message to display the help text - * of an attribute + * Spawns a popup-message to display the help text of an attribute. * @param title name of attribute * @param msg message text */ @@ -1084,8 +1084,8 @@ } /** - * Switch between the input-interface for all attributes - * and the summary list of all nonzero attributes. + * Switchs between the input-interface for all attributes and the summary + * list of all nonzero attributes. */ private void toggleSummary() { if (!displaySummary) { @@ -1383,7 +1383,7 @@ } // before we modify the archtext, we look for errors and save them. - // later the user must confirm wether to keep or dump those errors + // later the user must confirm whether to keep or dump those errors String errors = null; errors = arch.getSyntaxErrors(typeStruct); @@ -1566,8 +1566,9 @@ ref = null; helpButton = null; } - } + } // class DialogAttrib + /** This (Sub)Class implements the dialog attribute of type BOOL. */ public final class BoolAttrib extends DialogAttrib { @@ -1626,9 +1627,10 @@ public void setValue(final int newValue) { value = newValue; } - } - /** Action-listener for help-buttons */ + } // class BitmaskAttrib + + /** ActionListener for help-buttons */ private class HelpAL implements ActionListener { CFArchAttrib attrib; // attribute structure @@ -1650,9 +1652,10 @@ popupHelp(attrib.getNameNew(), attrib.getText()); } } - } - /** Action-listener for the change buttons of bitmasks */ + } // class HelpAL + + /** ActionListener for the change buttons of bitmasks. */ public final class MaskChangeAL implements ActionListener { BitmaskAttrib bmAttr; // attribute structure @@ -1660,7 +1663,7 @@ CAttribDialog dialog; // reference to this dialog instance /** - * Constructor + * Constructor. * @param newAttr the GUI-bitmask attribute where the change button belongs to */ public MaskChangeAL(final BitmaskAttrib newAttr, final CAttribDialog newDialog) { @@ -1677,10 +1680,11 @@ bmAttr.bitmask.popupFrame(dialog, bmAttr); } } - } + } // class MaskChangeAL + /** - * Action-listener for the buttons on treasurelists. When such a button is + * ActionListener for the buttons on treasurelists. When such a button is * pressed, the dialog with treasurelists pops up. */ public final class ViewTreasurelistAL implements ActionListener { @@ -1690,7 +1694,7 @@ CAttribDialog dialog; // reference to this dialog instance /** - * Constructor + * Constructor. * @param attr the GUI-string attribute where the treasurelist button belongs to */ public ViewTreasurelistAL(final StringAttrib attr, final CAttribDialog dialog) { @@ -1707,12 +1711,13 @@ CFTreasureListTree.getInstance().showDialog(strAttr.input, dialog); } } - } + } // class ViewTreasurelistAL + /** - * Action-listener for the buttons in the ConfirmErrors popup dialog - * and also Window-listener for the closebox of the dialog - * (which would equal a "keep all" button) + * ActionListener for the buttons in the ConfirmErrors popup dialog and + * also WindowListener for the closebox of the dialog (which would equal a + * "keep all" button). */ public final class ConfirmErrorsAL implements ActionListener, WindowListener { @@ -1727,15 +1732,14 @@ final String allErrors; // list of all errors /** - * Constructor + * Constructor. * @param dl the popup dialog * @param archNew the arch which has the error to be added * @param errors list of all errors (= initial content of the textarea) * @param keepB button "keep what is in the textfield" * @param textNew textfield containing the error-text to keep */ - public ConfirmErrorsAL(final JDialog dl, final ArchObject archNew, final String errors, - final JButton keepB, final JTextArea textNew) { + public ConfirmErrorsAL(final JDialog dl, final ArchObject archNew, final String errors, final JButton keepB, final JTextArea textNew) { arch = archNew; keepButton = keepB; text = textNew; @@ -1792,10 +1796,10 @@ public void windowDeiconified(final WindowEvent event) { } - } + } // class ConfirmErrorsAL - /** Item-listener for the type-selection box on the attribute-dialog */ + /** ItemListener for the type-selection box on the attribute-dialog. */ private class TypesBoxAL implements ItemListener { final CAttribDialog frame; // the entire frame @@ -1809,7 +1813,7 @@ public boolean ignoreEvent; // while true, this listener ignores all events /** - * Constructor + * Constructor. * @param frameNew the attribute-dialog mainframe * @param archNew the arch which has the error to be added * @param defarchNew the default arch of 'arch' @@ -1882,19 +1886,21 @@ } } } - } + } // class TypesBoxAL + /** - * class to manage the select-per-keystroke in a JComboBox - * (The default KeySelectionManager fails because all strings - * start with whitespace ' ') + * KeySelectionManager to manage the select-per-keystroke in a JComboBox + * (The default KeySelectionManager fails because all strings start with + * whitespace ' '). * <p/> - * Unfortunately, this class cannot be used anymore because - * it does not work together with the listener <code>TypesBoxAL</code> + * Unfortunately, this class cannot be used anymore because it does not + * work together with the listener <code>TypesBoxAL</code> */ private static final class StringKeyManager implements JComboBox.KeySelectionManager { - final JComboBox box; // reference to ComboBox + /** JComboBox reference. */ + final JComboBox box; public StringKeyManager(final JComboBox myBox) { box = myBox; @@ -1916,5 +1922,7 @@ } return -1; // no match found } - } -} + + } // class StringKeyManager + +} // class CAttribDialog Modified: trunk/crossfire/src/cfeditor/CFArchAttrib.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchAttrib.java 2006-06-12 13:44:44 UTC (rev 146) +++ trunk/crossfire/src/cfeditor/CFArchAttrib.java 2006-06-12 21:07:14 UTC (rev 147) @@ -296,7 +296,7 @@ } /** - * assign this attribute to a section + * Assign this attribute to a section. * @param id section ID * @param sname section name */ @@ -306,7 +306,7 @@ } /** - * get a new instance of this object with identical content + * Get a new instance of this object with identical content. * @return clone instance of this <code>CFArchAttrib</code> */ public CFArchAttrib getClone() { Modified: trunk/crossfire/src/cfeditor/CFArchType.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchType.java 2006-06-12 13:44:44 UTC (rev 146) +++ trunk/crossfire/src/cfeditor/CFArchType.java 2006-06-12 21:07:14 UTC (rev 147) @@ -42,26 +42,33 @@ private static final Logger LOG = Logger.getLogger(CFArchType.class); - // XML tag names public static final String XML_TYPE = "type"; + /** Attribute Element Name. */ public static final String XML_ATTRIBUTE = "attribute"; + /** Required Element Name. */ public static final String XML_REQUIRED = "required"; + /** Ignore Element Name. */ public static final String XML_IGNORE = "ignore"; + /** Import Type Element Name. */ public static final String XML_IMPORT_TYPE = "import_type"; + /** Value Element Name. */ public static final String XML_VALUE = "value"; + /** Description Element Name. */ public static final String XML_DESC = "description"; + /** Use Element Name. */ public static final String XML_USE = "use"; + /** Section Element Name. */ public static final String XML_SECTION = "section"; - // file with type definitions: + /** File with type definitions. */ public static final String filename = IGUIConstants.TYPEDEF_FILE; private int typenr; // type number of this CF type @@ -82,10 +89,14 @@ private CFArchAttrib[] attr; // list of arch attributes (/array)) - private int sectionNum; // number of attribute-sections + /** + * Number of attribute sections. + * The number of attribute sections determine the number of tabs to be used. + */ + private int sectionNum; /** - * Konstructor + * Constructor. * @param defaultArchType the head element of the list */ public CFArchType(final CFArchType defaultArchType) { @@ -405,7 +416,7 @@ } /** - * Create the documentation to this ArchObject-type + * Create the documentation to this ArchObject-type. * @return the full html-text to be (parsed and) displayed */ public String createHtmlDocu() { @@ -476,6 +487,11 @@ return attr; } + /** + * Returns number of attribute sections. + * The number of attribute sections determine the number of tabs to be used. + * @return number of attribute sections. + */ public int getSectionNum() { return sectionNum; } Modified: trunk/crossfire/src/cfeditor/CFArchTypeList.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-06-12 13:44:44 UTC (rev 146) +++ trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-06-12 21:07:14 UTC (rev 147) @@ -48,8 +48,8 @@ import org.jdom.input.SAXBuilder; /** - * This class handles all the CFArchTypes and makes - * them conveniently accessible. + * This class handles all the CFArchTypes and makes them conveniently + * accessible. * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ public final class CFArchTypeList { @@ -72,8 +72,8 @@ private int length = 0; // Number of types in the list /** - * Constructor - Parsing all the data from the xml definitions - * file 'types.xml'. + * Constructor - Parsing all the data from the xml definitions file + * 'types.xml'. */ CFArchTypeList() { CFArchType cfType = head; // index of CFArchType list Modified: trunk/crossfire/src/cfeditor/CFJavaEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/CFJavaEditor.java 2006-06-12 13:44:44 UTC (rev 146) +++ trunk/crossfire/src/cfeditor/CFJavaEditor.java 2006-06-12 21:07:14 UTC (rev 147) @@ -34,8 +34,7 @@ import org.apache.log4j.Logger; /** - * MAIN CLASS - * The launcher that launches the whole level editor application. + * Main class, launches the level editor application. * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @version $Revision: 1.27 $ */ Modified: trunk/crossfire/src/cfeditor/CFTreasureListTree.java =================================================================== --- trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-06-12 13:44:44 UTC (rev 146) +++ trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-06-12 21:07:14 UTC (rev 147) @@ -58,7 +58,7 @@ import org.jetbrains.annotations.Nullable; /** - * The CFTreasureListTree class fully manages the Crossfire treausrelists. + * The CFTreasureListTree class fully manages the Crossfire treasurelists. * CF datafile "treasures" gets parsed into a JTree structure. * @author Andreas Vogl */ @@ -85,14 +85,14 @@ // as keys and folder-nodes where to put these treasurelists as values private Hashtable specialTreasureLists = null; - // all syntax-errors encountered during datafile-parsing get written in this LOG + // all syntax-errors encountered during datafile-parsing get written in this log private StringBuffer errorLog = null; private Vector needSecondLink; private boolean processSecondLinking; - // dialog window containing the tree + /** JDialog containing the tree. */ private JDialog frame; // the cell renderer @@ -234,9 +234,8 @@ } /** - * Parse the treasure-data from the CF file "treasures.txt" into - * this JTree instance. - * This method must be called AFTER arch-loading is complete! + * Parse the treasure-data from the CF file "treasures.txt" into this JTree + * instance. This method must be called AFTER arch-loading is complete! * @return True when parsing succeeded so that at least one treasurelist * has been parsed. False when there is no data and tree remains empty. */ @@ -663,7 +662,6 @@ final JButton helpButton = new JButton("Help"); helpButton.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent event) { - // open the help window new Help(CMainControl.getInstance().getMainView(), "treasurelists.html").setVisible(true); } }); @@ -681,7 +679,8 @@ /** * @return The name of the currently selected treasurelist. * If nothing is selected, null is returned. - * @throws GridderException when user selected an invalid treasurelist (e.g. a god-list) + * @throws net.sf.gridarta.GridderException when user selected an invalid + * treasurelist (e.g. a god-list) */ @Nullable private String getSelectedTreasureList() throws GridderException { // return null when nothing is selected @@ -715,7 +714,7 @@ return trNode.getTreasureObj().getName(); } - // ======================== SUBCLASSES ========================== + // ======================== INNERCLASSES ========================== /** * Subclass: Nodes in the CFTreasureListTree. @@ -828,7 +827,9 @@ private boolean hasLoop; // true when this is a list containing itself (-> infinit loop) - /** Constructor for treasurelist objects */ + /** + * Constructor for treasurelist objects. + */ public TreasureObj(final String name, final int type) { this.type = type; this.name = name; Modified: trunk/crossfire/src/cfeditor/CFileInputStream.java =================================================================== --- trunk/crossfire/src/cfeditor/CFileInputStream.java 2006-06-12 13:44:44 UTC (rev 146) +++ trunk/crossfire/src/cfeditor/CFileInputStream.java 2006-06-12 21:07:14 UTC (rev 147) @@ -34,7 +34,7 @@ /** * Class for opening and reading a buffered stream to a BINARY resource-file. * If no such file is found, the file is loaded from the jar archive. - * This class is very similar to CFileReader. + * This class is very similar to {@link CFileReader}. * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ public final class CFileInputStream { @@ -145,4 +145,5 @@ } } } -} + +} // class CFileInputStream Modified: trunk/crossfire/src/cfeditor/CFileReader.java =================================================================== --- trunk/crossfire/src/cfeditor/CFileReader.java 2006-06-12 13:44:44 UTC (rev 146) +++ trunk/crossfire/src/cfeditor/CFileReader.java 2006-06-12 21:07:14 UTC (rev 147) @@ -120,18 +120,17 @@ } /** - * readTill - reads characters from the BufferedReader stream - * till 'tag' is found. If found, the method returns with - * stream pointing right after the appearance of 'tag'. + * Reads characters from the BufferedReader stream till 'tag' is found. If + * found, the method returns with stream pointing right after the + * appearance of 'tag'. * @param stream ascii input stream to read from * @param tag stop reading at the string 'tag' * @param abort throw <code>EOFException</code> at string 'abort' (this can be null) - * @throws IOException an I/O-error occurred while reading the file + * @throws IOException an I/O-error occurred while reading the file * @throws EOFException the end of file was reached, or the 'abort' string - * has been encountered + * has been encountered */ - public static void readTill(final BufferedReader stream, final String tag, final String abort) - throws IOException { + public static void readTill(final BufferedReader stream, final String tag, final String abort) throws IOException { int c; // character value, read from the stream int t = 0; // tag index int a = 0; // abort index @@ -176,19 +175,17 @@ } /** - * readsTill - reads characters from the BufferedReader stream - * till 'tag' is found. Similar to readTill(), except that the - * read String is returned. 'tag' is not included in the returned - * String. + * Reads characters from the BufferedReader stream till 'tag' is found. + * Similar to readTill(), except that the read String is returned. 'tag' is + * not included in the returned String. * @param stream ascii input stream to read from * @param tag stop reading at the string 'tag' - * @return the string between the starting pos. of 'stream' - * (inclusive) and the first character of 'tag' (exclusive). - * @throws IOException an I/O-error occurred while reading the file + * @return the string between the starting pos. of 'stream' (inclusive) and + * the first character of 'tag' (exclusive). + * @throws IOException an I/O-error occurred while reading the file * @throws EOFException the end of file was reached */ - public static String readsTill(final BufferedReader stream, final String tag) - throws IOException { + public static String readsTill(final BufferedReader stream, final String tag) throws IOException { String r = ""; // returned string int c; // character value, read from the stream int t = 0; // index @@ -258,4 +255,5 @@ } } } -} + +} // class CFileReader Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-06-12 13:44:44 UTC (rev 146) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-06-12 21:07:14 UTC (rev 147) @@ -71,6 +71,7 @@ /** Serial Version UID. */ private static final long serialVersionUID = 1L; + /** Logger. */ private static final Logger log = Logger.getLogger(CMainControl.class); private static CMainControl instance = null; @@ -100,6 +101,7 @@ /** The main view. */ private final CMainView mainView; + /** Bit field of edit types to show only. */ private int tileEdit; private CMapFileDecode mapFileDecoder; @@ -108,6 +110,7 @@ private ArchObjectParser archObjectParser; + /** The Animation Objects. */ private AnimationObjects animationObjects; // icons for the map and arch pictures . X= rectangle, normal = iso @@ -200,7 +203,7 @@ } /** - * This static instance may only be accessed from this package + * Get the static instance of CMainControl. * @return static instance of this class */ public static CMainControl getInstance() { @@ -634,6 +637,10 @@ mainView.setStatusText(string); } + /** + * Get the ArchObjectStack. + * @return ArchObjectStack + */ public ArchObjectStack getArchObjectStack() { return archList; } @@ -797,7 +804,7 @@ * Closes the given level. * @param level the level to close. * @param forced when true, user does not get asked and changes do not get saved - * @return true if closing successful + * @return <code>true</code> if closing successful */ public boolean closeLevel(final MapControl level, final boolean forced) { @@ -927,30 +934,30 @@ } /** - * load a mapfile - * @param file mapfile. - * @return The map controller to manipulate this map. + * Load a mapfile. + * @param file mapfile + * @return the map controller to manipulate this map */ public MapControl openFile(final File file) { return openFile(file, true, null); } /** - * load a mapfile - * @param file mapfile. - * @param show set to true to show the map in main view. - * @return The map controller to manipulate this map. + * Load a mapfile. + * @param file mapfile + * @param show set to true to show the map in main view + * @return the map controller to manipulate this map */ public MapControl openFile(final File file, final boolean show) { return openFile(file, show, null); } /** - * load a mapfile - * @param file mapfile. - * @param show set to true to show the map in main view. + * Load a mapfile. + * @param file mapfile + * @param show set to true to show the map in main view * @param initial the view position to show initially - * @return The map controller to manipulate this map. + * @return the map controller to manipulate this map */ @Nullable public MapControl openFile(final File file, final boolean show, final Point initial) { final ArchObject start; @@ -1011,7 +1018,11 @@ } } - // save map! + /** + * Save a map. + * @param file File to save to + * @param mapModel MapModel to save + */ public void encodeMapFile(final File file, final MapModel mapModel) { mapFileEncoder.encodeMapFile(file, mapModel); } @@ -1258,7 +1269,6 @@ } /** Invoked when user wants to see/edit the level properties. */ - void mapPropertiesWanted() { showMapProperties(currentMap); } @@ -1478,6 +1488,7 @@ public void setCurrentLevel(final MapControl map) { currentMap = map; refreshMenusAndToolbars(); + //CMainStatusbar.getInstance().setLevelInfo(level); } @@ -1550,7 +1561,7 @@ /** * Returns the name of the undo operation. - * @return Name of the undo operation. + * @return name of the undo operation */ public String getUndoName() { if (currentMap != null) { @@ -1562,9 +1573,8 @@ /** * Returns the name of the redo operation. - * @return Name of the redo operation. + * @return name of the redo operation */ - public String getRedoName() { if (currentMap != null) { return currentMap.getRedoName(); @@ -1575,7 +1585,7 @@ /** * Returns whether undo is possible or not. - * @return True if undo is possible, false if not possible. + * @return true if undo is possible, false if not possible */ boolean isUndoPossible() { @@ -1588,7 +1598,7 @@ /** * Returns whether redo is possible or not. - * @return True if redo is possible, false if not possible. + * @return true if redo is possible, false if not possible */ boolean isRedoPossible() { @@ -1657,7 +1667,7 @@ } /** - * is CopyBuffer empty? + * Is the CopyBuffer empty? * @return true if the buffer is empty */ public boolean isCopyBufferEmpty() { @@ -1711,7 +1721,7 @@ /** * Returns whether a level is being edited or not. - * @return True if a level is being edited or false if not. + * @return true if a level is being edited or false if not */ boolean isLevelEdited() { return currentMap != null; @@ -1720,7 +1730,7 @@ /** * Returns whether the level can be just saved (true) or does it need * to be saved as (false). - * @return True if level can be just saved, false if not. + * @return true if level can be just saved, false if not */ boolean isPlainSaveEnabled() { @@ -1774,8 +1784,8 @@ } /** - * load all system tile icons into temporare variables - * for more convenient access + * Load all system tile icons into temporare variables for more convenient + * access. */ public void loadDefTiles() { mapGridIcon = CGUIUtils.getSysIcon(IGUIConstants.TILE_IGRID_TILE); @@ -1820,7 +1830,7 @@ * is a yes/no option. * @param strTitle The title of the message. * @param strMessage The message to be shown. - * @return Ture if the user agrees, false if user disagrees. + * @return true if the user agrees, false if user disagrees */ public boolean askConfirm(final String strTitle, final String strMessage) { return mainView.askConfirm(strTitle, strMessage); @@ -1873,4 +1883,5 @@ public CMapFileDecode getMapFileDecoder() { return mapFileDecoder; } -} + +} // class CMainControl Modified: trunk/crossfire/src/cfeditor/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainView.java 2006-06-12 13:44:44 UTC (rev 146) +++ trunk/crossfire/src/cfeditor/CMainView.java 2006-06-12 21:07:14 UTC (rev 147) @@ -64,10 +64,10 @@ /** The key used to store the selected L'n'F to INI file. */ public static final String SELECTED_LNF_KEY = "MainWindow.lnfClass"; - /** The key used to store the main windows X-coordinate to INI file. */ + /** The key used to store the main windows x-coordinate to INI file. */ private static final String WINDOW_X = "MainWindow.x"; - /** The key used to store the main windows Y-coordinate to INI file. */ + /** The key used to store the main windows y-coordinate to INI file. */ private static final String WINDOW_Y = "MainWindow.y"; /** The key used to store the main windows width to INI file. */ @@ -76,14 +76,16 @@ /** The key used to store the main windows height to INI file. */ private static final String WINDOW_HEIGHT = "MainWindow.height"; - /** The key used to store the main windows divider location to the INI file. */ + /** The key used to store the main windows divider location to the preferences. */ private static final String DIVIDER_LOCATION_KEY = "MainWindow.dividerLocation"; + /** The key used to store the main windows divider location to the preferences. */ private static final String DIVIDER_LOCATION_KEY2 = "MainWindow.dividerLocation2"; + /** The key used to store the main windows divider location to the preferences. */ private static final String DIVIDER_LOCATION_KEY3 = "MainWindow.dividerLocation3"; - /** key for info weither map-tile panel is seperate or at bottom. */ + /** Key for info whether map-tile panel is seperate or at bottom. */ public static final String MAPTILE_BOTTOM_KEY = "MapTileBottom"; /** Border size for the split panes */ @@ -119,19 +121,20 @@ /** All open level views. */ private Vector mapViews = new Vector(1, 2); - /** list of objects on map (right side) */ + /** List of objects on map (right side). */ private CMapTileList mapTileList; - /** attribute panel (bottom) */ + /** Attributes panel (bottom). */ private CMapArchPanel mapArchPanel; - /** panel with pickmaps */ + /** Panel with pickmaps. */ private JTabbedPane pickmapPanel; - /** true when pickmap is active, false when archlist is active */ + /** <code>true</code> when pickmap is active, <code>false</code> when + * archlist is active. */ private boolean pickmapActive = false; - /** when true, archpanel is merged into the bottom panel */ + /** <code>true</code> when archpanel is merged into the bottom panel. */ private boolean mapTileListBottom = true; /** @@ -262,7 +265,7 @@ //startupScreen.show(); } - /** open the online help window */ + /** Open the online help window. */ public void openHelpWindow() { new Help(this, null).setVisible(true); } @@ -277,7 +280,7 @@ return pickmapActive; } - /** Move the pickmap panel in front of the default-archpanel */ + /** Move the pickmap panel in front of the default-archpanel. */ public void movePickmapPanelToFront() { archPanel.movePickmapPanelToFront(); } @@ -377,16 +380,28 @@ return archPanel.getPanelArch(); } + /** + * Set the status message to be displayed in the status bar. + * @param string status message to be displayed + */ public void setStatusText(final String string) { statusBar.setStatusText(string); } - // is the map tile list in the bottom panel + /** + * Returns <code>true</code> when archpanel is merged into the bottom + * panel. + * @return <code>true</code> when archpanel is merged into the bottom panel + */ public boolean isMapTileListBottom() { return mapTileListBottom; } - // is the map tile list in the bottom panel + /** + * Sets <code>true</code> when archpanel is merged into the bottom panel. + * @param state <code>true</code> when archpanel is merged into the bottom + * panel + */ public void setMapTileListBottom(final boolean state) { mapTileListBottom = state; } Modified: trunk/daimonin/src/daieditor/CAttribDialog.java =================================================================== --- trunk/daimonin/src/daieditor/CAttribDialog.java 2006-06-12 13:44:44 UTC (rev 146) +++ trunk/daimonin/src/daieditor/CAttribDialog.java 2006-06-12 21:07:14 UTC (rev 147) @@ -323,7 +323,7 @@ } /** - * Construct the Combo box of the available archtypes. + * Construct the Combo box of the available archetypes. * @return a <code>JComponent</code> with the combo box in it */ private JComponent buildTypesBox() { @@ -351,7 +351,7 @@ } /** - * Construct the Combobox of the available spells. + * Construct the Combo box of the available spells. * @param attr spell attribute * @return the completed <code>JComboBox</code> */ @@ -491,7 +491,8 @@ } /** - * Construct the central part of the attribute dialog, containing the object's arch attributes. + * Construct the central part of the attribute dialog, containing the + * object's arch attributes. * @return When this method is called the first time: a <code>JScrollPane</code> * with the central part of the dialog window. * All further calls rebuild the existing tabbedpane and return null. @@ -522,10 +523,11 @@ } /** - * This method creates an attribute panel for one section of attributes. - * If the section is empty, null is returned. + * This method creates an attribute panel for one section of attributes. If + * the section is empty, null is returned. * @param secId the identifier of the section - * @return a <code>Component</code> containing the attribute panel (currently always a JScrollPane) + * @return a <code>Component</code> containing the attribute panel + * (currently always a JScrollPane) * @todo I'm still 263 lines long, please make me shorter. */ @Nullable private Component makeAttribPanel(final int secId) { @@ -849,6 +851,7 @@ return s; } } + return "???"; } @@ -911,13 +914,14 @@ } /** - * Action method for summary. - * Switches the cardlayout to the summary list of all nonzero attributes. + * Action method for summary. Switches the cardlayout to the summary list + * of all nonzero attributes. * @used */ public void attribSummary() { // interface is displayed, switch to summary final Document doc = summaryTP.getDocument(); + try { // clear document if (doc.getLength() > 0) { @@ -1297,6 +1301,7 @@ System.err.println(e); // Really ignore this? } + return false; // error (-> try again) } @@ -1496,8 +1501,8 @@ /** - * ActionListener for the buttons on treasurelists. - * When such a button is pressed, the dialog with treasurelists pops up. + * ActionListener for the buttons on treasurelists. When such a button is + * pressed, the dialog with treasurelists pops up. */ private static final class ViewTreasurelistAL extends AbstractAction { @@ -1529,11 +1534,10 @@ } // class ViewTreasurelistAL - /** - * ActionListener for the buttons in the ConfirmErrors popup dialog - * and also WindowListener for the closebox of the dialog - * (which would equal a "keep all" button). + * ActionListener for the buttons in the ConfirmErrors popup dialog and + * also WindowListener for the closebox of the dialog (which would equal a + * "keep all" button). */ private static final class ConfirmErrorsAL extends WindowAdapter implements ActionListener { @@ -1667,13 +1671,13 @@ } // class TypesBoxAL - /** * KeySelectionManager to manage the select-per-keystroke in a JComboBox - * (The default KeySelectionManager fails because all strings - * start with whitespace ' '). - * Unfortunately, this class cannot be used anymore because - * it does not work together with the listener <code>TypesBoxAL</code> + * (The default KeySelectionManager fails because all strings start with + * whitespace ' '). + * <p/> + * Unfortunately, this class cannot be used anymore because it does not + * work together with the listener <code>TypesBoxAL</code> */ private static final class StringKeyManager implements JComboBox.KeySelectionManager { Modified: trunk/daimonin/src/daieditor/CFArchType.java =================================================================== --- trunk/daimonin/src/daieditor/CFArchType.java 2006-06-12 13:44:44 UTC (rev 146) +++ trunk/daimonin/src/daieditor/CFArchType.java 2006-06-12 21:07:14 UTC (rev 147) @@ -75,7 +75,7 @@ private String[] typeAttributes; // list of aditional attributes that an object // must have, in order to be of this type: - // typeAttributes[0] is attr. name, typtAttributes[1] is attr. value, ... + // typeAttributes[0] is attr. name, typeAttributes[1] is attr. value, ... private final CFArchType defaultArchType; // contains default attributes @@ -92,7 +92,7 @@ private int sectionNum; /** - * Constructor + * Constructor. * @param defaultArchType default ArchType */ public CFArchType(final CFArchType defaultArchType) { Modified: trunk/daimonin/src/daieditor/CFArchTypeList.java =================================================================== --- trunk/daimonin/src/daieditor/CFArchTypeList.java 2006-06-12 13:44:44 UTC (rev 146) +++ trunk/daimonin/src/daieditor/CFArchTypeList.java 2006-06-12 21:07:14 UTC (rev 147) @@ -49,7 +49,8 @@ import org.xml.sax.SAXException; /** - * This class handles all the CFArchTypes and makes them conveniently accessible. + * This class handles all the CFArchTypes and makes them conveniently + * accessible. * @author <a href="mailto:and...@gm...">Andreas Vogl</a> * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ @@ -104,8 +105,11 @@ } /** - * Constructor - Parsing all the data from the xml definitions file 'types.xml'. - * @todo I consume too much time. Why? XPath is too slow. Let's hope Beta4 arrives soon, then some XPath that contains backup compatible expressions can be replaced by faster direct access + * Constructor - Parsing all the data from the xml definitions file + * 'types.xml'. + * @todo I consume too much time. Why? XPath is too slow. Let's hope Beta4 + * arrives soon, then some XPath that contains backup compatible + * expressions can be replaced by faster direct access */ CFArchTypeList() { // initialize the arrays of "special-data" Modified: trunk/daimonin/src/daieditor/CFJavaEditor.java =================================================================== --- trunk/daimonin/src/daieditor/CFJavaEditor.java 2006-06-12 13:44:44 UTC (rev 146) +++ trunk/daimonin/src/daieditor/CFJavaEditor.java 2006-06-12 21:07:14 UTC (rev 147) @@ -36,7 +36,7 @@ import static net.sf.japi.swing.ActionFactory.getFactory; /** - * Main Class, launches the level editor application. + * Main class, launches the level editor application. * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:ch...@it...">Chrsitian Hujer</a> */ Modified: trunk/daimonin/src/daieditor/CFTreasureListTree.java =================================================================== --- trunk/daimonin/src/daieditor/CFTreasureListTree.java 2006-06-12 13:44:44 UTC (rev 146) +++ trunk/daimonin/src/daieditor/CFTreasureListTree.java 2006-06-12 21:07:14 UTC (rev 147) @@ -68,7 +68,7 @@ import org.jetbrains.annotations.Nullable; /** - * The CFTreasureListTree class fully manages the Daimonin treausrelists. + * The CFTreasureListTree class fully manages the Daimonin treasurelists. * CF datafile "treasures" gets parsed into a JTree structure. * @author Andreas Vogl */ @@ -214,8 +214,8 @@ } /** - * Parse the treasure-data from the CF file "treasures.txt" into this JTree instance. - * This method must be called AFTER arch-loading is complete! + * Parse the treasure-data from the CF file "treasures.txt" into this JTree + * instance. This method must be called AFTER arch-loading is complete! * @todo scan maps/ directory for .tl files and append them as well */ private void parseTreasures() { @@ -665,7 +665,8 @@ /** * @return The name of the currently selected treasurelist. * If nothing is selected, null is returned. - * @throws net.sf.gridarta.GridderException when user selected an invalid treasurelist (e.g. a god-list) + * @throws net.sf.gridarta.GridderException when user selected an invalid + * treasurelist (e.g. a god-list) */ @Nullable private String getSelectedTreasureList() throws GridderException { // return null when nothing is selected @@ -808,8 +809,7 @@ private boolean hasLoop; // true when this is a list containing itself (-> infinit loop) /** - * Constructor for treasurelist objects - * @param name + * Constructor for treasurelist objects. */ TreasureObj(final String name, final int type) { this.type = type; Modified: trunk/daimonin/src/daieditor/CFileInputStream.java =================================================================== --- trunk/daimonin/src/daieditor/CFileInputStream.java 2006-06-12 13:44:44 UTC (rev 146) +++ trunk/daimonin/src/daieditor/CFileInputStream.java 2006-06-12 21:07:14 UTC (rev 147) @@ -37,9 +37,11 @@ * This class is very similar to {@link CFileReader}. * The file is tried to open in the following order: * <ol> - * <li>Try opening it with the given directory. The directory path is relative to the current working directory, the file path relative to that + * <li>Try opening it with the given directory. The directory path is relative + * to the current working directory, the file path relative to that * directory..</li> - * <li>Try opening it without the given directory. The file path is relative to the current working directory.</li> + * <li>Try opening it without the given directory. The file path is relative to + * the current working directory.</li> * <li>Try opening the file as a system resource through the class loader.</li> * </ol> * Only if all tries failed, creating the stream fails. @@ -51,7 +53,8 @@ /** * Creates a new CFileInputStream to a specified resource file. - * @param dname name of directory that the file is in (<code>null</code> means the file is located in the editor root dir) + * @param dname name of directory that the file is in (<code>null</code> + * means the file is located in the editor root dir) * @param fname name of the resource file * @throws FileNotFoundException In case all three tries to open the file failed */ Modified: trunk/daimonin/src/daieditor/CFileReader.java =================================================================== --- trunk/daimonin/src/daieditor/CFileReader.java 2006-06-12 13:44:44 UTC (rev 146) +++ trunk/daimonin/src/daieditor/CFileReader.java 2006-06-12 21:07:14 UTC (rev 147) @@ -82,15 +82,18 @@ } /** - * Reads characters from the BufferedReader stream till 'tag' is found, if found, the method returns with stream pointing right after - * the appearance of 'tag'. + * Reads characters from the BufferedReader stream till 'tag' is found. If + * found, the method returns with stream pointing right after the + * appearance of 'tag'. * @param stream ascii input stream to read from * @param tag stop reading at the string 'tag' * @param abort throw <code>EOFException</code> at string 'abort' (this can be null) - * @throws IOException an I/O-error occurred while reading the file - * @throws EOFException the end of file was reached, or the 'abort' string has been encountered - * @todo Should the encounter of the abort string before the tag really be an EOFException? - * That's semantically wrong, but current usage code relies on this :( + * @throws IOException an I/O-error occurred while reading the file + * @throws EOFException the end of file was reached, or the 'abort' string + * has been encountered + * @todo Should the encounter of the abort string before the tag really be + * an EOFException? That's semantically wrong, but current usage code + * relies on this :( */ public static void readUntil(final BufferedReader stream, final String tag, final String abort) throws IOException, EOFException { int c; // character value, read from the stream @@ -137,11 +140,13 @@ /** * Reads characters from the BufferedReader stream till 'tag' is found. - * Similar to readUntil(), except that the read String is returned. 'tag' is not included in the returned String. + * Similar to readUntil(), except that the read String is returned. 'tag' + * is not included in the returned String. * @param stream ascii input stream to read from * @param tag stop reading at the string 'tag' - * @return the string between the starting pos. of 'stream' (inclusive) and the first character of 'tag' (exclusive). - * @throws IOException an I/O-error occurred while reading the file + * @return the string between the starting pos. of 'stream' (inclusive) and + * the first character of 'tag' (exclusive). + * @throws IOException an I/O-error occurred while reading the file * @throws EOFException the end of file was reached */ public static String readUntil(final BufferedReader stream, final String tag) throws IOException, EOFException { Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-06-12 13:44:44 UTC (rev 146) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-06-12 21:07:14 UTC (rev 147) @@ -372,7 +372,7 @@ /** * Get the Animation Objects. - * @return animationObjects. + * @return animationObjects */ public AnimationObjects getAnimationObjects() { return animationObjects; @@ -813,7 +813,7 @@ /** * Returns the main view. - * @return the main view. + * @return the main view */ public CMainView getMainView() { return mainView; @@ -1189,17 +1189,19 @@ /** * Load a mapfile and create a view. * @param file mapfile - * @return true if the file was new, false if the file already was open or something went wrong + * @return true if the file was new, false if the file already was open or + * something went wrong */ boolean openFile(final File file) { return openFile(file, true); } /** - * load a mapfile + * Load a mapfile. * @param file mapfile - * @param view Only create a view if this is true. - * @return true if the file was new, false if the file already was open or something went wrong + * @param view only create a view if this is true + * @return true if the file was new, false if the file already was open or + * something went wrong */ public boolean openFile(final File file, final boolean view) { lastOpenedMap = null; @@ -1285,7 +1287,7 @@ /** * Save a map. * @param file File to save to - * @param mapModel Map to save + * @param mapModel MapModel to save */ public void encodeMapFile(final File file, final MapModel mapModel) { try { @@ -1637,7 +1639,6 @@ * @param direction the direction to go (see MapArchObject: 'tile_path') */ public void enterTileWanted(final int direction) { - final String path = currentMap.getMapArch().getTilePath(direction); if (path == null || path.length() == 0) { // tile direction not set (due to disabled menus this should normally not happen) @@ -1647,7 +1648,6 @@ enterMapWanted(new Point(), path); } - /** * Enter a map wanted. * @param d Desired destination point on the map (pass 0|0 if unknown, and note that the point gets modified) @@ -1726,7 +1726,7 @@ currentMap = map; refreshMenusAndToolbars(); - // CMainStatusbar.getInstance().setLevelInfo( level ); + //CMainStatusbar.getInstance().setLevelInfo(level); } /** Invoked when user wants to revert the current map to previously saved state */ @@ -1794,7 +1794,7 @@ /** * Returns the name of the undo operation. - * @return Name of the undo operation. + * @return name of the undo operation */ public String getUndoName() { return currentMap != null ? currentMap.getUndoName() : null; @@ -1802,7 +1802,7 @@ /** * Returns the name of the redo operation. - * @return Name of the redo operation. + * @return name of the redo operation */ public String getRedoName() { return currentMap != null ? currentMap.getRedoName() : null; @@ -1810,25 +1810,27 @@ /** * Returns whether undo is possible or not. - * @return True if undo is possible, false if not possible. + * @return true if undo is possible, false if not possible */ boolean isUndoPossible() { if (currentMap != null) { return currentMap.isUndoPossible(); } + return false; } /** * Returns whether redo is possible or not. - * @return True if redo is possible, false if not possible. + * @return true if redo is possible, false if not possible */ boolean isRedoPossible() { if (currentMap != null) { return currentMap.isRedoPossible(); } + return false; } @@ -1837,6 +1839,7 @@ if (currentMap == null || currentMap.getMapViewFrame() == null) { return; // this should never be possible, but I just wanna make sure... } + copybuffer.clear(currentMap); } @@ -1845,6 +1848,7 @@ if (currentMap == null || currentMap.getMapViewFrame() == null) { return; // this should never be possible, but I just wanna make sure... } + copybuffer.cut(currentMap); } @@ -1853,6 +1857,7 @@ if (currentMap == null || currentMap.getMapViewFrame() == null) { return; // this should never be possible, but I just wanna make sure... } + copybuffer.copy(currentMap); } @@ -1861,6 +1866,7 @@ if (currentMap == null || currentMap.getMapViewFrame() == null) { return; // this should never be possible, but I just wanna make sure... } + copybuffer.paste(currentMap); } @@ -1994,7 +2000,7 @@ /** * Returns whether a level is being edited or not. - * @return True if a level is being edited or false if not. + * @return true if a level is being edited or false if not */ boolean isLevelEdited() { return currentMap != null; @@ -2003,7 +2009,7 @@ /** * Returns whether the level can be just saved (true) or does it need * to be saved as (false). - * @return True if level can be just saved, false if not. + * @return true if level can be just saved, false if not */ boolean isPlainSaveEnabled() { Modified: trunk/daimonin/src/daieditor/CMainView.java =================================================================== --- trunk/daimonin/src/daieditor/CMainView.java 2006-06-12 13:44:44 UTC (rev 146) +++ trunk/daimonin/src/daieditor/CMainView.java 2006-06-12 21:07:14 UTC (rev 147) @@ -67,8 +67,8 @@ import org.jetbrains.annotations.Nullable; /** - * The main view of the level editor. - * Contains the "desktop" for internal level windows, tile palette, menu, status- and toolbar. + * The main view of the level editor. Contains the "desktop" for internal level + * windows, tile palette, menu, status- and toolbar. * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> * @author <a href="mailto:Chr...@it...">Christian Hujer</a> @@ -151,13 +151,16 @@ /** Panel with pickmaps. */ private JTabbedPane pickmapPanel; - /** <code>true</code> when pickmap is active, <code>false</code> when archlist is active. */ + /** <code>true</code> when pickmap is active, <code>false</code> when + * archlist is active. */ private boolean pickmapActive; /** <code>true</code> when archpanel is merged into the bottom panel. */ private boolean mapTileListBottom = true; - /** Constructs the main view and registers the given main controller. */ + /** + * Constructs the main view and registers the given main controller. + */ CMainView() { super(IGUIConstants.APP_NAME + " - " + IGUIConstants.APP_WINDOW_TITLE); initActions(); @@ -171,7 +174,9 @@ addWindowListener(this); } - /** Initialises (builds) this view. */ + /** + * Initialises (builds) this view. + */ void init() { // calculate some default values in case there is no settings file final Rectangle screen = getGraphicsConfiguration().getBounds(); @@ -352,7 +357,6 @@ } public ArchObject getMapTileSelection() { - return mapTileList.getMapTileSelection(); } @@ -394,8 +398,9 @@ } /** - * Returns <code>true</code> when archpanel is merged into the bottom panel. - * @return <code>true</code> when archpanel is merged into the bottom panel. + * Returns <code>true</code> when archpanel is merged into the bottom + * panel. + * @return <code>true</code> when archpanel is merged into the bottom panel */ public boolean isMapTileListBottom() { return mapTileListBottom; @@ -403,7 +408,8 @@ /** * Sets <code>true</code> when archpanel is merged into the bottom panel. - * @param mapTileListBottom <code>true</code> when archpanel is merged into the bottom panel + * @param mapTileListBottom <code>true</code> when archpanel is merged into + * the bottom panel */ public void setMapTileListBottom(final boolean mapTileListBottom) { this.mapTileListBottom = mapTileListBottom; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <der...@us...> - 2006-06-12 13:44:57
|
Revision: 146 Author: derdanny Date: 2006-06-12 06:44:44 -0700 (Mon, 12 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=146&view=rev Log Message: ----------- JavaDoc corrections. Modified Paths: -------------- trunk/daimonin/src/daieditor/arch/anim/AnimationObjects.java trunk/src/app/net/sf/gridarta/arch/ArchObject.java Modified: trunk/daimonin/src/daieditor/arch/anim/AnimationObjects.java =================================================================== --- trunk/daimonin/src/daieditor/arch/anim/AnimationObjects.java 2006-06-12 12:08:47 UTC (rev 145) +++ trunk/daimonin/src/daieditor/arch/anim/AnimationObjects.java 2006-06-12 13:44:44 UTC (rev 146) @@ -48,7 +48,10 @@ */ public final class AnimationObjects extends NamedObjects<AnimationObject> { - // animHashTable holds <anim object name, path to .arc file> pairs + /** + * This Map holds (anim object name, path to arc file) pairs. + * The object name is included in the path. + */ private final Map<String, String> animMap = new HashMap<String, String>(); /** @@ -70,7 +73,7 @@ } /** - * Adds a new animation object. If <code>path == null</code> path will be read from #animMap. + * Adds a new animation object. If <code>path == null</code> path will be read from {@link #animMap}. * @param animName name of the animation object to add * @param list String with animation list data * @param path Path relative to the arch directory Modified: trunk/src/app/net/sf/gridarta/arch/ArchObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/arch/ArchObject.java 2006-06-12 12:08:47 UTC (rev 145) +++ trunk/src/app/net/sf/gridarta/arch/ArchObject.java 2006-06-12 13:44:44 UTC (rev 146) @@ -19,7 +19,7 @@ /** * Get the value of an attribute of this ArchObject or its default arch. * <p /> - * This methods corresponds to {#getAttributeString(String, boolean)} with <code>useDefArch == true</code>. + * This methods corresponds to {@link #getAttributeString(String, boolean)} with <code>useDefArch == true</code>. * @param attr attribute name to get value for * @return attribute value or empty String ("") if no such attribute * @see #getAttributeString(String, boolean) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <der...@us...> - 2006-06-12 12:09:00
|
Revision: 145 Author: derdanny Date: 2006-06-12 05:08:47 -0700 (Mon, 12 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=145&view=rev Log Message: ----------- Added support for .anim files. Modified Paths: -------------- trunk/daimonin/src/daieditor/arch/ArchObjectStack.java trunk/daimonin/src/daieditor/arch/anim/AnimationObjects.java Modified: trunk/daimonin/src/daieditor/arch/ArchObjectStack.java =================================================================== --- trunk/daimonin/src/daieditor/arch/ArchObjectStack.java 2006-06-11 15:37:10 UTC (rev 144) +++ trunk/daimonin/src/daieditor/arch/ArchObjectStack.java 2006-06-12 12:08:47 UTC (rev 145) @@ -25,7 +25,6 @@ package daieditor.arch; -import static net.sf.japi.swing.ActionFactory.getFactory; import daieditor.CFTreasureListTree; import daieditor.CFileReader; import daieditor.CMainControl; @@ -60,6 +59,7 @@ import java.util.TreeMap; import javax.swing.ImageIcon; import net.sf.japi.swing.ActionFactory; +import static net.sf.japi.swing.ActionFactory.getFactory; import net.sf.japi.swing.Progress; import net.sf.japi.swing.ProgressDisplay; @@ -429,6 +429,8 @@ } else if (name.endsWith(".png")) { //CMainStatusbar.getInstance().setText(" Loading PNG: "+ name); addPNGFace(f.getAbsolutePath(), name); + } else if (name.endsWith(".anim")) { + animFiles.add(f); } } @@ -462,7 +464,7 @@ Reader in = null; try { in = new CFileReader(mainControl.getArchDefaultFolder(), "animations"); - mainControl.getAnimationObjects().loadAnims(in); + mainControl.getAnimationObjects().loadAnims(in, null); } catch (final DuplicateAnimationException e) { mainControl.handleThrowable(e); } catch (final IOException e) { Modified: trunk/daimonin/src/daieditor/arch/anim/AnimationObjects.java =================================================================== --- trunk/daimonin/src/daieditor/arch/anim/AnimationObjects.java 2006-06-11 15:37:10 UTC (rev 144) +++ trunk/daimonin/src/daieditor/arch/anim/AnimationObjects.java 2006-06-12 12:08:47 UTC (rev 145) @@ -26,6 +26,7 @@ package daieditor.arch.anim; import static daieditor.CMainControl.MAP_ENCODING; +import daieditor.PathManager; import daieditor.arch.NamedObjects; import java.io.BufferedReader; import java.io.File; @@ -36,6 +37,7 @@ import java.io.Reader; import java.util.HashMap; import java.util.Map; +import org.jetbrains.annotations.Nullable; /** @@ -64,7 +66,23 @@ * @throws DuplicateAnimationException in case the animation was not unique */ public void addAnimationObject(final String animName, final String list) throws DuplicateAnimationException { - final AnimationObject animationObject = new AnimationObject(animName, list, animMap.get(animName)); + addAnimationObject(animName, list, null); + } + + /** + * Adds a new animation object. If <code>path == null</code> path will be read from #animMap. + * @param animName name of the animation object to add + * @param list String with animation list data + * @param path Path relative to the arch directory + * @throws DuplicateAnimationException in case the animation was not unique + */ + public void addAnimationObject(final String animName, final String list, @Nullable final String path) throws DuplicateAnimationException { + final AnimationObject animationObject; + if (path == null) { + animationObject = new AnimationObject(animName, list, animMap.get(animName)); + } else { + animationObject = new AnimationObject(animName, list, path + '/' + animName); + } if (containsKey(animName)) { throw new DuplicateAnimationException(animationObject); } @@ -83,7 +101,8 @@ Reader in = null; try { in = new InputStreamReader(new FileInputStream(animFile), MAP_ENCODING); - loadAnims(in); + final String path = (new File(PathManager.getArchPath(animFile.getPath()))).getParent().replace('\\', '/'); + loadAnims(in, path); } finally { try { in.close(); @@ -98,12 +117,13 @@ * It is not neccessary to provide a BufferedReader for buffering. * This method will always wrap the supplied <var>reader</var> with a BufferedReader if the supplied reader isn't already a BufferedReader itself. * @param reader Reader to load animations from + * @param path Path relative to the arch directory * @throws IOException in case of I/O errors * @throws AnimationParseException in case parsing the animation reveals errors * @throws DuplicateAnimationException in case an animation was not unique */ @SuppressWarnings({"IOResourceOpenedButNotSafelyClosed"}) - public void loadAnims(final Reader reader) throws IOException, AnimationParseException, DuplicateAnimationException { + public void loadAnims(final Reader reader, @Nullable final String path) throws IOException, AnimationParseException, DuplicateAnimationException { final BufferedReader in = reader instanceof BufferedReader ? (BufferedReader) reader : new BufferedReader(reader); boolean inAnim = false; String animName = null; @@ -125,7 +145,7 @@ throw new AnimationParseException("anim ...", line, lineNumber); } inAnim = false; - addAnimationObject(animName, animText.toString()); + addAnimationObject(animName, animText.toString(), path); } else { if (!inAnim) { throw new AnimationParseException("anim ...", line, lineNumber); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-06-11 15:37:34
|
Revision: 144 Author: akirschbaum Date: 2006-06-11 08:37:10 -0700 (Sun, 11 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=144&view=rev Log Message: ----------- Reset all serialVersionUID numbers to 1. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CDialogBase.java trunk/crossfire/src/cfeditor/CFancyButton.java trunk/crossfire/src/cfeditor/CMainToolbar.java trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java trunk/crossfire/src/cfeditor/COptionDialog.java trunk/crossfire/src/cfeditor/CStartupScreen.java trunk/crossfire/src/cfeditor/JFontChooser.java trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java trunk/crossfire/src/cfeditor/gui/ArchComboBox.java trunk/crossfire/src/cfeditor/gui/CloseableTabbedPane.java trunk/crossfire/src/cfeditor/gui/ScriptEditor.java trunk/crossfire/src/cfeditor/gui/ScriptManager.java trunk/crossfire/src/cfeditor/parameter/DoubleParameterView.java trunk/crossfire/src/cfeditor/parameter/MapParameterView.java trunk/crossfire/src/cfeditor/parameter/ParameterDescriptionEditor.java trunk/crossfire/src/cfeditor/parameter/ParameterNameEditor.java trunk/crossfire/src/cfeditor/parameter/ParameterTypeEditor.java Modified: trunk/crossfire/src/cfeditor/CDialogBase.java =================================================================== --- trunk/crossfire/src/cfeditor/CDialogBase.java 2006-06-11 15:20:57 UTC (rev 143) +++ trunk/crossfire/src/cfeditor/CDialogBase.java 2006-06-11 15:37:10 UTC (rev 144) @@ -41,7 +41,7 @@ */ @Deprecated public abstract class CDialogBase extends JDialog { - private static final long serialVersionUID = -625386596453840074L; + private static final long serialVersionUID = 1L; /** * Create a CDialogBase. Modified: trunk/crossfire/src/cfeditor/CFancyButton.java =================================================================== --- trunk/crossfire/src/cfeditor/CFancyButton.java 2006-06-11 15:20:57 UTC (rev 143) +++ trunk/crossfire/src/cfeditor/CFancyButton.java 2006-06-11 15:37:10 UTC (rev 144) @@ -40,7 +40,7 @@ private ImageIcon rolloverIcon; - private static final long serialVersionUID = -6830925679283342190L; + private static final long serialVersionUID = 1L; public CFancyButton(final String strLabel, final ActionListener actionListener) { this(strLabel, null, null, actionListener); Modified: trunk/crossfire/src/cfeditor/CMainToolbar.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainToolbar.java 2006-06-11 15:20:57 UTC (rev 143) +++ trunk/crossfire/src/cfeditor/CMainToolbar.java 2006-06-11 15:37:10 UTC (rev 144) @@ -84,7 +84,7 @@ private JButton m_prevWindow; - private static final long serialVersionUID = -3989252938129708277L; + private static final long serialVersionUID = 1L; /** * Constructs a new toolbar. @@ -333,7 +333,7 @@ final ButtonGroup m_group; - private static final long serialVersionUID = -2232217397820552908L; + private static final long serialVersionUID = 1L; /** Constructs the popup menu with the appropriate menuitems. */ public CPopupMenu() { Modified: trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java 2006-06-11 15:20:57 UTC (rev 143) +++ trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java 2006-06-11 15:37:10 UTC (rev 144) @@ -145,7 +145,7 @@ private final JCheckBox m_pvp = new JCheckBox(); - private static final long serialVersionUID = 6994866465987083128L; + private static final long serialVersionUID = 1L; /** * Constructs the map-options dialog. Modified: trunk/crossfire/src/cfeditor/COptionDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/COptionDialog.java 2006-06-11 15:20:57 UTC (rev 143) +++ trunk/crossfire/src/cfeditor/COptionDialog.java 2006-06-11 15:37:10 UTC (rev 144) @@ -66,7 +66,7 @@ private final JCheckBox m_mapPanelBottom; // is map-tile panel in bottom panel? - private static final long serialVersionUID = 7268632624185255433L; + private static final long serialVersionUID = 1L; /** * Constructs a new option dialog. Modified: trunk/crossfire/src/cfeditor/CStartupScreen.java =================================================================== --- trunk/crossfire/src/cfeditor/CStartupScreen.java 2006-06-11 15:20:57 UTC (rev 143) +++ trunk/crossfire/src/cfeditor/CStartupScreen.java 2006-06-11 15:37:10 UTC (rev 144) @@ -54,7 +54,7 @@ private MouseListener clickListener; - private static final long serialVersionUID = 5107663950987715313L; + private static final long serialVersionUID = 1L; /** Constructs and shows a startup screen. */ public CStartupScreen(final Frame parentFrame) { Modified: trunk/crossfire/src/cfeditor/JFontChooser.java =================================================================== --- trunk/crossfire/src/cfeditor/JFontChooser.java 2006-06-11 15:20:57 UTC (rev 143) +++ trunk/crossfire/src/cfeditor/JFontChooser.java 2006-06-11 15:37:10 UTC (rev 144) @@ -71,7 +71,7 @@ private Font fontValue; - private static final long serialVersionUID = 3927109879696626225L; + private static final long serialVersionUID = 1L; public JFontChooser() { this(UIManager.getFont("Button.font")); Modified: trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java 2006-06-11 15:20:57 UTC (rev 143) +++ trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java 2006-06-11 15:37:10 UTC (rev 144) @@ -950,7 +950,7 @@ final JLabel label; - private static final long serialVersionUID = -3633959822875652319L; + private static final long serialVersionUID = 1L; /** * Constructor - builds the window layout and shows it Modified: trunk/crossfire/src/cfeditor/gui/ArchComboBox.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/ArchComboBox.java 2006-06-11 15:20:57 UTC (rev 143) +++ trunk/crossfire/src/cfeditor/gui/ArchComboBox.java 2006-06-11 15:37:10 UTC (rev 144) @@ -58,7 +58,7 @@ private final ArchComboBoxModel archComboBoxModel; - private static final long serialVersionUID = 6027654196326451339L; + private static final long serialVersionUID = 1L; public ArchComboBox() { setMaximumRowCount(4); @@ -305,7 +305,7 @@ private ArrayList subFilters = new ArrayList(); - private static final long serialVersionUID = 5878378868557234984L; + private static final long serialVersionUID = 1L; public ArchComboBoxModel() { archList = new ArchObject[mainControl.getArchCount()]; @@ -401,7 +401,7 @@ public final String sizeTester = new String("**Sizetester**"); - private static final long serialVersionUID = 8402293189506584343L; + private static final long serialVersionUID = 1L; /* This is the only method defined by ListCellRenderer. We just * reconfigure the Jlabel each time we're called. Modified: trunk/crossfire/src/cfeditor/gui/CloseableTabbedPane.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/CloseableTabbedPane.java 2006-06-11 15:20:57 UTC (rev 143) +++ trunk/crossfire/src/cfeditor/gui/CloseableTabbedPane.java 2006-06-11 15:37:10 UTC (rev 144) @@ -75,7 +75,7 @@ protected final ImageIcon closingIcon; - private static final long serialVersionUID = -2004164431543696336L; + private static final long serialVersionUID = 1L; //--- Constructor(s) --- Modified: trunk/crossfire/src/cfeditor/gui/ScriptEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/ScriptEditor.java 2006-06-11 15:20:57 UTC (rev 143) +++ trunk/crossfire/src/cfeditor/gui/ScriptEditor.java 2006-06-11 15:37:10 UTC (rev 144) @@ -120,7 +120,7 @@ private final JCheckBox typeBash; - private static final long serialVersionUID = -925081688574710327L; + private static final long serialVersionUID = 1L; /** * Create a visual JComponent used to edit the given script Modified: trunk/crossfire/src/cfeditor/gui/ScriptManager.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/ScriptManager.java 2006-06-11 15:20:57 UTC (rev 143) +++ trunk/crossfire/src/cfeditor/gui/ScriptManager.java 2006-06-11 15:37:10 UTC (rev 144) @@ -53,7 +53,7 @@ private final HashMap components = new HashMap(); - private static final long serialVersionUID = -3819064077177259928L; + private static final long serialVersionUID = 1L; /** @throws java.awt.HeadlessException */ public ScriptManager(final CScriptController scriptController) { Modified: trunk/crossfire/src/cfeditor/parameter/DoubleParameterView.java =================================================================== --- trunk/crossfire/src/cfeditor/parameter/DoubleParameterView.java 2006-06-11 15:20:57 UTC (rev 143) +++ trunk/crossfire/src/cfeditor/parameter/DoubleParameterView.java 2006-06-11 15:37:10 UTC (rev 144) @@ -41,7 +41,7 @@ private class TooltipSpinner extends JSpinner { - private static final long serialVersionUID = 5134878830296936975L; + private static final long serialVersionUID = 1L; public TooltipSpinner() { super(); Modified: trunk/crossfire/src/cfeditor/parameter/MapParameterView.java =================================================================== --- trunk/crossfire/src/cfeditor/parameter/MapParameterView.java 2006-06-11 15:20:57 UTC (rev 143) +++ trunk/crossfire/src/cfeditor/parameter/MapParameterView.java 2006-06-11 15:37:10 UTC (rev 144) @@ -87,7 +87,7 @@ */ public class MyCellRenderer extends DefaultListCellRenderer { - private static final long serialVersionUID = 7664767338340779298L; + private static final long serialVersionUID = 1L; public MyCellRenderer() { super(); @@ -122,7 +122,7 @@ private Object selected = null; - private static final long serialVersionUID = -9203046166810105260L; + private static final long serialVersionUID = 1L; public MyComboBoxModel() { super(); Modified: trunk/crossfire/src/cfeditor/parameter/ParameterDescriptionEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/parameter/ParameterDescriptionEditor.java 2006-06-11 15:20:57 UTC (rev 143) +++ trunk/crossfire/src/cfeditor/parameter/ParameterDescriptionEditor.java 2006-06-11 15:37:10 UTC (rev 144) @@ -22,7 +22,7 @@ private final PluginParameter parameter; - private static final long serialVersionUID = 3240105882190854344L; + private static final long serialVersionUID = 1L; public ParameterDescriptionEditor(final PluginParameter param) { super(); Modified: trunk/crossfire/src/cfeditor/parameter/ParameterNameEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/parameter/ParameterNameEditor.java 2006-06-11 15:20:57 UTC (rev 143) +++ trunk/crossfire/src/cfeditor/parameter/ParameterNameEditor.java 2006-06-11 15:37:10 UTC (rev 144) @@ -22,7 +22,7 @@ private final PluginParameter parameter; - private static final long serialVersionUID = 8115567486952666272L; + private static final long serialVersionUID = 1L; public ParameterNameEditor(final PluginParameter param) { super(); Modified: trunk/crossfire/src/cfeditor/parameter/ParameterTypeEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/parameter/ParameterTypeEditor.java 2006-06-11 15:20:57 UTC (rev 143) +++ trunk/crossfire/src/cfeditor/parameter/ParameterTypeEditor.java 2006-06-11 15:37:10 UTC (rev 144) @@ -26,7 +26,7 @@ private final CScriptModel theScript; - private static final long serialVersionUID = -4478213043766173573L; + private static final long serialVersionUID = 1L; public ParameterTypeEditor(final CScriptModel script, final PluginParameter param) { super(PluginParameterFactory.getTypes()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-06-11 15:21:47
|
Revision: 143 Author: akirschbaum Date: 2006-06-11 08:20:57 -0700 (Sun, 11 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=143&view=rev Log Message: ----------- Refactor map related classes to package cfeditor.map; rename classes CMapXxx to MapXxxx. Modified Paths: -------------- trunk/crossfire/src/cfeditor/AutojoinList.java trunk/crossfire/src/cfeditor/CFilterControl.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMainView.java trunk/crossfire/src/cfeditor/CMapFileDecode.java trunk/crossfire/src/cfeditor/CMapFileEncode.java trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java trunk/crossfire/src/cfeditor/CMapTileList.java trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/CMapViewIFrame.java trunk/crossfire/src/cfeditor/CNewMapDialog.java trunk/crossfire/src/cfeditor/CPickmapPanel.java trunk/crossfire/src/cfeditor/CUndoStack.java trunk/crossfire/src/cfeditor/CopyBuffer.java trunk/crossfire/src/cfeditor/ReplaceDialog.java trunk/crossfire/src/cfeditor/arch/ArchObjectIteratorDeleteArchMapObject.java trunk/crossfire/src/cfeditor/arch/ArchObjectIteratorDeleteMapArch.java trunk/crossfire/src/cfeditor/parameter/MapParameter.java trunk/crossfire/src/cfeditor/parameter/MapParameterView.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/CPickmapPanel.java trunk/daimonin/src/daieditor/CopyBuffer.java trunk/daimonin/src/daieditor/MapTilePane.java trunk/daimonin/src/daieditor/gui/map/MapPreviewAccessory.java trunk/daimonin/src/daieditor/gui/map/MapTilePane.java trunk/daimonin/src/daieditor/map/DefaultMapModel.java trunk/daimonin/src/daieditor/map/MapControl.java Added Paths: ----------- trunk/crossfire/src/cfeditor/map/ trunk/crossfire/src/cfeditor/map/DefaultMapModel.java trunk/crossfire/src/cfeditor/map/MapArchObject.java trunk/crossfire/src/cfeditor/map/MapControl.java trunk/crossfire/src/cfeditor/map/MapModel.java Removed Paths: ------------- trunk/crossfire/src/cfeditor/CMapControl.java trunk/crossfire/src/cfeditor/CMapModel.java trunk/crossfire/src/cfeditor/MapArchObject.java Modified: trunk/crossfire/src/cfeditor/AutojoinList.java =================================================================== --- trunk/crossfire/src/cfeditor/AutojoinList.java 2006-06-11 14:21:34 UTC (rev 142) +++ trunk/crossfire/src/cfeditor/AutojoinList.java 2006-06-11 15:20:57 UTC (rev 143) @@ -26,6 +26,7 @@ import cfeditor.arch.ArchObject; import cfeditor.arch.ArchObjectStack; +import cfeditor.map.MapModel; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; @@ -189,7 +190,7 @@ * @return node_nr of the (def.) arch to be inserted at x, y * -1 if there's already an arch of this list on x, y */ - public int joinInsert(final CMapModel map, final int x, final int y) { + public int joinInsert(final MapModel map, final int x, final int y) { int newIndex = 0; // return value, see above // if there already is an arch of this list at x, y -> abort @@ -239,7 +240,7 @@ * @param y Location of the insert point on the map * @param map Data model of the map */ - public void joinDelete(final CMapModel map, final int x, final int y) { + public void joinDelete(final MapModel map, final int x, final int y) { ArchObject arch; // temp. arch // do the joining in all four directions: @@ -311,7 +312,7 @@ * @param y location to search * @return arch which is part of this joinlist, null if no such arch exists */ - @Nullable private ArchObject findArchOfJoinlist(final CMapModel map, final int x, final int y) { + @Nullable private ArchObject findArchOfJoinlist(final MapModel map, final int x, final int y) { ArchObject tmpArch = map.getTopArchObject(x, y); // we look through the arches at the given location (top to bottom): for (; tmpArch != null; tmpArch = tmpArch.getPrevArch()) { Modified: trunk/crossfire/src/cfeditor/CFilterControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CFilterControl.java 2006-06-11 14:21:34 UTC (rev 142) +++ trunk/crossfire/src/cfeditor/CFilterControl.java 2006-06-11 15:20:57 UTC (rev 143) @@ -15,6 +15,7 @@ import cfeditor.filter.NamedFilterEvent; import cfeditor.filter.NamedFilterList; import cfeditor.filter.NamedFilterListener; +import cfeditor.map.MapControl; import cfeditor.menu.BasicMenuEntry; import javax.swing.JComponent; import javax.swing.JMenu; @@ -54,7 +55,7 @@ private final boolean highLightResult[]; - private final CMapControl map; + private final MapControl map; private static final CFilterControl defaultFilter = new CFilterControl(null); @@ -62,7 +63,7 @@ * Create a new FilterControl. * Do not highlight anything and does not filterOut anything */ - public CFilterControl(final CMapControl map) { + public CFilterControl(final MapControl map) { highLight = new boolean[]{false, false, false,}; filterOutConfig = (NamedFilterConfig) filterList.createConfig(); highLightConfig = new NamedFilterConfig[]{ @@ -135,7 +136,7 @@ if (map != null) { map.repaint(); } else { - final CMapControl[] maps = CMainControl.getInstance().getOpenedMaps(); + final MapControl[] maps = CMainControl.getInstance().getOpenedMaps(); for (int i = 0; i < maps.length; i++) { maps[i].repaint(); } Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-06-11 14:21:34 UTC (rev 142) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-06-11 15:20:57 UTC (rev 143) @@ -29,6 +29,9 @@ import cfeditor.arch.ArchObjectParser; import cfeditor.arch.ArchObjectStack; import cfeditor.arch.anim.AnimationObjects; +import cfeditor.map.MapArchObject; +import cfeditor.map.MapControl; +import cfeditor.map.MapModel; import cfeditor.textedit.scripteditor.ScriptEditControl; import java.awt.Font; import java.awt.Point; @@ -134,7 +137,7 @@ private final Vector levels = new Vector(1, 2); /** The current top map we are working with */ - private CMapControl currentMap; + private MapControl currentMap; /** The current script controller */ private final CScriptController scriptControl; @@ -359,7 +362,7 @@ void selectEditType(final int newType) { // calculate the new type for all opened maps: for (Enumeration enu = levels.elements(); enu.hasMoreElements();) { - final CMapControl level = (CMapControl) enu.nextElement(); + final MapControl level = (MapControl) enu.nextElement(); level.addEditType(newType); // calculate new type } @@ -529,7 +532,7 @@ } /** refresh the active map view, if there is one */ - void refreshCurrentMap() { + public void refreshCurrentMap() { mainView.refreshMapTileList(); // update tile window if (currentMap != null) { currentMap.repaint(); // update map view (if there is one) @@ -647,7 +650,7 @@ // update the look and feel for all open map views if (levels.size() > 0) { for (final Enumeration enu = levels.elements(); enu.hasMoreElements();) { - final CMapControl level = (CMapControl) enu.nextElement(); + final MapControl level = (MapControl) enu.nextElement(); level.getMapView().updateLookAndFeel(); if (log.isDebugEnabled()) { log.debug("map " + level.getMapName()); @@ -707,7 +710,7 @@ * left corner * @return map control of new map */ - public CMapControl newLevel(final ArchObject start, final MapArchObject maparch, final Point initial) { + public MapControl newLevel(final ArchObject start, final MapArchObject maparch, final Point initial) { return newLevel(start, maparch, true, initial); } @@ -722,11 +725,11 @@ * left corner * @return map control of new map */ - public CMapControl newLevel(final ArchObject start, final MapArchObject maparch, final boolean show, final Point initial) { + public MapControl newLevel(final ArchObject start, final MapArchObject maparch, final boolean show, final Point initial) { // Create a new level control and set the level view from that CMainStatusbar.getInstance().setText(" Creating new map " + maparch.getMapName()); - final CMapControl map = new CMapControl(this, start, maparch, false, initial); + final MapControl map = new MapControl(this, start, maparch, false, initial); if (show) { mainView.addLevelView(map.getMapView()); // one view... map.getMapView().setAutoscrolls(true); @@ -770,7 +773,7 @@ showMessage("Cannot close Pickmap", "Pickmaps are currently hidden.\n" + "Please select a pickmap before activating this command."); } else { - final CMapControl activePickmap = CPickmapPanel.getInstance().getCurrentPickmap(); + final MapControl activePickmap = CPickmapPanel.getInstance().getCurrentPickmap(); if (activePickmap == null) { showMessage("Cannot close Pickmap", "There are no pickmaps."); } else { @@ -796,7 +799,7 @@ * @param forced when true, user does not get asked and changes do not get saved * @return true if closing successful */ - public boolean closeLevel(final CMapControl level, final boolean forced) { + public boolean closeLevel(final MapControl level, final boolean forced) { if (level == null) { showMessage("CLOSE LEVEL", "FIND NULL LEVEL : " + levels.size() + " our map: " + currentMap); @@ -828,7 +831,7 @@ if (levels.size() > 0) { // get next open map we can find and set it to currentMap for (final Enumeration enu = levels.elements(); enu.hasMoreElements();) { - currentMap = (CMapControl) enu.nextElement(); + currentMap = (MapControl) enu.nextElement(); } } } @@ -847,7 +850,7 @@ showMessage("Cannot open Pickmap", "Pickmaps are currently hidden.\n" + "Please select a pickmap before activating this command."); } else { - final CMapControl activePickmap = CPickmapPanel.getInstance().getCurrentPickmap(); + final MapControl activePickmap = CPickmapPanel.getInstance().getCurrentPickmap(); if (activePickmap == null) { showMessage("Cannot open Pickmap", "There are no pickmaps."); } else { @@ -928,7 +931,7 @@ * @param file mapfile. * @return The map controller to manipulate this map. */ - public CMapControl openFile(final File file) { + public MapControl openFile(final File file) { return openFile(file, true, null); } @@ -938,7 +941,7 @@ * @param show set to true to show the map in main view. * @return The map controller to manipulate this map. */ - public CMapControl openFile(final File file, final boolean show) { + public MapControl openFile(final File file, final boolean show) { return openFile(file, show, null); } @@ -949,7 +952,7 @@ * @param initial the view position to show initially * @return The map controller to manipulate this map. */ - @Nullable public CMapControl openFile(final File file, final boolean show, final Point initial) { + @Nullable public MapControl openFile(final File file, final boolean show, final Point initial) { final ArchObject start; final MapArchObject maparch; try { @@ -969,7 +972,7 @@ // ok, we have it all!! - final CMapControl control; + final MapControl control; if (start == null) { // The map is totally empty control = newLevel(start, maparch, show, initial); // init the map @@ -1009,7 +1012,7 @@ } // save map! - public void encodeMapFile(final File file, final CMapModel mapModel) { + public void encodeMapFile(final File file, final MapModel mapModel) { mapFileEncoder.encodeMapFile(file, mapModel); } @@ -1107,7 +1110,7 @@ showMessage("Cannot save Pickmap", "Pickmaps are currently hidden.\n" + "Please select a pickmap before activating this command."); } else { - final CMapControl activePickmap = CPickmapPanel.getInstance().getCurrentPickmap(); + final MapControl activePickmap = CPickmapPanel.getInstance().getCurrentPickmap(); if (activePickmap == null) { showMessage("Cannot save Pickmap", "There are no pickmaps."); } else { @@ -1126,7 +1129,7 @@ * Invoked when user wants to save a level to certain file. * @param level map control of the map to be saved */ - public void saveLevelAsWanted(final CMapControl level) { + public void saveLevelAsWanted(final MapControl level) { if (level == null) { return; } @@ -1170,7 +1173,7 @@ * an output file name/path for the png image. */ public void createImageWanted() { - final CMapControl mc = currentMap; // control of current map + final MapControl mc = currentMap; // control of current map if (mc == null) { // there is no map open (should not happen due to disabled menus) @@ -1233,7 +1236,7 @@ * @param filename Name of the png image file to create. * @param mapc The controller of map to save. */ - public void createImageWanted(final CMapControl mapc, String filename) { + public void createImageWanted(final MapControl mapc, String filename) { if (mapc == null) { // there is no map open (should not happen due to disabled menus) @@ -1264,7 +1267,7 @@ * Shows the given levels properties. * @param level The level whose properties we want. */ - void showMapProperties(final CMapControl level) { + void showMapProperties(final MapControl level) { if (level != null) { final CMapPropertiesDialog dialog = new CMapPropertiesDialog(this, mainView, level); } @@ -1293,7 +1296,7 @@ * @param strMapTitle map name * @param mapSize size of map */ - void setLevelProperties(final CMapControl level, final String archText, final String loreText, final String strMapTitle, final Dimension mapSize) { + void setLevelProperties(final MapControl level, final String archText, final String loreText, final String strMapTitle, final Dimension mapSize) { if (level != null) { level.setProperties(archText, loreText, strMapTitle, mapSize); refreshMenusAndToolbars(); @@ -1308,7 +1311,7 @@ void exitWanted() { if (levels.size() > 0) { for (final Enumeration enu = levels.elements(); enu.hasMoreElements();) { - final CMapControl level = (CMapControl) enu.nextElement(); + final MapControl level = (MapControl) enu.nextElement(); closeLevel(level, false); } } @@ -1366,7 +1369,7 @@ return; } - final CMapControl oldmap = currentMap; // store old map control + final MapControl oldmap = currentMap; // store old map control openFile(newfile); // open the new map if (exitPos.x == 0 && exitPos.y == 0) { @@ -1413,7 +1416,7 @@ return; } - final CMapControl oldmap = currentMap; // store old map control + final MapControl oldmap = currentMap; // store old map control openFile(newfile); // open the new map // set viewport view on the new map @@ -1469,10 +1472,10 @@ /** * Sets the given level view as the current one. - * @param map <code>CMapControl</code> of the new current map. + * @param map <code>MapControl</code> of the new current map. */ - public void setCurrentLevel(final CMapControl map) { + public void setCurrentLevel(final MapControl map) { currentMap = map; refreshMenusAndToolbars(); //CMainStatusbar.getInstance().setLevelInfo(level); @@ -1480,7 +1483,7 @@ /** Invoked when user wants to revert the current map to previously saved state */ public void revertCurrentLevelWanted() { - final CMapControl modmap = this.currentMap; // "modified map" to be reverted + final MapControl modmap = this.currentMap; // "modified map" to be reverted // ask for confirmation if (askConfirm("Revert " + modmap.getMapFileName() + "?", "If you revert the map '" + modmap.getMapFileName() + "' to it's last saved state, all\nrecent changes will be lost. Do you really want to revert this map?")) { @@ -1505,7 +1508,7 @@ if (!getMainView().isPickmapActive()) { showMessage("Cannot revert Pickmap", "Pickmaps are currently hidden.\nPlease select a pickmap before activating this command."); } else { - final CMapControl activePickmap = CPickmapPanel.getInstance().getCurrentPickmap(); + final MapControl activePickmap = CPickmapPanel.getInstance().getCurrentPickmap(); if (activePickmap == null) { showMessage("Cannot revert Pickmap", "There are no pickmaps."); } else { @@ -1835,11 +1838,11 @@ return IGUIConstants.isoView ? nofaceTileIcon : nofaceTileIconX; } - public CMapControl[] getOpenedMaps() { - return (CMapControl[]) levels.toArray(new CMapControl[levels.size()]); + public MapControl[] getOpenedMaps() { + return (MapControl[]) levels.toArray(new MapControl[levels.size()]); } - public CMapControl getCurrentMap() { + public MapControl getCurrentMap() { return currentMap; } Modified: trunk/crossfire/src/cfeditor/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainView.java 2006-06-11 14:21:34 UTC (rev 142) +++ trunk/crossfire/src/cfeditor/CMainView.java 2006-06-11 15:20:57 UTC (rev 143) @@ -25,6 +25,7 @@ package cfeditor; import cfeditor.arch.ArchObject; +import cfeditor.map.MapControl; import net.sf.gridarta.help.Help; import net.sf.gridarta.GridderException; import java.awt.BorderLayout; @@ -298,7 +299,7 @@ && CPickmapPanel.getInstance().isLoadComplete() && CPickmapPanel.getInstance().getCurrentPickmap() != null) { // get the active pickmap - final CMapControl pmap = CPickmapPanel.getInstance().getCurrentPickmap(); + final MapControl pmap = CPickmapPanel.getInstance().getCurrentPickmap(); if (pmap != null && pmap.getMapView().isHighlight()) { // now try to get the topmost object @@ -338,7 +339,7 @@ } // access mape tile list ... - public void setMapTileList(final CMapControl map, final int archid) { + public void setMapTileList(final MapControl map, final int archid) { mapTileList.setMapTileList(map, archid); } @@ -449,7 +450,7 @@ archPanel.updateFont(); } - void setRevertMenuEnabled(final boolean state) { + public void setRevertMenuEnabled(final boolean state) { menu.setRevertEnabled(state); } @@ -667,7 +668,7 @@ public void levelViewFocusGainedNotify(final CMapViewIFrame view) { mapViews.removeElement(view); mapViews.insertElementAt(view, 0); - final CMapControl level = view.getLevel(); + final MapControl level = view.getLevel(); mainControl.setCurrentLevel(level); //statusBar.setLevelInfo(level); Deleted: trunk/crossfire/src/cfeditor/CMapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapControl.java 2006-06-11 14:21:34 UTC (rev 142) +++ trunk/crossfire/src/cfeditor/CMapControl.java 2006-06-11 15:20:57 UTC (rev 143) @@ -1,591 +0,0 @@ -/* - * Crossfire Java Editor. - * Copyright (C) 2000 Michael Toennies - * Copyright (C) 2001 Andreas Vogl - * - * (code based on: Gridder. 2D grid based level editor. (C) 2000 Pasi Keränen) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - */ - -package cfeditor; - -import cfeditor.arch.ArchObject; -import cfeditor.arch.ArchObjectIterator; -import cfeditor.arch.ArchObjectIteratorDeleteMapArch; -import java.awt.Dimension; -import java.awt.Point; -import java.io.File; -import java.util.Iterator; -import net.sf.gridarta.GridderException; - -/** - * The <code>CMapControl</code> - * @author <a href="mailto:mic...@no...">Michael Toennies</a> - * @author <a href="mailto:and...@gm...">Andreas Vogl</a> - */ -public final class CMapControl { - - /** The main controller of this subcontroller. */ - private final CMainControl mainControl; - - /** model (= map data of this level) */ - private final CMapModel mapModel; - - /** the view of the map */ - private final CMapViewIFrame mapView; - - private File mapFile; - - /** - * contains the edit types that have already been (requested and) - * calculated (edit types get calculated only when needed to save time) - */ - private int activeEditType; - - /** Flag that indicates whether the level is closing or not. */ - private boolean levelClosing = false; - - /** Flag that indicates whether this is a pickmap or not. */ - private final boolean isPickmap; - - /** - * Flag that indicates whether the tile maps surrounding current one - * must be displayed. - */ - private boolean showTiles = false; - - /** - * surrounding tiles. - * In order: north-west, north, north-east, west, east, south-west, south, south-east - */ - private CMapModel tileModel[]; - - private int northHeight, southHeight; - - private int westWidth, eastWidth; - - /** - * Constructs a new Map. - * @param mainControl the controller of this map - * @param maparch the <code>MapArchObject</code> of the map - * @param startObj chained list of Objects (ArchObjects) which should be - * filled in map - * @param isPick true if this is a pickmap - * @param initial the view position to show initially - */ - CMapControl(final CMainControl mainControl, final ArchObject startObj, - final MapArchObject maparch, final boolean isPick, - final Point initial) { - this.mainControl = mainControl; - activeEditType = 0; // start with no edit types (saves time) - isPickmap = isPick; // is this a pickmap? - // we create model (= data) - mapModel = new CMapModel(mainControl, this, maparch); - mapModel.addArchListToMap(startObj); - // and create a view (= window) - mapView = new CMapViewIFrame(mainControl, this, initial); - } - - /** Notifies that the application is about to exit. */ - void appExitNotify() { - mapView.appExitNotify(); // drop the view - mapModel.appExitNotify(); // and then the model - } - - /** - * Returns flag that indicates whether this is a pickmap or not. - * @return flag that indicates whether this is a pickmap or not. - */ - public boolean isPickmap() { - return isPickmap; - } - - public boolean isGridVisible() { - return mapView.isGridVisible(); - } - - public void setGridVisibility(final boolean fVisible) { - mapView.setGridVisibility(fVisible); - } - - /** - * Returns contains the edit types that have already been (requested and) - * calculated (edit types get calculated only when needed to save time) - * @return contains the edit types that have already been (requested and) - */ - public int getActiveEditType() { - return activeEditType; - } - - /** - * Sets contains the edit types that have already been (requested and) - * calculated (edit types get calculated only when needed to save time) - * @param newType contains the edit types that have already been (requested and) - */ - public void setActiveEditType(final int newType) { - activeEditType = newType; - } - - /** - * Checks if the given edit type is active or not - * @param checkType edit type - * @return true if this edit type is active - */ - public boolean hasEditType(final int checkType) { - return (activeEditType & checkType) != 0; - } - - /** - * Add edit type to the bitmask of active types. If this is a new type, it - * gets calculated for every arch on the map. Once it is calculated, we - * save that state in 'activeEditType' so we don't need to do it again. - * @param newType new edit type - */ - public void addEditType(final int newType) { - // calculate only if needed - final Dimension size = mapModel.getMapSize(); - final Point pos = new Point(); - if (!hasEditType(newType)) { - for (pos.x = 0; pos.x < size.width; pos.x++) { - for (pos.y = 0; pos.y < size.height; pos.y++) { - final Iterator<ArchObject> it = mapModel.getArchObjects(pos); - while (it.hasNext()) { - final ArchObject arch = it.next(); - // calculate the new edit type - if (arch.getRefFlag() && arch.getMapMultiHead() != null) { - // multi tails get the value from their head - arch.setEditType(arch.getMapMultiHead().calculateEditType(newType)); - } else { - arch.calculateEditType(newType); - } - } - } - } - // from now on we have this type, so we don't have to calculate it again - activeEditType |= newType; - } - } - - /** - * Notifies that a view has been closed. - * @param view The view that was closed. - */ - void viewCloseNotify(final CMapViewBasic view) { - if (!levelClosing) { - mainControl.closeLevel(this, false); - } - } - - // text of map arch object! - public String getMapText() { - return mapModel.getMapText(); - } - - // text of map arch object! - public String getMapLore() { - return mapModel.getMapArchObject().getLore(); - } - - /** - * Handles the given error. - * @param error a generic error - */ - public void handleErrors(final GridderException error) { - mainControl.handleErrors(error); - } - - /** - * Shows the given message in the UI. - * @param strTitle The title of the message. - * @param strMessage The message to be shown. - */ - protected void showMessage(final String strTitle, final String strMessage) { - mainControl.showMessage(strTitle, strMessage); - } - - /** Refreshes the state of menu items and toolbar buttons. */ - void refreshMenusAndToolbars() { - mainControl.refreshMenusAndToolbars(); - } - - void levelCloseNotify() { - levelClosing = true; - mapModel.levelCloseNotify(); - } - - /** @return true when this map has been closed */ - public boolean isClosing() { - return levelClosing; - } - - void freeMapArchObject() { - mapModel.freeMapArchObject(); - } - - boolean addArchToMap(final int archnr, final Point pos, final int intern, final boolean join, final boolean insertBelow) { - return mapModel.addArchToMap(archnr, pos, intern, join, insertBelow); - } - - /** wrapper method for addArchToMap, always inserting new arches on top */ - public boolean addArchToMap(final int archnr, final Point pos, final int intern, final boolean join) { - return addArchToMap(archnr, pos, intern, join, false); - } - - /** wrapper method for addArchToMap, always inserting new arches on top. - * @param archnr - * @param xx - * @param yy - * @param intern - * @param join - * @return <code>true</code> if insertion is successful, <code>false</code> if not - * @deprecated use {@link #addArchToMap(int, Point, int, boolean)} instead - */ - @Deprecated public boolean addArchToMap(final int archnr, final int xx, final int yy, final int intern, final boolean join) { - return addArchToMap(archnr, new Point(xx, yy), intern, join, false); - } - - public boolean insertArchToMap(final ArchObject newarch, final int archnr, final ArchObject next, final Point pos, final boolean join) { - return mapModel.insertArchToMap(newarch, archnr, next, pos, join); - } - - public void addArchObjectToMap(final ArchObject arch, final boolean insertBelow) { - mapModel.addArchObjectToMap(arch, insertBelow); - } - - public void addArchObjectToMap(final ArchObject arch) { - mapModel.addArchObjectToMap(arch, false); - } - - public void deleteMapArch(final int index, final Point pos, final boolean refreshMap, final boolean join) { - mapModel.deleteMapArch(index, pos, refreshMap, join); - } - - public ArchObject getMapArch(final int index, final Point pos) { - return mapModel.getMapArch(index, pos); - } - - public String getMapTilePath(final int direction) { - return mapModel.getMapArchObject().getTilePath(direction); - } - - public ArchObjectIterator getArchObjects(final Point pos) { - return mapModel.getArchObjects(pos); - } - - public ArchObjectIteratorDeleteMapArch getArchObjectsDeleteMapArch(final Point pos, final boolean refreshMap, final boolean join) { - return mapModel.getArchObjectsDeleteMapArch(pos, refreshMap, join); - } - - public boolean containsArchObject(final Point pos) { - return mapModel.containsArchObject(pos); - } - - @Deprecated public boolean containsArchObject(final int x, final int y) { - return containsArchObject(new Point(x, y)); - } - - public ArchObject getBottomArchObject(final Point pos) { - return mapModel.getBottomArchObject(pos); - } - - public ArchObject getTopArchObject(final Point pos) { - return mapModel.getTopArchObject(pos); - } - - public void setArchObject(final Point pos, final ArchObject arch) { - mapModel.setArchObject(pos, arch); - } - - /** - * Returns whether the level has changed since it was last saved or not. - * @return True if level has changed, false if not. - */ - boolean isLevelChanged() { - return mapModel.isLevelChanged(); - } - - /** - * Returns whether the level can be just saved (true) or does it need - * to be saved as (false). - * @return True if level can be just saved, false if not. - */ - boolean isPlainSaveEnabled() { - return mainControl.getCurrentMap().getMapFileName() != null && - mainControl.getCurrentMap().getMapFileName().compareTo(IGUIConstants.DEF_MAPFNAME) != 0; - } - - /** - * Set the properties (name, maptext and size) of this map. - * @param archText map text - * @param loreText lore text - * @param strMapTitle map name - * @param newSize size of map - */ - protected void setProperties(final String archText, final String loreText, String strMapTitle, final Dimension newSize) { - // resize this map - if (!newSize.equals(getMapSize())) { - resizeMap(newSize); - } - - setNewMapText(archText); // change map text - setNewLoreText(loreText); // change lore text - - // change map name (does not change the filename anymore) - strMapTitle = strMapTitle.trim(); - setMapName(strMapTitle); - - notifyViews(); // update - } - - /** Undoes a change in the level. */ - void undo() { - CUndoStack.getInstance(this).undo(); - } - - /** Redoes a change in the level. */ - void redo() { - CUndoStack.getInstance(this).redo(); - } - - /** - * Returns the name of the undo operation. - * @return Name of the undo operation. - */ - public String getUndoName() { - return CUndoStack.getInstance(this).getUndoName(); - } - - /** - * Returns the name of the redo operation. - * @return Name of the redo operation. - */ - public String getRedoName() { - return CUndoStack.getInstance(this).getRedoName(); - } - - /** - * Returns whether undo is possible or not. - * @return True if undo is possible, false if not possible. - */ - boolean isUndoPossible() { - return CUndoStack.getInstance(this).canUndo(); - } - - /** - * Returns whether redo is possible or not. - * @return True if redo is possible, false if not possible. - */ - boolean isRedoPossible() { - return CUndoStack.getInstance(this).canRedo(); - } - - /** Repaints the view. */ - void repaint() { - mapView.modelChanged(); - } - - /** Notifies the view that data has changed in the model. */ - void notifyViews() { - mapView.refreshDataFromModel(); - } - - /** - * Returns the map size of the mapModel. - * @return map size - */ - public Dimension getMapSize() { - return mapModel.getMapSize(); - } - - /** - * Returns the width of the level. - * @return map width - * @deprecated use {@link #getMapSize()} instead. - */ - @Deprecated public int getMapWidth() { - return getMapSize().width; - } - - /** - * Returns the height of the level. - * @return map height - * @deprecated use {@link #getMapSize()} instead. - */ - @Deprecated public int getMapHeight() { - return getMapSize().height; - } - - /** - * Return the current view position. - * @return the current view position - */ - public Point getViewPosition() { - return mapView.getViewPosition(); - } - - /** - * Returns the width of the level + neighbors tile maps if any. - * @return global width - */ - // TODO implement this - int getDisplayMapWidth() { - if (showTiles) { - return mapModel.getMapSize().width + eastWidth + westWidth; - } else { - return mapModel.getMapSize().width; - } - } - - /** - * Returns the height of the level + neighbors tile maps if any. - * @return global height - */ - int getDisplayMapHeight() { - if (showTiles) { - return mapModel.getMapSize().height + northHeight + southHeight; - } else { - return mapModel.getMapSize().height; - } - } - - boolean isTileShow() { - return showTiles; - } - - void setTileShow(final boolean show) { - showTiles = show; - if (show) { - /*Do the tile maps loading :)*/ - final String north = mapModel.getMapArchObject().getTilePath(MapArchObject.TILE_NORTH); - final String west = mapModel.getMapArchObject().getTilePath(MapArchObject.TILE_WEST); - final String east = mapModel.getMapArchObject().getTilePath(MapArchObject.TILE_EAST); - final String south = mapModel.getMapArchObject().getTilePath(MapArchObject.TILE_SOUTH); - /*tileModel = new CMapModel[8]; - CMapFileDecode loader; - CMapControl tmp; - loader = new CMapFileDecode(); - loader.decodeMapFile() - tmp = new CMapControl() - tileModel[1] = new CMapModel()*/ - } - } - - @Deprecated public boolean pointValid(final int posx, final int posy) { - return pointValid(new Point(posx, posy)); - } - - /** - * Check if the coordinates posx, posy are valid (located within the - * borders of the map). - * @param pos coordinate to check - * @return true if this point is located within the map boundaries - */ - public boolean pointValid(final Point pos) { - return mapModel.pointValid(pos); - } - - public boolean checkResizeMap(final Dimension dim) { - return mapModel.checkResizeMap(dim); - } - - /** - * Resize the map. - * @param size the new level size. - */ - void resizeMap(final Dimension size) { - mapModel.resizeMap(size); - } - - /** @return The level name. */ - public String getMapName() { - return mapModel.getMapName(); - } - - /** @return The level name without attached music string */ - public String getMapNameWithoutMusic() { - return mapModel.getMapNameWithoutMusic(); - } - - /** - * Sets the level name. - * @param strName The level name. - */ - public void setMapName(final String strName) { - mapModel.setMapName(strName); - } - - public String getMapFileName() { - return mapModel.getFileName(); - } - - public void setMapFileName(final String fname) { - mapView.setTitle("Map [" + fname + "]"); - mapModel.setFileName(fname); - } - - public void setNewMapText(final String str) { - mapModel.setNewMapText(str); - } - - public void setNewLoreText(final String str) { - mapModel.getMapArchObject().setLore(str); - } - - public void setLevelChangedFlag() { - mapModel.setLevelChangedFlag(); - } - - /** Saves the level to a file. */ - public void save() { - if (isPickmap()) { - CMainStatusbar.getInstance().setText("Saving pickmap '" + getMapFileName() + "'..."); - } else { - CMainStatusbar.getInstance().setText("Saving map '" + getMapFileName() + "'..."); - } - mainControl.encodeMapFile(mapFile, mapModel); - mapModel.resetLevelChangedFlag(); - mapView.changedFlagNotify(); - } - - /** - * Saves the file with the given file name. - * @param file The file to be saved to. - */ - void saveAs(final File file) { - CMainStatusbar.getInstance().setText("Saving the map to a file..."); - mainControl.encodeMapFile(file, mapModel); - mapModel.resetLevelChangedFlag(); - mapView.changedFlagNotify(); - } - - void setMapFile(final File file) { - mapFile = file; - } - - public CMapModel getMapModel() { - return mapModel; - } - - public CMapViewIFrame getMapView() { - return mapView; - } - - public File getMapFile() { - return mapFile; - } -} Modified: trunk/crossfire/src/cfeditor/CMapFileDecode.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapFileDecode.java 2006-06-11 14:21:34 UTC (rev 142) +++ trunk/crossfire/src/cfeditor/CMapFileDecode.java 2006-06-11 15:20:57 UTC (rev 143) @@ -25,6 +25,7 @@ package cfeditor; import cfeditor.arch.ArchObject; +import cfeditor.map.MapArchObject; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; Modified: trunk/crossfire/src/cfeditor/CMapFileEncode.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapFileEncode.java 2006-06-11 14:21:34 UTC (rev 142) +++ trunk/crossfire/src/cfeditor/CMapFileEncode.java 2006-06-11 15:20:57 UTC (rev 143) @@ -25,6 +25,8 @@ package cfeditor; import cfeditor.arch.ArchObject; +import cfeditor.map.MapArchObject; +import cfeditor.map.MapModel; import java.awt.Dimension; import java.awt.Point; import java.io.BufferedReader; @@ -66,7 +68,7 @@ * @param file mapfile * @param mapModel the MapModel to encode */ - public void encodeMapFile(File file, final CMapModel mapModel) { + public void encodeMapFile(File file, final MapModel mapModel) { final MapArchObject map = mapModel.getMapArchObject(); try { Deleted: trunk/crossfire/src/cfeditor/CMapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapModel.java 2006-06-11 14:21:34 UTC (rev 142) +++ trunk/crossfire/src/cfeditor/CMapModel.java 2006-06-11 15:20:57 UTC (rev 143) @@ -1,1228 +0,0 @@ -/* - * Crossfire Java Editor. - * Copyright (C) 2000 Michael Toennies - * Copyright (C) 2001 Andreas Vogl - * - * (code based on: Gridder. 2D grid based level editor. (C) 2000 Pasi Keränen) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - */ - -package cfeditor; - -import cfeditor.arch.ArchObject; -import cfeditor.arch.ArchObjectIterator; -import cfeditor.arch.ArchObjectIteratorDeleteArchMapObject; -import cfeditor.arch.ArchObjectIteratorDeleteMapArch; -import cfeditor.filter.Filter; -import cfeditor.filter.FilterConfig; -import cfeditor.filter.NamedFilterConfig; -import cfeditor.filter.NamedFilterList; -import java.awt.Point; -import java.awt.Dimension; -import java.util.Iterator; -import org.apache.log4j.Logger; -import org.jetbrains.annotations.Nullable; - -/** - * The level model that represents a level. - * @author <a href="mailto:mic...@no...">Michael Toennies</a> - * @author <a href="mailto:and...@gm...">Andreas Vogl</a> - */ -public final class CMapModel { - - private static final Logger log = Logger.getLogger(CMapModel.class); - - /** Enable autojoin when inserting objects. */ - public static final boolean JOIN_ENABLE = true; - - /** Disable autojoin when inserting objects. */ - public static final boolean JOIN_DISABLE = false; - - /** The MapArchObject; it contains global map attributes. */ - private MapArchObject m_mapArch = null; - - /** - * Level grid data. Contains all arches grid-wise. Its size is - * m_mapGrid[m_mapWidth][m_mapHeight]. Can never be null. - */ - private ArchObject[][] m_mapGrid; - - /** Size of this map. */ - private final Dimension mapSize = new Dimension(); - - /** Flag that indicates if the level has been changed since last save. */ - private boolean m_fLevelChanged = false; - - /** The main controller. Is never null. */ - private final CMainControl mainControl; - - /** The controller of this view. Is never null. */ - private final CMapControl mapControl; - - /** - * Constructs a level model. - * @param mainControl main controller - * @param control the controller of this view - * @param map the map header - */ - public CMapModel(final CMainControl mainControl, final CMapControl control, final MapArchObject map) { - this.mainControl = mainControl; - mapControl = control; - mapSize.setSize(map.getMapSize()); - - m_mapGrid = initMap(); - - m_mapArch = map; - - m_mapArch.setMapSize(mapSize); - } - - /** - * Return the first object (last in the object list) to display in the - * map-tiles panel. - * @return the ArchObject to show; the object(s) must not be modified - */ - @Nullable public ArchObject getMouseRightPosObject() { - final Point pos = mapControl.getMapView().getMapMouseRightPos(); - - if (pos.x == -1 || pos.y == -1 || !pointValid(pos)) { - return null; - } - - return m_mapGrid[pos.x][pos.y]; - } - - /** - * Update the map description text. - * @param str the new description text - */ - public void setNewMapText(final String str) { - m_mapArch.resetText(); - m_mapArch.addText(str); - } - - /** - * Return the map description text. - * @return the map description text - */ - public String getMapText() { - return m_mapArch.getText(); - } - - /** - * Place a list of arches onto the map. - * @param arch the head of the arches list; may be null to insert nothing - */ - public void addArchListToMap(ArchObject arch) { - while (arch != null) { - if (arch.getContainer() == null) { // only map arches.... - addArchObjectToMap(arch, false); - } - - arch = arch.getTemp(); - } - } - - /** Notifies that the application is about to exit. */ - public void appExitNotify() { - } - - /** Notifies that the level is about to be closed. */ - public void levelCloseNotify() { - freeMapArchObject(); - } - - /** Reset the level changed flag to false. */ - public void resetLevelChangedFlag() { - if (!m_fLevelChanged) { - return; - } - - // change status and update title bar - m_fLevelChanged = false; - if (mapControl.getMapView() != null) { - mapControl.getMapView().changedFlagNotify(); - } - } - - /** Set the level changed flag to true. */ - public void setLevelChangedFlag() { - if (m_fLevelChanged) { - return; - } - - // change status and update title bar - m_fLevelChanged = true; - if (mapControl.getMapView() != null) { - mapControl.getMapView().changedFlagNotify(); - } - - // enable menu file->revert to revert the map - if (mainControl.getCurrentMap() == mapControl) { - mainControl.getMainView().setRevertMenuEnabled(true); - } - } - - /** - * Return whether the level has changed since it was last saved. - * @return true=level has changed - */ - public boolean isLevelChanged() { - return m_fLevelChanged; - } - - /** - * Return the width of the level. - * @return the width of the level - */ - @Deprecated public int getMapWidth() { - return mapSize.width; - } - - /** - * Returns the height of the level. - * @return The height of the level. - */ - @Deprecated public int getMapHeight() { - return mapSize.height; - } - - /** Return the map size of this level. - * @return Map size of this level. - */ - public Dimension getMapSize() { - return mapSize; - } - - /** - * Return the bottom {@link ArchObject} in the given location. - * @return the ArchObject, or null if no object is present - */ - @Deprecated @Nullable public ArchObject getBottomArchObject(final int x, final int y) { - return getBottomArchObject(new Point(x, y)); - } - - /** - * Return the bottom {@link ArchObject} in the given location. - * @return the ArchObject, or null if no object is present - */ - @Nullable public ArchObject getBottomArchObject(final Point pos) { - if (!pointValid(pos)) { - return null; - } - - return m_mapGrid[pos.x][pos.y]; - } - - @Deprecated public ArchObject getTopArchObject(final int x, final int y) { - return getTopArchObject(new Point(x, y)); - } - - /** - * Return the topmost {@link ArchObject} in the given location. - * @return the ArchObject, or null if no object is present - */ - public ArchObject getTopArchObject(final Point pos) { - ArchObject result = getBottomArchObject(pos); - while (result != null && result.getNextArch() != null) { - result = result.getNextArch(); - } - return result; - } - - @Deprecated public void setArchObject(final int x, final int y, final ArchObject arch) { - setArchObject(new Point(x, y), arch); - } - - /** Save a map square to the given ArchObject. */ - public void setArchObject(final Point pos, final ArchObject arch) { - if (!pointValid(pos)) { - throw new IllegalArgumentException(); - } - if (arch == null) { - throw new IllegalArgumentException(); - } - - m_mapGrid[pos.x][pos.y] = arch; - } - - /** - * Return an Iterator of all ArchObjects in the given location. The - * Iterator supports deleting objects. - */ - @Deprecated public ArchObjectIteratorDeleteMapArch getArchObjectsDeleteMapArch(final int x, final int y, final boolean refreshMap, final boolean join) { - return getArchObjectsDeleteMapArch(new Point(x, y), refreshMap, join); - } - - /** - * Return an Iterator of all ArchObjects in the given location. The - * Iterator supports deleting objects. - */ - public ArchObjectIteratorDeleteMapArch getArchObjectsDeleteMapArch(final Point pos, final boolean refreshMap, final boolean join) { - return new ArchObjectIteratorDeleteMapArch(this, getBottomArchObject(pos), pos.x, pos.y, refreshMap, join); - } - - /** - * Return an Iterator of all ArchObjects in the given location. The - * Iterator supports deleting objects. - */ - public ArchObjectIteratorDeleteArchMapObject getArchObjectsDeleteArchMapObject(final Point pos) { - return new ArchObjectIteratorDeleteArchMapObject(this, getBottomArchObject(pos)); - } - - /** Return an Iterator of all ArchObjects in the given location. */ - @Deprecated public ArchObjectIterator getArchObjects(final int x, final int y) { - return getArchObjects(new Point(x, y)); - } - /** Return an Iterator of all ArchObjects in the given location. */ - public ArchObjectIterator getArchObjects(final Point pos) { - return new ArchObjectIterator(getBottomArchObject(pos)); - } - - /** Check whether a given location contains at least one ArchObject. */ - @Deprecated public boolean containsArchObject(final int x, final int y) { - return containsArchObject(new Point(x, y)); - } - - /** Check whether a given location contains at least one ArchObject. */ - public boolean containsArchObject(final Point pos) { - return pointValid(pos) && m_mapGrid[pos.x][pos.y] != null; - } - - /** - * Create an empty map grid. - * @return the empty map grid - */ - private ArchObject[][] initMap() { - final ArchObject[][] map = new ArchObject[mapSize.width][mapSize.height]; - for (int y = 0; y < mapSize.height; y++) { - for (int x = 0; x < mapSize.width; x++) { - map[x][y] = null; - } - } - - return map; - } - - /** - * Check if a given archetype fits within map bounds. Multi tiles can't be - * set if going out of borders. - * @param archnr the archetype to check - * @param xx the x-coordinate to place archnr - * @param yy the y-coordinate to place archnr - * @param intern ??? - */ - private boolean testArchToMap(final int archnr, final int xx, final int yy, final int intern) { - final int count = mainControl.getArchObjectStack().getArch(archnr).getRefCount(); // count of multi tile. 0= single tile - - for (int c = 0; c <= count; c++) { - final int mapx = xx + mainControl.getArchObjectStack().getArch(archnr + c).getRefX(); - final int mapy = yy + mainControl.getArchObjectStack().getArch(archnr + c).getRefY(); - if (mapx < 0 || mapy < 0 || mapx >= mapSize.width|| mapy >= mapSize.height) { - // outside map - return false; - } - - final int temp; - if (intern != -1) { // we use this different - only one object - temp = archnr + c; // of one type on a map position when dragged - } else { - temp = -1; - } - - // run through map parts and test for intern counter - // if == intern, this is painted from this action - final Iterator it = getArchObjects(mapx, mapy); - while (it.hasNext()) { - final ArchObject node = (ArchObject) it.next(); - if (node.getNodeNr() == temp) { - return false; - } - } - } - - return true; - } - - /** - * Move the given arch up on the map. (Note that this actually means moving - * "down" in the linked list). - * @param prev arch to be moved - * @param refresh if true, map and panel get refreshed - */ - public void moveTileUp(final ArchObject prev, final boolean refresh) { - if (prev == null) { - return; - } - - if (prev.getContainer() != null) { - return; - } - - final ArchObject arch = prev.getNextArch(); - if (arch == null) { - return; - } - - prev.setNextArch(arch.getNextArch()); - arch.setPrevArch(prev.getPrevArch()); - arch.setNextArch(prev); - prev.setPrevArch(arch); - if (prev.getNextArch() != null) { - prev.getNextArch().setPrevArch(prev); - } - if (arch.getPrevArch() != null) { - arch.getPrevArch().setNextArch(arch); - } else { - m_mapGrid[arch.getMapX()][arch.getMapY()] = arch; - } - - arch.propagateElevation(prev); - - if (refresh) { - mainControl.refreshCurrentMap(); - } - } - - /** - * Move the given arch down on the map. (Note that this actually means - * moving "up" in the linked list) - * @param arch arch to be moved - * @param refresh if true, map and panel get refreshed - */ - public void moveTileDown(final ArchObject arch, final boolean refresh) { - if (arch == null) { - return; - } - - if (arch.getContainer() != null) { - return; - } - - final ArchObject prev = arch.getPrevArch(); - if (prev == null) { - return; - } - - prev.setNextArch(arch.getNextArch()); - arch.setPrevArch(prev.getPrevArch()); - arch.setNextArch(prev); - prev.setPrevArch(arch); - if (prev.getNextArch() != null) { - prev.getNextArch().setPrevArch(prev); - } - if (arch.getPrevArch() != null) { - arch.getPrevArch().setNextArch(arch); - } else { - m_mapGrid[arch.getMapX()][arch.getMapY()] = arch; - } - - arch.propagateElevation(prev); - - if (refresh) { - mainControl.refreshCurrentMap(); - } - } - - @Deprecated public boolean addArchToMap(final int archnr, final int xx, final int yy, final int intern, final boolean join, final boolean insert_below) { - return addArchToMap(archnr, new Point(xx, yy), intern, join, insert_below); - } - - /** - * Add a new arch to the map. Including multi tile arches. This function - * allows only to choose from the default arches (->archnr). - * @param archnr ID from a default arch on the ArchObjectStack - * @param pos insert-location on this map - * @param intern if NOT '-1': only one arch of the same kind can be - * inserted per square - * @param join if set to JOIN_ENABLE auto-joining is supported; autojoining - * is only done if enabled in the main control - * @param insert_below true: new arch is inserted on top, false: new arch is - * inserted below - * @return true if insertion successful, false if not - */ - public boolean addArchToMap(int archnr, final Point pos, final int intern, final boolean join, final boolean insert_below) { - ArchObject newarch, oldarch, startarch; // our new suckers (copys, not ref ptrs) - - if (archnr < 0 || archnr >= mainControl.getArchObjectStack().getArchCount() - || pos.x == -1 || pos.y == -1 || pos.x >= mapSize.width|| pos.y >= mapSize.height) { - // invalid parameter - return false; - } - if (!testArchToMap(archnr, pos.x, pos.y, intern)) { - // does not fit on map - return false; - } - - newarch = mainControl.getArchObjectStack().getArch(archnr); // temp. store this arch - if (mainControl.getAutojoin() && join == JOIN_ENABLE && mainControl.getJoinlist() != null - && newarch.getJoinList() != null && !newarch.isMulti()) { - // do autojoining if enabled - archnr = newarch.getJoinList().joinInsert(this, pos.x, pos.y); - if (archnr == -1) { - return false; // only one autojoin type per square allowed - } - } - - final int count = mainControl.getArchObjectStack().getArch(archnr).getRefCount(); // count of multi tile. 0= single tile - - oldarch = null; - startarch = null; - for (int c = 0; c <= count; c++) { - final int mapx = pos.x + mainControl.getArchObjectStack().getArch(archnr + c).getRefX(); - final int mapy = pos.y + mainControl.getArchObjectStack().getArch(archnr + c).getRefY(); - newarch = mainControl.getArchObjectStack().newArchObjectInstance(archnr + c); - if (oldarch != null) { - newarch.setMapMultiHead(startarch); - oldarch.setMapMultiNext(newarch); - } else { - startarch = newarch; - } - oldarch = newarch; - - // insert ít in map or add to arch in map - ArchObject node = m_mapGrid[mapx][mapy]; - if (node == null) { - m_mapGrid[mapx][mapy] = newarch; - m_mapGrid[mapx][mapy].setMapX(mapx); - m_mapGrid[mapx][mapy].setMapY(mapy); - } else { - if (!insert_below) { - // if we want to insert on top, we need to get last node element - for (int i = 0; node.getNextArch() != null; i++) { - node = node.getNextArch(); - } - - node.setNextArch(newarch); - node.getNextArch().setPrevArch(node); - node.getNextArch().setMapX(mapx); - node.getNextArch().setMapY(mapy); - } else { - //ArchObject tmp = node; - node.setPrevArch(newarch); - newarch.setNextArch(node); - m_mapGrid[mapx][mapy] = newarch; - newarch.setMapX(mapx); - newarch.setMapY(mapy); - newarch.propagateElevation(node); - } - } - - mainControl.getArchObjectParser().postParseMapArch(newarch, mapControl.getActiveEditType()); - } - - // Level data has changed - setLevelChangedFlag(); - return true; - } - - @Deprecated public boolean insertArchToMap(final ArchObject newarch, final int archnr, final ArchObject next, final int mapx, final int mapy, fin... [truncated message content] |
From: <der...@us...> - 2006-06-11 14:22:32
|
Revision: 142 Author: derdanny Date: 2006-06-11 07:21:34 -0700 (Sun, 11 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=142&view=rev Log Message: ----------- Added final modifiers to variables. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CAttribBitmask.java trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/crossfire/src/cfeditor/CFArchType.java trunk/crossfire/src/cfeditor/CFArchTypeList.java trunk/crossfire/src/cfeditor/CFTreasureListTree.java trunk/crossfire/src/cfeditor/CMainMenu.java trunk/crossfire/src/cfeditor/CMapArchPanel.java trunk/crossfire/src/cfeditor/CMapFileEncode.java trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/COptionDialog.java trunk/crossfire/src/cfeditor/CResourceLoader.java trunk/crossfire/src/cfeditor/CScriptView.java trunk/crossfire/src/cfeditor/JarResources.java trunk/crossfire/src/cfeditor/ScriptArchData.java trunk/crossfire/src/cfeditor/arch/ArchObject.java trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java trunk/crossfire/src/cfeditor/gui/CloseableTabbedPane.java trunk/crossfire/src/cfeditor/gui/ScriptEditor.java trunk/crossfire/src/cfeditor/gui/ScriptManager.java trunk/crossfire/src/cfeditor/menu/AggregateMenuLocation.java trunk/crossfire/src/cfeditor/menu/BasicAction.java trunk/crossfire/src/cfeditor/menu/BasicMenuEntry.java trunk/crossfire/src/cfeditor/menu/CheckBoxMenuEntry.java trunk/crossfire/src/cfeditor/menu/LocationMenuEntry.java trunk/crossfire/src/cfeditor/menu/MenuChangeEvent.java trunk/crossfire/src/cfeditor/menu/MenuEntry.java trunk/crossfire/src/cfeditor/menu/MenuGroup.java trunk/crossfire/src/cfeditor/menu/MenuHelper.java trunk/crossfire/src/cfeditor/menu/MenuManager.java trunk/crossfire/src/cfeditor/menu/SimpleMenuEntry.java trunk/crossfire/src/cfeditor/menu/SimpleMenuLocation.java trunk/crossfire/src/cfeditor/menu/SwitchedMenuEntry.java trunk/crossfire/src/cfeditor/parameter/ArchParameter.java trunk/crossfire/src/cfeditor/parameter/ArchParameterView.java trunk/crossfire/src/cfeditor/parameter/BooleanParameter.java trunk/crossfire/src/cfeditor/parameter/BooleanParameterView.java trunk/crossfire/src/cfeditor/parameter/DoubleParameter.java trunk/crossfire/src/cfeditor/parameter/DoubleParameterView.java trunk/crossfire/src/cfeditor/parameter/FilterParameter.java trunk/crossfire/src/cfeditor/parameter/FilterParameterView.java trunk/crossfire/src/cfeditor/parameter/IntegerParameter.java trunk/crossfire/src/cfeditor/parameter/IntegerParameterView.java trunk/crossfire/src/cfeditor/parameter/MapParameter.java trunk/crossfire/src/cfeditor/parameter/MapParameterView.java trunk/crossfire/src/cfeditor/parameter/ParameterDescriptionEditor.java trunk/crossfire/src/cfeditor/parameter/ParameterNameEditor.java trunk/crossfire/src/cfeditor/parameter/ParameterTypeEditor.java trunk/crossfire/src/cfeditor/parameter/StringParameter.java trunk/crossfire/src/cfeditor/parameter/StringParameterView.java trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditView.java trunk/crossfire/src/cfeditor/textedit/textarea/PythonTokenMarker.java trunk/crossfire/src/cfeditor/textedit/textarea/TextAreaPainter.java trunk/crossfire/src/cfeditor/textedit/textarea/Token.java trunk/daimonin/src/daieditor/CMapViewBasic.java trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java trunk/daimonin/src/daieditor/textedit/textarea/TextAreaPainter.java trunk/daimonin/src/daieditor/textedit/textarea/Token.java Modified: trunk/crossfire/src/cfeditor/CAttribBitmask.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribBitmask.java 2006-06-11 12:47:11 UTC (rev 141) +++ trunk/crossfire/src/cfeditor/CAttribBitmask.java 2006-06-11 14:21:34 UTC (rev 142) @@ -98,7 +98,7 @@ int maxBit = 0; for (int i = 0; entries != null && i < entries.size(); i++) { elem = (Element) entries.get(i); - Attribute a; + final Attribute a; if ((a = elem.getAttribute("bit")) == null || elem.getAttribute("name") == null) { LOG.warn("Parse error: Found bitmask entry without 'bit' or 'name'."); elem.detach(); // remove element from DOM tree Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-06-11 12:47:11 UTC (rev 141) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-06-11 14:21:34 UTC (rev 142) @@ -26,8 +26,6 @@ import cfeditor.arch.ArchObject; import cfeditor.arch.ArchObjectStack; -import net.sf.gridarta.help.Help; -import net.sf.gridarta.GridderException; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; @@ -68,6 +66,8 @@ import javax.swing.text.Style; import javax.swing.text.StyleConstants; import javax.swing.text.StyleContext; +import net.sf.gridarta.GridderException; +import net.sf.gridarta.help.Help; import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; @@ -340,7 +340,7 @@ * @param boxWidth width of the JChooseBox in pixels * @return a <code>JPanel</code> with the combo box in it */ - private JPanel buildTypesBox(int boxWidth) { + private JPanel buildTypesBox(final int boxWidth) { final JPanel lineLayout = new JPanel(new FlowLayout(FlowLayout.RIGHT)); // layout for this line final String []namelist = new String[typelist.getLength()]; // list of typenames @@ -577,7 +577,7 @@ if (initialCall) { // if this is the first time call: // create a scrollpane and put the tabbedpane inside - JScrollPane scrollPane = new JScrollPane(tabbedPane); + final JScrollPane scrollPane = new JScrollPane(tabbedPane); scrollPane.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); @@ -1206,7 +1206,7 @@ String newFace = null; String newMsg = null; for (DialogAttrib attr = attrHead; attr != null; attr = attr.next) { - int dType = attr.ref.getDataType(); + final int dType = attr.ref.getDataType(); if (dType == CFArchAttrib.T_BOOL) { // a boolean attribute (flag) Modified: trunk/crossfire/src/cfeditor/CFArchType.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchType.java 2006-06-11 12:47:11 UTC (rev 141) +++ trunk/crossfire/src/cfeditor/CFArchType.java 2006-06-11 14:21:34 UTC (rev 142) @@ -24,12 +24,10 @@ package cfeditor; -import java.io.BufferedReader; -import java.io.IOException; +import java.util.ArrayList; import java.util.Hashtable; import java.util.List; import java.util.Vector; -import java.util.ArrayList; import org.apache.log4j.Logger; import org.jdom.Attribute; import org.jdom.Element; @@ -251,7 +249,7 @@ } // parse all attributes in the section - List schildren = elem.getChildren(); + final List schildren = elem.getChildren(); for (int k = 0; schildren != null && k < schildren.size(); k++) { elem = (Element) schildren.get(k); if (elem.getName().equalsIgnoreCase(XML_ATTRIBUTE)) { Modified: trunk/crossfire/src/cfeditor/CFArchTypeList.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-06-11 12:47:11 UTC (rev 141) +++ trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-06-11 14:21:34 UTC (rev 142) @@ -77,7 +77,7 @@ */ CFArchTypeList() { CFArchType cfType = head; // index of CFArchType list - boolean headLoaded = false; // true when the default type (=head) is loaded + final boolean headLoaded = false; // true when the default type (=head) is loaded CFileReader fread = null; // file reader for "types.txt" // initialize the arrays of "special-data" @@ -123,7 +123,7 @@ if (elem.getAttribute("name") == null) { LOG.warn("In file '" + IGUIConstants.TYPEDEF_FILE + "': cannot load list element without 'name'."); } else { - Vector list = parseListFromElement(elem); + final Vector list = parseListFromElement(elem); if (list != null && list.size() > 0) { listTable.put(elem.getAttribute("name").getValue(), list); } @@ -136,7 +136,7 @@ LOG.warn("In file '" + IGUIConstants.TYPEDEF_FILE + "': default_type element is missing!"); } else { // create a new CFArchType element - CFArchType newType = new CFArchType(head); + final CFArchType newType = new CFArchType(head); // attach the new CFArchType element to the list // if we manage to parse it properly from the file @@ -153,11 +153,11 @@ if (elem.getAttribute("name") == null) { LOG.warn("In file '" + IGUIConstants.TYPEDEF_FILE + "': cannot load ignore_list element without 'name'."); } else { - String lname = elem.getAttribute("name").getValue().trim(); - List children2 = elem.getChildren(CFArchType.XML_ATTRIBUTE); + final String lname = elem.getAttribute("name").getValue().trim(); + final List children2 = elem.getChildren(CFArchType.XML_ATTRIBUTE); if (children2 != null && children2.size() > 0) { // load all attribute entries - Vector content = new Vector(); + final Vector content = new Vector(); for (int k = 0; k < children2.size(); k++) { elem = (Element) children2.get(k); if ((a = elem.getAttribute(CFArchAttrib.XML_KEY_ARCH)) != null) { @@ -180,7 +180,7 @@ LOG.warn("In file '" + IGUIConstants.TYPEDEF_FILE + "': found type element without 'name' or 'number'."); } else { // create a new CFArchType element - CFArchType newType = new CFArchType(head); + final CFArchType newType = new CFArchType(head); // attach the new CFArchType element to the list // if we manage to parse it properly from the file @@ -213,14 +213,14 @@ * Parse a list vector from an xml list element. * @param root */ - private Vector parseListFromElement(Element root) { - Vector list = new Vector(); // list vector + private Vector parseListFromElement(final Element root) { + final Vector list = new Vector(); // list vector int num; // number for list element String string; // string for list element Element elem; Attribute a; - List entries = root.getChildren("entry"); + final List entries = root.getChildren("entry"); for (int i = 0; entries != null && i < entries.size(); i++) { elem = (Element) entries.get(i); if (elem.getAttribute("value") == null || elem.getAttribute("name") == null) { @@ -285,25 +285,25 @@ spellName = null; spellNum = null; CFileReader reader = null; // input reader - int spnum = 0; // number of spells + final int spnum = 0; // number of spells try { // open reading stream to the spells xml file - String baseDir = (IGUIConstants.isoView ? CMainControl.getInstance().getArchDefaultFolder() + File.separator + IGUIConstants.CONFIG_DIR : IGUIConstants.CONFIG_DIR); + final String baseDir = (IGUIConstants.isoView ? CMainControl.getInstance().getArchDefaultFolder() + File.separator + IGUIConstants.CONFIG_DIR : IGUIConstants.CONFIG_DIR); reader = new CFileReader(baseDir, IGUIConstants.SPELL_FILE); // parse xml document - SAXBuilder builder = new SAXBuilder(); - Document doc = builder.build(reader.getReader()); + final SAXBuilder builder = new SAXBuilder(); + final Document doc = builder.build(reader.getReader()); // retrieve the spell data from the xml - Element root = doc.getRootElement(); + final Element root = doc.getRootElement(); Element spellElem; Attribute a; if (root == null || !root.getName().equalsIgnoreCase("spells")) { LOG.warn("File '" + IGUIConstants.SPELL_FILE + "' lacks root element 'spells'."); } else { - List spells = root.getChildren("spell"); + final List spells = root.getChildren("spell"); if (spells == null || spells.size() == 0) { LOG.warn("File '" + IGUIConstants.SPELL_FILE + "' has no content."); } else { @@ -400,8 +400,8 @@ Vector list = null; // growable array of spellnames+numbers String tmp; // tmp String for spell names - FileWriter fileWriter; // file writer for "spells.def" - BufferedWriter bufferedWriter; // buffered writer + final FileWriter fileWriter; // file writer for "spells.def" + final BufferedWriter bufferedWriter; // buffered writer if (spellfile.getName().equalsIgnoreCase("spellist.h")) { list = new Vector(); @@ -494,8 +494,8 @@ // write spell-entries: for (int i = 0; i < list.size(); i++) { tmp = String.valueOf(list.elementAt(i)); - String id = tmp.substring(0, tmp.indexOf(" ")).trim(); - String name = tmp.substring(tmp.indexOf(" ") + 1).trim(); + final String id = tmp.substring(0, tmp.indexOf(" ")).trim(); + final String name = tmp.substring(tmp.indexOf(" ") + 1).trim(); String space = ""; if (id.length() == 1) { space = " "; @@ -552,7 +552,7 @@ boolean match = true; for (int t = 0; t < argsNum * 2; t += 2) { - String archvalue = arch.getAttributeString(tmp.getTypeAttr()[t], defarch); + final String archvalue = arch.getAttributeString(tmp.getTypeAttr()[t], defarch); if (!archvalue.equals(tmp.getTypeAttr()[t + 1]) && !(tmp.getTypeAttr()[t + 1].equals("0") && archvalue.length() == 0)) { Modified: trunk/crossfire/src/cfeditor/CFTreasureListTree.java =================================================================== --- trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-06-11 12:47:11 UTC (rev 141) +++ trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-06-11 14:21:34 UTC (rev 142) @@ -26,8 +26,6 @@ import cfeditor.arch.ArchObject; import cfeditor.arch.ArchObjectStack; -import net.sf.gridarta.help.Help; -import net.sf.gridarta.GridderException; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; @@ -54,6 +52,8 @@ import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.TreePath; +import net.sf.gridarta.GridderException; +import net.sf.gridarta.help.Help; import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; @@ -319,7 +319,7 @@ // do second linking to link all what is left processSecondLinking = true; - int x = needSecondLink.size(); + final int x = needSecondLink.size(); for (int i = 0; i < x; i++) { // 'node' is a sub-treasurelist which needs to be linked to it's content final TreasureTreeNode node = (TreasureTreeNode) needSecondLink.elementAt(i); @@ -406,7 +406,7 @@ * @param parentNode parent treenode * @param needLink vector containing all sub-treasurelist nodes which need linking */ - private void readInsideList(TreasureTreeNode parentNode, BufferedReader reader, Vector needLink) throws IOException { + private void readInsideList(final TreasureTreeNode parentNode, final BufferedReader reader, final Vector needLink) throws IOException { String line; // read line of file TreasureTreeNode node = null; // tmp. treenode Modified: trunk/crossfire/src/cfeditor/CMainMenu.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainMenu.java 2006-06-11 12:47:11 UTC (rev 141) +++ trunk/crossfire/src/cfeditor/CMainMenu.java 2006-06-11 14:21:34 UTC (rev 142) @@ -498,7 +498,7 @@ entry.setMnemonic('V'); final CSettings settings = CSettings.getInstance(IGUIConstants.APP_NAME); - UIManager.LookAndFeelInfo[] aInfos = UIManager.getInstalledLookAndFeels(); + final UIManager.LookAndFeelInfo[] aInfos = UIManager.getInstalledLookAndFeels(); final MenuGroup group = new MenuGroup(); //JCheckBoxMenuItem selectedMenuItem = null; final String strSelectedLNFName = settings.getProperty(CMainView.SELECTED_LNF_KEY, Modified: trunk/crossfire/src/cfeditor/CMapArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-06-11 12:47:11 UTC (rev 141) +++ trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-06-11 14:21:34 UTC (rev 142) @@ -382,11 +382,11 @@ if (arch.getFaceName() != null) { // we have a non-default face - int index = ArchObjectStack.getFaceIndex(arch.getFaceName()); + final int index = ArchObjectStack.getFaceIndex(arch.getFaceName()); arch.setFaceNr(index); } else { // we have the default face - int index = ArchObjectStack.getFaceIndex(defarch.getFaceName()); + final int index = ArchObjectStack.getFaceIndex(defarch.getFaceName()); arch.setFaceNr(index); } Modified: trunk/crossfire/src/cfeditor/CMapFileEncode.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapFileEncode.java 2006-06-11 12:47:11 UTC (rev 141) +++ trunk/crossfire/src/cfeditor/CMapFileEncode.java 2006-06-11 14:21:34 UTC (rev 142) @@ -57,7 +57,7 @@ private String fname; - public CMapFileEncode(CMainControl mainControl) { + public CMapFileEncode(final CMainControl mainControl) { this.mainControl = mainControl; } Modified: trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java 2006-06-11 12:47:11 UTC (rev 141) +++ trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java 2006-06-11 14:21:34 UTC (rev 142) @@ -50,8 +50,8 @@ import javax.swing.border.EmptyBorder; import javax.swing.border.EtchedBorder; import javax.swing.border.TitledBorder; +import net.sf.gridarta.GridderException; import net.sf.gridarta.help.Help; -import net.sf.gridarta.GridderException; /** * Dialog used to ask the user the properties for the new level. @@ -204,7 +204,7 @@ final JTabbedPane tabPane = new JTabbedPane(JTabbedPane.TOP); tabPane.setBorder(BorderFactory.createEmptyBorder(0, 3, 3, 0)); - JPanel optionPanel = new JPanel(new GridLayout(1, 1)); + final JPanel optionPanel = new JPanel(new GridLayout(1, 1)); if (IGUIConstants.isoView) { optionPanel.setBorder( new CompoundBorder( Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-06-11 12:47:11 UTC (rev 141) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-06-11 14:21:34 UTC (rev 142) @@ -639,9 +639,9 @@ new Color(0.0f, 1.0f, 1.0f, 0.33f)}; resizeBackBuffer(); /*taken from java doc, scroll while dragged*/ - MouseMotionListener doScrollRectToVisible = new MouseMotionAdapter() { + final MouseMotionListener doScrollRectToVisible = new MouseMotionAdapter() { @Override public void mouseDragged(final MouseEvent e) { - Rectangle r = new Rectangle(e.getX(), e.getY(), 1, 1); + final Rectangle r = new Rectangle(e.getX(), e.getY(), 1, 1); ((JComponent) e.getSource()).scrollRectToVisible(r); } }; @@ -1103,7 +1103,7 @@ new Color(0.0f, 1.0f, 0.0f, 0.33f), new Color(0.0f, 1.0f, 1.0f, 0.33f)}; /*taken from java doc, scroll while dragged*/ - MouseMotionListener doScrollRectToVisible = new MouseMotionAdapter() { + final MouseMotionListener doScrollRectToVisible = new MouseMotionAdapter() { @Override public void mouseDragged(final MouseEvent e) { final Rectangle r = new Rectangle(e.getX(), e.getY(), 1, 1); ((JComponent) e.getSource()).scrollRectToVisible(r); @@ -1198,7 +1198,7 @@ mainControl.getUnknownTileIcon().paintIcon(this, grfx, xstart, ystart); } } else { - Iterator it = mapModel.getArchObjects(x, y); + final Iterator it = mapModel.getArchObjects(x, y); while (it.hasNext()) { ArchObject node = (ArchObject) it.next(); @@ -1715,7 +1715,7 @@ drawInternDrag = drawInternCount; Point[] needRedraw = null; // array of tile coords which need to be redrawn - Point dragPoint = event.getPoint(); // Mouse pointer + final Point dragPoint = event.getPoint(); // Mouse pointer xp = (int) dragPoint.getX(); yp = (int) dragPoint.getY(); final Point temp = renderer.getTileLocationAt(dragPoint); // tile under Mouse pointer Modified: trunk/crossfire/src/cfeditor/COptionDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/COptionDialog.java 2006-06-11 12:47:11 UTC (rev 141) +++ trunk/crossfire/src/cfeditor/COptionDialog.java 2006-06-11 14:21:34 UTC (rev 142) @@ -204,7 +204,7 @@ final JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent event) { + public void actionPerformed(final ActionEvent event) { dispose(); } }); Modified: trunk/crossfire/src/cfeditor/CResourceLoader.java =================================================================== --- trunk/crossfire/src/cfeditor/CResourceLoader.java 2006-06-11 12:47:11 UTC (rev 141) +++ trunk/crossfire/src/cfeditor/CResourceLoader.java 2006-06-11 14:21:34 UTC (rev 142) @@ -56,7 +56,7 @@ private File file; - public CResourceLoader(String filename) { + public CResourceLoader(final String filename) { this(filename, true, true, true); } Modified: trunk/crossfire/src/cfeditor/CScriptView.java =================================================================== --- trunk/crossfire/src/cfeditor/CScriptView.java 2006-06-11 12:47:11 UTC (rev 141) +++ trunk/crossfire/src/cfeditor/CScriptView.java 2006-06-11 14:21:34 UTC (rev 142) @@ -61,7 +61,7 @@ private JFrame scriptManager = null; /** @param controller controller of this ScriptView */ - public CScriptView(CScriptController controller) { + public CScriptView(final CScriptController controller) { super(); this.ctrl = controller; } @@ -206,7 +206,7 @@ }; choose.setFileFilter(filter); if (choose.showOpenDialog(ctrl.getMainControl().getMainView()) == JFileChooser.APPROVE_OPTION) { - File f = choose.getSelectedFile(); + final File f = choose.getSelectedFile(); try { ctrl.importXML(new FileReader(f), true); } catch (final FileNotFoundException ex) { Modified: trunk/crossfire/src/cfeditor/JarResources.java =================================================================== --- trunk/crossfire/src/cfeditor/JarResources.java 2006-06-11 12:47:11 UTC (rev 141) +++ trunk/crossfire/src/cfeditor/JarResources.java 2006-06-11 14:21:34 UTC (rev 142) @@ -82,7 +82,7 @@ try { if (file.startsWith("file:")) { - URL localJar = new URL(file); + final URL localJar = new URL(file); final StringTokenizer st = new StringTokenizer(localJar.getFile(), "!"); this.jarFileName = st.nextToken(); init(); Modified: trunk/crossfire/src/cfeditor/ScriptArchData.java =================================================================== --- trunk/crossfire/src/cfeditor/ScriptArchData.java 2006-06-11 12:47:11 UTC (rev 141) +++ trunk/crossfire/src/cfeditor/ScriptArchData.java 2006-06-11 14:21:34 UTC (rev 142) @@ -576,7 +576,7 @@ if (couldCreateFile) { // file has been created, now link it to the event - ScriptedEvent event = new ScriptedEvent(eventType, pluginName, scriptPath, eventOptions); + final ScriptedEvent event = new ScriptedEvent(eventType, pluginName, scriptPath, eventOptions); if (replaceIndex != -1) { eventList.setElementAt(event, replaceIndex); } else { Modified: trunk/crossfire/src/cfeditor/arch/ArchObject.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObject.java 2006-06-11 12:47:11 UTC (rev 141) +++ trunk/crossfire/src/cfeditor/arch/ArchObject.java 2006-06-11 14:21:34 UTC (rev 142) @@ -196,7 +196,7 @@ * @param checkType bitmask containing the edit type(s) to be calculated * @return new editType for this arch */ - public int calculateEditType(int checkType) { + public int calculateEditType(final int checkType) { final ArchObject defarch = getDefaultArch(); // default arch /* if one of the types in check_type already is in editType, @@ -305,7 +305,7 @@ int result = 0; for (i = 0, j = 0; i < aText.length(); i++) { if (aText.charAt(i) == '\n') { - String line = aText.substring(j, i).trim(); + final String line = aText.substring(j, i).trim(); try { // try to read the value behind 'attr' @@ -358,7 +358,7 @@ int i; for (i = 0, j = 0; i < aText.length(); i++) { if (aText.charAt(i) == '\n') { - String line = aText.substring(j, i).trim(); + final String line = aText.substring(j, i).trim(); // take the String behind 'attr' if (line.startsWith(attr)) { @@ -406,7 +406,7 @@ String result = ""; for (i = 0, j = 0; i < aText.length(); i++) { if (aText.charAt(i) == '\n') { - String line = aText.substring(j, i).trim(); + final String line = aText.substring(j, i).trim(); // take the String behind 'attr' if (!line.startsWith(attr)) { @@ -449,7 +449,7 @@ String result = ""; for (i = 0, j = 0; i < aText.length(); i++) { if (aText.charAt(i) == '\n') { - String line = aText.substring(j, i).trim(); + final String line = aText.substring(j, i).trim(); // take the String behind 'attr' if (!line.startsWith(attr)) { @@ -1052,7 +1052,7 @@ } else { // not ignoring the value-part try { - String test = diffTextString(this.getArchText(), line, ignoreValues); + final String test = diffTextString(this.getArchText(), line, ignoreValues); char c = '\n'; if (test != null) { c = test.charAt(0); @@ -1417,7 +1417,7 @@ line = line.trim(); // get only the key-part of the attribute - String attrKey; + final String attrKey; if (line.indexOf(" ") <= 0) { // this line doesn't even have the proper format: "key value" // we assume the missing value part means zero-value Modified: trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java 2006-06-11 12:47:11 UTC (rev 141) +++ trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java 2006-06-11 14:21:34 UTC (rev 142) @@ -458,7 +458,7 @@ for (t = 0; t < 3; t++) { face += String.valueOf((char) stream.read()); } - char l = (char) stream.read(); + final char l = (char) stream.read(); if (face.indexOf("/") >= 0) { face = face.substring(face.lastIndexOf("/") + 1); Modified: trunk/crossfire/src/cfeditor/gui/CloseableTabbedPane.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/CloseableTabbedPane.java 2006-06-11 12:47:11 UTC (rev 141) +++ trunk/crossfire/src/cfeditor/gui/CloseableTabbedPane.java 2006-06-11 14:21:34 UTC (rev 142) @@ -79,7 +79,7 @@ //--- Constructor(s) --- - public CloseableTabbedPane(ImageIcon closingIcon) { + public CloseableTabbedPane(final ImageIcon closingIcon) { this.closingIcon = closingIcon; addMouseListener(new ClosingListener()); @@ -91,7 +91,7 @@ //--- Method(s) --- - public void addTab(String title, Component component, boolean closeable) { + public void addTab(final String title, final Component component, final boolean closeable) { if (closeable) { super.addTab(title, new ClosingIcon(closingIcon), component); } else { @@ -100,7 +100,7 @@ setSelectedComponent(component); } - @Override public void addTab(String title, Component component) { + @Override public void addTab(final String title, final Component component) { addTab(title, component, true); } @@ -108,15 +108,15 @@ protected class ClosingListener extends MouseAdapter { - @Override public void mouseReleased(MouseEvent e) { - int i = getSelectedIndex(); + @Override public void mouseReleased(final MouseEvent e) { + final int i = getSelectedIndex(); // nothing selected if (i == -1) { return; } - ClosingIcon icon = (ClosingIcon) getIconAt(i); + final ClosingIcon icon = (ClosingIcon) getIconAt(i); // close tab, if icon was clicked if (icon != null && icon.contains(e.getX(), e.getY())) { @@ -146,7 +146,7 @@ //--- Constructor(s) --- - public ClosingIcon(ImageIcon icon) { + public ClosingIcon(final ImageIcon icon) { this.icon = icon; if (icon != null) { @@ -170,7 +170,7 @@ * this is a rather rude approach just to find out if the closingIcon * was pressed. */ - public void paintIcon(Component c, Graphics g, int x, int y) { + public void paintIcon(final Component c, final Graphics g, final int x, final int y) { this.x = x; this.y = y; @@ -182,7 +182,7 @@ } /** Verifies if x and y are within the icon's borders. */ - public boolean contains(int xEvent, int yEvent) { + public boolean contains(final int xEvent, final int yEvent) { if (!(xEvent >= x) || !(xEvent <= x + width)) { return false; } Modified: trunk/crossfire/src/cfeditor/gui/ScriptEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/ScriptEditor.java 2006-06-11 12:47:11 UTC (rev 141) +++ trunk/crossfire/src/cfeditor/gui/ScriptEditor.java 2006-06-11 14:21:34 UTC (rev 142) @@ -86,31 +86,31 @@ private int selectedCol = -1; private final MouseListener cellMouseListener = new MouseListener() { - public void mouseClicked(MouseEvent e) { + public void mouseClicked(final MouseEvent e) { selectTableComponent((Component) e.getSource()); } - public void mouseEntered(MouseEvent e) { + public void mouseEntered(final MouseEvent e) { } - public void mouseExited(MouseEvent e) { + public void mouseExited(final MouseEvent e) { } - public void mousePressed(MouseEvent e) { + public void mousePressed(final MouseEvent e) { selectTableComponent((Component) e.getSource()); } - public void mouseReleased(MouseEvent e) { + public void mouseReleased(final MouseEvent e) { selectTableComponent((Component) e.getSource()); } }; private final FocusListener cellFocusListener = new FocusListener() { - public void focusGained(FocusEvent e) { + public void focusGained(final FocusEvent e) { selectTableComponent((Component) e.getSource()); } - public void focusLost(FocusEvent e) { + public void focusLost(final FocusEvent e) { } }; @@ -126,14 +126,14 @@ * Create a visual JComponent used to edit the given script * @param script the script object to edit */ - public ScriptEditor(CScriptModel script) { + public ScriptEditor(final CScriptModel script) { super(); this.script = script; tabs = new JTabbedPane(); this.setLayout(new BorderLayout()); this.add(tabs); optionsTab = new JPanel(new GridBagLayout()); - GridBagConstraints gbc = new GridBagConstraints(); + final GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.weightx = 1.0; gbc.gridwidth = 2; @@ -160,7 +160,7 @@ gbc.anchor = GridBagConstraints.WEST; typeAutorun = new JCheckBox("autorun at application startup"); typeAutorun.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { getScript().setAutoboot(typeAutorun.isSelected()); } }); @@ -169,7 +169,7 @@ gbc.gridy = 2; typeFilter = new JCheckBox("reference in the filters list"); typeFilter.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { getScript().setFilter(typeFilter.isSelected()); } }); @@ -178,7 +178,7 @@ gbc.gridy = 3; typeBash = new JCheckBox("reference in the manual run list"); typeBash.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { getScript().setBash(typeBash.isSelected()); } }); @@ -189,7 +189,7 @@ JButton btn = new JButton("re-register script"); btn.setToolTipText("Force plugin manager to unregister this plugin from filter list, launch the autrun (if plugin is autostart) and re-register it (if filter plugin)"); btn.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { getScript().getController().reRegister(getScript().getName()); } }); @@ -199,7 +199,7 @@ btn = new JButton("Export script..."); btn.setToolTipText("Export the specified plugin as XML (for distribution)"); btn.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { getScript().getController().exportScript(getScript()); } }); @@ -209,29 +209,29 @@ paramTable = new JPanel(new GridBagLayout()); redrawTable(); script.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent e) { + public void stateChanged(final ChangeEvent e) { redrawTable(); } }); JScrollPane scrl = new JScrollPane(paramTable); parameterTab.add(scrl, BorderLayout.CENTER); //parameterTab.add(paramTable, BorderLayout.CENTER); - JPanel paramButtons = new JPanel(); + final JPanel paramButtons = new JPanel(); paramButtons.setLayout(new StackLayout(5)); addParameter = new JButton("Add parameter"); addParameter.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { getScript().newParameter(); } }); removeParameter = new JButton("Remove parameter"); removeParameter.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { if (selectedRow < 0) { return; } - String name = getScript().getParamName(selectedRow); + final String name = getScript().getParamName(selectedRow); if (JOptionPane.showConfirmDialog(removeParameter, "Delete " + name + "?", "Delete?", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { getScript().removeParameter(selectedRow); @@ -248,25 +248,25 @@ code.setText(script.getCode()); code.setFont(new Font("Monospaced", Font.PLAIN, 14)); code.getDocument().addDocumentListener(new DocumentListener() { - public void changedUpdate(DocumentEvent e) { + public void changedUpdate(final DocumentEvent e) { getScript().setCode(code.getText()); } - public void insertUpdate(DocumentEvent e) { + public void insertUpdate(final DocumentEvent e) { getScript().setCode(code.getText()); } - public void removeUpdate(DocumentEvent e) { + public void removeUpdate(final DocumentEvent e) { getScript().setCode(code.getText()); } }); scrl = new JScrollPane(code); - JPanel codePanel = new JPanel(new BorderLayout()); + final JPanel codePanel = new JPanel(new BorderLayout()); codePanel.add(scrl, BorderLayout.CENTER); - JPanel codeBottom = new JPanel(new FlowLayout()); - JButton test = new JButton("Run Script..."); + final JPanel codeBottom = new JPanel(new FlowLayout()); + final JButton test = new JButton("Run Script..."); test.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { getScript().getController().runScript(getScript()); } }); @@ -275,9 +275,9 @@ tabs.addTab("Code", codePanel); } - public void selectTableComponent(Component c) { - GridBagLayout l = (GridBagLayout) paramTable.getLayout(); - GridBagConstraints gbc = l.getConstraints(c); + public void selectTableComponent(final Component c) { + final GridBagLayout l = (GridBagLayout) paramTable.getLayout(); + final GridBagConstraints gbc = l.getConstraints(c); if (gbc != null) { selectedRow = gbc.gridy - 1; selectedCol = gbc.gridx; @@ -285,7 +285,7 @@ } private void redrawTable() { - GridBagConstraints gbc; + final GridBagConstraints gbc; 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(new JLabel("Name"), gbc); @@ -308,12 +308,12 @@ repaint(); } - private void newTableComponent(Component c) { + private void newTableComponent(final Component c) { c.addFocusListener(cellFocusListener); c.addMouseListener(cellMouseListener); } - private ParameterNameEditor getParameterNameEditor(PluginParameter param) { + private ParameterNameEditor getParameterNameEditor(final PluginParameter param) { if (log.isDebugEnabled()) { log.debug("Doing " + param); } @@ -329,7 +329,7 @@ return o; } - private ParameterDescriptionEditor getParameterDescriptionEditor(PluginParameter param) { + private ParameterDescriptionEditor getParameterDescriptionEditor(final PluginParameter param) { ParameterDescriptionEditor o = (ParameterDescriptionEditor) paramDescriptionEditors.get(param); if (o != null) { return o; @@ -341,7 +341,7 @@ return o; } - private ParameterTypeEditor getParameterTypeEditor(PluginParameter param) { + private ParameterTypeEditor getParameterTypeEditor(final PluginParameter param) { ParameterTypeEditor o = (ParameterTypeEditor) paramTypeEditors.get(param); if (o != null) { return o; @@ -353,7 +353,7 @@ return o; } - private PluginParameterView getParameterView(PluginParameter param) { + private PluginParameterView getParameterView(final PluginParameter param) { PluginParameterView o = (PluginParameterView) paramViews.get(param); if (o != null) { return o; @@ -374,7 +374,7 @@ return o; } - private void putRow(GridBagConstraints gbc, PluginParameter param) { + private void putRow(final GridBagConstraints gbc, final PluginParameter param) { gbc.gridx = 0; paramTable.add(getParameterNameEditor(param), gbc); gbc.gridx = 1; Modified: trunk/crossfire/src/cfeditor/gui/ScriptManager.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/ScriptManager.java 2006-06-11 12:47:11 UTC (rev 141) +++ trunk/crossfire/src/cfeditor/gui/ScriptManager.java 2006-06-11 14:21:34 UTC (rev 142) @@ -56,28 +56,28 @@ private static final long serialVersionUID = -3819064077177259928L; /** @throws java.awt.HeadlessException */ - public ScriptManager(CScriptController scriptController) { + public ScriptManager(final CScriptController scriptController) { super("Editor plugins management"); this.ctrl = scriptController; this.getContentPane().setLayout(new BorderLayout()); - JPanel left = new JPanel(new BorderLayout()); + final JPanel left = new JPanel(new BorderLayout()); scriptLayout = new CardLayout(); scriptPanel = new JPanel(scriptLayout); this.getContentPane().add(left, BorderLayout.WEST); this.getContentPane().add(scriptPanel, BorderLayout.CENTER); - ListModel mdl = new AbstractListModel() { + final ListModel mdl = new AbstractListModel() { private static final long serialVersionUID = 7636033005940159801L; { - ChangeListener l = new ChangeListener() { - public void stateChanged(ChangeEvent e) { + final ChangeListener l = new ChangeListener() { + public void stateChanged(final ChangeEvent e) { fireContentsChanged(scripts, 0, getController().getScriptCount() + 1); } }; getController().addChangeListener(l); } - @Nullable public Object getElementAt(int index) { + @Nullable public Object getElementAt(final int index) { try { return ctrl.getScript(index); } catch (Exception e) { @@ -91,7 +91,7 @@ }; scripts = new JList(mdl); scripts.addListSelectionListener(new ListSelectionListener() { - public void valueChanged(ListSelectionEvent e) { + public void valueChanged(final ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { showScript((CScriptModel) scripts.getSelectedValue()); } @@ -100,12 +100,12 @@ scripts.setSelectionMode(DefaultListSelectionModel.SINGLE_SELECTION); scripts.setBorder(new LineBorder(Color.black, 1)); left.add(scripts, BorderLayout.CENTER); - JButton addScriptBtn = new JButton("New..."); + final JButton addScriptBtn = new JButton("New..."); addScriptBtn.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - String name = JOptionPane.showInputDialog(scripts, "Name of the new Beanshell plugin?"); + public void actionPerformed(final ActionEvent e) { + final String name = JOptionPane.showInputDialog(scripts, "Name of the new Beanshell plugin?"); if (name != null) { - CScriptModel m = new CScriptModel(ctrl); + final CScriptModel m = new CScriptModel(ctrl); m.setName(name); m.setCode("//input your beanshell Code"); getController().addScript(m); @@ -113,10 +113,10 @@ } } }); - JButton removeScriptBtn = new JButton("Remove"); + final JButton removeScriptBtn = new JButton("Remove"); removeScriptBtn.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - CScriptModel m = (CScriptModel) scripts.getSelectedValue(); + public void actionPerformed(final ActionEvent e) { + final CScriptModel m = (CScriptModel) scripts.getSelectedValue(); if (m == null) { return; } @@ -133,7 +133,7 @@ } } }); - JPanel bottomLeft = new JPanel(new GridLayout(2, 1)); + final JPanel bottomLeft = new JPanel(new GridLayout(2, 1)); bottomLeft.add(addScriptBtn); bottomLeft.add(removeScriptBtn); left.add(bottomLeft, BorderLayout.SOUTH); @@ -146,7 +146,7 @@ return this.ctrl; } - private void showScript(CScriptModel model) { + private void showScript(final CScriptModel model) { /* using a cardlayout is a necessary trick as * simply removing previous component and putting * the new one in the JPanel lead to problem unless @@ -167,8 +167,8 @@ scriptLayout.show(scriptPanel, c.getUid()); } - private void removeScript(CScriptModel model) { - ScriptEditor c = (ScriptEditor) components.get(model); + private void removeScript(final CScriptModel model) { + final ScriptEditor c = (ScriptEditor) components.get(model); if (c != null) { components.remove(model); scriptPanel.remove(c); Modified: trunk/crossfire/src/cfeditor/menu/AggregateMenuLocation.java =================================================================== --- trunk/crossfire/src/cfeditor/menu/AggregateMenuLocation.java 2006-06-11 12:47:11 UTC (rev 141) +++ trunk/crossfire/src/cfeditor/menu/AggregateMenuLocation.java 2006-06-11 14:21:34 UTC (rev 142) @@ -24,17 +24,17 @@ private final MenuLocation location; - public WrappedMenuLocation(MenuLocation location, String parentName) { + public WrappedMenuLocation(final MenuLocation location, final String parentName) { this.location = location; this.parentName = parentName; name = parentName + "." + location.getName(); } - public void addMenuEntry(MenuEntry entry) { + public void addMenuEntry(final MenuEntry entry) { location.addMenuEntry(entry); } - public boolean contains(MenuEntry entry) { + public boolean contains(final MenuEntry entry) { return location.contains(entry); } @@ -46,11 +46,11 @@ return name; } - public void removeMenuEntry(MenuEntry entry) { + public void removeMenuEntry(final MenuEntry entry) { location.removeMenuEntry(entry); } - public void setMenuManager(MenuManager menuManager) { + public void setMenuManager(final MenuManager menuManager) { location.setMenuManager(menuManager); } @@ -58,9 +58,9 @@ return location; } - @Override public boolean equals(Object obj) { + @Override public boolean equals(final Object obj) { if (obj instanceof WrappedMenuLocation) { - WrappedMenuLocation loc = (WrappedMenuLocation) obj; + final WrappedMenuLocation loc = (WrappedMenuLocation) obj; return ((loc.name == null ? name == null : loc.equals(name)) && (loc.location == null ? location == null : loc.equals(location))); } @@ -83,19 +83,19 @@ private MenuManager menuManager = null; - public AggregateMenuLocation(String name) { + public AggregateMenuLocation(final String name) { super(name); subMenus = new LinkedHashMap(); } - public void addMenuLocation(MenuLocation location) { + public void addMenuLocation(final MenuLocation location) { if (subMenus.containsKey(location.getName())) { if (log.isInfoEnabled()) { log.info("Tried to add location" + location.getName() + " twice to " + getName()); } return; } - WrappedMenuLocation wml = new WrappedMenuLocation(location, getName()); + final WrappedMenuLocation wml = new WrappedMenuLocation(location, getName()); subMenus.put(location.getName(), wml); if (menuManager != null) { menuManager.addMenuLocation(wml); @@ -107,8 +107,8 @@ * @param location The location name. This should not include the * AggregateMenuLocation name as parent. It is a relative path. */ - @Nullable public MenuLocation getMenuLocation(String location) { - WrappedMenuLocation wml = (WrappedMenuLocation) subMenus.get(location); + @Nullable public MenuLocation getMenuLocation(final String location) { + final WrappedMenuLocation wml = (WrappedMenuLocation) subMenus.get(location); if (wml != null) { return wml.getLocation(); } else { @@ -116,7 +116,7 @@ } } - @Override public boolean contains(MenuEntry entry) { + @Override public boolean contains(final MenuEntry entry) { if (super.contains(entry)) { return true; } @@ -129,7 +129,7 @@ return false; } - @Override public void setMenuManager(MenuManager menuManager) { + @Override public void setMenuManager(final MenuManager menuManager) { if (log.isDebugEnabled()) { log.debug("Setting menu Manager for " + getName()); } Modified: trunk/crossfire/src/cfeditor/menu/BasicAction.java =================================================================== --- trunk/crossfire/src/cfeditor/menu/BasicAction.java 2006-06-11 12:47:11 UTC (rev 141) +++ trunk/crossfire/src/cfeditor/menu/BasicAction.java 2006-06-11 14:21:34 UTC (rev 142) @@ -27,47 +27,47 @@ private static final long serialVersionUID = -9018592526345334501L; - public BasicAction(BasicMenuEntry entry) { + public BasicAction(final BasicMenuEntry entry) { super(); this.entry = entry; } - public BasicAction(BasicMenuEntry entry, String name) { + public BasicAction(final BasicMenuEntry entry, final String name) { super(name); this.entry = entry; } - public BasicAction(BasicMenuEntry entry, String name, Icon icon) { + public BasicAction(final BasicMenuEntry entry, final String name, final Icon icon) { super(name, icon); this.entry = entry; } - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { log.debug("ActionPerformed: " + e); entry.actionPerformed(e); } - public void setName(String name) { + public void setName(final String name) { putValue(NAME, name); } - public void setKeyStroke(KeyStroke key) { + public void setKeyStroke(final KeyStroke key) { putValue(ACCELERATOR_KEY, key); } - public void setActionCommand(String command) { + public void setActionCommand(final String command) { putValue(ACTION_COMMAND_KEY, command); } - public void setIcon(Icon icon) { + public void setIcon(final Icon icon) { putValue(SMALL_ICON, icon); } - public void setMnemonic(int key) { + public void setMnemonic(final int key) { putValue(MNEMONIC_KEY, new Integer(key)); } - @Override public Object getValue(String key) { + @Override public Object getValue(final String key) { if (log.isDebugEnabled()) { log.debug("getValue(" + key + ") -> " + super.getValue(key)); } Modified: trunk/crossfire/src/cfeditor/menu/BasicMenuEntry.java =================================================================== --- trunk/crossfire/src/cfeditor/menu/BasicMenuEntry.java 2006-06-11 12:47:11 UTC (rev 141) +++ trunk/crossfire/src/cfeditor/menu/BasicMenuEntry.java 2006-06-11 14:21:34 UTC (rev 142) @@ -49,27 +49,27 @@ private boolean enabled = true; - public BasicMenuEntry(String name) { + public BasicMenuEntry(final String name) { setName(name); } - public void setAccelerator(KeyStroke accelerator) { + public void setAccelerator(final KeyStroke accelerator) { this.accelerator = accelerator; fireUpdate(); } - public void setMnemonic(char mnemonic) { + public void setMnemonic(final char mnemonic) { this.mnemonic = mnemonic; fireUpdate(); } - public void addActionListener(ActionListener listener) { + public void addActionListener(final ActionListener listener) { synchronized (listeners) { listeners.add(listener); } } - protected void initItem(AbstractButton item) { + protected void initItem(final AbstractButton item) { log.debug("initItem()"); item.setAction(getBasicAction()); updateItem(item); @@ -80,7 +80,7 @@ if (action == null) { synchronized (this) { if (action == null) { - BasicAction bas = new BasicAction(this, getName()); + final BasicAction bas = new BasicAction(this, getName()); action = bas; } } @@ -88,7 +88,7 @@ return action; } - private void referenceItem(Object item) { + private void referenceItem(final Object item) { log.debug("referenceMenuItem()"); synchronized (refs) { refs.add(new WeakReference(item, componentQueue)); @@ -99,7 +99,7 @@ protected abstract void update(); - protected void defaultUpdateItem(JComponent item) { + protected void defaultUpdateItem(final JComponent item) { log.debug("defaultUpdateJMenuItem"); if (log.isDebugEnabled()) { log.debug("item " + item.getClass() + ": " + name + " (" + mnemonic + ") -> " + accelerator); @@ -116,7 +116,7 @@ } } - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { synchronized (listeners) { for (Iterator i = listeners.iterator(); i.hasNext();) { log.debug("One more actionPerformed Listerner"); @@ -137,8 +137,8 @@ cleanUpQueue(componentQueue); synchronized (refs) { for (Iterator i = refs.iterator(); i.hasNext();) { - WeakReference wf = (WeakReference) i.next(); - JComponent item = (JComponent) wf.get(); + final WeakReference wf = (WeakReference) i.next(); + final JComponent item = (JComponent) wf.get(); if (log.isDebugEnabled()) { log.debug("Updating item: " + item); } @@ -149,7 +149,7 @@ } } - private void cleanUpQueue(ReferenceQueue queue) { + private void cleanUpQueue(final ReferenceQueue queue) { Reference r; synchronized (refs) { while ((r = queue.poll()) != null) { @@ -162,7 +162,7 @@ return name; } - public void setName(String name) { + public void setName(final String name) { if (log.isDebugEnabled()) { log.debug("setName(" + name + ")"); } @@ -183,7 +183,7 @@ return enabled; } - public void setEnabled(boolean enabled) { + public void setEnabled(final boolean enabled) { this.enabled = enabled; fireUpdate(); } Modified: trunk/crossfire/src/cfeditor/menu/CheckBoxMenuEntry.java =================================================================== --- trunk/crossfire/src/cfeditor/menu/CheckBoxMenuEntry.java 2006-06-11 12:47:11 UTC (rev 141) +++ trunk/crossfire/src/cfeditor/menu/CheckBoxMenuEntry.java 2006-06-11 14:21:34 UTC (rev 142) @@ -33,7 +33,7 @@ private MenuGroup group = null; /** @param name */ - public CheckBoxMenuEntry(String name) { + public CheckBoxMenuEntry(final String name) { super(name); } @@ -41,9 +41,9 @@ return checked; } - public void setChecked(boolean checked) { + public void setChecked(final boolean checked) { if (group == null) { - boolean oldChecked = this.checked; + final boolean oldChecked = this.checked; this.checked = checked; if (this.checked != oldChecked) { fireUpdate(); @@ -59,7 +59,7 @@ //getModel().setSelected(isChecked()); } - @Override protected void updateItem(JComponent item) { + @Override protected void updateItem(final JComponent item) { defaultUpdateItem(item); if (item instanceof JCheckBoxMenuItem) { ((JCheckBoxMenuItem) item).setSelected(isChecked()); @@ -75,22 +75,22 @@ @Override public JComponent getMenuItemComponent() { log.debug("getMenuItemComponent()"); - JCheckBoxMenuItem chk = new JCheckBoxMenuItem(); + final JCheckBoxMenuItem chk = new JCheckBoxMenuItem(); ... [truncated message content] |
From: <aki...@us...> - 2006-06-11 13:04:15
|
Revision: 141 Author: akirschbaum Date: 2006-06-11 05:47:11 -0700 (Sun, 11 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=141&view=rev Log Message: ----------- Add final modifier where possible. Modified Paths: -------------- trunk/crossfire/src/cfeditor/AutojoinList.java trunk/crossfire/src/cfeditor/BshThread.java trunk/crossfire/src/cfeditor/CArchPanelPan.java trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/crossfire/src/cfeditor/CFArchAttrib.java trunk/crossfire/src/cfeditor/CFArchType.java trunk/crossfire/src/cfeditor/CFArchTypeList.java trunk/crossfire/src/cfeditor/CFJavaEditor.java trunk/crossfire/src/cfeditor/CFTreasureListTree.java trunk/crossfire/src/cfeditor/CFancyButton.java trunk/crossfire/src/cfeditor/CFileInputStream.java trunk/crossfire/src/cfeditor/CFileReader.java trunk/crossfire/src/cfeditor/CFilterControl.java trunk/crossfire/src/cfeditor/CGUIUtils.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMainMenu.java trunk/crossfire/src/cfeditor/CMainToolbar.java trunk/crossfire/src/cfeditor/CMainView.java trunk/crossfire/src/cfeditor/CMapArchPanel.java trunk/crossfire/src/cfeditor/CMapTileList.java trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/CMapViewIFrame.java trunk/crossfire/src/cfeditor/CNewMapDialog.java trunk/crossfire/src/cfeditor/COptionDialog.java trunk/crossfire/src/cfeditor/CPickmapPanel.java trunk/crossfire/src/cfeditor/CResourceLoader.java trunk/crossfire/src/cfeditor/CScriptController.java trunk/crossfire/src/cfeditor/CScriptModel.java trunk/crossfire/src/cfeditor/CScriptView.java trunk/crossfire/src/cfeditor/CSettings.java trunk/crossfire/src/cfeditor/CStartupScreen.java trunk/crossfire/src/cfeditor/CopyBuffer.java trunk/crossfire/src/cfeditor/ExitTypes.java trunk/crossfire/src/cfeditor/FaceObject.java trunk/crossfire/src/cfeditor/IdGenerator.java trunk/crossfire/src/cfeditor/JFontChooser.java trunk/crossfire/src/cfeditor/JarResources.java trunk/crossfire/src/cfeditor/MapArchObject.java trunk/crossfire/src/cfeditor/MultiArchData.java trunk/crossfire/src/cfeditor/MultiPositionData.java trunk/crossfire/src/cfeditor/PluginParameter.java trunk/crossfire/src/cfeditor/PluginParameterFactory.java trunk/crossfire/src/cfeditor/ReplaceDialog.java trunk/crossfire/src/cfeditor/ScriptArchData.java trunk/crossfire/src/cfeditor/TrackedBufferedInputStream.java trunk/crossfire/src/cfeditor/textedit/scripteditor/CFPythonPopup.java trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditView.java trunk/daimonin/src/daieditor/ArchUpdater.java trunk/daimonin/src/daieditor/CAttribDialog.java trunk/daimonin/src/daieditor/CFArchAttrib.java trunk/daimonin/src/daieditor/CFArchType.java trunk/daimonin/src/daieditor/CFTreasureListTree.java trunk/daimonin/src/daieditor/CGUIUtils.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/CMapArchPanel.java trunk/daimonin/src/daieditor/CMapFileDecode.java trunk/daimonin/src/daieditor/CMapTileList.java trunk/daimonin/src/daieditor/ProcessRunner.java trunk/daimonin/src/daieditor/ReplaceDialog.java trunk/daimonin/src/daieditor/ResourceFileManager.java trunk/daimonin/src/daieditor/ScriptArchData.java trunk/daimonin/src/daieditor/Spells.java trunk/daimonin/src/daieditor/SplashScreen.java trunk/daimonin/src/daieditor/arch/ArchObjectStack.java Modified: trunk/crossfire/src/cfeditor/AutojoinList.java =================================================================== --- trunk/crossfire/src/cfeditor/AutojoinList.java 2006-06-08 21:24:32 UTC (rev 140) +++ trunk/crossfire/src/cfeditor/AutojoinList.java 2006-06-11 12:47:11 UTC (rev 141) @@ -37,7 +37,7 @@ * do autojoining. * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ -public class AutojoinList { +public final class AutojoinList { private static final Logger log = Logger.getLogger(AutojoinList.class); Modified: trunk/crossfire/src/cfeditor/BshThread.java =================================================================== --- trunk/crossfire/src/cfeditor/BshThread.java 2006-06-08 21:24:32 UTC (rev 140) +++ trunk/crossfire/src/cfeditor/BshThread.java 2006-06-11 12:47:11 UTC (rev 141) @@ -16,7 +16,7 @@ * To change the template for this generated type comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ -public class BshThread extends Thread { +public final class BshThread extends Thread { private CScriptModel script; @@ -53,7 +53,7 @@ try { interpreter.set("scriptThread", this); interpreter.eval(script.getCode()); - } catch (EvalError e) { + } catch (final EvalError e) { //do something? interpreter.getErr().print(e.getMessage()); if (e.getCause() != null) { Modified: trunk/crossfire/src/cfeditor/CArchPanelPan.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-06-08 21:24:32 UTC (rev 140) +++ trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-06-11 12:47:11 UTC (rev 141) @@ -42,7 +42,7 @@ import javax.swing.event.ListSelectionListener; import org.apache.log4j.Logger; -public class CArchPanelPan extends JPanel { +public final class CArchPanelPan extends JPanel { private static final Logger LOG = Logger.getLogger(CArchPanel.class); @@ -218,7 +218,7 @@ try { final int index = Integer.parseInt(list.substring(5 + 10 * i, 10 + 10 * i)); cathList[i] = jbox.getItemAt(index).toString().trim(); - } catch (NullPointerException e) { + } catch (final NullPointerException e) { LOG.warn("Nullpointer in getListCathegoryArray()!", e); } } Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-06-08 21:24:32 UTC (rev 140) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-06-11 12:47:11 UTC (rev 141) @@ -377,8 +377,6 @@ * @return the completed <code>JComboBox</code> */ private JComboBox buildSpellBox(final CFArchAttrib attr) { - int active = 0; // active selection in the combo box - // first parse the spell-number value from arch int spnum = arch.getAttributeValue(attr.getNameOld(), defarch); // spell number @@ -387,11 +385,13 @@ } // do we have "none" spell? + int active; if (spnum == 0 && (arch.getAttributeString(attr.getNameOld(), defarch).length() == 0 || attr.getDataType() == CFArchAttrib.T_ZSPELL)) { active = 0; } else { // now look up the spell-number in the array of spells + active = 0; for (int i = 0; i < typelist.getSpellNum().length; i++) { if (typelist.getSpellNum()[i] == spnum) { active = i; // set selection @@ -1242,9 +1242,7 @@ } else { try { if (dType == CFArchAttrib.T_INT) { - final int value; // int value from the input form - // try to parse String to Int - value = Integer.parseInt(((IntAttrib) attr).input.getText().trim()); + final int value = Integer.parseInt(((IntAttrib) attr).input.getText().trim()); if (defarch.getAttributeValue(attr.ref.getNameOld(), null) != value) { newArchText = newArchText + attr.ref.getNameOld() + " " + value + "\n"; } @@ -1252,9 +1250,11 @@ // try to parse floating point final double value = Double.parseDouble(((FloatAttrib) attr).input.getText().trim()); final String defValueStr = defarch.getAttributeString(attr.ref.getNameOld(), null).trim(); - double defValue = 0; + final double defValue; if (defValueStr.length() > 0) { defValue = Double.parseDouble(defValueStr); + } else { + defValue = 0; } if (value != defValue) { newArchText = newArchText + attr.ref.getNameOld() + " " + value + "\n"; @@ -1569,31 +1569,31 @@ } /** This (Sub)Class implements the dialog attribute of type BOOL. */ - public class BoolAttrib extends DialogAttrib { + public final class BoolAttrib extends DialogAttrib { public JCheckBox input; // the input means of bool is a checkbox } /** This (Sub)Class implements the dialog attribute of type INT. */ - public class IntAttrib extends DialogAttrib { + public final class IntAttrib extends DialogAttrib { public JTextField input; // the input means of int is a textfield } /** This (Sub)Class implements the dialog attribute of type FLOAT. */ - public class FloatAttrib extends DialogAttrib { + public final class FloatAttrib extends DialogAttrib { public JTextField input; // the input means of int is a textfield } /** This (Sub)Class implements the dialog attribute of type STRING. */ - public class StringAttrib extends DialogAttrib { + public final class StringAttrib extends DialogAttrib { public JTextField input; // the input means of string is a textfield } /** This (Sub)Class implements the dialog attribute of type TEXT. */ - public class TextAttrib extends DialogAttrib { + public final class TextAttrib extends DialogAttrib { public JTextArea input; // the input means of text is a textarea } @@ -1602,7 +1602,7 @@ * This (Sub)Class implements the dialog attribute of types with * selection lists (ComboBoxes) to choose from. */ - public class ListAttrib extends DialogAttrib { + public final class ListAttrib extends DialogAttrib { public JComboBox input; // the input means of spell is a combo box } @@ -1611,7 +1611,7 @@ * This (Sub)Class implements the dialog attribute of types with * bitmasks to choose from. */ - public class BitmaskAttrib extends DialogAttrib { + public final class BitmaskAttrib extends DialogAttrib { public JTextArea text; // the display component for bitmask-contents @@ -1653,7 +1653,7 @@ } /** Action-listener for the change buttons of bitmasks */ - public class MaskChangeAL implements ActionListener { + public final class MaskChangeAL implements ActionListener { BitmaskAttrib bmAttr; // attribute structure @@ -1683,7 +1683,7 @@ * Action-listener for the buttons on treasurelists. When such a button is * pressed, the dialog with treasurelists pops up. */ - public class ViewTreasurelistAL implements ActionListener { + public final class ViewTreasurelistAL implements ActionListener { StringAttrib strAttr; // attribute structure @@ -1714,7 +1714,7 @@ * and also Window-listener for the closebox of the dialog * (which would equal a "keep all" button) */ - public class ConfirmErrorsAL implements ActionListener, WindowListener { + public final class ConfirmErrorsAL implements ActionListener, WindowListener { JDialog dialog; // the popup dialog itself @@ -1892,7 +1892,7 @@ * Unfortunately, this class cannot be used anymore because * it does not work together with the listener <code>TypesBoxAL</code> */ - private class StringKeyManager implements JComboBox.KeySelectionManager { + private static final class StringKeyManager implements JComboBox.KeySelectionManager { final JComboBox box; // reference to ComboBox Modified: trunk/crossfire/src/cfeditor/CFArchAttrib.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchAttrib.java 2006-06-08 21:24:32 UTC (rev 140) +++ trunk/crossfire/src/cfeditor/CFArchAttrib.java 2006-06-11 12:47:11 UTC (rev 141) @@ -135,7 +135,7 @@ } // type name - String atype = null; + final String atype; if ((a1 = root.getAttribute(XML_ATTR_TYPE)) != null) { atype = a1.getValue().trim(); } else { Modified: trunk/crossfire/src/cfeditor/CFArchType.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchType.java 2006-06-08 21:24:32 UTC (rev 140) +++ trunk/crossfire/src/cfeditor/CFArchType.java 2006-06-11 12:47:11 UTC (rev 141) @@ -40,7 +40,7 @@ * It is mainly used as info-base for the arch-attribute GUI. * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ -public class CFArchType { +public final class CFArchType { private static final Logger LOG = Logger.getLogger(CFArchType.class); @@ -74,7 +74,7 @@ // must have, in order to be of this type: // typeAttributes[0] is attr. name, typeAttributes[1] is attr. value, ... - private CFArchType defaultArchType; // head Element (contains default attributes) + private final CFArchType defaultArchType; // contains default attributes private CFArchType next; // next CFArchType in the list @@ -163,7 +163,7 @@ typeAttributes = tmp.toArray(new String[tmp.size()]); } } - } catch (NumberFormatException e) { + } catch (final NumberFormatException e) { // parsing type number failed: LOG.error("In " + IGUIConstants.TYPEDEF_FILE + ": Type " + typeName + " has invalid type number '" + root.getAttribute("number").getValue() + "'."); return false; Modified: trunk/crossfire/src/cfeditor/CFArchTypeList.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-06-08 21:24:32 UTC (rev 140) +++ trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-06-11 12:47:11 UTC (rev 141) @@ -52,7 +52,7 @@ * them conveniently accessible. * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ -public class CFArchTypeList { +public final class CFArchTypeList { private static final Logger LOG = Logger.getLogger(CFArchTypeList.class); @@ -89,16 +89,16 @@ try { // open ascii filestream to the xml data - String baseDir = (IGUIConstants.isoView ? CMainControl.getInstance().getArchDefaultFolder() + File.separator + IGUIConstants.CONFIG_DIR : IGUIConstants.CONFIG_DIR); + final String baseDir = (IGUIConstants.isoView ? CMainControl.getInstance().getArchDefaultFolder() + File.separator + IGUIConstants.CONFIG_DIR : IGUIConstants.CONFIG_DIR); fread = new CFileReader(baseDir, IGUIConstants.TYPEDEF_FILE); // parse xml document - SAXBuilder builder = new SAXBuilder(); + final SAXBuilder builder = new SAXBuilder(); builder.setValidation(true); - Document doc = builder.build(fread.getReader()); + final Document doc = builder.build(fread.getReader()); // start parsing the xml - Element root = doc.getRootElement(); + final Element root = doc.getRootElement(); Element elem; Attribute a; if (root == null || !root.getName().equalsIgnoreCase("types")) { Modified: trunk/crossfire/src/cfeditor/CFJavaEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/CFJavaEditor.java 2006-06-08 21:24:32 UTC (rev 140) +++ trunk/crossfire/src/cfeditor/CFJavaEditor.java 2006-06-11 12:47:11 UTC (rev 141) @@ -39,7 +39,7 @@ * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @version $Revision: 1.27 $ */ -public class CFJavaEditor { +public final class CFJavaEditor { private static final Logger log = Logger.getLogger(CFJavaEditor.class); @@ -151,7 +151,7 @@ private static void processFile(final CMainControl mainControl, final String filelist) { try { - BufferedReader reader = new BufferedReader(new FileReader(filelist)); + final BufferedReader reader = new BufferedReader(new FileReader(filelist)); try { while (true) { final String in = reader.readLine(); Modified: trunk/crossfire/src/cfeditor/CFTreasureListTree.java =================================================================== --- trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-06-08 21:24:32 UTC (rev 140) +++ trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-06-11 12:47:11 UTC (rev 141) @@ -62,7 +62,7 @@ * CF datafile "treasures" gets parsed into a JTree structure. * @author Andreas Vogl */ -public class CFTreasureListTree extends JTree { +public final class CFTreasureListTree extends JTree { private static final Logger LOG = Logger.getLogger(CFTreasureListTree.class); @@ -162,11 +162,11 @@ public synchronized void initSpecialTreasureLists() { specialTreasureLists = new Hashtable(); - TreasureTreeNode godFolder = new TreasureTreeNode("God Intervention", TreasureObj.FOLDER); + final TreasureTreeNode godFolder = new TreasureTreeNode("God Intervention", TreasureObj.FOLDER); root.add(godFolder); - TreasureTreeNode dragonFolder = new TreasureTreeNode("Dragon Player Evolution", TreasureObj.FOLDER); + final TreasureTreeNode dragonFolder = new TreasureTreeNode("Dragon Player Evolution", TreasureObj.FOLDER); root.add(dragonFolder); - TreasureTreeNode playerFolder = new TreasureTreeNode("Player Creation", TreasureObj.FOLDER); + final TreasureTreeNode playerFolder = new TreasureTreeNode("Player Creation", TreasureObj.FOLDER); root.add(playerFolder); specialTreasureLists.put("Valriel", godFolder); @@ -229,7 +229,7 @@ * @param name Name of a treasurelist * @return True when the treasurelists with the given name exists */ - public boolean containsTreasureList(String name) { + public static final boolean containsTreasureList(final String name) { return treasureTable.containsKey(name); } @@ -241,29 +241,26 @@ * has been parsed. False when there is no data and tree remains empty. */ private boolean parseTreasures() { - CFileReader reader; // resource file reader - TreasureTreeNode node = null; // tmp. treenode - Vector tmpList = new Vector(); // tmp. container for all treasurelists - Vector needLink = new Vector(); // all sub-treasurelist nodes that need linking + final Vector tmpList = new Vector(); // tmp. container for all treasurelists + final Vector needLink = new Vector(); // all sub-treasurelist nodes that need linking treasureTable = new Hashtable(); // hashtable for all treasureTreeNodes - int i = 0; - // first step: parsing datafile, adding all treasurelists to the tmpList vector try { - String baseDir = IGUIConstants.isoView ? CMainControl.getInstance().getArchDefaultFolder() : IGUIConstants.CONFIG_DIR; - reader = new CFileReader(baseDir, IGUIConstants.TREASURES_FILE); + final String baseDir = IGUIConstants.isoView ? CMainControl.getInstance().getArchDefaultFolder() : IGUIConstants.CONFIG_DIR; + final CFileReader reader = new CFileReader(baseDir, IGUIConstants.TREASURES_FILE); String line = null; // read line of file // read the whole file line by line + TreasureTreeNode node = null; while ((line = reader.getReader().readLine()) != null) { line = line.trim(); if (line.length() > 0 && !line.startsWith("#")) { // reading outside of treasurelist + final int i; if (line.startsWith("treasure") && (i = line.indexOf(" ")) != -1) { // start of a new treasure section - node = new TreasureTreeNode(line.substring(i).trim(), - line.startsWith("treasureone") ? TreasureObj.TREASUREONE_LIST : TreasureObj.TREASURE_LIST); + node = new TreasureTreeNode(line.substring(i).trim(), line.startsWith("treasureone") ? TreasureObj.TREASUREONE_LIST : TreasureObj.TREASURE_LIST); tmpList.addElement(node); // put this node to tmplist vector treasureTable.put(node.getTreasureObj().getName(), node); // put it into hashtable tListCount++; @@ -278,8 +275,8 @@ } reader.close(); - } catch (FileNotFoundException e) { - } catch (IOException e) { + } catch (final FileNotFoundException e) { + } catch (final IOException e) { } // second step: sort alphabetically and link sub-treasurelist entries @@ -288,9 +285,8 @@ // Loop through all treasureone lists and calculate the real ratio // of chances (Summed up to be 100%). Also attach lists to tree model. - TreasureTreeNode realNode = null; - for (i = 0; i < tmpList.size(); i++) { - realNode = (TreasureTreeNode) tmpList.elementAt(i); + for (int i = 0; i < tmpList.size(); i++) { + final TreasureTreeNode realNode = (TreasureTreeNode) tmpList.elementAt(i); if (realNode.getTreasureObj().getType() == TreasureObj.TREASUREONE_LIST) { recalculateChances(realNode); } @@ -304,13 +300,12 @@ } // link the sub-lists first time - realNode = null; - for (i = 0; i < needLink.size(); i++) { + for (int i = 0; i < needLink.size(); i++) { // 'node' is a sub-treasurelist which needs to be linked to it's content - node = (TreasureTreeNode) needLink.elementAt(i); + final TreasureTreeNode node = (TreasureTreeNode) needLink.elementAt(i); // 'realNode' is the real instance of that treasurelist - realNode = (TreasureTreeNode) treasureTable.get(node.getTreasureObj().getName()); + final TreasureTreeNode realNode = (TreasureTreeNode) treasureTable.get(node.getTreasureObj().getName()); if (realNode != null) { // set accurate type of treausrelist (one/multi) @@ -323,15 +318,14 @@ } // do second linking to link all what is left - realNode = null; processSecondLinking = true; int x = needSecondLink.size(); - for (i = 0; i < x; i++) { + for (int i = 0; i < x; i++) { // 'node' is a sub-treasurelist which needs to be linked to it's content - node = (TreasureTreeNode) needSecondLink.elementAt(i); + final TreasureTreeNode node = (TreasureTreeNode) needSecondLink.elementAt(i); // 'realNode' is the real instance of that treasurelist - realNode = (TreasureTreeNode) treasureTable.get(node.getTreasureObj().getName()); + final TreasureTreeNode realNode = (TreasureTreeNode) treasureTable.get(node.getTreasureObj().getName()); if (realNode != null) { // set accurate type of treausrelist (one/multi) @@ -364,15 +358,13 @@ * The new chances always sum up to 100% total. * @param listNode node of the treasureone list */ - private void recalculateChances(TreasureTreeNode listNode) { - int cnum = listNode.getSiblingCount() - 1; // number of child-objects in the treasureone list + private void recalculateChances(final TreasureTreeNode listNode) { + final int cnum = listNode.getSiblingCount() - 1; // number of child-objects in the treasureone list int sumChances = 0; // sum of chances - double corrector; // corrector value - TreasureObj content = null; // calculate the sum of all chances for (Enumeration clist = listNode.children(); clist != null && clist.hasMoreElements();) { - content = ((TreasureTreeNode) clist.nextElement()).getTreasureObj(); + final TreasureObj content = ((TreasureTreeNode) clist.nextElement()).getTreasureObj(); if (content.getChance() == UNSET) { content.setChance(100); sumChances += 100; @@ -381,11 +373,11 @@ } } - corrector = 100. / sumChances; // corrector value + final double corrector = 100. / sumChances; // corrector value // now apply the correcting factor to all chances for (Enumeration clist = listNode.children(); clist != null && clist.hasMoreElements();) { - content = ((TreasureTreeNode) clist.nextElement()).getTreasureObj(); + final TreasureObj content = ((TreasureTreeNode) clist.nextElement()).getTreasureObj(); content.setChance((int) Math.round(content.getChance() * corrector)); } } @@ -396,16 +388,12 @@ * is bubblesort because the expected number of objects is low (~300). * @param v Vector to be sorted */ - private void sortVector(Vector v) { - int i; - int j; - Object node = null; - - for (j = 0; j < v.size() + 1; j++) { - for (i = 0; i < v.size() - 1; i++) { + private void sortVector(final Vector v) { + for (int j = 0; j < v.size() + 1; j++) { + for (int i = 0; i < v.size() - 1; i++) { if (((TreasureTreeNode) v.elementAt(i)).getTreasureObj().getName().compareToIgnoreCase( ((TreasureTreeNode) v.elementAt(i + 1)).getTreasureObj().getName()) > 0) { - node = v.elementAt(i); + final Object node = v.elementAt(i); v.setElementAt(v.elementAt(i + 1), i); v.setElementAt(node, i + 1); } @@ -421,7 +409,6 @@ private void readInsideList(TreasureTreeNode parentNode, BufferedReader reader, Vector needLink) throws IOException { String line; // read line of file TreasureTreeNode node = null; // tmp. treenode - TreasureTreeNode subNode = null; // subnode for YES/NO case boolean insideArch = false; @@ -434,7 +421,7 @@ parentNode.add(node); insideArch = true; } else if (line.startsWith("list ")) { - String newName = line.substring(line.indexOf(" ")).trim(); // name of this contained list + final String newName = line.substring(line.indexOf(" ")).trim(); // name of this contained list node = new TreasureTreeNode(newName, TreasureObj.TREASURE_LIST); parentNode.add(node); needLink.add(node); // this node needs to be linked to it's content later @@ -459,27 +446,27 @@ } else if (line.startsWith("chance")) { try { node.getTreasureObj().setChance(Integer.parseInt(line.substring(line.indexOf(" ") + 1).trim())); - } catch (NumberFormatException e) { + } catch (final NumberFormatException e) { errorLog.append("in list " + parentNode.getTreasureObj().getName() + ": arch " + node.getTreasureObj().getName() + " chance is not a number.\n"); } } else if (line.startsWith("nrof")) { try { node.getTreasureObj().setNrof(Integer.parseInt(line.substring(line.indexOf(" ") + 1).trim())); - } catch (NumberFormatException e) { + } catch (final NumberFormatException e) { errorLog.append("in list " + parentNode.getTreasureObj().getName() + ": arch " + node.getTreasureObj().getName() + " nrof value is not a number.\n"); } } else if (line.startsWith("magic")) { try { node.getTreasureObj().setMagic(Integer.parseInt(line.substring(line.indexOf(" ") + 1).trim())); - } catch (NumberFormatException e) { + } catch (final NumberFormatException e) { errorLog.append("in list " + parentNode.getTreasureObj().getName() + ": arch " + node.getTreasureObj().getName() + " magic value is not a number.\n"); } } else if (line.equals("no")) { // if fist arch not generated, process subtree - int chance = UNSET; + final int chance; if (node.getTreasureObj().getChance() == UNSET) { errorLog.append("in list " + parentNode.getTreasureObj().getName() + ": arch " + node.getTreasureObj().getName() + " has NO-list but chance is unset!\n"); @@ -488,7 +475,7 @@ chance = 100 - node.getTreasureObj().getChance(); } - subNode = new TreasureTreeNode("NO", TreasureObj.NO); + final TreasureTreeNode subNode = new TreasureTreeNode("NO", TreasureObj.NO); subNode.getTreasureObj().setChance(chance); node.add(subNode); @@ -496,7 +483,7 @@ readInsideList(subNode, reader, needLink); } else if (line.equals("yes")) { // if fist arch not generated, process subtree - subNode = new TreasureTreeNode("YES", TreasureObj.YES); + final TreasureTreeNode subNode = new TreasureTreeNode("YES", TreasureObj.YES); subNode.getTreasureObj().setChance(node.getTreasureObj().getChance()); node.add(subNode); @@ -529,7 +516,7 @@ * When a second window is opened, the first one gets (re-)moved. * @param parent Parent frame (attribute dialog) */ - public synchronized void showDialog(JTextField input, CAttribDialog parent) { + public synchronized void showDialog(final JTextField input, final CAttribDialog parent) { this.input = input; // set textfield for input/output parentDialog = parent; // set parent attribute dialog (or null if there is none) @@ -539,14 +526,14 @@ frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); // click on closebox hides dialog this.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 5)); - JScrollPane scrollPane = new JScrollPane(this); + final JScrollPane scrollPane = new JScrollPane(this); scrollPane.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); // split display: tree/buttons - JPanel buttonPanel = buildButtonPanel(); - JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, + final JPanel buttonPanel = buildButtonPanel(); + final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, scrollPane, buttonPanel); splitPane.setOneTouchExpandable(false); splitPane.setDividerLocation((int) (frame.getHeight() - buttonPanel.getMinimumSize().height - 4)); @@ -588,13 +575,13 @@ } if (input != null) { - String listName = input.getText().trim(); // name of pre-selected list + final String listName = input.getText().trim(); // name of pre-selected list if (treasureTable.containsKey(listName)) { // set the position of the scrollbar - DefaultMutableTreeNode[] nnode = new DefaultMutableTreeNode[2]; + final DefaultMutableTreeNode[] nnode = new DefaultMutableTreeNode[2]; nnode[0] = root; nnode[1] = (DefaultMutableTreeNode) treasureTable.get(listName); - TreePath tpath = new TreePath(nnode); + final TreePath tpath = new TreePath(nnode); expandPath(tpath); // expand pre-selected treasurelist setSelectionPath(tpath); // select it too @@ -631,23 +618,23 @@ * @return the JPanel containing all buttons */ private JPanel buildButtonPanel() { - JPanel buttonPanel = new JPanel(new BorderLayout()); // main panel, containing everything + final JPanel buttonPanel = new JPanel(new BorderLayout()); // main panel, containing everything - JPanel leftSide = new JPanel(); // panel containing left-side buttons - JPanel rightSide = new JPanel(); // panel containing right-side buttons + final JPanel leftSide = new JPanel(); // panel containing left-side buttons + final JPanel rightSide = new JPanel(); // panel containing right-side buttons // build right side buttons okButton = new JButton("Select"); okButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { try { // print the currently selected treasurelist into the attribute dialog - String result = getSelectedTreasureList(); + final String result = getSelectedTreasureList(); if (result != null) { input.setText(" " + getSelectedTreasureList()); } frame.setVisible(false); - } catch (GridderException ex) { + } catch (final GridderException ex) { // user selected an invalid treasurelist - do nothing } } @@ -656,7 +643,7 @@ noneButton = new JButton("None"); noneButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { // print "none" into the attribute dialog input.setText(" " + NONE_SYM); frame.setVisible(false); @@ -666,22 +653,22 @@ cancelButton = new JButton("Cancel"); cancelButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { frame.setVisible(false); } }); rightSide.add(cancelButton); // left right side buttons - JButton helpButton = new JButton("Help"); + final JButton helpButton = new JButton("Help"); helpButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent event) { + public void actionPerformed(final ActionEvent event) { // open the help window new Help(CMainControl.getInstance().getMainView(), "treasurelists.html").setVisible(true); } }); leftSide.add(helpButton); - JButton testButton = new JButton("Test"); + final JButton testButton = new JButton("Test"); leftSide.add(testButton); testButton.setEnabled(false); // disable test button until implemented @@ -702,9 +689,7 @@ return null; } - DefaultMutableTreeNode parentNode = null; DefaultMutableTreeNode node = (DefaultMutableTreeNode) getSelectionPath().getLastPathComponent(); - TreasureTreeNode trNode = null; // when the root node is selected, also return null if (node == root) { @@ -712,13 +697,14 @@ } // climb up the treepath to the last node before root - this is the treasurelist + DefaultMutableTreeNode parentNode; while ((parentNode = (DefaultMutableTreeNode) (node.getParent())) != root) { node = parentNode; } // When a treasurelist inside a special-subfolder (like "God Intervention") // is selected, also return null because those must not be used on maps. - trNode = (TreasureTreeNode) node; + final TreasureTreeNode trNode = (TreasureTreeNode) node; if (trNode.getTreasureObj().getType() == TreasureObj.FOLDER) { CMainControl.getInstance().showMessage("Invalid Selection", "The " + trNode.getTreasureObj().getName() + " treasurelists must not be used in maps.\n" + @@ -735,15 +721,15 @@ * Subclass: Nodes in the CFTreasureListTree. * Each node contains a TreauserObj as content. */ - private class TreasureTreeNode extends DefaultMutableTreeNode { + private final class TreasureTreeNode extends DefaultMutableTreeNode { /** Serial Version UID. */ private static final long serialVersionUID = 1L; - private TreasureObj content; // content object + private final TreasureObj content; // content object /** Construct tree node with specified content object */ - public TreasureTreeNode(TreasureObj content) { + public TreasureTreeNode(final TreasureObj content) { super(); this.content = content; } @@ -753,7 +739,7 @@ * @param name name of content object * @param type type of content object (see TreasureObj constants) */ - public TreasureTreeNode(String name, int type) { + public TreasureTreeNode(final String name, final int type) { super(); this.content = new TreasureObj(name, type); } @@ -761,10 +747,10 @@ /** @return a new cloned instance of this object */ public TreasureTreeNode getClone() { // clone this object - TreasureTreeNode clone = new TreasureTreeNode(this.getTreasureObj()); - Enumeration clist; // enumeration to loop through children nodes + final TreasureTreeNode clone = new TreasureTreeNode(this.getTreasureObj()); // also clone all children nodes and link them properly + Enumeration clist; // enumeration to loop through children nodes for (clist = children(); clist != null && clist.hasMoreElements();) { clone.add(((TreasureTreeNode) clist.nextElement()).getClone()); } @@ -780,11 +766,10 @@ } else { // has children, but any *real* children, or just YES/NO? boolean hasChildren = false; // true when this list has real children - TreasureObj content; // tmp. storage for children's TreasureObj for (clist = children(); clist != null && clist.hasMoreElements() && !hasChildren;) { // check for real children, other than YES/NO objects - content = ((TreasureTreeNode) clist.nextElement()).getTreasureObj(); + final TreasureObj content = ((TreasureTreeNode) clist.nextElement()).getTreasureObj(); if (content.getType() != TreasureObj.YES && content.getType() != TreasureObj.NO) { hasChildren = true; // found a real child } @@ -813,7 +798,7 @@ * Subclass: UserObject (= content object) for nodes in the CFTreasureListTree * These can be either treasurelists (containers), arches, or yes/no containers. */ - private class TreasureObj extends Object { + private static final class TreasureObj { public static final int TREASURE_LIST = 0; @@ -829,7 +814,7 @@ private int type; // type must be one of the above - private String name; // name of this list/arch + private final String name; // name of this list/arch private boolean isTreasureList = false; // true when either treasure or treasureone @@ -844,7 +829,7 @@ private boolean hasLoop; // true when this is a list containing itself (-> infinit loop) /** Constructor for treasurelist objects */ - public TreasureObj(String name, int type) { + public TreasureObj(final String name, final int type) { this.type = type; this.name = name; if (type == TREASURE_LIST || type == TREASUREONE_LIST) { @@ -866,7 +851,7 @@ } // --- GET/SET methods: --- - public void setChance(int value) { + public void setChance(final int value) { chance = value; } @@ -874,7 +859,7 @@ return chance; } - public void setMagic(int value) { + public void setMagic(final int value) { magic = value; } @@ -882,7 +867,7 @@ return magic; } - public void setType(int value) { + public void setType(final int value) { type = value; } @@ -890,7 +875,7 @@ return type; } - public void setNrof(int value) { + public void setNrof(final int value) { nrof = value; } @@ -898,7 +883,7 @@ return hasLoop; } - public void setHasLoop(boolean state) { + public void setHasLoop(final boolean state) { hasLoop = state; } @@ -915,22 +900,22 @@ * This cell renderer is responsible for drawing the treasure-object * cells in the JTree. */ - public class TreasureCellRenderer extends DefaultTreeCellRenderer { + public final class TreasureCellRenderer extends DefaultTreeCellRenderer { /** Serial Version UID. */ private static final long serialVersionUID = 1L; - ImageIcon tlistIcon; // icon for treasurelists + final ImageIcon tlistIcon; // icon for treasurelists - ImageIcon tlistOneIcon; // icon for treasure-one-lists + final ImageIcon tlistOneIcon; // icon for treasure-one-lists - ImageIcon yesIcon; // icon for "YES" objects + final ImageIcon yesIcon; // icon for "YES" objects - ImageIcon noIcon; // icon for "NO" objects + final ImageIcon noIcon; // icon for "NO" objects - ImageIcon noface; // icon for faceless arches + final ImageIcon noface; // icon for faceless arches - ImageIcon noarch; // icon for unknown arches + final ImageIcon noarch; // icon for unknown arches Font plain; // plain (editor-)font @@ -960,12 +945,11 @@ } /** The cell-drawing method. */ - @Override public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, - boolean expanded, boolean leaf, int row, boolean hasFocus) { + @Override public Component getTreeCellRendererComponent(final JTree tree, final Object value, final boolean sel, final boolean expanded, final boolean leaf, final int row, final boolean hasFocus) { // first use the standard renderer to paint it all super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); - DefaultMutableTreeNode node = (DefaultMutableTreeNode) value; + final DefaultMutableTreeNode node = (DefaultMutableTreeNode) value; setFont(plain); if (node.isRoot()) { @@ -973,7 +957,7 @@ setIcon(null); } else { // node content object of this cell - TreasureObj content = ((TreasureTreeNode) value).getTreasureObj(); + final TreasureObj content = ((TreasureTreeNode) value).getTreasureObj(); // now apply customized icons if (content.getType() == TreasureObj.YES) { @@ -1028,7 +1012,7 @@ } } else { // parent is not root - TreasureTreeNode parent = (TreasureTreeNode) (node.getParent()); + final TreasureTreeNode parent = (TreasureTreeNode) (node.getParent()); if (parent.getTreasureObj().getType() == TreasureObj.FOLDER) { setFont(bold); } Modified: trunk/crossfire/src/cfeditor/CFancyButton.java =================================================================== --- trunk/crossfire/src/cfeditor/CFancyButton.java 2006-06-08 21:24:32 UTC (rev 140) +++ trunk/crossfire/src/cfeditor/CFancyButton.java 2006-06-11 12:47:11 UTC (rev 141) @@ -34,7 +34,7 @@ * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @deprecated Don't use this anymore. */ -@Deprecated public class CFancyButton extends JButton { +@Deprecated public final class CFancyButton extends JButton { private ImageIcon normalIcon; Modified: trunk/crossfire/src/cfeditor/CFileInputStream.java =================================================================== --- trunk/crossfire/src/cfeditor/CFileInputStream.java 2006-06-08 21:24:32 UTC (rev 140) +++ trunk/crossfire/src/cfeditor/CFileInputStream.java 2006-06-11 12:47:11 UTC (rev 141) @@ -37,7 +37,7 @@ * This class is very similar to CFileReader. * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ -public class CFileInputStream { +public final class CFileInputStream { private static final Logger LOG = Logger.getLogger(CFileInputStream.class); @@ -81,14 +81,14 @@ fileInput = new FileInputStream(filedir + File.separator + filename); stream = new TrackedBufferedInputStream(fileInput); isBinfile = true; - } catch (FileNotFoundException e) { + } catch (final FileNotFoundException e) { try { // second we look if the resource is available as normal binary-file // in the editor's root directory fileInput = new FileInputStream(filename); stream = new TrackedBufferedInputStream(fileInput); isBinfile = true; - } catch (FileNotFoundException ex) { + } catch (final FileNotFoundException ex) { // if there is no binary file at all, we try to load it from // the system-jar-archive: inStream = ClassLoader.getSystemResourceAsStream(filename); @@ -126,21 +126,21 @@ if (stream != null) { try { stream.close(); - } catch (IOException e) { + } catch (final IOException e) { LOG.warn("Couldn't close BufferedInputStream for \"" + filename + "\"."); } } if (inStream != null) { try { inStream.close(); - } catch (IOException e) { + } catch (final IOException e) { LOG.warn("Couldn't close InputStream for \"" + filename + "\"."); } } if (fileInput != null) { try { fileInput.close(); - } catch (IOException e) { + } catch (final IOException e) { LOG.warn("Couldn't close FileInputStream for \"" + filename + "\"."); } } Modified: trunk/crossfire/src/cfeditor/CFileReader.java =================================================================== --- trunk/crossfire/src/cfeditor/CFileReader.java 2006-06-08 21:24:32 UTC (rev 140) +++ trunk/crossfire/src/cfeditor/CFileReader.java 2006-06-11 12:47:11 UTC (rev 141) @@ -39,7 +39,7 @@ * If no such file is found, the file is loaded from the jar archive. * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ -public class CFileReader { +public final class CFileReader { private static final Logger LOG = Logger.getLogger(CFileReader.class); @@ -85,13 +85,13 @@ // in the specified directory fileRead = new FileReader(filedir + File.separator + filename); isAscii = true; - } catch (FileNotFoundException e) { + } catch (final FileNotFoundException e) { try { // second we look if the resource is available as normal ascii-file // in the editor's root directory fileRead = new FileReader(filename); isAscii = true; - } catch (FileNotFoundException ex) { + } catch (final FileNotFoundException ex) { // if there is no ascii file at all, we try to load it from // the system-jar-archive: inStream = ClassLoader.getSystemResourceAsStream(filename); @@ -232,7 +232,7 @@ if (read != null) { try { read.close(); - } catch (IOException e) { + } catch (final IOException e) { LOG.warn("Couldn't close BufferedReader for \"" + filename + "\".", e); } } @@ -246,14 +246,14 @@ if (streamRead != null) { try { streamRead.close(); - } catch (IOException e) { + } catch (final IOException e) { LOG.warn("Couldn't close InputStreamReader for \"" + filename + "\".", e); } } if (inStream != null) { try { inStream.close(); - } catch (IOException e) { + } catch (final IOException e) { LOG.warn("Couldn't close InputStream for \"" + filename + "\".", e); } } Modified: trunk/crossfire/src/cfeditor/CFilterControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CFilterControl.java 2006-06-08 21:24:32 UTC (rev 140) +++ trunk/crossfire/src/cfeditor/CFilterControl.java 2006-06-11 12:47:11 UTC (rev 141) @@ -38,7 +38,7 @@ * this path the wall and the floor filters, only walls and floors will be shown. */ //TODO allow implementation of own filter -public class CFilterControl implements NamedFilterListener, ConfigListener { +public final class CFilterControl implements NamedFilterListener, ConfigListener { public static final int MAX_HIGHLIGHT = 3; @@ -142,7 +142,7 @@ } } - private class FilterControlMenuEntry extends BasicMenuEntry { + private final class FilterControlMenuEntry extends BasicMenuEntry { FilterControlMenuEntry() { super("<<set me>>"); Modified: trunk/crossfire/src/cfeditor/CGUIUtils.java =================================================================== --- trunk/crossfire/src/cfeditor/CGUIUtils.java 2006-06-08 21:24:32 UTC (rev 140) +++ trunk/crossfire/src/cfeditor/CGUIUtils.java 2006-06-11 12:47:11 UTC (rev 141) @@ -45,7 +45,7 @@ * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ -public class CGUIUtils { +public final class CGUIUtils { private static final Logger log = Logger.getLogger(CGUIUtils.class); @@ -76,9 +76,9 @@ } // looks like we need to load this icon - ImageIcon icon = null; final File imageFile = new File(dirName, strIconName); + final ImageIcon icon; if (imageFile.exists()) { // image file exists in expected directory icon = new ImageIcon(imageFile.getAbsolutePath()); @@ -99,9 +99,11 @@ icon = new ImageIcon(imageResource); } else { log.warn("Failed to load icon '" + strIconName + "'!"); + icon = null; } } else { log.warn("Failed to load icon '" + strIconName + "'!"); + icon = null; } } @@ -126,13 +128,13 @@ * @param icon The colour icon to be grayscaled. * @return The given icon as grayscaled version. */ - public static ImageIcon getGrayScaled(ImageIcon icon) { + public static ImageIcon getGrayScaled(final ImageIcon icon) { // Use the static instance to do the grayscaling return staticInstance._getGrayScaled(icon); } - public static JComponent getBox(JComponent c) { - JPanel p = new JPanel(new BorderLayout()); + public static JComponent getBox(final JComponent c) { + final JPanel p = new JPanel(new BorderLayout()); p.add(c, BorderLayout.CENTER); return p; } @@ -142,17 +144,16 @@ * @param icon The colour icon to be grayscaled. * @return The given icon as grayscaled version. */ - private ImageIcon _getGrayScaled(ImageIcon icon) { - CGrayScaleFilter filter = new CGrayScaleFilter(); - ImageProducer imageProducer = - new FilteredImageSource(icon.getImage().getSource(), filter); - Image grayIcon = Toolkit.getDefaultToolkit().createImage(imageProducer); + private ImageIcon _getGrayScaled(final ImageIcon icon) { + final CGrayScaleFilter filter = new CGrayScaleFilter(); + final ImageProducer imageProducer = new FilteredImageSource(icon.getImage().getSource(), filter); + final Image grayIcon = Toolkit.getDefaultToolkit().createImage(imageProducer); return new ImageIcon(grayIcon); } /** Grayscale filter to make grayscaled images. */ - private class CGrayScaleFilter extends RGBImageFilter { + private final class CGrayScaleFilter extends RGBImageFilter { /** * Converts a single input pixel in the default RGB ColorModel @@ -161,10 +162,10 @@ * @param y The y-coordinate of the pixel. * @param rgb The pixels colour in default RGB ColorModel. */ - @Override public int filterRGB(int x, int y, int rgb) { - float red = (float) ((rgb >> 16) & 0xFF); - float green = (float) ((rgb >> 8) & 0xFF); - float blue = (float) (rgb & 0xFF); + @Override public int filterRGB(final int x, final int y, final int rgb) { + final float red = (float) ((rgb >> 16) & 0xFF); + final float green = (float) ((rgb >> 8) & 0xFF); + final float blue = (float) (rgb & 0xFF); int gray = (int) (0.33F * red + 0.33F * green + 0.33F * blue); Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-06-08 21:24:32 UTC (rev 140) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-06-11 12:47:11 UTC (rev 141) @@ -60,7 +60,7 @@ * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ -public class CMainControl extends JFrame { +public final class CMainControl extends JFrame { /** ActionFactory. */ private static final ActionFactory ACTION_FACTORY = getFactory("cfeditor"); @@ -207,7 +207,7 @@ /** * Initialises this main controller. */ - void init(boolean doShow) { + void init(final boolean doShow) { // Register ourselves to the undo/redo stack CUndoStack.setMainControl(this); @@ -218,10 +218,10 @@ readGlobalSettings(); // initialize pickmap panel (needed early during the loading process) - CPickmapPanel pickmappanel = new CPickmapPanel(); + final CPickmapPanel pickmappanel = new CPickmapPanel(); // apply custom font - String fontDesc = CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(USE_FONT); + final String fontDesc = CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(USE_FONT); if (fontDesc != null) { int fontsize = 0; // fontsize @@ -232,7 +232,7 @@ // okay, now set fonts newPlainFont(new Font(fontDesc.substring(0, fontDesc.indexOf("|")), Font.PLAIN, fontsize)); newBoldFont(new Font(fontDesc.substring(0, fontDesc.indexOf("|")), Font.BOLD, fontsize)); - } catch (NumberFormatException e) { + } catch (final NumberFormatException e) { } } @@ -292,11 +292,11 @@ } } - void moveTileUp(ArchObject arch, boolean refresh) { + void moveTileUp(final ArchObject arch, final boolean refresh) { currentMap.getMapModel().moveTileUp(arch, refresh); } - void moveTileDown(ArchObject arch, boolean refresh) { + void moveTileDown(final ArchObject arch, final boolean refresh) { currentMap.getMapModel().moveTileDown(arch, refresh); } @@ -316,7 +316,7 @@ * (If no tileEdit is set, everything is displayed) * @param v tileedit bitmask of types to show */ - public void setTileEdit(int v) { + public void setTileEdit(final int v) { tileEdit |= v; } @@ -325,7 +325,7 @@ * (If no tileEdit is set, everything is displayed) * @param v tileedit bitmask of types to hide */ - public void unsetTileEdit(int v) { + public void unsetTileEdit(final int v) { tileEdit &= ~v; } @@ -335,7 +335,7 @@ * @param v are tiles of this type displayed? * @return true if these tiles are currently displayed */ - public boolean isTileEdit(int v) { + public boolean isTileEdit(final int v) { if (v == 0) { return (tileEdit & IGUIConstants.TILE_EDIT_NONE) != 0; } @@ -356,10 +356,10 @@ * each map where this type has not yet been used. * @param newType new selected edit type (should not be more than one) */ - void selectEditType(int newType) { + void selectEditType(final int newType) { // calculate the new type for all opened maps: for (Enumeration enu = levels.elements(); enu.hasMoreElements();) { - CMapControl level = (CMapControl) enu.nextElement(); + final CMapControl level = (CMapControl) enu.nextElement(); level.addEditType(newType); // calculate new type } @@ -368,7 +368,7 @@ } // get/set autojoin state - public void setAutojoin(boolean state) { + public void setAutojoin(final boolean state) { autojoin = state; } @@ -382,7 +382,7 @@ // access to ArchNodeList // remark: i use before some weird access to it, use this instead when you find it - public void addArchToList(ArchObject data) { + public void addArchToList(final ArchObject data) { archList.addArchToList(data); } @@ -398,7 +398,7 @@ return archList.getArchCount(); } - public ArchObject getArch(int i) { + public ArchObject getArch(final int i) { return archList.getArch(i); } @@ -416,11 +416,11 @@ return boldFont; } - public void newPlainFont(Font newfont) { + public void newPlainFont(final Font newfont) { plainFont = newfont; } - public void newBoldFont(Font newfont) { + public void newBoldFont(final Font newfont) { boldFont = newfont; } @@ -486,7 +486,7 @@ * @param script path of script directory * @param baseImageSet true if base ima... [truncated message content] |
From: <aki...@us...> - 2006-06-08 21:25:08
|
Revision: 140 Author: akirschbaum Date: 2006-06-08 14:24:32 -0700 (Thu, 08 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=140&view=rev Log Message: ----------- Add final modifier where possible. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainView.java trunk/crossfire/src/cfeditor/CMapArchPanel.java trunk/crossfire/src/cfeditor/CMapControl.java trunk/crossfire/src/cfeditor/CMapFileDecode.java trunk/crossfire/src/cfeditor/CMapFileEncode.java trunk/crossfire/src/cfeditor/CMapModel.java trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java trunk/crossfire/src/cfeditor/CMapTileList.java trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/daimonin/src/daieditor/CMapTileList.java Modified: trunk/crossfire/src/cfeditor/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainView.java 2006-06-06 21:54:36 UTC (rev 139) +++ trunk/crossfire/src/cfeditor/CMainView.java 2006-06-08 21:24:32 UTC (rev 140) @@ -55,7 +55,7 @@ * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ -public class CMainView extends JFrame implements InternalFrameListener { +public final class CMainView extends JFrame implements InternalFrameListener { /** Serial Version UID. */ private static final long serialVersionUID = 1L; @@ -141,7 +141,7 @@ super(IGUIConstants.APP_NAME + " - " + IGUIConstants.APP_WINDOW_TITLE); this.mainControl = mainControl; - ImageIcon icon = CGUIUtils.getIcon(IGUIConstants.APP_ICON); + final ImageIcon icon = CGUIUtils.getIcon(IGUIConstants.APP_ICON); if (icon != null) { setIconImage(icon.getImage()); } @@ -149,7 +149,7 @@ setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener( new WindowAdapter() { - @Override public void windowClosing(WindowEvent event) { + @Override public void windowClosing(final WindowEvent event) { mainControl.exitWanted(); } }); @@ -158,28 +158,28 @@ /** * Initialises (builds) this view. */ - void init(boolean doShow) { - CSettings settings = CSettings.getInstance(IGUIConstants.APP_NAME); + void init(final boolean doShow) { + final CSettings settings = CSettings.getInstance(IGUIConstants.APP_NAME); // set look and feel - String strSelectedLNFName = settings.getProperty(CMainView.SELECTED_LNF_KEY, UIManager.getCrossPlatformLookAndFeelClassName()); + final String strSelectedLNFName = settings.getProperty(CMainView.SELECTED_LNF_KEY, UIManager.getCrossPlatformLookAndFeelClassName()); mainControl.setLookNFeel(strSelectedLNFName); // calculate some default values in case there is no settings file - Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); - int defwidth = (int) (0.9 * screen.getWidth()); - int defheight = (int) (0.9 * screen.getHeight()); + final Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); + final int defwidth = (int) (0.9 * screen.getWidth()); + final int defheight = (int) (0.9 * screen.getHeight()); // define divider locations - int divLocationRight = Integer.parseInt(settings.getProperty(DIVIDER_LOCATION_KEY3, "" + (int) (defwidth * 0.62))); - int divLocationDown = Integer.parseInt(settings.getProperty(DIVIDER_LOCATION_KEY2, "" + (int) (defheight * 0.76))); - int divLocation = Integer.parseInt(settings.getProperty(DIVIDER_LOCATION_KEY, "" + (int) (defwidth * 0.17))); + final int divLocationRight = Integer.parseInt(settings.getProperty(DIVIDER_LOCATION_KEY3, "" + (int) (defwidth * 0.62))); + final int divLocationDown = Integer.parseInt(settings.getProperty(DIVIDER_LOCATION_KEY2, "" + (int) (defheight * 0.76))); + final int divLocation = Integer.parseInt(settings.getProperty(DIVIDER_LOCATION_KEY, "" + (int) (defwidth * 0.17))); // get the old location and size - int x = Integer.parseInt(settings.getProperty(WINDOW_X, "" + (int) ((screen.getWidth() - defwidth) / 2.))); - int y = Integer.parseInt(settings.getProperty(WINDOW_Y, "" + (int) ((screen.getHeight() - defheight) / 2.))); - int width = Integer.parseInt(settings.getProperty(WINDOW_WIDTH, "" + defwidth)); - int height = Integer.parseInt(settings.getProperty(WINDOW_HEIGHT, "" + defheight)); + final int x = Integer.parseInt(settings.getProperty(WINDOW_X, "" + (int) ((screen.getWidth() - defwidth) / 2.))); + final int y = Integer.parseInt(settings.getProperty(WINDOW_Y, "" + (int) ((screen.getHeight() - defheight) / 2.))); + final int width = Integer.parseInt(settings.getProperty(WINDOW_WIDTH, "" + defwidth)); + final int height = Integer.parseInt(settings.getProperty(WINDOW_HEIGHT, "" + defheight)); // Add all the subviews getContentPane().setLayout(new BorderLayout()); @@ -266,7 +266,7 @@ new Help(this, null).setVisible(true); } - public void setPickmapActive(boolean state) { + public void setPickmapActive(final boolean state) { pickmapActive = state; menu.setActivePickmapsEnabled(state); } @@ -298,7 +298,7 @@ && CPickmapPanel.getInstance().isLoadComplete() && CPickmapPanel.getInstance().getCurrentPickmap() != null) { // get the active pickmap - CMapControl pmap = CPickmapPanel.getInstance().getCurrentPickmap(); + final CMapControl pmap = CPickmapPanel.getInstance().getCurrentPickmap(); if (pmap != null && pmap.getMapView().isHighlight()) { // now try to get the topmost object @@ -318,7 +318,7 @@ return archPanel.getArchPanelSelection(); } - public void showArchPanelQuickObject(ArchObject arch) { + public void showArchPanelQuickObject(final ArchObject arch) { archPanel.showArchPanelQuickObject(arch); } @@ -328,7 +328,7 @@ } // show a arch in the arch map panel - public void setMapArchPanelObject(ArchObject arch) { + public void setMapArchPanelObject(final ArchObject arch) { mapArchPanel.setMapArchPanelObject(arch); } @@ -338,7 +338,7 @@ } // access mape tile list ... - public void setMapTileList(CMapControl map, int archid) { + public void setMapTileList(final CMapControl map, final int archid) { mapTileList.setMapTileList(map, archid); } @@ -350,7 +350,7 @@ return mapTileList.getMapTileSelection(); } - public void addArchPanel(String name) { + public void addArchPanel(final String name) { archPanel.addPanel(name); } @@ -363,11 +363,11 @@ archPanel.enableTabPane(); } - public int addArchPanelCombo(String name) { + public int addArchPanelCombo(final String name) { return archPanel.addArchPanelCombo(name); } - public void addArchPanelArch(int archnr, int index) { + public void addArchPanelArch(final int archnr, final int index) { archPanel.addArchPanelArch(archnr, index); } @@ -376,7 +376,7 @@ return archPanel.getPanelArch(); } - public void setStatusText(String string) { + public void setStatusText(final String string) { statusBar.setStatusText(string); } @@ -386,7 +386,7 @@ } // is the map tile list in the bottom panel - public void setMapTileListBottom(boolean state) { + public void setMapTileListBottom(final boolean state) { mapTileListBottom = state; } @@ -394,8 +394,8 @@ void appExitNotify() { // Store the location and size - CSettings settings = CSettings.getInstance(IGUIConstants.APP_NAME); - Rectangle bounds = getBounds(); + final CSettings settings = CSettings.getInstance(IGUIConstants.APP_NAME); + final Rectangle bounds = getBounds(); settings.setProperty(WINDOW_X, "" + bounds.x); settings.setProperty(WINDOW_Y, "" + bounds.y); settings.setProperty(WINDOW_WIDTH, "" + bounds.width); @@ -449,7 +449,7 @@ archPanel.updateFont(); } - void setRevertMenuEnabled(boolean state) { + void setRevertMenuEnabled(final boolean state) { menu.setRevertEnabled(state); } @@ -489,7 +489,7 @@ * Adds the level view. * @param mapView the map view to add */ - public void addLevelView(CMapViewIFrame mapView) { + public void addLevelView(final CMapViewIFrame mapView) { mapViews.add(mapView); mapView.addInternalFrameListener(this); mapDesktop.add(mapView); @@ -509,7 +509,7 @@ * Removes (closes) the level view. * @param mapView the map view to be removed (closed). */ - void removeLevelView(CMapViewIFrame mapView) { + void removeLevelView(final CMapViewIFrame mapView) { if (!mapViews.contains(mapView)) { return; } @@ -539,7 +539,7 @@ * Shows the given error in the UI. * @param error The error to be shown. */ - void showError(GridderException error) { + void showError(final GridderException error) { JOptionPane.showConfirmDialog(this, error.getMessage(), IGUIConstants.APP_NAME, JOptionPane.OK_OPTION, JOptionPane.WARNING_MESSAGE); } @@ -549,11 +549,11 @@ * @param strMessage The message to be shown. * @param messageType Type of message (see JOptionPane constants), defines icon used */ - public void showMessage(String strTitle, String strMessage, int messageType) { + public void showMessage(final String strTitle, final String strMessage, final int messageType) { JOptionPane.showMessageDialog(this, strMessage, strTitle, messageType); } - public void showMessage(String strTitle, String strMessage) { + public void showMessage(final String strTitle, final String strMessage) { JOptionPane.showMessageDialog(this, strMessage, strTitle, JOptionPane.INFORMATION_MESSAGE); } @@ -564,7 +564,7 @@ * @param strMessage The message to be shown. * @return Ture if the user agrees, false if user disagrees. */ - public boolean askConfirm(String strTitle, String strMessage) { + public boolean askConfirm(final String strTitle, final String strMessage) { return JOptionPane.showConfirmDialog(this, strMessage, strTitle, JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE) == JOptionPane.YES_OPTION; } @@ -573,11 +573,11 @@ * @param fCareAboutIconification True if the focus update should ignore * all windows iconified by the user. */ - void updateFocus(boolean fCareAboutIconification) { + void updateFocus(final boolean fCareAboutIconification) { // Show the next level (if such exists) for (Enumeration enu = mapViews.elements(); enu.hasMoreElements();) { - CMapViewIFrame view = (CMapViewIFrame) enu.nextElement(); + final CMapViewIFrame view = (CMapViewIFrame) enu.nextElement(); if (view.isIcon()) { if (!fCareAboutIconification) { @@ -587,7 +587,7 @@ view.moveToFront(); view.show(); return; - } catch (PropertyVetoException cantUniconify) { + } catch (final PropertyVetoException cantUniconify) { } } } else { @@ -606,7 +606,7 @@ public void previousWindowWanted() { if (mapViews.size() > 1) { - Object view = mapViews.firstElement(); + final Object view = mapViews.firstElement(); mapViews.removeElement(view); mapViews.addElement(view); } @@ -617,7 +617,7 @@ public void nextWindowWanted() { if (mapViews.size() > 1) { - Object view = mapViews.lastElement(); + final Object view = mapViews.lastElement(); mapViews.removeElement(view); mapViews.insertElementAt(view, 0); } @@ -629,7 +629,7 @@ * Sets the given level view as the current one. * @param view The new current level view. */ - public void setCurrentLevelView(CMapViewIFrame view) { + public void setCurrentLevelView(final CMapViewIFrame view) { mapViews.removeElement(view); mapViews.insertElementAt(view, 0); @@ -639,7 +639,7 @@ view.setIcon(false); view.show(); return; - } catch (PropertyVetoException cantUniconify) { + } catch (final PropertyVetoException cantUniconify) { } } updateFocus(true); @@ -651,7 +651,7 @@ * @param view The level view who lost the focus. */ - public void levelViewFocusLostNotify(CMapViewIFrame view) { + public void levelViewFocusLostNotify(final CMapViewIFrame view) { if (mapViews.size() > 1) { mapViews.removeElement(view); mapViews.addElement(view); @@ -664,10 +664,10 @@ * @param view The new current level view. */ - public void levelViewFocusGainedNotify(CMapViewIFrame view) { + public void levelViewFocusGainedNotify(final CMapViewIFrame view) { mapViews.removeElement(view); mapViews.insertElementAt(view, 0); - CMapControl level = view.getLevel(); + final CMapControl level = view.getLevel(); mainControl.setCurrentLevel(level); //statusBar.setLevelInfo(level); @@ -677,16 +677,16 @@ * Invoked when the internal frame view is opened. * @param event the occurred <code>InternalFrameEvent</code> */ - public void internalFrameOpened(InternalFrameEvent event) { + public void internalFrameOpened(final InternalFrameEvent event) { } /** * Invoked when the internal frame view is closing. * @param event the occurred <code>InternalFrameEvent</code> */ - public void internalFrameClosing(InternalFrameEvent event) { + public void internalFrameClosing(final InternalFrameEvent event) { - CMapViewIFrame view = (CMapViewIFrame) event.getSource(); + final CMapViewIFrame view = (CMapViewIFrame) event.getSource(); removeLevelView(view); } @@ -695,15 +695,15 @@ * Invoked when the internal frame view is closed. * @param event the occurred <code>InternalFrameEvent</code> */ - public void internalFrameClosed(InternalFrameEvent event) { + public void internalFrameClosed(final InternalFrameEvent event) { } /** * Invoked when the internal frame view is iconified. * @param event the occurred <code>InternalFrameEvent</code> */ - public void internalFrameIconified(InternalFrameEvent event) { - CMapViewIFrame view = (CMapViewIFrame) event.getSource(); + public void internalFrameIconified(final InternalFrameEvent event) { + final CMapViewIFrame view = (CMapViewIFrame) event.getSource(); levelViewFocusLostNotify(view); } @@ -711,15 +711,15 @@ * Invoked when the internal frame view is deiconified. * @param event the occurred <code>InternalFrameEvent</code> */ - public void internalFrameDeiconified(InternalFrameEvent event) { + public void internalFrameDeiconified(final InternalFrameEvent event) { } /** * Invoked when the internal frame view is activated. * @param event the occurred <code>InternalFrameEvent</code> */ - public void internalFrameActivated(InternalFrameEvent event) { - CMapViewIFrame view = (CMapViewIFrame) event.getSource(); + public void internalFrameActivated(final InternalFrameEvent event) { + final CMapViewIFrame view = (CMapViewIFrame) event.getSource(); levelViewFocusGainedNotify(view); } @@ -727,7 +727,7 @@ * Invoked when the internal frame view is deactivated. * @param event the occurred <code>InternalFrameEvent</code> */ - public void internalFrameDeactivated(InternalFrameEvent event) { + public void internalFrameDeactivated(final InternalFrameEvent event) { } /** Splitpane class that keeps its size even upon L'n'F change. */ @@ -736,7 +736,7 @@ /** Serial Version UID. */ private static final long serialVersionUID = 1L; - public CSplitPane(int newOrientation, Component newLeftComponent, Component newRightComponent) { + public CSplitPane(final int newOrientation, final Component newLeftComponent, final Component newRightComponent) { super(newOrientation, newLeftComponent, newRightComponent); } @@ -745,8 +745,8 @@ * UI change. */ @Override public void updateUI() { - int dividerLocation = getDividerLocation(); - int dividerSize = getDividerSize(); + final int dividerLocation = getDividerLocation(); + final int dividerSize = getDividerSize(); super.updateUI(); setDividerLocation(dividerLocation); setDividerSize(dividerSize); Modified: trunk/crossfire/src/cfeditor/CMapArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-06-06 21:54:36 UTC (rev 139) +++ trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-06-08 21:24:32 UTC (rev 140) @@ -63,7 +63,7 @@ * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ -public class CMapArchPanel extends JPanel { +public final class CMapArchPanel extends JPanel { /** Serial Version UID. */ private static final long serialVersionUID = 1L; @@ -79,7 +79,7 @@ // without overruling getScrollableTracksViewportWidth(), // is JTextPanel not scrolling horizontal // i searched hours for the reason... the net is full of broken examples - private JTextPane archEdit = new JTextPane() { + private final JTextPane archEdit = new JTextPane() { /** Serial Version UID. */ private static final long serialVersionUID = 1L; @@ -88,7 +88,7 @@ return getSize().width < getParent().getSize().width; } - @Override public void setSize(Dimension d) { + @Override public void setSize(final Dimension d) { if (d.width < getParent().getSize().width) { d.width = getParent().getSize().width; } @@ -104,18 +104,18 @@ private final CMainView mainView; - private CSplitPane splitPane; + private final CSplitPane splitPane; - private JTabbedPane panelDesktop; + private final JTabbedPane panelDesktop; private Style currentAttributes; - private Document doc; + private final Document doc; - private JScrollPane scrollArchPane = new JScrollPane(); + private final JScrollPane scrollArchPane = new JScrollPane(); /** panel with name/face etc */ - private JPanel archPanel; + private final JPanel archPanel; /** panel with message text */ private JPanel textPanel; @@ -123,33 +123,33 @@ private JPanel scriptPanel; /** arch text field */ - private JTextArea archTextArea = new JTextArea(4, 25); + private final JTextArea archTextArea = new JTextArea(4, 25); /** arch name field */ - private JTextField archNameField = new JTextField(14); + private final JTextField archNameField = new JTextField(14); /** arch face field */ - private JTextField archFaceField = new JTextField(14); + private final JTextField archFaceField = new JTextField(14); private JLabel archInvCount = new JLabel(); private JLabel archMapPos = new JLabel(); - private JLabel archTypeText = new JLabel(); + private final JLabel archTypeText = new JLabel(); - private JLabel archTileText = new JLabel(); + private final JLabel archTileText = new JLabel(); - private JPanel mapArchPanel = new JPanel(); + private final JPanel mapArchPanel = new JPanel(); - private JButton submitChange; + private final JButton submitChange; - private JButton submitMultiChange; + private final JButton submitMultiChange; private JButton jumpChange; - private JButton invChange; + private final JButton invChange; - private JButton attrWin; + private final JButton attrWin; // stuff for scripting tab private JButton s_new; @@ -165,21 +165,21 @@ private ArchObject selectedObject; /* Build Panel */ - CMapArchPanel(final CMainControl mainControl, CMainView view) { + CMapArchPanel(final CMainControl mainControl, final CMainView view) { this.mainControl = mainControl; mainView = view; - CSettings settings = CSettings.getInstance(IGUIConstants.APP_NAME); + final CSettings settings = CSettings.getInstance(IGUIConstants.APP_NAME); setLayout(new BorderLayout()); // scrollPane2 contains the document for archtext editing - JScrollPane scrollPane2 = new JScrollPane(archEdit); + final JScrollPane scrollPane2 = new JScrollPane(archEdit); scrollPane2.getViewport().add(archEdit); add(scrollPane2, BorderLayout.EAST); scrollPane2.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane2.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); scrollPane2.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); - JScrollPane scrollPane3 = new JScrollPane(mapArchPanel); + final JScrollPane scrollPane3 = new JScrollPane(mapArchPanel); scrollPane3.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollPane3.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); scrollPane3.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); @@ -191,7 +191,7 @@ scrollPane3, scrollPane2); - JPanel buttonPanel = new JPanel(); + final JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new GridLayout(0, 1)); mapArchPanel.add(buttonPanel, BorderLayout.WEST); @@ -214,8 +214,8 @@ // setup our plain archPanel - we need to add later field to it // depending on the arch typ selected archPanel = new JPanel(); - GridBagLayout gridbag = new GridBagLayout(); - GridBagConstraints c = new GridBagConstraints(); + final GridBagLayout gridbag = new GridBagLayout(); + final GridBagConstraints c = new GridBagConstraints(); archPanel.setLayout(gridbag); c.fill = GridBagConstraints.BOTH; c.anchor = GridBagConstraints.NORTHWEST; @@ -231,13 +231,13 @@ panelDesktop.add(scriptPanel, "Scripts"); - JPanel animationPanel = new JPanel(); + final JPanel animationPanel = new JPanel(); panelDesktop.add(animationPanel, "Animation"); // calculate default value in case there is no settings file - Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); + final Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); - int divLocation = Integer.parseInt(settings.getProperty( + final int divLocation = Integer.parseInt(settings.getProperty( MAPARCHPANEL_LOCATION_KEY, "" + (int) (0.49 * screen.getWidth()))); splitPane.setDividerLocation(divLocation); @@ -247,19 +247,19 @@ doc = archEdit.getDocument(); submitChange.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent event) { + public void actionPerformed(final ActionEvent event) { applyArchPanelChanges(mainView.getMapTileSelection()); } }); attrWin.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent event) { + public void actionPerformed(final ActionEvent event) { openAttrDialog(mainView.getMapTileSelection()); } }); invChange.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent event) { + public void actionPerformed(final ActionEvent event) { ArchObject arch = mainControl.getArchPanelSelection(); if (arch == null) { // nothing selected? return; @@ -280,7 +280,7 @@ inv = inv.getMapMultiHead(); } - ArchObject invnew; + final ArchObject invnew; if (arch.isDefaultArch()) { // create a new copy of a defautl arch invnew = mainControl.getArchObjectStack().newArchObjectInstance(arch.getNodeNr()); @@ -302,10 +302,10 @@ * is pressed, this function updates the active arch object. * @param activeArch the currently selected arch */ - public void applyArchPanelChanges(ArchObject activeArch) { - ArchObject arch; // ArchObject that gets modified - String oldArchText; // the old ArchText - String oldMsg; // old arch msg + public void applyArchPanelChanges(final ArchObject activeArch) { + final ArchObject arch; // ArchObject that gets modified + final String oldArchText; // the old ArchText + final String oldMsg; // old arch msg boolean needRedraw = false; // do we need a map-redraw? true/false if (activeArch == null) { @@ -320,7 +320,7 @@ arch = activeArch; } - ArchObject defarch = mainControl.getArch(arch.getNodeNr()); + final ArchObject defarch = mainControl.getArch(arch.getNodeNr()); if (defarch == null) { // hm, this should NOT happen return; } @@ -353,7 +353,7 @@ if (testForText(archFaceField.getText())) { // there is something in // check if we need a map redraw if (defarch.getFaceName() != null) { - String facename; + final String facename; if (arch.getFaceName() != null) { facename = arch.getFaceName(); } else { @@ -456,7 +456,7 @@ // simple "white space test, to eliminate ' ' // perhaps we should include here a real white space test - public boolean testForText(String text) { + public boolean testForText(final String text) { for (int i = 0; i < text.length(); i++) { if (text.charAt(i) != ' ') { return true; @@ -468,8 +468,8 @@ /** set up the arch panel entry of the lower window */ private void setupArchPanel() { - GridBagLayout gridbag = new GridBagLayout(); - GridBagConstraints c = new GridBagConstraints(); + final GridBagLayout gridbag = new GridBagLayout(); + final GridBagConstraints c = new GridBagConstraints(); //archPanel.setBorder(new EtchedBorder(EtchedBorder.LOWERED)); archPanel.setLayout(gridbag); c.fill = GridBagConstraints.BOTH; @@ -529,7 +529,7 @@ * Open an attribute dialog window for the currently selected arch * @param arch currently selected arch */ - private void openAttrDialog(ArchObject arch) { + private void openAttrDialog(final ArchObject arch) { mainControl.openAttrDialog(arch); } @@ -541,7 +541,7 @@ archTextArea.setForeground(Color.blue); // create ScrollPane for text scrolling - JScrollPane sta = new JScrollPane(archTextArea); + final JScrollPane sta = new JScrollPane(archTextArea); sta.setBorder(new EtchedBorder()); sta.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); sta.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); @@ -559,18 +559,18 @@ mainControl.setPlainFont(eventList); // create ScrollPane for jlist scrolling - JScrollPane ssa = new JScrollPane(eventList); + final JScrollPane ssa = new JScrollPane(eventList); ssa.setBorder(new EtchedBorder()); ssa.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); ssa.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); ssa.setPreferredSize(new Dimension(80, 40)); // create buttons - JPanel grid = new JPanel(new GridLayout(2, 2)); + final JPanel grid = new JPanel(new GridLayout(2, 2)); s_new = new JButton("Create New"); s_new.setMargin(new Insets(3, 3, 3, 3)); s_new.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { addNewScriptWanted(); } }); @@ -579,7 +579,7 @@ s_path = new JButton("Edit Params"); s_path.setMargin(new Insets(3, 3, 3, 3)); s_path.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { editScriptWanted(CMapArchPanel.SCRIPT_EDIT_PATH); } }); @@ -588,7 +588,7 @@ s_modify = new JButton("Edit Script"); s_modify.setMargin(new Insets(3, 3, 3, 3)); s_modify.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { editScriptWanted(CMapArchPanel.SCRIPT_OPEN); } }); @@ -597,7 +597,7 @@ s_remove = new JButton("Remove"); s_remove.setMargin(new Insets(3, 3, 3, 3)); s_remove.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { editScriptWanted(CMapArchPanel.SCRIPT_REMOVE); } }); @@ -618,7 +618,7 @@ } void appExitNotify() { - CSettings settings = CSettings.getInstance(IGUIConstants.APP_NAME); + final CSettings settings = CSettings.getInstance(IGUIConstants.APP_NAME); settings.setProperty(MAPARCHPANEL_LOCATION_KEY, "" + splitPane.getDividerLocation()); @@ -633,7 +633,7 @@ * update the map arch panel to display the custom font * @param refresh if true, the window is redrawn after setting the fonts */ - public void updateFont(boolean refresh) { + public void updateFont(final boolean refresh) { mainControl.setPlainFont(archTextArea); mainControl.setPlainFont(archFaceField); mainControl.setPlainFont(archNameField); @@ -676,10 +676,10 @@ * updated. * @param activeArch the selected arch */ - public void setMapArchPanelObject(ArchObject activeArch) { - ArchObject arch; // reference to the displayed archobject + public void setMapArchPanelObject(final ArchObject activeArch) { + final ArchObject arch; // reference to the displayed archobject boolean hasMessage = false; // true when arch has a message text - int i; // tmp. variable + final int i; // tmp. variable selectedObject = activeArch; // archObjNameText.setText("<html><font color=black>Name:</font></html>"); @@ -821,7 +821,7 @@ if (arch.getArchText() != null && mainControl.getArchObjectStack().getArch(arch.getNodeNr()) != null) { doc.insertString(doc.getLength(), arch.diffArchText(mainControl.getArchObjectStack().getArch(arch.getNodeNr()).getArchText(), true), currentAttributes); } - } catch (BadLocationException e) { + } catch (final BadLocationException e) { } archEdit.setCaretPosition(0); @@ -849,7 +849,7 @@ * valid selection in the event list, the appropriate action for this * script is triggered. */ - public void editScriptWanted(int task) { + public void editScriptWanted(final int task) { ArchObject arch = mainControl.getMainView().getMapTileSelection(); // get selected arch if (arch != null && arch.isMulti() && arch.getMapMultiHead() != null) { arch = arch.getMapMultiHead(); // if it's a multi, always take the head @@ -885,8 +885,8 @@ * @param pathButton * @param removeButton */ - public void setScriptPanelButtonState(boolean newButton, boolean modifyButton, - boolean pathButton, boolean removeButton) { + public void setScriptPanelButtonState(final boolean newButton, final boolean modifyButton, + final boolean pathButton, final boolean removeButton) { s_new.setEnabled(newButton); s_modify.setEnabled(modifyButton); s_path.setEnabled(pathButton); @@ -899,9 +899,9 @@ /** Serial Version UID. */ private static final long serialVersionUID = 1L; - public CSplitPane(int newOrientation, - Component newLeftComponent, - Component newRightComponent) { + public CSplitPane(final int newOrientation, + final Component newLeftComponent, + final Component newRightComponent) { super(newOrientation, newLeftComponent, newRightComponent); } @@ -910,8 +910,8 @@ * UI change. */ @Override public void updateUI() { - int dividerLocation = getDividerLocation(); - int dividerSize = getDividerSize(); + final int dividerLocation = getDividerLocation(); + final int dividerSize = getDividerSize(); super.updateUI(); setDividerLocation(dividerLocation); setDividerSize(dividerSize); Modified: trunk/crossfire/src/cfeditor/CMapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapControl.java 2006-06-06 21:54:36 UTC (rev 139) +++ trunk/crossfire/src/cfeditor/CMapControl.java 2006-06-08 21:24:32 UTC (rev 140) @@ -38,7 +38,7 @@ * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ -public class CMapControl { +public final class CMapControl { /** The main controller of this subcontroller. */ private final CMainControl mainControl; @@ -61,7 +61,7 @@ private boolean levelClosing = false; /** Flag that indicates whether this is a pickmap or not. */ - private boolean isPickmap; + private final boolean isPickmap; /** * Flag that indicates whether the tile maps surrounding current one @@ -88,9 +88,9 @@ * @param isPick true if this is a pickmap * @param initial the view position to show initially */ - CMapControl(CMainControl mainControl, ArchObject startObj, - MapArchObject maparch, boolean isPick, - Point initial) { + CMapControl(final CMainControl mainControl, final ArchObject startObj, + final MapArchObject maparch, final boolean isPick, + final Point initial) { this.mainControl = mainControl; activeEditType = 0; // start with no edit types (saves time) isPickmap = isPick; // is this a pickmap? @@ -185,7 +185,7 @@ * Notifies that a view has been closed. * @param view The view that was closed. */ - void viewCloseNotify(CMapViewBasic view) { + void viewCloseNotify(final CMapViewBasic view) { if (!levelClosing) { mainControl.closeLevel(this, false); } @@ -205,7 +205,7 @@ * Handles the given error. * @param error a generic error */ - public void handleErrors(GridderException error) { + public void handleErrors(final GridderException error) { mainControl.handleErrors(error); } @@ -214,7 +214,7 @@ * @param strTitle The title of the message. * @param strMessage The message to be shown. */ - protected void showMessage(String strTitle, String strMessage) { + protected void showMessage(final String strTitle, final String strMessage) { mainControl.showMessage(strTitle, strMessage); } @@ -471,10 +471,10 @@ showTiles = show; if (show) { /*Do the tile maps loading :)*/ - String north = mapModel.getMapArchObject().getTilePath(MapArchObject.TILE_NORTH); - String west = mapModel.getMapArchObject().getTilePath(MapArchObject.TILE_WEST); - String east = mapModel.getMapArchObject().getTilePath(MapArchObject.TILE_EAST); - String south = mapModel.getMapArchObject().getTilePath(MapArchObject.TILE_SOUTH); + final String north = mapModel.getMapArchObject().getTilePath(MapArchObject.TILE_NORTH); + final String west = mapModel.getMapArchObject().getTilePath(MapArchObject.TILE_WEST); + final String east = mapModel.getMapArchObject().getTilePath(MapArchObject.TILE_EAST); + final String south = mapModel.getMapArchObject().getTilePath(MapArchObject.TILE_SOUTH); /*tileModel = new CMapModel[8]; CMapFileDecode loader; CMapControl tmp; @@ -525,7 +525,7 @@ * Sets the level name. * @param strName The level name. */ - public void setMapName(String strName) { + public void setMapName(final String strName) { mapModel.setMapName(strName); } @@ -533,16 +533,16 @@ return mapModel.getFileName(); } - public void setMapFileName(String fname) { + public void setMapFileName(final String fname) { mapView.setTitle("Map [" + fname + "]"); mapModel.setFileName(fname); } - public void setNewMapText(String str) { + public void setNewMapText(final String str) { mapModel.setNewMapText(str); } - public void setNewLoreText(String str) { + public void setNewLoreText(final String str) { mapModel.getMapArchObject().setLore(str); } @@ -566,14 +566,14 @@ * Saves the file with the given file name. * @param file The file to be saved to. */ - void saveAs(File file) { + void saveAs(final File file) { CMainStatusbar.getInstance().setText("Saving the map to a file..."); mainControl.encodeMapFile(file, mapModel); mapModel.resetLevelChangedFlag(); mapView.changedFlagNotify(); } - void setMapFile(File file) { + void setMapFile(final File file) { mapFile = file; } Modified: trunk/crossfire/src/cfeditor/CMapFileDecode.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapFileDecode.java 2006-06-06 21:54:36 UTC (rev 139) +++ trunk/crossfire/src/cfeditor/CMapFileDecode.java 2006-06-08 21:24:32 UTC (rev 140) @@ -39,7 +39,7 @@ * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ -public class CMapFileDecode { +public final class CMapFileDecode { private static final Logger log = Logger.getLogger(CMapFileDecode.class); @@ -74,8 +74,8 @@ public ArchObject decodeMapFile(final File file) throws GridderException { try { - FileReader fr = new FileReader(file); - BufferedReader myInput = new BufferedReader(fr); + final FileReader fr = new FileReader(file); + final BufferedReader myInput = new BufferedReader(fr); maxxlen = maxylen = 0; start = previous = null; @@ -97,7 +97,7 @@ } myInput.close(); fr.close(); - } catch (IOException e) { + } catch (final IOException e) { log.debug("Error Loading file " + file.getName(), e); for (ArchObject tarch = start, temparch; tarch != null;) { @@ -137,12 +137,12 @@ * @return the new parsed <code>ArchObject</code> * @throws IOException when an I/O-error occured during file reading */ - @Nullable public ArchObject readArch(BufferedReader myInput, String thisLine, ArchObject container) + @Nullable public ArchObject readArch(final BufferedReader myInput, String thisLine, final ArchObject container) throws IOException { ArchObject arch; String thisLine2; boolean archflag, archmore, msgflag, animflag, scriptflag; - int x, y, temp; + final int y; archflag = false; archmore = false; @@ -169,6 +169,7 @@ } else if (thisLine.regionMatches(0, "arch ", 0, 5)) { // kill white spaces afer arch... // (hm, no command for this in java?) + int x; for (x = 5; x < thisLine.length(); x++) { if (thisLine.charAt(x) != ' ') { break; @@ -247,24 +248,24 @@ animflag = true; } else if (thisLine.startsWith("event_")) { // here's something about a scripted event - int i = thisLine.indexOf("_plugin"); - int k = thisLine.indexOf("_options"); - int space = thisLine.indexOf(" "); + final int i = thisLine.indexOf("_plugin"); + final int k = thisLine.indexOf("_options"); + final int space = thisLine.indexOf(" "); if (space > 0) { if (i > 0) { // expecting: "event_type_plugin Name" - String type = thisLine.substring(6, i); - String plname = thisLine.substring(space + 1).trim(); + final String type = thisLine.substring(6, i); + final String plname = thisLine.substring(space + 1).trim(); arch.addEventPlugin(type, plname); } else if (k > 0) { // expecting: "event_type_options Name" - String type = thisLine.substring(6, k); - String eventopt = thisLine.substring(space + 1).trim(); + final String type = thisLine.substring(6, k); + final String eventopt = thisLine.substring(space + 1).trim(); arch.addEventOptions(type, eventopt); } else { // expecting: "event_type filepath" - String type = thisLine.substring(6, space); - String path = thisLine.substring(space + 1).trim(); + final String type = thisLine.substring(6, space); + final String path = thisLine.substring(space + 1).trim(); arch.addEventScript(type, path); } } else { @@ -272,13 +273,13 @@ arch.addArchText(thisLine + "\n"); // keep line, it might have a meaning after all } } else if (thisLine.regionMatches(0, "x ", 0, 2)) { - temp = Integer.parseInt(thisLine.substring(2)); + final int temp = Integer.parseInt(thisLine.substring(2)); if (temp > maxxlen) { maxxlen = temp; } arch.setMapX(temp); } else if (thisLine.regionMatches(0, "y ", 0, 2)) { - temp = Integer.parseInt(thisLine.substring(2)); + final int temp = Integer.parseInt(thisLine.substring(2)); if (temp > maxylen) { maxylen = temp; } @@ -288,6 +289,7 @@ arch.setArchTypNr(Integer.parseInt(thisLine.substring(5))); // don't load it into the archtext! } else if (thisLine.regionMatches(0, "face ", 0, 5)) { + int x; for (x = 4; x < thisLine.length(); x++) { if (thisLine.charAt(x) != ' ') { break; @@ -308,7 +310,7 @@ } thisLine2 = myInput.readLine(); } - } catch (IOException e) { + } catch (final IOException e) { log.error("Read Error while trying to load map: " + maparch.getFileName(), e); throw e; // we simply pass this exception to the calling function } Modified: trunk/crossfire/src/cfeditor/CMapFileEncode.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapFileEncode.java 2006-06-06 21:54:36 UTC (rev 139) +++ trunk/crossfire/src/cfeditor/CMapFileEncode.java 2006-06-08 21:24:32 UTC (rev 140) @@ -45,7 +45,7 @@ * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ -public class CMapFileEncode { +public final class CMapFileEncode { private static final Logger log = Logger.getLogger(CMapFileEncode.class); @@ -66,8 +66,8 @@ * @param file mapfile * @param mapModel the MapModel to encode */ - public void encodeMapFile(File file, CMapModel mapModel) { - MapArchObject map = mapModel.getMapArchObject(); + public void encodeMapFile(File file, final CMapModel mapModel) { + final MapArchObject map = mapModel.getMapArchObject(); try { if (file == null) { @@ -133,9 +133,9 @@ bufferedWriter.close(); fileWriter.close(); - } catch (FileNotFoundException e) { + } catch (final FileNotFoundException e) { mainControl.showMessage("Error Save Map", "Error writing file " + fname + "\n"); - } catch (IOException e) { + } catch (final IOException e) { mainControl.showMessage("Error Save Map", "Error writing file " + fname + "\n"); } } @@ -145,11 +145,11 @@ * @param start the container arch whose inventory is to be written * @return true if all writing actions successful */ - public boolean browseInvObjects(ArchObject start) { + public boolean browseInvObjects(final ArchObject start) { // cycle throught the whole inventory list: - Iterator it = start.getInventory(); + final Iterator it = start.getInventory(); while (it.hasNext()) { - ArchObject arch = (ArchObject) it.next(); + final ArchObject arch = (ArchObject) it.next(); // write the inventory arch (recursion possible here) if (!writeMapArch(arch, true)) { return false; @@ -165,28 +165,28 @@ * @param isInventory is 'arch' inside a container? true/false * @return true if arch was written successfully */ - boolean writeMapArch(ArchObject arch, boolean isInventory) { - ArchObject defarch = arch.getDefaultArch(); + boolean writeMapArch(final ArchObject arch, final boolean isInventory) { + final ArchObject defarch = arch.getDefaultArch(); // Collect all fields to write. - HashMap fields = new HashMap(); // String key -> String value + final HashMap fields = new HashMap(); // String key -> String value - String name = arch.getObjName(); + final String name = arch.getObjName(); if (name != null) { fields.put("name", name); } - String face = arch.getFaceName(); + final String face = arch.getFaceName(); if (face != null) { fields.put("face", face); } if (arch.isScripted()) { - String events = arch.getMapArchEventData(); + final String events = arch.getMapArchEventData(); if (!events.equals("")) { - String[] tmp = events.split("\n"); + final String[] tmp = events.split("\n"); for (int i = 0; i < tmp. length; i++) { - String[] line = tmp[i].split(" +", 2); + final String[] line = tmp[i].split(" +", 2); if (line.length != 2) { log.warn("writeMapArch: ignoring invalid event line: " + tmp[i]); } else { @@ -214,8 +214,8 @@ // is conflicting. remove the type from the archtext // open a reading stream for the archText - StringReader sread = new StringReader(arch.getArchText().toString()); - BufferedReader sstream = new BufferedReader(sread); + final StringReader sread = new StringReader(arch.getArchText().toString()); + final BufferedReader sstream = new BufferedReader(sread); String newArchtext = ""; try { @@ -244,7 +244,7 @@ } else { arch.setArchText(newArchtext.trim() + "\n"); } - } catch (IOException e) { + } catch (final IOException e) { log.error("getSyntaxErrors: Cannot close StringReader"); } } @@ -253,11 +253,11 @@ fields.put("type", Integer.toString(arch.getArchTypNr())); } - String text = arch.getArchText(); + final String text = arch.getArchText(); if (!text.equals("")) { - String[] tmp = text.split("\n"); + final String[] tmp = text.split("\n"); for (int i = 0; i < tmp. length; i++) { - String[] line = tmp[i].split(" +", 2); + final String[] line = tmp[i].split(" +", 2); if (line.length != 2) { log.warn("writeMapArch: ignoring invalid arch line: " + tmp[i]); } else { @@ -268,28 +268,28 @@ if (!isInventory) { // map coordinates only belong into map arches (not inventory arches) - int x = arch.getMapX(); + final int x = arch.getMapX(); if (x != 0) { fields.put("x", Integer.toString(x)); } - int y = arch.getMapY(); + final int y = arch.getMapY(); if (y != 0) { fields.put("y", Integer.toString(y)); } } // Sort fields to match server/crossedit order. - String[] keys = (String[]) fields.keySet().toArray(new String[0]); + final String[] keys = (String[]) fields.keySet().toArray(new String[0]); Arrays.sort(keys, keyOrderComparator); // Actually write the fields. try { bufferedWriter.write("arch " + arch.getArchName() + "\n"); for (int i = 0; i < keys.length; i++) { - String value = (String) fields.get(keys[i]); + final String value = (String) fields.get(keys[i]); if (value != null) { - String key = keys[i]; + final String key = keys[i]; if (key.equals("msg") || key.equals("lore")) { bufferedWriter.write(key + "\n" + value + "\n"); } else { @@ -301,7 +301,7 @@ browseInvObjects(arch); // write his inventory inside this arch bufferedWriter.write("end\n"); - } catch (IOException e) { + } catch (final IOException e) { mainControl.showMessage("Error Save Map", "Error writing file " + fname + "\n"); return false; } @@ -313,13 +313,13 @@ * in the order in which they should be written to disk. */ private final Comparator keyOrderComparator = new Comparator() { - public int compare(Object o1, Object o2) { - String s1 = (String) o1; - String s2 = (String) o2; - Integer i1 = (Integer) keys.get(s1); - Integer i2 = (Integer) keys.get(s2); - int v1 = i1 == null ? 10000 : i1.intValue(); - int v2 = i2 == null ? 10000 : i2.intValue(); + public int compare(final Object o1, final Object o2) { + final String s1 = (String) o1; + final String s2 = (String) o2; + final Integer i1 = (Integer) keys.get(s1); + final Integer i2 = (Integer) keys.get(s2); + final int v1 = i1 == null ? 10000 : i1.intValue(); + final int v2 = i2 == null ? 10000 : i2.intValue(); if (v1 < v2) { return -1; } @@ -579,7 +579,7 @@ * Add a new key to {@link #keys}. The order in which the keys are added is * the order in which the objects fields are written out. */ - private static void addKey(String key) { + private static void addKey(final String key) { keys.put(key, new Integer(idKey++)); } } Modified: trunk/crossfire/src/cfeditor/CMapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapModel.java 2006-06-06 21:54:36 UTC (rev 139) +++ trunk/crossfire/src/cfeditor/CMapModel.java 2006-06-08 21:24:32 UTC (rev 140) @@ -43,7 +43,7 @@ * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ -public class CMapModel { +public final class CMapModel { private static final Logger log = Logger.getLogger(CMapModel.class); @@ -338,9 +338,11 @@ return false; } - int temp = -1; + final int temp; if (intern != -1) { // we use this different - only one object temp = archnr + c; // of one type on a map position when dragged + } else { + temp = -1; } // run through map parts and test for intern counter @@ -529,7 +531,7 @@ return true; } - @Deprecated public boolean insertArchToMap(ArchObject newarch, int archnr, final ArchObject next, final int mapx, final int mapy, final boolean join) { + @Deprecated public boolean insertArchToMap(final ArchObject newarch, final int archnr, final ArchObject next, final int mapx, final int mapy, final boolean join) { return insertArchToMap(newarch, archnr, next, new Point(mapx, mapy), join); } /** @@ -595,7 +597,7 @@ } } else { // insert the new arch into the inventory of a map arch - ArchObject invnew; // new arch to be inserted + final ArchObject invnew; // new arch to be inserted if (newarch == null || newarch.isDefaultArch()) { if (newarch != null && newarch.isDefaultArch()) { archnr = newarch.getNodeNr(); @@ -1121,7 +1123,7 @@ * @param y square location (y coordinate) * @return whether a match was found */ - public boolean filterSquare(NamedFilterConfig config, int x, int y) { + public boolean filterSquare(final NamedFilterConfig config, final int x, final int y) { return filterSquare(NamedFilterList.getDefaultList(), config, x, y); } @@ -1134,7 +1136,7 @@ * @param y square location (y coordinate) * @return whether a match was found */ - public boolean filterSquare(Filter filter, FilterConfig config, int x, int y) { + public boolean filterSquare(final Filter filter, final FilterConfig config, final int x, final int y) { if (x < 0 || y < 0 || x >= mapSize.width || y >= mapSize.height) { return false; } @@ -1171,7 +1173,7 @@ * @param levelFile The level file that is used as the data source. */ /* - void setLevelCellData(int x, int y, int data) { + void setLevelCellData(final int x, final int y, final int data) { // Clear data bits m_levelGrid[x][y] &= m_flagMask; @@ -1192,7 +1194,7 @@ */ /* int[] getRawData() { - int[] aData = new int[m_levelWidth*m_levelHeight]; + final int[] aData = new int[m_levelWidth*m_levelHeight]; int idx = 0; for (int y = 0; y < m_levelHeight; y++) { for (int x = 0; x < m_levelWidth; x++) { @@ -1208,7 +1210,7 @@ * Sets the level data. */ /* - void setRawData(int[] aData) { + void setRawData(final int[] aData) { m_levelGrid = new int[m_levelWidth][m_levelHeight]; int idx = 0; for (int y = 0; y < m_levelHeight; y++) { Modified: trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java 2006-06-06 21:54:36 UTC (rev 139) +++ trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java 2006-06-08 21:24:32 UTC (rev 140) @@ -58,7 +58,7 @@ * @author <a href="mailto:and...@gm...">Andreas Vogl</a> * @author <a href="mailto:mic...@no...">Michael Toennies</a> */ -public class CMapPropertiesDialog extends CDialogBase { +public final class CMapPropertiesDialog extends CDialogBase { public static final String CENTER_MAP_KEY = "MapProperties.centerMapOnResize"; @@ -154,7 +154,7 @@ CMapPropertiesDialog(final CMainControl mainControl, final Frame parentFrame, final CMapControl level) { // set title super(parentFrame, "" + level.getMapNameWithoutMusic() + " - Map Properties"); - MapArchObject map = level.getMapModel().getMapArchObject(); // map arch object + final MapArchObject map = level.getMapModel().getMapArchObject(); // map arch object this.mainControl = mainControl; // main control m_level = level; // map control @@ -162,9 +162,9 @@ getContentPane().setLayout(new BorderLayout()); // main panel (gridbag) - GridBagLayout gridbag = new GridBagLayout(); - GridBagConstraints c = new GridBagConstraints(); - JPanel mainPanel = new JPanel(gridbag); + final GridBagLayout gridbag = new GridBagLayout(); + final GridBagConstraints c = new GridBagConstraints(); + final JPanel mainPanel = new JPanel(gridbag); //mainPanel.setLayout(new CardLayout()); mainPanel.setBorder(new EmptyBorder( IGUIConstants.DIALOG_INSETS, @@ -173,7 +173,7 @@ IGUIConstants.DIALOG_INSETS)); // 1. map panel: - JPanel mapPanel = new JPanel(new GridLayout(0, 1)); + final JPanel mapPanel = new JPanel(new GridLayout(0, 1)); mapPanel.setBorder( new CompoundBorder( new TitledBorder(new EtchedBorder(), "Map"), @@ -201,7 +201,7 @@ mainPanel.add(mapPanel); // 2. options panel: - JTabbedPane tabPane = new JTabbedPane(JTabbedPane.TOP); + final JTabbedPane tabPane = new JTabbedPane(JTabbedPane.TOP); tabPane.setBorder(BorderFactory.createEmptyBorder(0, 3, 3, 0)); JPanel optionPanel = new JPanel(new GridLayout(1, 1)); @@ -215,9 +215,9 @@ IGUIConstants.DIALOG_INSETS, IGUIConstants.DIALOG_INSETS))); } - JPanel optionPanel2 = new JPanel(); + final JPanel optionPanel2 = new JPanel(); optionPanel2.setLayout(new BoxLayout(optionPanel2, BoxLayout.Y_AXIS)); - ... [truncated message content] |
From: <der...@us...> - 2006-06-07 22:14:29
|
Revision: 137 Author: derdanny Date: 2006-06-06 12:49:16 -0700 (Tue, 06 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=137&view=rev Log Message: ----------- Corrected some javadocs. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CAttribBitmask.java trunk/crossfire/src/cfeditor/CMapControl.java trunk/crossfire/src/cfeditor/CMapFileEncode.java trunk/daimonin/src/daieditor/CMainView.java trunk/daimonin/src/daieditor/CMapViewBasic.java trunk/daimonin/src/daieditor/arch/match/MutableOrArchObjectMatcher.java trunk/daimonin/src/daieditor/gui/DirectionLayout.java trunk/daimonin/src/daieditor/map/MapControl.java trunk/src/app/net/sf/gridarta/gui/GSplitPane.java Modified: trunk/crossfire/src/cfeditor/CAttribBitmask.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribBitmask.java 2006-06-06 18:49:02 UTC (rev 136) +++ trunk/crossfire/src/cfeditor/CAttribBitmask.java 2006-06-06 19:49:16 UTC (rev 137) @@ -55,7 +55,7 @@ /** * Maximum number of characters in a line before linebreak (see {@link - * #getText(int)}). + * #getText(int, JTextArea)}). */ private static final int MAX_CHARS_PER_LINE = 35; // 50 Modified: trunk/crossfire/src/cfeditor/CMapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapControl.java 2006-06-06 18:49:02 UTC (rev 136) +++ trunk/crossfire/src/cfeditor/CMapControl.java 2006-06-06 19:49:16 UTC (rev 137) @@ -252,7 +252,7 @@ * @param yy * @param intern * @param join - * @return + * @return <code>true</code> if insertion is successful, <code>false</code> if not * @deprecated use {@link #addArchToMap(int, Point, int, boolean)} instead */ @Deprecated public boolean addArchToMap(final int archnr, final int xx, final int yy, final int intern, final boolean join) { Modified: trunk/crossfire/src/cfeditor/CMapFileEncode.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapFileEncode.java 2006-06-06 18:49:02 UTC (rev 136) +++ trunk/crossfire/src/cfeditor/CMapFileEncode.java 2006-06-06 19:49:16 UTC (rev 137) @@ -25,6 +25,8 @@ package cfeditor; import cfeditor.arch.ArchObject; +import java.awt.Dimension; +import java.awt.Point; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; @@ -36,8 +38,6 @@ import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; -import java.awt.Dimension; -import java.awt.Point; import org.apache.log4j.Logger; /** @@ -576,7 +576,7 @@ private static int idKey = 1; /** - * Add a new key to {@link keys}. The order in which the keys are added is + * Add a new key to {@link #keys}. The order in which the keys are added is * the order in which the objects fields are written out. */ private static void addKey(String key) { Modified: trunk/daimonin/src/daieditor/CMainView.java =================================================================== --- trunk/daimonin/src/daieditor/CMainView.java 2006-06-06 18:49:02 UTC (rev 136) +++ trunk/daimonin/src/daieditor/CMainView.java 2006-06-06 19:49:16 UTC (rev 137) @@ -24,14 +24,12 @@ package daieditor; -import static net.sf.japi.swing.ActionFactory.getFactory; import daieditor.arch.ArchObject; import daieditor.arch.ArchObjectStack; import daieditor.gui.AboutDialog; import daieditor.map.MapControl; import daieditor.map.validation.ErrorCollector; import daieditor.map.validation.ErrorHandler; -import net.sf.gridarta.gui.GSplitPane; import java.awt.BorderLayout; import java.awt.Point; import java.awt.Rectangle; @@ -61,8 +59,10 @@ import javax.swing.SwingConstants; import javax.swing.event.InternalFrameEvent; import javax.swing.event.InternalFrameListener; +import net.sf.gridarta.gui.GSplitPane; import net.sf.gridarta.help.Help; import net.sf.japi.swing.ActionFactory; +import static net.sf.japi.swing.ActionFactory.getFactory; import net.sf.japi.util.ThrowableHandler; import org.jetbrains.annotations.Nullable; @@ -115,7 +115,7 @@ /** Key for info whether map-tile panel is seperate or at bottom. */ public static final String MAP_TILE_LIST_BOTTOM_KEY = "MapTileBottom"; - /** Default value for {@link MAP_TILE_LIST_BOTTOM_KEY}. */ + /** Default value for {@link #MAP_TILE_LIST_BOTTOM_KEY}. */ public static final boolean MAP_TILE_LIST_BOTTOM_DEFAULT = true; /** The controller of this view. */ Modified: trunk/daimonin/src/daieditor/CMapViewBasic.java =================================================================== --- trunk/daimonin/src/daieditor/CMapViewBasic.java 2006-06-06 18:49:02 UTC (rev 136) +++ trunk/daimonin/src/daieditor/CMapViewBasic.java 2006-06-06 19:49:16 UTC (rev 137) @@ -108,7 +108,7 @@ /** * Constructs a level view. * @param mainControl the main controller - * @param control the controller of this view + * @param mapControl the controller of this view */ CMapViewBasic(final CMainControl mainControl, final MapControl mapControl, final CMapViewInterface fi) { super(VERTICAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_AS_NEEDED); Modified: trunk/daimonin/src/daieditor/arch/match/MutableOrArchObjectMatcher.java =================================================================== --- trunk/daimonin/src/daieditor/arch/match/MutableOrArchObjectMatcher.java 2006-06-06 18:49:02 UTC (rev 136) +++ trunk/daimonin/src/daieditor/arch/match/MutableOrArchObjectMatcher.java 2006-06-06 19:49:16 UTC (rev 137) @@ -34,7 +34,7 @@ */ public class MutableOrArchObjectMatcher implements ArchObjectMatcher { - /** The default matching state when {@link archObjectMatchers} is empty. */ + /** The default matching state when {@link #archObjectMatchers} is empty. */ private final boolean defaultState; /** The ArchObjectMatchers to OR. */ @@ -42,7 +42,7 @@ /** * Create a MutableOrArchObjectMatcher. - * @param defaultState default matching state when {@link archObjectMatchers} is empty + * @param defaultState default matching state when {@link #archObjectMatchers} is empty */ public MutableOrArchObjectMatcher(final boolean defaultState) { this.defaultState = defaultState; Modified: trunk/daimonin/src/daieditor/gui/DirectionLayout.java =================================================================== --- trunk/daimonin/src/daieditor/gui/DirectionLayout.java 2006-06-06 18:49:02 UTC (rev 136) +++ trunk/daimonin/src/daieditor/gui/DirectionLayout.java 2006-06-06 19:49:16 UTC (rev 137) @@ -447,7 +447,7 @@ * Helper method for returning the maximum of an unspecified number of arguments. * (The class {@link Math} only provides max methods for 2 arguments. * @param numbers Numbers to get maximum of - * @return maximum of numbers, which is {@link Integer.MIN_VALUE} in case no number was supplied. + * @return maximum of numbers, which is {@link Integer#MIN_VALUE} in case no number was supplied. */ private static int max(final int... numbers) { int ret = Integer.MIN_VALUE; Modified: trunk/daimonin/src/daieditor/map/MapControl.java =================================================================== --- trunk/daimonin/src/daieditor/map/MapControl.java 2006-06-06 18:49:02 UTC (rev 136) +++ trunk/daimonin/src/daieditor/map/MapControl.java 2006-06-06 19:49:16 UTC (rev 137) @@ -570,8 +570,8 @@ } /** - * - * @return + * Returns a <code>LevelRenderer</code> of the map. If no renderer is available a new one is created and returned. + * @return A <code>LevelRenderer</code> which may have to be created. */ public LevelRenderer getRenderer() { final SimpleLevelRenderer tmpLevelRenderer = simpleLevelRendererReference == null ? null : simpleLevelRendererReference.get(); Modified: trunk/src/app/net/sf/gridarta/gui/GSplitPane.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/GSplitPane.java 2006-06-06 18:49:02 UTC (rev 136) +++ trunk/src/app/net/sf/gridarta/gui/GSplitPane.java 2006-06-06 19:49:16 UTC (rev 137) @@ -42,7 +42,7 @@ /** * Create a new DSplitPane. - * @param newOrientation {@link JSplitPane#HORIZONTAL_SPLIT} or {@link JSplitPane.VERTICAL_SPLIT}. + * @param newOrientation {@link JSplitPane#HORIZONTAL_SPLIT} or {@link JSplitPane#VERTICAL_SPLIT}. * @param newLeftComponent the Component that will appear on the left of a horizontally-split pane, or at the top of a vertically-split pane * @param newRightComponent the Component that will appear on the right of a horizontally-split pane, or at the bottom of a vertically-split pane */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <der...@us...> - 2006-06-07 21:54:27
|
Revision: 136 Author: derdanny Date: 2006-06-06 11:49:02 -0700 (Tue, 06 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=136&view=rev Log Message: ----------- Added package descriptions. Updated some javadocs. Made some variables final. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/MapCursor.java trunk/src/app/net/sf/gridarta/gui/map/MapCursorEvent.java trunk/src/app/net/sf/gridarta/gui/map/MapCursorListener.java trunk/src/app/net/sf/gridarta/gui/map/MapGrid.java trunk/src/app/net/sf/gridarta/gui/map/MapGridEvent.java trunk/src/app/net/sf/gridarta/gui/map/MapGridListener.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/gui/map/package.html trunk/src/app/net/sf/gridarta/gui/package.html Modified: trunk/src/app/net/sf/gridarta/gui/map/MapCursor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapCursor.java 2006-06-06 00:22:26 UTC (rev 135) +++ trunk/src/app/net/sf/gridarta/gui/map/MapCursor.java 2006-06-06 18:49:02 UTC (rev 136) @@ -29,9 +29,16 @@ import org.jetbrains.annotations.Nullable; /** - * MapCursor provides methods to move and drag on map. - * A <code>MapGrid</code> is changed accordingly - * When coordinates or mode of MapCursor changes a #MapCursorEvent is fired. + * MapCursor provides methods to move and drag on map. The MapCursor is bound to a + * {@link MapGrid} which will change it flags depending on MapCursor movement/selection. + * <p> + * There are three different states for MapCursor: + * <ul> + * <li>Deactivated</li> + * <li>On the map</li> + * <li>Dragging</li> + * </ul> + * When coordinates or state of MapCursor changes a {@link MapCursorEvent} is fired. */ public class MapCursor implements MapGridListener { @@ -74,7 +81,7 @@ private EventListenerList listenerList = new EventListenerList(); /** - * Construct a cursor + * Construct a MapCursor. The cursor will be deactivated after construction. * @param mapGrid Cursor is bound to this grid */ public MapCursor(final MapGrid mapGrid) { @@ -98,16 +105,17 @@ * @return <code>true</code> if cursor position changed or if it gets disabled */ public boolean setLocation(@Nullable final Point p) { - boolean hasChanged = true; + final boolean hasChanged; if (p != null && mapRec.contains(p)) { if (isOnMap) { - if (!pos.equals(p)) { + if (pos.equals(p)) { + hasChanged = false; + } else { mapGrid.unSetCursor(pos); pos.setLocation(p); mapGrid.setCursor(pos); fireMapCursorChangedPosEvent(); - } else { - hasChanged = false; + hasChanged = true; } } else { pos.setLocation(p); @@ -115,9 +123,11 @@ isOnMap = true; fireMapCursorChangedModeEvent(); fireMapCursorChangedPosEvent(); + hasChanged = true; } } else if (isOnMap) { deactivate(); + hasChanged = true; } else { hasChanged = false; } @@ -130,20 +140,22 @@ * @return <code>true</code> if cursor position changed */ public boolean setLocationSafe(@Nullable final Point p) { - boolean hasChanged = true; + final boolean hasChanged; if (p != null && mapRec.contains(p)) { if (isOnMap) { - if (!pos.equals(p)) { + if (pos.equals(p)) { + hasChanged = false; + } else { mapGrid.unSetCursor(pos); pos.setLocation(p); mapGrid.setCursor(pos); - } else { - hasChanged = false; + hasChanged = true; } } else { pos.setLocation(p); isOnMap = true; fireMapCursorChangedModeEvent(); + hasChanged = true; } } else { hasChanged = false; @@ -154,7 +166,7 @@ return hasChanged; } - /** Set cursor to drag mode when it is active */ + /** Set cursor to drag mode when it is active. */ public void dragStart() { if (isOnMap && !isDragging) { dragStart.setLocation(pos); @@ -167,7 +179,7 @@ /** * When in drag mode and the point is on the map cursor is moved to this position. - * MapGrid changes preselection accordingly + * {@link MapGrid} changes preselection accordingly. * @param p new coordinates * @return <code>true</code> when dragging position changed successfully */ @@ -185,7 +197,7 @@ return false; } - /** Leave drag mode and undo preselection */ + /** Leave drag mode and undo preselection. */ public void dragRelease() { if (isDragging) { mapGrid.unPreSelect(dragStart, pos); @@ -206,7 +218,7 @@ } } - /** Cursor gets deactivated. All selections get lost */ + /** Cursor gets deactivated. All selections get lost. */ public void deactivate() { final boolean hasChanged = isOnMap; isOnMap = false; @@ -220,7 +232,7 @@ } /** - * Get cursor state + * Get cursor state. * @return <code>true</code> if cursor is on the map */ public boolean isActive() { @@ -240,7 +252,7 @@ } /** - * Check if point is on grid + * Check if point is on grid. * @param p Coordinates of point * @return <code>true</code> if <code>p != null</code> and point is on grid */ @@ -249,8 +261,8 @@ } /** - * Moves the corsor 1 tile relative to current position - * @param dir Index of #direction see #IGUIConstants + * Moves the cursor 1 tile relative to current position. + * @param dir Index of {@link #direction} * @return <code>true</code> if cursor really moved */ public boolean go(final int dir) { @@ -262,18 +274,17 @@ } else { return setLocationSafe(tmpPoint); } - } else { - return false; } + return false; } - /** Getter of #isDragging */ + /** Getter of {@link #isDragging}. */ public boolean isDragging() { return isDragging; } /** - * Register a MapCursorListener + * Register a MapCursorListener. * @param listener MapCursorListener to register */ public void addMapCursorListener(final MapCursorListener listener) { @@ -281,14 +292,14 @@ } /** - * Remove a MapCursorListener + * Remove a MapCursorListener. * @param listener MapCursorListener to remove */ public void removeMapCursorListener(final MapCursorListener listener) { listenerList.remove(MapCursorListener.class, listener); } - /** Inform all registered listeners that the MapCursor's mode has changed */ + /** Inform all registered listeners that the MapCursor's mode has changed. */ private void fireMapCursorChangedModeEvent() { final MapCursorEvent e = new MapCursorEvent(this); final Object[] listeners = listenerList.getListenerList(); @@ -300,7 +311,7 @@ } } - /** Inform all registered listeners that the MapCursor's position has changed */ + /** Inform all registered listeners that the MapCursor's position has changed. */ private void fireMapCursorChangedPosEvent() { final MapCursorEvent e = new MapCursorEvent(this); final Object[] listeners = listenerList.getListenerList(); Modified: trunk/src/app/net/sf/gridarta/gui/map/MapCursorEvent.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapCursorEvent.java 2006-06-06 00:22:26 UTC (rev 135) +++ trunk/src/app/net/sf/gridarta/gui/map/MapCursorEvent.java 2006-06-06 18:49:02 UTC (rev 136) @@ -23,6 +23,7 @@ import java.util.EventObject; +/** This Event is created by {@link MapCursor}. */ public class MapCursorEvent extends EventObject { /** Modified: trunk/src/app/net/sf/gridarta/gui/map/MapCursorListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapCursorListener.java 2006-06-06 00:22:26 UTC (rev 135) +++ trunk/src/app/net/sf/gridarta/gui/map/MapCursorListener.java 2006-06-06 18:49:02 UTC (rev 136) @@ -23,6 +23,7 @@ import java.util.EventListener; +/** Interface for listeners listening to {@link MapCursorEvent}s. */ public interface MapCursorListener extends EventListener { /** Modified: trunk/src/app/net/sf/gridarta/gui/map/MapGrid.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapGrid.java 2006-06-06 00:22:26 UTC (rev 135) +++ trunk/src/app/net/sf/gridarta/gui/map/MapGrid.java 2006-06-06 18:49:02 UTC (rev 136) @@ -30,8 +30,13 @@ import org.jetbrains.annotations.Nullable; /** - * 2D-Grid containing flags for selection, cursor, warnings, errors... - * Every change of the grid fires a MapGridEvent and informs all registered MapGridListeners + * 2D-Grid containing flags for selection, preselection, cursor, warnings and errors. + * This class provides methods to modify these flags. Normally a {@link MapCursor} is used to access them. + * Selection flags are not changed directly. First preselection flags have to be set with {@link #preSelect(Point, Point)}, + * then {@link #select(Point, Point, SelectionMode)} will change the selection flags according to {@link SelectionMode}. + * This allows visualisation of the dragging process when selecting an area. + * <p/> + * Every change of the grid size or flags fires a {@link MapGridEvent} and informs all registered {@link MapGridListener}s. * @author <a href="mailto:dlv...@gm...">Daniel Viegas</a> */ public class MapGrid { @@ -51,10 +56,10 @@ /** Rectangle to store location of last grid change. */ private final Rectangle recChange = new Rectangle(); - /** Selection. RFU. */ - public static final int GRID_FLAG_SELECTION = 1 << 0; + /** Selection - marks all selected tiles. */ + public static final int GRID_FLAG_SELECTION = 1; - /** Selecting - used to distinguish the latest selection from the already selected tiles. RFU. */ + /** Preselection - used to preselect tiles. */ public static final int GRID_FLAG_SELECTING = 1 << 1; /** Flag to highlight as information. RFU. */ @@ -63,7 +68,7 @@ /** Flag to highlight as warning. RFU. */ public static final int GRID_FLAG_WARNING = 1 << 3; - /** Flag to highlight as error. RFU. */ + /** Flag to highlight as error. */ public static final int GRID_FLAG_ERROR = 1 << 4; /** Flag to highlight as fatal. RFU. */ @@ -72,7 +77,10 @@ /** Flag to highlight as part of a connection group. RFU. */ public static final int GRID_FLAG_CONNECTION = 1 << 6; - /** Flag to highlight cursor position. */ + /** + * Flag to highlight cursor position. + * Normally there will only be up to one tile that has this flag set. + */ public static final int GRID_FLAG_CURSOR = 1 << 7; /** The MapGridListeners to inform of changes. */ @@ -82,7 +90,7 @@ private final Rectangle mapRec = new Rectangle(); /** - * Create a MapGrid + * Create a MapGrid. * @param gridSize Size of the grid */ public MapGrid(final Dimension gridSize) { @@ -92,7 +100,7 @@ } /** - * Register a MapGridListener + * Register a MapGridListener. * @param listener MapGridListener to register */ public void addMapGridListener(final MapGridListener listener) { @@ -100,7 +108,7 @@ } /** - * Remove a MapGridListener + * Remove a MapGridListener. * @param listener MapGridListener to remove */ public void removeMapGridListener(final MapGridListener listener) { @@ -173,7 +181,7 @@ } /** - * Unhighlight the given cursor position + * Unhighlight the given cursor position. * @param pos Map coordinates of tile to unhighlight */ public void unSetCursor(final Point pos) { @@ -186,7 +194,7 @@ } /** - * Highlight the given cursor position + * Highlight the given cursor position. * @param pos Map coordinates of tile to highlight */ public void setCursor(final Point pos) { @@ -196,8 +204,8 @@ } /** - * Rectangle defined by two points gets preselected - * The points can be on any corner as long as they are opposite to each other + * Rectangle defined by two points gets preselected. + * The points can be on any corner as long as they are opposite to each other. * @param start Any point on a corner of the rectangle * @param end Point on the opposite corner * @see MapGrid#unPreSelect(Point, Point) @@ -214,7 +222,7 @@ } /** - * Preselection of rectangle defined by points gets deleted + * Preselection of rectangle defined by points gets deleted. * @param start Coordiantes of the first corner * @param end Coordinates of the opposite corner * @see MapGrid#preSelect(Point, Point) @@ -232,7 +240,7 @@ /** * All tiles in the rectangle defined by dragStart and pos that are preselected - * get selected + * get selected. * @param dragStart First corner of rectangle * @param pos Opposite corner of rectangle * @param selectionMode Method how to handle already selected tiles @@ -266,7 +274,11 @@ fireMapGridChangedEvent(); } - /** <code>minX, maxX, minY, maxY</code>are set according to the the points <code>p1</code>and<code>p2</code> */ + /** + * <code>minX, maxX, minY, maxY</code> are set according to the the points <code>p1</code> and <code>p2</code>. + * @param p1 Coordinates of one corner of a rectangle + * @param p2 Coordinates of the opposite corner + */ private void calcRec(final Point p1, final Point p2) { if (p1.x > p2.x) { cornerMin.x = p2.x; @@ -285,16 +297,16 @@ } /** - * Check if tile has error flag set + * Check if tile has error flag set. * @param p Point to check - * @return <code>true</code> if GRID_FLAG_ERROR is set + * @return <code>true</code> if {@link #GRID_FLAG_ERROR} is set */ public boolean hasError(final Point p) { return (gridFlags[p.x][p.y] & GRID_FLAG_ERROR) != 0; } /** - * Get flags of tile + * Get flags of tile. * @param x x-coordinate of tile * @param y y-coordinate of tile * @return Grid flags @@ -304,7 +316,7 @@ } /** - * Get flags of tile + * Get flags of tile. * @param p coordinates of tile * @return Grid flags */ @@ -314,7 +326,7 @@ /** * Get rectangle where grid was changed. - * width and height is 0 for single tiles + * Width and height is 0 for single tiles. * @return changed rectangle */ public Rectangle getRecChange() { @@ -322,7 +334,7 @@ } /** - * Get size of grid + * Get size of grid. * @return Size of grid */ public Dimension getSize() { @@ -330,7 +342,7 @@ } /** - * Get smalles rectangle containing selection + * Get smallest rectangle containing selection. * @return Rectangle containing selection or <code>null</code> if nothing is selected */ @Nullable public Rectangle getSelectedRec() { @@ -389,7 +401,7 @@ return null; } - /** Mark all tiles as selected */ + /** Mark all tiles as selected. */ public void selectAll() { for (int x = 0; x < gridSize.width; x++) { for (int y = 0; y < gridSize.height; y++) { @@ -400,7 +412,7 @@ } /** - * Set error flag at given coordinats + * Set error flag at given coordinats. * @param x X coordinate * @param y Y coordinate */ @@ -412,7 +424,7 @@ } } - /** Clears all error flags */ + /** Clears all error flags. */ public void clearErrors() { boolean errorFound = false; for (int x = 0; x < gridSize.width; x++) { @@ -428,14 +440,14 @@ } } - /** Modes that describe how tiles get selected */ + /** Modes that describe how tiles get selected. */ public enum SelectionMode { - /** All tiles that are preselected get selected */ + /** All tiles that are preselected get selected. */ ADD, - /** All tiles that are preselected get unselected */ + /** All tiles that are preselected get unselected. */ SUB, - /** All tiles that are preselected change state of selection */ + /** All tiles that are preselected change state of selection. */ FLIP } Modified: trunk/src/app/net/sf/gridarta/gui/map/MapGridEvent.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapGridEvent.java 2006-06-06 00:22:26 UTC (rev 135) +++ trunk/src/app/net/sf/gridarta/gui/map/MapGridEvent.java 2006-06-06 18:49:02 UTC (rev 136) @@ -23,6 +23,7 @@ import java.util.EventObject; +/** This event is created by {@link MapGrid}. */ public class MapGridEvent extends EventObject { /** Modified: trunk/src/app/net/sf/gridarta/gui/map/MapGridListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapGridListener.java 2006-06-06 00:22:26 UTC (rev 135) +++ trunk/src/app/net/sf/gridarta/gui/map/MapGridListener.java 2006-06-06 18:49:02 UTC (rev 136) @@ -23,6 +23,7 @@ import java.util.EventListener; +/** Interface for listeners listening to {@link MapGridEvent}s. */ public interface MapGridListener extends EventListener { /** Added: trunk/src/app/net/sf/gridarta/gui/map/package.html =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/package.html (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/map/package.html 2006-06-06 18:49:02 UTC (rev 136) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de"> + <head> + <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> + <title></title> + </head> + <body> + <p> + This package containes classes related to map visualisation. + </p> + <p> + A <a href="MapGrid">MapGrid</a> contains a 2D array of flags for highlighting tiles on a map. + A <a href="MapCursor">MapCursor</a> is used to modify selection and cursor position flags on this MapGrid. + </p> + </body> +</html> \ No newline at end of file Property changes on: trunk/src/app/net/sf/gridarta/gui/map/package.html ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/src/app/net/sf/gridarta/gui/package.html =================================================================== --- trunk/src/app/net/sf/gridarta/gui/package.html (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/package.html 2006-06-06 18:49:02 UTC (rev 136) @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de"> + <head> + <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> + <title></title> + </head> + <body> + <p> + This package containes GUI related classes. + </p> + </body> +</html> \ No newline at end of file Property changes on: trunk/src/app/net/sf/gridarta/gui/package.html ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-06 21:54:51
|
Revision: 139 Author: christianhujer Date: 2006-06-06 14:54:36 -0700 (Tue, 06 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=139&view=rev Log Message: ----------- Minor improvements to filters: Replaced enable() and disable() with setEnabled() to match JavaBeans. Modified Paths: -------------- trunk/crossfire/src/cfeditor/filter/AttributeFilter.java trunk/crossfire/src/cfeditor/filter/BasicFilterConfig.java trunk/crossfire/src/cfeditor/filter/FilterConfig.java trunk/crossfire/src/cfeditor/filter/NamedFilterConfig.java trunk/crossfire/src/cfeditor/filter/NamedFilterList.java trunk/crossfire/src/cfeditor/menu/FilterCheckBoxEntry.java Modified: trunk/crossfire/src/cfeditor/filter/AttributeFilter.java =================================================================== --- trunk/crossfire/src/cfeditor/filter/AttributeFilter.java 2006-06-06 21:48:09 UTC (rev 138) +++ trunk/crossfire/src/cfeditor/filter/AttributeFilter.java 2006-06-06 21:54:36 UTC (rev 139) @@ -117,11 +117,7 @@ final SimpleFilterConfig sConfig = (SimpleFilterConfig) config; final boolean enabled = Boolean.valueOf(value.getChildTextTrim("enabled")); - if (enabled) { - sConfig.enable(); - } else { - sConfig.disable(); - } + sConfig.setEnabled(enabled); final List<Element> properties = value.getChildren("property"); for (final Element property : properties) { final String pName = property.getChildTextTrim("name"); Modified: trunk/crossfire/src/cfeditor/filter/BasicFilterConfig.java =================================================================== --- trunk/crossfire/src/cfeditor/filter/BasicFilterConfig.java 2006-06-06 21:48:09 UTC (rev 138) +++ trunk/crossfire/src/cfeditor/filter/BasicFilterConfig.java 2006-06-06 21:54:36 UTC (rev 139) @@ -25,30 +25,27 @@ private final EventListenerList listenerList = new EventListenerList(); - public void disable() { - if (LOG.isDebugEnabled()) { - LOG.debug("disabling filter " + this); - } - + public void setEnabled(final boolean enabled) { + this.enabled = enabled; if (enabled) { - enabled = false; - final ConfigEvent e = new ConfigEvent(ConfigEventType.DISABLE, this); - fireEvent(e); + if (LOG.isDebugEnabled()) { + LOG.debug("enabling filter " + this); + } + if (!enabled) { + final ConfigEvent e = new ConfigEvent(ConfigEventType.ENABLE, this); + fireEvent(e); + } + } else { + if (LOG.isDebugEnabled()) { + LOG.debug("disabling filter " + this); + } + if (enabled) { + final ConfigEvent e = new ConfigEvent(ConfigEventType.DISABLE, this); + fireEvent(e); + } } } - public void enable() { - if (LOG.isDebugEnabled()) { - LOG.debug("enabling filter " + this); - } - - if (!enabled) { - enabled = true; - final ConfigEvent e = new ConfigEvent(ConfigEventType.ENABLE, this); - fireEvent(e); - } - } - public boolean isEnabled() { return enabled; } Modified: trunk/crossfire/src/cfeditor/filter/FilterConfig.java =================================================================== --- trunk/crossfire/src/cfeditor/filter/FilterConfig.java 2006-06-06 21:48:09 UTC (rev 138) +++ trunk/crossfire/src/cfeditor/filter/FilterConfig.java 2006-06-06 21:54:36 UTC (rev 139) @@ -15,10 +15,8 @@ */ public interface FilterConfig { - void enable(); + void setEnabled(boolean enabled); - void disable(); - boolean isEnabled(); void addConfigChangeListener(ConfigListener listener); Modified: trunk/crossfire/src/cfeditor/filter/NamedFilterConfig.java =================================================================== --- trunk/crossfire/src/cfeditor/filter/NamedFilterConfig.java 2006-06-06 21:48:09 UTC (rev 138) +++ trunk/crossfire/src/cfeditor/filter/NamedFilterConfig.java 2006-06-06 21:54:36 UTC (rev 139) @@ -70,11 +70,7 @@ map.put(name, config); config.addConfigChangeListener(this); } - if (enabled) { - config.enable(); - } else { - config.disable(); - } + config.setEnabled(enabled); final ConfigEvent e = new ConfigEvent(ConfigEventType.CHANGE, this); fireEvent(e); } Modified: trunk/crossfire/src/cfeditor/filter/NamedFilterList.java =================================================================== --- trunk/crossfire/src/cfeditor/filter/NamedFilterList.java 2006-06-06 21:48:09 UTC (rev 138) +++ trunk/crossfire/src/cfeditor/filter/NamedFilterList.java 2006-06-06 21:54:36 UTC (rev 139) @@ -240,11 +240,7 @@ final NamedFilterConfig fConfig = (NamedFilterConfig) config; final boolean enabled = Boolean.valueOf(value.getChildTextTrim("enabled")); - if (enabled) { - fConfig.enable(); - } else { - fConfig.disable(); - } + fConfig.setEnabled(enabled); fConfig.setInverted(Boolean.valueOf(value.getChildTextTrim("inverted"))); final List<Element> l = value.getChildren("subfilter"); for (final Element fElement : l) { @@ -298,11 +294,7 @@ active.getModel().setSelected(config.isEnabled()); active.addChangeListener(new ChangeListener() { public void stateChanged(final ChangeEvent e) { - if (active.getModel().isSelected()) { - config.enable(); - } else { - config.disable(); - } + config.setEnabled(active.getModel().isSelected()); } }); c.add(active); Modified: trunk/crossfire/src/cfeditor/menu/FilterCheckBoxEntry.java =================================================================== --- trunk/crossfire/src/cfeditor/menu/FilterCheckBoxEntry.java 2006-06-06 21:48:09 UTC (rev 138) +++ trunk/crossfire/src/cfeditor/menu/FilterCheckBoxEntry.java 2006-06-06 21:54:36 UTC (rev 139) @@ -19,22 +19,18 @@ private final FilterConfig config; - public FilterCheckBoxEntry(FilterConfig config) { + public FilterCheckBoxEntry(final FilterConfig config) { super("<<set me>>"); this.config = config; setChecked(config.isEnabled()); } - @Override public void setChecked(boolean checked) { + @Override public void setChecked(final boolean checked) { if (checked == isChecked()) { return; } - super.setChecked(checked); - if (checked) { - config.enable(); - } else { - config.disable(); - } + config.setEnabled(checked); } -} + +} // class FilterCheckBoxEntry This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-06 21:48:24
|
Revision: 138 Author: christianhujer Date: 2006-06-06 14:48:09 -0700 (Tue, 06 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=138&view=rev Log Message: ----------- Fixed old libs handling: .svn is now recognized. Modified Paths: -------------- trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/action.properties trunk/daimonin/src/daieditor/arch/ArchObject.java trunk/daimonin/src/daieditor/messages.properties trunk/daimonin/src/daieditor/messages_sv.properties Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-06-06 19:49:16 UTC (rev 137) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-06-06 21:48:09 UTC (rev 138) @@ -463,6 +463,11 @@ assert libsString != null; final String[] patterns = libsString.split("\\s+"); final File[] libFiles = libs.listFiles(Factory.not(new GlobFileFilter(patterns))); + if (libFiles != null) { + for (final File libFile : libFiles) { + System.out.println(libFile); + } + } if (libFiles != null && libFiles.length > 0 && ACTION_FACTORY.showOnetimeConfirmDialog(mainView, YES_NO_OPTION, INFORMATION_MESSAGE, "oldLibsFound", libs.toString()) == YES_OPTION) { for (final File libFile : libFiles) { Modified: trunk/daimonin/src/daieditor/action.properties =================================================================== --- trunk/daimonin/src/daieditor/action.properties 2006-06-06 19:49:16 UTC (rev 137) +++ trunk/daimonin/src/daieditor/action.properties 2006-06-06 21:48:09 UTC (rev 138) @@ -44,7 +44,7 @@ optionsChooseFile.icon=general/Open16 -oldLibs.okayLibs=CVS README LICENSE-* japi.jar jlfgr-1_0.jar +oldLibs.okayLibs=.svn CVS README LICENSE-* japi.jar jlfgr-1_0.jar ####### # File Modified: trunk/daimonin/src/daieditor/arch/ArchObject.java =================================================================== --- trunk/daimonin/src/daieditor/arch/ArchObject.java 2006-06-06 19:49:16 UTC (rev 137) +++ trunk/daimonin/src/daieditor/arch/ArchObject.java 2006-06-06 21:48:09 UTC (rev 138) @@ -127,7 +127,7 @@ private FaceDesc faceobjdesc; /** - * Wether the direction is set. + * Whether the direction is set. * <code>true</code> if direction is set, otherwise <code>false</code>. */ private boolean directionSet; Modified: trunk/daimonin/src/daieditor/messages.properties =================================================================== --- trunk/daimonin/src/daieditor/messages.properties 2006-06-06 19:49:16 UTC (rev 137) +++ trunk/daimonin/src/daieditor/messages.properties 2006-06-06 21:48:09 UTC (rev 138) @@ -315,7 +315,6 @@ oldSettingsFound.title=Delete old configuration file? oldLibsFound.message=Old libraries found.\nLocation: {0}\nThey aren''t used anymore.\nDelete them? oldLibsFound.title=Delete old libraries? -oldLibs.okayLibs=CVS README LICENSE-* japi.jar jlfgr-1_0.jar # Attribues attribHelp.text=Help Modified: trunk/daimonin/src/daieditor/messages_sv.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_sv.properties 2006-06-06 19:49:16 UTC (rev 137) +++ trunk/daimonin/src/daieditor/messages_sv.properties 2006-06-06 21:48:09 UTC (rev 138) @@ -313,7 +313,6 @@ oldSettingsFound.title=Ta bort gammal konfigurationsfil oldLibsFound=Hittade gamla bibliotek.\nS\xF6kv\xE4g: {0}\nDe anv\xE4nds inte l\xE4ngre. Skall jag ta bort dem? oldLibsFound.title=Ta bort gamla bibliotek? -oldLibs.okayLibs=CVS README LICENSE-* japi.jar jlfgr-1_0.jar # Attribues attribHelp.text=Hj\xE4lp This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-06 02:51:19
|
Revision: 133 Author: christianhujer Date: 2006-06-04 16:23:06 -0700 (Sun, 04 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=133&view=rev Log Message: ----------- Added fake unit test for HideFileFilterProxy. Added Paths: ----------- trunk/src/test/net/sf/gridarta/gui/ trunk/src/test/net/sf/gridarta/gui/HideFileFilterProxyTest.java Added: trunk/src/test/net/sf/gridarta/gui/HideFileFilterProxyTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/HideFileFilterProxyTest.java (rev 0) +++ trunk/src/test/net/sf/gridarta/gui/HideFileFilterProxyTest.java 2006-06-04 23:23:06 UTC (rev 133) @@ -0,0 +1,45 @@ +package test.net.sf.gridarta.gui; + +import net.sf.gridarta.gui.HideFileFilterProxy; +import net.sf.japi.util.filter.file.AbstractFileFilter; +import junit.framework.TestCase; +import java.io.File; + +/** + * Test for {@link HideFileFilterProxy}. + * + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public class HideFileFilterProxyTest extends TestCase { + + /** Object Under Test: A HideFileFilterProxy. */ + private HideFileFilterProxy oUT; + + /** {@inheritDoc} */ + @Override public void setUp() throws Exception { + super.setUp(); + //oUT = new HideFileFilterProxy(); + } + + /** {@inheritDoc} */ + @Override public void tearDown() throws Exception { + super.tearDown(); + oUT = null; + } + + /** Test case for {@link HideFileFilterProxy#HideFileFilterProxy(AbstractFileFilter)}. */ + public void testHideFileFilterProxy() throws Exception { + fail("Test is not implemented"); // TODO: Test goes here... + } + + /** Test case for {@link HideFileFilterProxy#getDescription()}. */ + public void testGetDescription() throws Exception { + fail("Test is not implemented"); // TODO: Test goes here... + } + + /** Test case for {@link HideFileFilterProxy#accept(File)}. */ + public void testAccept() throws Exception { + fail("Test is not implemented"); // TODO: Test goes here... + } + +} // class HideFileFilterProxyTest \ No newline at end of file Property changes on: trunk/src/test/net/sf/gridarta/gui/HideFileFilterProxyTest.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |