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: <chr...@us...> - 2006-06-02 20:34:38
|
Revision: 109 Author: christianhujer Date: 2006-06-02 13:34:17 -0700 (Fri, 02 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=109&view=rev Log Message: ----------- Unified C/DSplitPane into Gridarta. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CArchPanel.java trunk/daimonin/src/daieditor/CMainView.java trunk/daimonin/src/daieditor/CMapArchPanel.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/gui/DSplitPane.java Removed Paths: ------------- trunk/crossfire/src/cfeditor/DSplitPane.java trunk/daimonin/src/daieditor/swing/DSplitPane.java Modified: trunk/crossfire/src/cfeditor/CArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanel.java 2006-06-02 20:24:44 UTC (rev 108) +++ trunk/crossfire/src/cfeditor/CArchPanel.java 2006-06-02 20:34:17 UTC (rev 109) @@ -37,6 +37,7 @@ import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import org.jetbrains.annotations.Nullable; +import net.sf.gridarta.gui.DSplitPane; /** * The <code>CArchPanel</code> holds the tile palette. Deleted: trunk/crossfire/src/cfeditor/DSplitPane.java =================================================================== --- trunk/crossfire/src/cfeditor/DSplitPane.java 2006-06-02 20:24:44 UTC (rev 108) +++ trunk/crossfire/src/cfeditor/DSplitPane.java 2006-06-02 20:34:17 UTC (rev 109) @@ -1,38 +0,0 @@ -package cfeditor; - -import java.awt.Component; -import javax.swing.JSplitPane; - -/** - * Splitpane subclass that keeps its size even upon L'n'F change. - * @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 class DSplitPane extends JSplitPane { - - /** Serial Version UID. */ - private static final long serialVersionUID = 1L; - - /** - * Create a new DSplitPane. - * @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 - */ - public DSplitPane(final int newOrientation, final Component newLeftComponent, final Component newRightComponent) { - super(newOrientation, newLeftComponent, newRightComponent); - setOneTouchExpandable(true); - } - - /** {@inheritDoc} */ - // Overridden to store and restore the divider location upon UI change. - @Override public void updateUI() { - final int dividerLocationBackup = getDividerLocation(); - final int dividerSizeBackup = getDividerSize(); - super.updateUI(); - setDividerLocation(dividerLocationBackup); - setDividerSize(dividerSizeBackup); - } - -} // class DSplitPane Modified: trunk/daimonin/src/daieditor/CMainView.java =================================================================== --- trunk/daimonin/src/daieditor/CMainView.java 2006-06-02 20:24:44 UTC (rev 108) +++ trunk/daimonin/src/daieditor/CMainView.java 2006-06-02 20:34:17 UTC (rev 109) @@ -31,7 +31,7 @@ import daieditor.map.MapControl; import daieditor.map.validation.ErrorCollector; import daieditor.map.validation.ErrorHandler; -import daieditor.swing.DSplitPane; +import net.sf.gridarta.gui.DSplitPane; import java.awt.BorderLayout; import java.awt.Point; import java.awt.Rectangle; Modified: trunk/daimonin/src/daieditor/CMapArchPanel.java =================================================================== --- trunk/daimonin/src/daieditor/CMapArchPanel.java 2006-06-02 20:24:44 UTC (rev 108) +++ trunk/daimonin/src/daieditor/CMapArchPanel.java 2006-06-02 20:34:17 UTC (rev 109) @@ -24,14 +24,12 @@ package daieditor; -import static net.sf.japi.swing.ActionFactory.getFactory; import daieditor.arch.ArchObject; import daieditor.arch.ArchObjectParser; import daieditor.gui.ConnectionView; import daieditor.gui.ErrorListView; import daieditor.map.validation.ErrorCollector; import daieditor.map.validation.ErrorHandler; -import daieditor.swing.DSplitPane; import java.awt.BorderLayout; import static java.awt.Color.black; import static java.awt.Color.blue; @@ -70,7 +68,9 @@ import javax.swing.text.Style; import javax.swing.text.StyleConstants; import javax.swing.text.StyleContext; +import net.sf.gridarta.gui.DSplitPane; import net.sf.japi.swing.ActionFactory; +import static net.sf.japi.swing.ActionFactory.getFactory; /** * <code>CMapArchPanel</code> implements the panel that holds information Deleted: trunk/daimonin/src/daieditor/swing/DSplitPane.java =================================================================== --- trunk/daimonin/src/daieditor/swing/DSplitPane.java 2006-06-02 20:24:44 UTC (rev 108) +++ trunk/daimonin/src/daieditor/swing/DSplitPane.java 2006-06-02 20:34:17 UTC (rev 109) @@ -1,63 +0,0 @@ -/* - * Daimonin Java Editor. - * Copyright (C) 2000 Michael Toennies - * Copyright (C) 2001 Andreas Vogl - * Copyright (C) 2005 Christian Hujer - * - * (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 daieditor.swing; - -import java.awt.Component; -import javax.swing.JSplitPane; - -/** - * Splitpane subclass that keeps its size even upon L'n'F change. - * @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 class DSplitPane extends JSplitPane { - - /** Serial Version UID. */ - private static final long serialVersionUID = 1L; - - /** - * Create a new DSplitPane. - * @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 - */ - public DSplitPane(final int newOrientation, final Component newLeftComponent, final Component newRightComponent) { - super(newOrientation, newLeftComponent, newRightComponent); - setOneTouchExpandable(true); - } - - /** {@inheritDoc} */ - // Overridden to store and restore the divider location upon UI change. - @Override public void updateUI() { - final int dividerLocationBackup = getDividerLocation(); - final int dividerSizeBackup = getDividerSize(); - super.updateUI(); - setDividerLocation(dividerLocationBackup); - setDividerSize(dividerSizeBackup); - } - -} // class DSplitPane Copied: trunk/src/app/net/sf/gridarta/gui/DSplitPane.java (from rev 108, trunk/daimonin/src/daieditor/swing/DSplitPane.java) =================================================================== --- trunk/src/app/net/sf/gridarta/gui/DSplitPane.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/DSplitPane.java 2006-06-02 20:34:17 UTC (rev 109) @@ -0,0 +1,64 @@ +/* + * Gridarta Java Editor. + * Copyright (C) 2000 Michael Toennies + * Copyright (C) 2001 Andreas Vogl + * Copyright (C) 2005 Christian Hujer + * Copyright (C) 2006 The Gridarta Developers + * + * (code based on: Gridder. 2D grid based level editor. (C) 2000 Pasi Keränen) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + */ + +package net.sf.gridarta.gui; + +import java.awt.Component; +import javax.swing.JSplitPane; + +/** + * Splitpane subclass that keeps its size even upon L'n'F change. + * @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 class DSplitPane extends JSplitPane { + + /** Serial Version UID. */ + private static final long serialVersionUID = 1L; + + /** + * Create a new DSplitPane. + * @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 + */ + public DSplitPane(final int newOrientation, final Component newLeftComponent, final Component newRightComponent) { + super(newOrientation, newLeftComponent, newRightComponent); + setOneTouchExpandable(true); + } + + /** {@inheritDoc} */ + // Overridden to store and restore the divider location upon UI change. + @Override public void updateUI() { + final int dividerLocationBackup = getDividerLocation(); + final int dividerSizeBackup = getDividerSize(); + super.updateUI(); + setDividerLocation(dividerLocationBackup); + setDividerSize(dividerSizeBackup); + } + +} // class DSplitPane This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-02 20:25:13
|
Revision: 108 Author: christianhujer Date: 2006-06-02 13:24:44 -0700 (Fri, 02 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=108&view=rev Log Message: ----------- Unified splitpanes. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CArchPanel.java trunk/daimonin/src/daieditor/swing/DSplitPane.java Added Paths: ----------- trunk/crossfire/src/cfeditor/DSplitPane.java Removed Paths: ------------- trunk/crossfire/src/cfeditor/CSplitPane.java Modified: trunk/crossfire/src/cfeditor/CArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanel.java 2006-06-02 20:04:11 UTC (rev 107) +++ trunk/crossfire/src/cfeditor/CArchPanel.java 2006-06-02 20:24:44 UTC (rev 108) @@ -61,7 +61,7 @@ private final JTabbedPane archAndPickPane; /** Our split pane. */ - private final CSplitPane splitPane; + private final DSplitPane splitPane; /** The Tab panel with arch lists. */ private final JTabbedPane tabDesktop; @@ -100,7 +100,7 @@ // this listener informs the mainview which panel is active: archlist or pickmaps? CPickmapPanel.getInstance().addArchNPickChangeListener(archAndPickPane); - splitPane = new CSplitPane(JSplitPane.VERTICAL_SPLIT, archAndPickPane, archQuickPanel); + splitPane = new DSplitPane(JSplitPane.VERTICAL_SPLIT, archAndPickPane, archQuickPanel); // calculate default value in case there is no settings file final Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); Deleted: trunk/crossfire/src/cfeditor/CSplitPane.java =================================================================== --- trunk/crossfire/src/cfeditor/CSplitPane.java 2006-06-02 20:04:11 UTC (rev 107) +++ trunk/crossfire/src/cfeditor/CSplitPane.java 2006-06-02 20:24:44 UTC (rev 108) @@ -1,28 +0,0 @@ -package cfeditor; - -import javax.swing.JSplitPane; -import java.awt.Component; - -/** Splitpane class that keeps its size even upon L'n'F change. */ -public class CSplitPane extends JSplitPane { - - /** Serial Version UID. */ - private static final long serialVersionUID = 1L; - - public CSplitPane(final int newOrientation, final Component newLeftComponent, final Component newRightComponent) { - super(newOrientation, newLeftComponent, newRightComponent); - } - - /** - * Overridden to store and restore the divider location upon - * UI change. - */ - @Override public void updateUI() { - final int dividerLocation = getDividerLocation(); - final int dividerSize = getDividerSize(); - super.updateUI(); - setDividerLocation(dividerLocation); - setDividerSize(dividerSize); - } - -} // class CSplitPane Copied: trunk/crossfire/src/cfeditor/DSplitPane.java (from rev 107, trunk/crossfire/src/cfeditor/CSplitPane.java) =================================================================== --- trunk/crossfire/src/cfeditor/DSplitPane.java (rev 0) +++ trunk/crossfire/src/cfeditor/DSplitPane.java 2006-06-02 20:24:44 UTC (rev 108) @@ -0,0 +1,38 @@ +package cfeditor; + +import java.awt.Component; +import javax.swing.JSplitPane; + +/** + * Splitpane subclass that keeps its size even upon L'n'F change. + * @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 class DSplitPane extends JSplitPane { + + /** Serial Version UID. */ + private static final long serialVersionUID = 1L; + + /** + * Create a new DSplitPane. + * @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 + */ + public DSplitPane(final int newOrientation, final Component newLeftComponent, final Component newRightComponent) { + super(newOrientation, newLeftComponent, newRightComponent); + setOneTouchExpandable(true); + } + + /** {@inheritDoc} */ + // Overridden to store and restore the divider location upon UI change. + @Override public void updateUI() { + final int dividerLocationBackup = getDividerLocation(); + final int dividerSizeBackup = getDividerSize(); + super.updateUI(); + setDividerLocation(dividerLocationBackup); + setDividerSize(dividerSizeBackup); + } + +} // class DSplitPane Property changes on: trunk/crossfire/src/cfeditor/DSplitPane.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Modified: trunk/daimonin/src/daieditor/swing/DSplitPane.java =================================================================== --- trunk/daimonin/src/daieditor/swing/DSplitPane.java 2006-06-02 20:04:11 UTC (rev 107) +++ trunk/daimonin/src/daieditor/swing/DSplitPane.java 2006-06-02 20:24:44 UTC (rev 108) @@ -32,15 +32,16 @@ * Splitpane subclass that keeps its size even upon L'n'F change. * @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 DSplitPane extends JSplitPane { +public class DSplitPane extends JSplitPane { /** Serial Version UID. */ private static final long serialVersionUID = 1L; /** * Create a new DSplitPane. - * @param newOrientation JSplitPane.HORIZONTAL_SPLIT or 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 */ @@ -49,14 +50,14 @@ setOneTouchExpandable(true); } - // This method is currently unused because changing the look and feel while the applicatin is running is not possible any longer. - ///** {@inheritDoc} - // * Overridden to store and restore the divider location upon UI change. - // */ - //@Override public final void updateUI() { - // int dividerLocation = getDividerLocation(); - // super.updateUI(); - // setDividerLocation(dividerLocation); - //} + /** {@inheritDoc} */ + // Overridden to store and restore the divider location upon UI change. + @Override public void updateUI() { + final int dividerLocationBackup = getDividerLocation(); + final int dividerSizeBackup = getDividerSize(); + super.updateUI(); + setDividerLocation(dividerLocationBackup); + setDividerSize(dividerSizeBackup); + } } // class DSplitPane This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-06-02 20:04:53
|
Revision: 107 Author: christianhujer Date: 2006-06-02 13:04:11 -0700 (Fri, 02 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=107&view=rev Log Message: ----------- Code unification and code beautification. Deprecated CGridderException because it should be replaced by more meaningful exceptions. Removed a lot of unused code about CGridderException and other things. Modified Paths: -------------- trunk/crossfire/src/cfeditor/AutojoinList.java trunk/crossfire/src/cfeditor/BshThread.java trunk/crossfire/src/cfeditor/CArchPanel.java trunk/crossfire/src/cfeditor/CArchPanelPan.java trunk/crossfire/src/cfeditor/CArchQuickView.java 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/CFilterControl.java trunk/crossfire/src/cfeditor/CGUIUtils.java trunk/crossfire/src/cfeditor/CGridderException.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMainStatusbar.java trunk/crossfire/src/cfeditor/CMainToolbar.java trunk/crossfire/src/cfeditor/CMainView.java trunk/crossfire/src/cfeditor/CMapControl.java trunk/crossfire/src/cfeditor/CMapFileDecode.java trunk/crossfire/src/cfeditor/CMapModel.java trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java trunk/crossfire/src/cfeditor/CNewMapDialog.java trunk/crossfire/src/cfeditor/COptionDialog.java trunk/crossfire/src/cfeditor/CPickmapPanel.java trunk/crossfire/src/cfeditor/CUndoStack.java trunk/crossfire/src/cfeditor/CopyBuffer.java trunk/crossfire/src/cfeditor/IGUIConstants.java trunk/crossfire/src/cfeditor/IUndoable.java trunk/daimonin/src/daieditor/CFileReader.java trunk/daimonin/src/daieditor/CGUIUtils.java trunk/daimonin/src/daieditor/CGridderException.java Added Paths: ----------- trunk/crossfire/src/cfeditor/CSplitPane.java Modified: trunk/crossfire/src/cfeditor/AutojoinList.java =================================================================== --- trunk/crossfire/src/cfeditor/AutojoinList.java 2006-06-01 23:09:01 UTC (rev 106) +++ trunk/crossfire/src/cfeditor/AutojoinList.java 2006-06-02 20:04:11 UTC (rev 107) @@ -81,30 +81,30 @@ * @param archstack the stack of default arches * @return true if at least one autojoin list was successfully loaded */ - public boolean loadList(ArchObjectStack archstack) { + public boolean loadList(final ArchObjectStack archstack) { boolean success = false; // return value (true if >= 1 list loaded) try { String line; // line of file - boolean section_flag = false; // true while section (start ... end) read - int[] nbuf = new int[16]; // buffer for nodenumbers of 16 arches + boolean sectionFlag = false; // true while section (start ... end) read + final int[] nbuf = new int[16]; // buffer for nodenumbers of 16 arches int count = 0; // counter index AutojoinList jlist = this; // index of the linked list of AutojoinLists // (starting at 'this') // open the resource file - String baseDir = (IGUIConstants.isoView ? CMainControl.getInstance().getArchDefaultFolder() + File.separator + IGUIConstants.CONFIG_DIR : IGUIConstants.CONFIG_DIR); - CFileReader stream = new CFileReader(baseDir, filename); + final String baseDir = (IGUIConstants.isoView ? CMainControl.getInstance().getArchDefaultFolder() + File.separator + IGUIConstants.CONFIG_DIR : IGUIConstants.CONFIG_DIR); + final CFileReader stream = new CFileReader(baseDir, filename); // read the file while ((line = stream.getReader().readLine()) != null) { if (!line.startsWith("#") && line.length() > 0) { line = line.trim(); // remove whitespace at both ends - if (!section_flag) { + if (!sectionFlag) { // we are outside a section if (line.equals("start")) { - section_flag = true; + sectionFlag = true; count = 0; } } else { @@ -134,7 +134,7 @@ } else if (archstack.getArchCount() >= 1) { log.warn("In file " + filename + ": List with less than 16 valid entries!"); } - section_flag = false; + sectionFlag = false; } else if (count < 16) { // add a new archid to the buffer Object entry = null; // hashtable entry @@ -179,11 +179,8 @@ return false; } - if (success) { - return true; // we have loaded one or more lists - } + return success; - return false; // nothing got loaded } /** @@ -198,9 +195,8 @@ * @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 join_insert(CMapModel map, int x, int y) { - int new_index = 0; // return value, see above - ArchObject arch = null; // temp. arch + public int joinInsert(final CMapModel 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 if (findArchOfJoinlist(map, x, y) != null) { @@ -208,35 +204,36 @@ } // now do the joining in all four directions: + ArchObject arch = null; if (map.pointValid(x, y - 1)) { if ((arch = findArchOfJoinlist(map, x, y - 1)) != null) { - new_index = add_dir(new_index, NORTH); - connectArch(arch, nodenr[add_dir(get_index(arch.getNodeNr()), SOUTH)]); + newIndex = addDir(newIndex, NORTH); + connectArch(arch, nodenr[addDir(getIndex(arch.getNodeNr()), SOUTH)]); } } if (map.pointValid(x + 1, y)) { if ((arch = findArchOfJoinlist(map, x + 1, y)) != null) { - new_index = add_dir(new_index, EAST); - connectArch(arch, nodenr[add_dir(get_index(arch.getNodeNr()), WEST)]); + newIndex = addDir(newIndex, EAST); + connectArch(arch, nodenr[addDir(getIndex(arch.getNodeNr()), WEST)]); } } if (map.pointValid(x, y + 1)) { if ((arch = findArchOfJoinlist(map, x, y + 1)) != null) { - new_index = add_dir(new_index, SOUTH); - connectArch(arch, nodenr[add_dir(get_index(arch.getNodeNr()), NORTH)]); + newIndex = addDir(newIndex, SOUTH); + connectArch(arch, nodenr[addDir(getIndex(arch.getNodeNr()), NORTH)]); } } if (map.pointValid(x - 1, y)) { if ((arch = findArchOfJoinlist(map, x - 1, y)) != null) { - new_index = add_dir(new_index, WEST); - connectArch(arch, nodenr[add_dir(get_index(arch.getNodeNr()), EAST)]); + newIndex = addDir(newIndex, WEST); + connectArch(arch, nodenr[addDir(getIndex(arch.getNodeNr()), EAST)]); } } - return nodenr[new_index]; + return nodenr[newIndex]; } /** @@ -248,31 +245,31 @@ * @param y Location of the insert point on the map * @param map Data model of the map */ - public void join_delete(CMapModel map, int x, int y) { - ArchObject arch = null; // temp. arch + public void joinDelete(final CMapModel map, final int x, final int y) { + ArchObject arch; // temp. arch // do the joining in all four directions: if (map.pointValid(x, y - 1)) { if ((arch = findArchOfJoinlist(map, x, y - 1)) != null) { - connectArch(arch, nodenr[remove_dir(get_index(arch.getNodeNr()), SOUTH)]); + connectArch(arch, nodenr[removeDir(getIndex(arch.getNodeNr()), SOUTH)]); } } if (map.pointValid(x + 1, y)) { if ((arch = findArchOfJoinlist(map, x + 1, y)) != null) { - connectArch(arch, nodenr[remove_dir(get_index(arch.getNodeNr()), WEST)]); + connectArch(arch, nodenr[removeDir(getIndex(arch.getNodeNr()), WEST)]); } } if (map.pointValid(x, y + 1)) { if ((arch = findArchOfJoinlist(map, x, y + 1)) != null) { - connectArch(arch, nodenr[remove_dir(get_index(arch.getNodeNr()), NORTH)]); + connectArch(arch, nodenr[removeDir(getIndex(arch.getNodeNr()), NORTH)]); } } if (map.pointValid(x - 1, y)) { if ((arch = findArchOfJoinlist(map, x - 1, y)) != null) { - connectArch(arch, nodenr[remove_dir(get_index(arch.getNodeNr()), EAST)]); + connectArch(arch, nodenr[removeDir(getIndex(arch.getNodeNr()), EAST)]); } } } @@ -282,7 +279,7 @@ * @param node node to lookup * @return index of the node in the array. */ - private int get_index(int node) { + private int getIndex(final int node) { int i; for (i = 0; i < 16 && node != nodenr[i]; i++) { @@ -298,17 +295,17 @@ } /** Checks if the index (=bitmask) contains the following direction */ - private boolean has_dir(int index, int direction) { + private boolean hasDir(final int index, final int direction) { return (index & direction) != 0; } /** add direction to the index */ - private int add_dir(int index, int direction) { + private int addDir(final int index, final int direction) { return index | direction; } /** remove direction from the index */ - private int remove_dir(int index, int direction) { + private int removeDir(final int index, final int direction) { return index & ~direction; } @@ -320,12 +317,12 @@ * @param y location to search * @return arch which is part of this joinlist, null if no such arch exists */ - @Nullable private ArchObject findArchOfJoinlist(CMapModel map, int x, int y) { - ArchObject tmp_arch = map.getTopArchObject(x, y); + @Nullable private ArchObject findArchOfJoinlist(final CMapModel 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 (; tmp_arch != null; tmp_arch = tmp_arch.getPrevArch()) { - if (stack.getArch(tmp_arch.getNodeNr()).getJoinList() == this) { - return tmp_arch; // we found an arch + for (; tmpArch != null; tmpArch = tmpArch.getPrevArch()) { + if (stack.getArch(tmpArch.getNodeNr()).getJoinList() == this) { + return tmpArch; // we found an arch } } @@ -336,12 +333,12 @@ * Add/remove a certain connection of the given arch * by changing archtype and face. */ - private void connectArch(ArchObject arch, int new_nodenr) { - ArchObject defarch = stack.getArch(new_nodenr); // new default arch + private void connectArch(final ArchObject arch, final int newNodenr) { + final ArchObject defarch = stack.getArch(newNodenr); // new default arch - if (arch.getNodeNr() != new_nodenr) { + if (arch.getNodeNr() != newNodenr) { // set new archtype - arch.setNodeNr(new_nodenr); + arch.setNodeNr(newNodenr); arch.setArchName(defarch.getArchName()); // set face of new default arch @@ -352,4 +349,5 @@ } } } -} + +} // class AutojoinList Modified: trunk/crossfire/src/cfeditor/BshThread.java =================================================================== --- trunk/crossfire/src/cfeditor/BshThread.java 2006-06-01 23:09:01 UTC (rev 106) +++ trunk/crossfire/src/cfeditor/BshThread.java 2006-06-02 20:04:11 UTC (rev 107) @@ -26,11 +26,10 @@ * */ public BshThread() { - super(); } /** @param name */ - public BshThread(String name) { + public BshThread(final String name) { super(name); } @@ -38,15 +37,15 @@ * @param group * @param name */ - public BshThread(ThreadGroup group, String name) { + public BshThread(final ThreadGroup group, final String name) { super(group, name); } - public void setInterpreter(Interpreter interpreter) { + public void setInterpreter(final Interpreter interpreter) { this.interpreter = interpreter; } - public void setScript(CScriptModel script) { + public void setScript(final CScriptModel script) { this.script = script; } Modified: trunk/crossfire/src/cfeditor/CArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanel.java 2006-06-01 23:09:01 UTC (rev 106) +++ trunk/crossfire/src/cfeditor/CArchPanel.java 2006-06-02 20:04:11 UTC (rev 107) @@ -33,6 +33,7 @@ import javax.swing.JPanel; import javax.swing.JSplitPane; import javax.swing.JTabbedPane; +import javax.swing.SwingConstants; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import org.jetbrains.annotations.Nullable; @@ -82,32 +83,29 @@ */ public CArchPanel(final CMainControl mainControl) { this.mainControl = mainControl; - panelNodeStart = null; - panelNodeLast = null; - selectedPanel = null; - CSettings settings = CSettings.getInstance(IGUIConstants.APP_NAME); + final CSettings settings = CSettings.getInstance(IGUIConstants.APP_NAME); selectedArch = -1; setLayout(new BorderLayout()); - tabDesktop = new JTabbedPane(JTabbedPane.TOP); + tabDesktop = new JTabbedPane(SwingConstants.TOP); tabDesktop.setBorder(BorderFactory.createEmptyBorder(IGUIConstants.SPACE_PICKARCH_TOP, 0, 0, 0)); mainControl.setBoldFont(tabDesktop); archQuickPanel = new CArchQuickView(mainControl); // archAndPickPane is the panel containing both archpanel and pickmaps - archAndPickPane = new JTabbedPane(JTabbedPane.TOP); + archAndPickPane = new JTabbedPane(SwingConstants.TOP); mainControl.setBoldFont(archAndPickPane); archAndPickPane.addTab(" Arch List ", tabDesktop); archAndPickPane.addTab(" Pickmaps ", mainControl.getMainView().getPickmapPanel()); // this listener informs the mainview which panel is active: archlist or pickmaps? CPickmapPanel.getInstance().addArchNPickChangeListener(archAndPickPane); - splitPane = new CSplitPane(CSplitPane.VERTICAL_SPLIT, archAndPickPane, archQuickPanel); + splitPane = new CSplitPane(JSplitPane.VERTICAL_SPLIT, archAndPickPane, archQuickPanel); // 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(ARCHPANEL_LOCATION_KEY, "" + (int) (0.77 * 0.9 * screen.getHeight()))); + final int divLocation = Integer.parseInt(settings.getProperty(ARCHPANEL_LOCATION_KEY, String.valueOf((int) (0.77 * 0.9 * screen.getHeight())))); splitPane.setDividerLocation(divLocation); splitPane.setDividerSize(5); @@ -194,7 +192,7 @@ for (i = 0; i < tabDesktop.getTabCount() && name.compareToIgnoreCase(tabDesktop.getTitleAt(i)) < 0; i++) { ; } - this.tabDesktop.insertTab(name, null, newnode.data.getPanel(), null, i); + tabDesktop.insertTab(name, null, newnode.data.getPanel(), null, i); // careful: during the build proccess we are setting 'selectedPanel' // in spite of the fact that this panel might *not* actually be selected @@ -221,7 +219,7 @@ void appExitNotify() { final CSettings settings = CSettings.getInstance(IGUIConstants.APP_NAME); - settings.setProperty(ARCHPANEL_LOCATION_KEY, "" + splitPane.getDividerLocation()); + settings.setProperty(ARCHPANEL_LOCATION_KEY, String.valueOf(splitPane.getDividerLocation())); } public int getPanelArch() { @@ -253,7 +251,7 @@ public PanelNode(final CArchPanelPan data, final String title) { this.data = data; this.title = title; - this.next = null; + next = null; } public String getTitle() { @@ -262,28 +260,4 @@ } // class PanelNode - /** Splitpane class that keeps its size even upon L'n'F change. */ - public class CSplitPane extends JSplitPane { - - /** Serial Version UID. */ - private static final long serialVersionUID = 1L; - - public CSplitPane(final int newOrientation, final Component newLeftComponent, final Component newRightComponent) { - super(newOrientation, newLeftComponent, newRightComponent); - } - - /** - * Overridden to store and restore the divider location upon - * UI change. - */ - @Override public void updateUI() { - int dividerLocation = getDividerLocation(); - int dividerSize = getDividerSize(); - super.updateUI(); - setDividerLocation(dividerLocation); - setDividerSize(dividerSize); - } - - } // class CSplitPane - } // class CArchPanel Modified: trunk/crossfire/src/cfeditor/CArchPanelPan.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-06-01 23:09:01 UTC (rev 106) +++ trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-06-02 20:04:11 UTC (rev 107) @@ -44,7 +44,7 @@ public class CArchPanelPan extends JPanel { - private static final Logger log = Logger.getLogger(CArchPanel.class); + private static final Logger LOG = Logger.getLogger(CArchPanel.class); /** Serial Version UID. */ private static final long serialVersionUID = 1L; @@ -140,7 +140,7 @@ arch = mainControl.getArchObjectStack().getArch(index); } catch (final NullPointerException e) { /* - log.info("NullPointerException in showArchListObject()!", e); + LOG.info("NullPointerException in showArchListObject()!", e); This happens in JDK 1.4 when you select an arch in panel A, then select Panel B, then Panel A again. (why??) */ @@ -153,27 +153,27 @@ /** * Add this arch to list of (this) Jlist list. - * @param archname name of the arch to add - * @param index index of subdir where to add + * @param archnr nr of the arch to add + * @param index index of subdir where to add */ public void addArchPanelArch(final int archnr, final int index) { final String def = "00000"; String num = Integer.toString(archnr); - this.list.append(def.substring(0, 5 - num.length())); - this.list.append(num); + list.append(def.substring(0, 5 - num.length())); + list.append(num); num = Integer.toString(index); - this.list.append(def.substring(0, 5 - num.length())); - this.list.append(num); + list.append(def.substring(0, 5 - num.length())); + list.append(num); - this.listcounter++; + listcounter++; } int addArchPanelCombo(final String name) { - this.setEnabled(false); - this.jbox.addItem(name); - this.setEnabled(true); + setEnabled(false); + jbox.addItem(name); + setEnabled(true); return comboCounter++; } @@ -195,11 +195,11 @@ * @return an array of nodenumbers from all arches in this panel */ public int[] getListNodeNrArray() { - final int[] numList = new int[(int) (list.length() / 10.)]; + final int[] numList = new int[(int) (list.length() / 10.0)]; - for (int i = 0; i < (int) (list.length() / 10.); i++) { - numList[i] = Integer.parseInt(list.substring(0 + 10 * i, 5 + 10 * i)); - //log.debug(CMainControl.getInstance().getArchObjectStack().getArch(numList[i]).getArchName()); + for (int i = 0; i < (int) (list.length() / 10.0); i++) { + numList[i] = Integer.parseInt(list.substring(10 * i, 5 + 10 * i)); + //LOG.debug(CMainControl.getInstance().getArchObjectStack().getArch(numList[i]).getArchName()); } return numList; @@ -212,14 +212,14 @@ * note that the same indices are used for same arches in 'getListNodeNrArray()' */ public String[] getListCathegoryArray() { - final String[] cathList = new String[(int) (list.length() / 10.)]; + final String[] cathList = new String[(int) (list.length() / 10.0)]; - for (int i = 0; i < (int) (list.length() / 10.); i++) { + for (int i = 0; i < (int) (list.length() / 10.0); i++) { try { final int index = Integer.parseInt(list.substring(5 + 10 * i, 10 + 10 * i)); cathList[i] = jbox.getItemAt(index).toString().trim(); } catch (NullPointerException e) { - log.warn("Nullpointer in getListCathegoryArray()!", e); + LOG.warn("Nullpointer in getListCathegoryArray()!", e); } } @@ -231,19 +231,19 @@ } void showArchList() { - int offset = 0; - final int index = this.jbox.getSelectedIndex(); + final int index = jbox.getSelectedIndex(); - this.model.removeAllElements(); + model.removeAllElements(); - for (int i = 0; i < this.listcounter; i++) { + int offset = 0; + for (int i = 0; i < listcounter; i++) { if (index >= 0) { if (index == 0) { // this.model.addElement(this.list.substring(offset, offset+5)+" I:"+this.list.substring(offset+5, offset+10)); - this.model.addElement(this.list.substring(offset, offset + 5)); + model.addElement(list.substring(offset, offset + 5)); } else { - if (index == Integer.parseInt(this.list.substring(offset + 5, offset + 10))) { - this.model.addElement(this.list.substring(offset, offset + 5)); + if (index == Integer.parseInt(list.substring(offset + 5, offset + 10))) { + model.addElement(list.substring(offset, offset + 5)); } } } @@ -251,30 +251,28 @@ } } - class MyCellRenderer extends DefaultListCellRenderer { + private class MyCellRenderer extends DefaultListCellRenderer { /** Serial Version UID. */ private static final long serialVersionUID = 1L; - /* This is the only method defined by ListCellRenderer. We just - * reconfigure the Jlabel each time we're called. - */ + /* {@inheritDoc} */ @Override public Component getListCellRendererComponent(final JList list, final Object value, // value to display final int index, // cell index - final boolean iss, // is the cell selected - final boolean chf) { // the list and the cell have the focus + final boolean isSelected, // is the cell selected + final boolean cellHasFocus) { // the list and the cell have the focus /* The DefaultListCellRenderer class will take care of * the JLabels text property, it's foreground and background *colors, and so on. */ - super.getListCellRendererComponent(list, value, index, iss, chf); + super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); /* We additionally set the JLabels icon property here. */ final ArchObject arch = mainControl.getArchObjectStack().getArch(Integer.parseInt(value.toString())); - if (iss) { + if (isSelected) { archPanel.setPanelArch(Integer.parseInt(value.toString())); mainControl.setStatusText(" " + value.toString() + " "); } Modified: trunk/crossfire/src/cfeditor/CArchQuickView.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchQuickView.java 2006-06-01 23:09:01 UTC (rev 106) +++ trunk/crossfire/src/cfeditor/CArchQuickView.java 2006-06-02 20:04:11 UTC (rev 107) @@ -33,6 +33,7 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; +import javax.swing.ScrollPaneConstants; /** * The <code>CArchQuickView</code> holds the tile palette. @@ -104,8 +105,8 @@ // put it in a scroller final JScrollPane scrollPane = new JScrollPane(panel); - scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); - scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); + scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); setMinimumSize(new Dimension(1, 1)); add(scrollPane); // and add it to this panel object } Modified: trunk/crossfire/src/cfeditor/CAttribBitmask.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribBitmask.java 2006-06-01 23:09:01 UTC (rev 106) +++ trunk/crossfire/src/cfeditor/CAttribBitmask.java 2006-06-02 20:04:11 UTC (rev 107) @@ -37,6 +37,7 @@ import javax.swing.JDialog; import javax.swing.JPanel; import javax.swing.JTextArea; +import javax.swing.WindowConstants; import org.apache.log4j.Logger; import org.jdom.Attribute; import org.jdom.DataConversionException; @@ -50,7 +51,7 @@ */ public final class CAttribBitmask { - private static final Logger log = Logger.getLogger(CAttribBitmask.class); + private static final Logger LOG = Logger.getLogger(CAttribBitmask.class); /** * Maximum number of characters in a line before linebreak (see {@link @@ -77,14 +78,10 @@ bitName[0] = "<none>"; //bitValue[0] = 0; - for (int i = 0; i < name.length; i++) { - // fill array and assign 2^i values - bitName[i + 1] = name[i]; - //bitValue[i+1] = (int)(Math.pow(2., (double)(i-1))); - } + System.arraycopy(name, 0, bitName, 1, name.length); number = bitName.length - 1; - maxvalue = ((int) Math.pow(2., (double) (bitName.length + 1))) - 1; + maxvalue = ((int) Math.pow(2.0, (double) (bitName.length + 1))) - 1; } /** @@ -92,28 +89,27 @@ * @param root xml bitmask element */ public CAttribBitmask(final Element root) { - int i; List entries = root.getChildren("entry"); if (entries != null && entries.size() > 0) { Element elem; - Attribute a; // find highest bit number int maxBit = 0; - for (i = 0; entries != null && i < entries.size(); i++) { + for (int i = 0; entries != null && i < entries.size(); i++) { elem = (Element) entries.get(i); + Attribute a; if ((a = elem.getAttribute("bit")) == null || elem.getAttribute("name") == null) { - log.warn("Parse error: Found bitmask entry without 'bit' or 'name'."); + LOG.warn("Parse error: Found bitmask entry without 'bit' or 'name'."); elem.detach(); // remove element from DOM tree } else { try { - int bit = a.getIntValue(); + final int bit = a.getIntValue(); if (bit > maxBit) { maxBit = bit; // this is the highest bit so far } } catch (final DataConversionException e) { - log.warn("Parse error: Bitmask bit '" + a.getValue() + "' (" + elem.getAttribute("name").getValue() + ") is not an integer."); + LOG.warn("Parse error: Bitmask bit '" + a.getValue() + "' (" + elem.getAttribute("name").getValue() + ") is not an integer."); elem.detach(); // remove element from DOM tree } } @@ -124,11 +120,11 @@ bitName = new String[maxBit + 2]; // initialize names array - the zero-bit always stays <none> - for (i = 0; i < maxBit + 2; i++) { + for (int i = 0; i < maxBit + 2; i++) { bitName[i] = "<none>"; } - for (i = 0; entries != null && i < entries.size(); i++) { + for (int i = 0; entries != null && i < entries.size(); i++) { elem = (Element) entries.get(i); // fill array and assign 2^i values try { @@ -137,19 +133,19 @@ } } - if (log.isDebugEnabled()) { + if (LOG.isDebugEnabled()) { String s = "bitmask '" + root.getAttribute("name") + "':"; - for (i = 0; i < bitName.length; i++) { + for (int i = 0; i < bitName.length; i++) { s = s + " " + i + " = " + bitName[i]; } - log.debug(s); + LOG.debug(s); } number = bitName.length - 1; maxvalue = ((int) Math.pow(2., (double) (bitName.length + 1))) - 1; } else { // Error: this is an "empty" bitmask - log.warn("Error in \"" + IGUIConstants.TYPEDEF_FILE + "\": Found a bitmask without content!"); + LOG.warn("Error in \"" + IGUIConstants.TYPEDEF_FILE + "\": Found a bitmask without content!"); bitName = new String[1]; bitName[0] = "<none>"; number = 0; @@ -189,7 +185,7 @@ } else { // value too big? if (value > maxvalue) { - log.warn("bitmask value " + value + " is too big."); + LOG.warn("bitmask value " + value + " is too big."); } boolean linebreak = false; @@ -241,7 +237,7 @@ 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); - frame.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); + frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); // panels final JPanel mainPanel = new JPanel(); @@ -294,15 +290,15 @@ */ private class PopupFrameAL implements ActionListener { - final CAttribBitmask bitmask; // reference to this CAttribBitmask instance + private final CAttribBitmask bitmask; // reference to this CAttribBitmask instance - JDialog frame; // reference to the popup dialog frame + private JDialog frame; // reference to the popup dialog frame - final CAttribDialog.BitmaskAttrib guiAttr; // gui attribute instance + private final CAttribDialog.BitmaskAttrib guiAttr; // gui attribute instance - final JCheckBox[] checkbox; // array of checkboxes on the frame + private final JCheckBox[] checkbox; // array of checkboxes on the frame - final CAttribDialog attrDialog; // instance of attribute dialog (parent frame) + private final CAttribDialog attrDialog; // instance of attribute dialog (parent frame) /** * Contructor @@ -312,7 +308,7 @@ * @param boxarray array of checkboxes in the popup frame * @param newAttrD attribute dialog frame */ - public PopupFrameAL(final JDialog newFrame, final CAttribDialog.BitmaskAttrib newGuiAttr, + private PopupFrameAL(final JDialog newFrame, final CAttribDialog.BitmaskAttrib newGuiAttr, final CAttribBitmask newMask, final JCheckBox[] boxarray, final CAttribDialog newAttrD) { frame = newFrame; guiAttr = newGuiAttr; @@ -333,7 +329,7 @@ int newValue = 0; for (int i = 0; i < bitmask.number; i++) { if (checkbox[i].isSelected()) { - newValue |= (int) (Math.pow(2., (double) i)); + newValue |= (int) (Math.pow(2.0, (double) i)); } } Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-06-01 23:09:01 UTC (rev 106) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-06-02 20:04:11 UTC (rev 107) @@ -59,6 +59,8 @@ import javax.swing.JTextField; import javax.swing.JTextPane; import javax.swing.JViewport; +import javax.swing.ScrollPaneConstants; +import javax.swing.WindowConstants; import javax.swing.text.BadLocationException; import javax.swing.text.Document; import javax.swing.text.Style; @@ -123,8 +125,6 @@ private CFArchType type; // reference to the type data - private int typeNr; // the type nr. to be applied to the object - // this differs from the ArchObject if the type is undefined private int listNr; // the position of this type in the type list @@ -168,7 +168,6 @@ } }); - boolean typeValid = false; // true if the type is valid attrHead = null; listNr = 0; @@ -239,9 +238,7 @@ // we found our type, now save all infos we need if (typeFound) { - typeValid = true; // this is an existing type type = tmp; // save reference to the type-data - typeNr = arch.getArchTypNr(); // CF type number listNr = i; // save position in list } } @@ -250,8 +247,6 @@ // get the type data //type = typelist.getType(typeNr); - final JPanel layout = new JPanel(new BorderLayout()); // face, name & type - // first split top-left and -right final JScrollPane paneLeft = buildHeader(); final JScrollPane paneRight = buildInv(); @@ -1068,8 +1063,8 @@ final JScrollPane scrollPane = new JScrollPane(totalBar); scrollPane.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); - scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); - scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); + scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); + scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); //scrollPane.setSize(width, buttonBarHeight); scrollPane.setMinimumSize(scrollPane.getPreferredSize()); @@ -1176,7 +1171,7 @@ summaryTP.setCaretPosition(0); // this prevents the document from scrolling down paneCenter.setViewportView(summaryTP); - paneCenter.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + paneCenter.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); summaryButton.setText("Input"); paneCenter.validate(); update(getGraphics()); @@ -1184,7 +1179,7 @@ } else { // summary is displayed, switch to interface paneCenter.setViewportView(tabbedPane); - paneCenter.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); + paneCenter.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); summaryButton.setText("Summary"); paneCenter.validate(); update(getGraphics()); @@ -1200,18 +1195,16 @@ */ private boolean applySettings() { final String oldArchText = arch.getArchText(); // the old ArchText - String newArchText = ""; // the new ArchText for the ArchObject - String newName = null; // new object name - String newFace = null; // new face name final String oldMsg = arch.getMsgText(); // old arch msg - String newMsg = null; // new arch msg - String errors = null; // syntax errors in the archtext - int dType; final CFArchType typeStruct = typelist.getTypeOfArch(arch); // the type structure for this arch try { + String newArchText = ""; + String newName = null; + String newFace = null; + String newMsg = null; for (DialogAttrib attr = attrHead; attr != null; attr = attr.next) { - dType = attr.ref.getDataType(); // attribute's data type + int dType = attr.ref.getDataType(); if (dType == CFArchAttrib.T_BOOL) { // a boolean attribute (flag) @@ -1254,11 +1247,10 @@ newArchText = newArchText + attr.ref.getNameOld() + " " + value + "\n"; } } else { - final double value; // value from the input form - double defValue = 0; // value from the default arch // try to parse floating point - value = Double.parseDouble(((FloatAttrib) attr).input.getText().trim()); - String defValueStr = defarch.getAttributeString(attr.ref.getNameOld(), null).trim(); + final double value = Double.parseDouble(((FloatAttrib) attr).input.getText().trim()); + final String defValueStr = defarch.getAttributeString(attr.ref.getNameOld(), null).trim(); + double defValue = 0; if (defValueStr.length() > 0) { defValue = Double.parseDouble(defValueStr); } @@ -1322,7 +1314,7 @@ // get selected index of ComboBox final int attrValTmp = ((ListAttrib) attr).input.getSelectedIndex(); // fetch value according to this list entry: - attrVal = ((Integer) ((Vector) (typelist.getListTable().get(attr.ref.getMisc()[0]))).elementAt(2 * attrValTmp)).intValue(); + attrVal = (Integer) ((Vector) (typelist.getListTable().get(attr.ref.getMisc()[0]))).elementAt(2 * attrValTmp); } if (attrVal == -1 || (attrVal == 0 && dType != CFArchAttrib.T_SPELL @@ -1347,7 +1339,7 @@ final String inline = ((StringAttrib) attr).input.getText().trim(); // input string if (inline != null) { - final boolean isNone = (inline.equals(CFTreasureListTree.NONE_SYM) || inline.length() == 0); + final boolean isNone = inline.equals(CFTreasureListTree.NONE_SYM) || inline.length() == 0; if (!isNone && !CFTreasureListTree.getInstance().containsTreasureList(inline) && !inline.equalsIgnoreCase(defarch.getAttributeString(attr.ref.getNameOld(), null))) { @@ -1390,6 +1382,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 + String errors = null; errors = arch.getSyntaxErrors(typeStruct); // --- parsing succeeded, now we write it into the arch/map --- @@ -1422,7 +1415,7 @@ // we have a non-default face final Integer index = (Integer) mainControl.getArchObjectStack().getFaceHashTable().get(arch.getFaceName()); if (index != null) { - arch.setFaceNr(index.intValue()); + arch.setFaceNr(index); } else { arch.setFaceNr(-1); } @@ -1430,7 +1423,7 @@ // we have the default face final Integer index = (Integer) mainControl.getArchObjectStack().getFaceHashTable().get(defarch.getFaceName()); if (index != null) { - arch.setFaceNr(index.intValue()); + arch.setFaceNr(index); } else { arch.setFaceNr(-1); } @@ -1499,7 +1492,7 @@ */ private void askConfirmErrors(final String errors) { final JDialog frame = new JDialog(this, "Syntax Errors", true); // dialog freezes parents - frame.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); // closing is handled by listener + frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); // closing is handled by listener final JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); @@ -1519,8 +1512,8 @@ textarea.setBorder(BorderFactory.createEmptyBorder(1, 4, 0, 0)); final JScrollPane scrollPane = new JScrollPane(textarea); scrollPane.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); - scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); - scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); + scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); // create buttons final JButton dumpButton = new JButton("Dump All Errors"); @@ -1559,12 +1552,7 @@ attrHead = null; attrTail = null; - this.dispose(); - try { - this.finalize(); - } catch (final Throwable e) { - } - //System.gc(); + dispose(); } // ============================ Subclasses ============================ @@ -1876,7 +1864,6 @@ // change the arch to be of the new type: arch.setArchTypNr(newType.getTypeNr()); - frame.typeNr = newType.getTypeNr(); attrHead = null; // clear list of attributes listNr = frame.typesel.getSelectedIndex(); Modified: trunk/crossfire/src/cfeditor/CFArchAttrib.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchAttrib.java 2006-06-01 23:09:01 UTC (rev 106) +++ trunk/crossfire/src/cfeditor/CFArchAttrib.java 2006-06-02 20:04:11 UTC (rev 107) @@ -106,7 +106,6 @@ public CFArchAttrib() { nameOld = ""; nameNew = ""; - final String text = null; endingOld = null; misc = null; inputLength = 0; // use default length @@ -120,14 +119,12 @@ * @return true if the parsing was successful */ public boolean load(final Element root, final CFArchTypeList tlist, final String typeName) { - String atype = null; // name of the attribute type - Attribute a1; - Attribute a2; // parse the info text from the element's "body" parseText(root); // arch syntax key + Attribute a1; if ((a1 = root.getAttribute(XML_KEY_ARCH)) != null) { nameOld = a1.getValue().trim(); } @@ -138,6 +135,7 @@ } // type name + String atype = null; if ((a1 = root.getAttribute(XML_ATTR_TYPE)) != null) { atype = a1.getValue().trim(); } else { @@ -164,7 +162,7 @@ // parse true and false values: a1 = root.getAttribute("true"); - a2 = root.getAttribute("false"); + final Attribute a2 = root.getAttribute("false"); if (a1 == null || a2 == null) { log.error("In '" + IGUIConstants.TYPEDEF_FILE + "': Type " + typeName + " has bool_special attribute missing 'true' or 'false' value."); return false; @@ -195,7 +193,7 @@ log.warn("In '" + IGUIConstants.TYPEDEF_FILE + "': Type " + typeName + " has text attribute missing '" + XML_KEY_ARCH_BEGIN + "' or '" + XML_KEY_ARCH_END + "'."); return false; } - } else if (atype.equalsIgnoreCase("fixed")) { + } else if ("fixed".equalsIgnoreCase(atype)) { // fixed attribute dataType = T_FIXED; if ((a1 = root.getAttribute("value")) != null) { @@ -204,14 +202,14 @@ log.warn("In '" + IGUIConstants.TYPEDEF_FILE + "': Type " + typeName + " has fixed attribute missing 'value'."); return false; } - } else if (atype.equalsIgnoreCase("spell")) { + } else if ("spell".equalsIgnoreCase(atype)) { // spell attribute if (tlist.getSpellNum() == null) { dataType = T_INT; // if we have no spells, use an INT field instead } else { dataType = T_SPELL; } - } else if (atype.equalsIgnoreCase("nz_spell")) { + } else if ("nz_spell".equalsIgnoreCase(atype)) { // spell attribute if (tlist.getSpellNum() == null) { dataType = T_INT; // if we have no spells, use an INT field instead @@ -220,7 +218,7 @@ } } else if (atype.startsWith("bitmask")) { // got a bitmask attribute - String bitmaskName = atype.substring(8).trim(); + final String bitmaskName = atype.substring(8).trim(); if (tlist.getBitmaskTable().containsKey(bitmaskName)) { // the bitmask is well defined @@ -232,7 +230,7 @@ } } else if (atype.startsWith("list")) { // got a bitmask attribute - String listName = atype.substring(5).trim(); + final String listName = atype.substring(5).trim(); if (tlist.getListTable().containsKey(listName)) { // the list is well defined @@ -242,7 +240,7 @@ } else { log.warn("In '" + IGUIConstants.TYPEDEF_FILE + "', type " + typeName + ": List \"" + listName + "\" is undefined."); } - } else if (atype.equalsIgnoreCase("treasurelist")) { + } else if ("treasurelist".equalsIgnoreCase(atype)) { dataType = T_TREASURE; } else { // unknown type @@ -276,7 +274,7 @@ boolean isFirst = true; while ((line = bfread.readLine()) != null) { // delete extra spaces for every line seperately - buff.append((isFirst ? "" : "\n") + line.trim()); + buff.append(isFirst ? "" : "\n").append(line.trim()); isFirst = false; } text = buff.toString(); @@ -312,7 +310,7 @@ * @return clone instance of this <code>CFArchAttrib</code> */ public CFArchAttrib getClone() { - CFArchAttrib newattr = new CFArchAttrib(); + final CFArchAttrib newattr = new CFArchAttrib(); newattr.next = next; @@ -381,11 +379,4 @@ next = cfAttr; } - private void readTill(final BufferedReader stream, final String tag) throws IOException { - CFileReader.readTill(stream, tag, null); - } - - private String readsTill(final BufferedReader stream, final String tag) throws IOException { - return CFileReader.readsTill(stream, tag); - } -} +} // class CFArchAttrib Modified: trunk/crossfire/src/cfeditor/CFArchType.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchType.java 2006-06-01 23:09:01 UTC (rev 106) +++ trunk/crossfire/src/cfeditor/CFArchType.java 2006-06-02 20:04:11 UTC (rev 107) @@ -29,6 +29,7 @@ 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; @@ -41,7 +42,7 @@ */ public class CFArchType { - private static final Logger log = Logger.getLogger(CFArchType.class); + private static final Logger LOG = Logger.getLogger(CFArchType.class); // XML tag names public static final String XML_TYPE = "type"; @@ -77,8 +78,6 @@ private CFArchType next; // next CFArchType in the list - private CFArchType[] see = null; // links to similar types - private String desc; // descrption of this type private String use; // notes on usage of this type @@ -91,7 +90,7 @@ * Konstructor * @param defaultArchType the head element of the list */ - public CFArchType(CFArchType defaultArchType) { + public CFArchType(final CFArchType defaultArchType) { next = null; desc = null; use = null; @@ -111,21 +110,17 @@ * @param tlist archtype list * @return true if the object was parsed correctly and can be used */ - public boolean load(Element root, CFArchTypeList tlist) { + public boolean load(final Element root, final CFArchTypeList tlist) { // this vector is used to store a temporare linked list of attributes - Vector attrList = new Vector(); + final Vector attrList = new Vector(); // for internal section handling: - Vector secNames = new Vector(); // list of section names - boolean inSection = false; // true while section active - String section = "?"; // name of the current section - Hashtable ignoreTable = new Hashtable(); // ignore list + final Vector secNames = new Vector(); // list of section names + final Hashtable ignoreTable = new Hashtable(); // ignore list - String importName = null; // name of type to import from (or null) List children; // list of children elements Element elem; // xml element Attribute a1; - Attribute a2; int i; // index if (root.getName().equalsIgnoreCase("default_type")) { @@ -133,7 +128,7 @@ typenr = -1; typeName = "default"; - log.debug("type: default"); + LOG.debug("type: default"); } else { try { // parse the type name @@ -142,43 +137,40 @@ // parse the type number typenr = Integer.parseInt(root.getAttribute("number").getValue().trim()); - if (log.isDebugEnabled()) { - log.debug("reading type: " + typeName + ", " + typenr); + if (LOG.isDebugEnabled()) { + LOG.debug("reading type: " + typeName + ", " + typenr); } // parse 'required' attributes - Element required = root.getChild(XML_REQUIRED); + final Element required = root.getChild(XML_REQUIRED); if (required != null) { children = required.getChildren(XML_ATTRIBUTE); - Vector tmp = new Vector(); + final List<String> tmp = new ArrayList<String>(); for (i = 0; children != null && i < children.size(); i++) { elem = (Element) children.get(i); a1 = elem.getAttribute(CFArchAttrib.XML_KEY_ARCH); - a2 = elem.getAttribute(XML_VALUE); + final Attribute a2 = elem.getAttribute(XML_VALUE); if (a1 == null || a2 == null) { - log.error("In '" + XML_REQUIRED + "' element of type " + typeName + ": " + XML_ATTRIBUTE + " missing '" + CFArchAttrib.XML_KEY_ARCH + "' or '" + XML_VALUE + "'."); + LOG.error("In '" + XML_REQUIRED + "' element of type " + typeName + ": " + XML_ATTRIBUTE + " missing '" + CFArchAttrib.XML_KEY_ARCH + "' or '" + XML_VALUE + "'."); } else { - tmp.addElement(a1.getValue().trim()); - tmp.addElement(a2.getValue().trim()); + tmp.add(a1.getValue().trim()); + tmp.add(a2.getValue().trim()); } } // create array and copy vector content into the array: (key1, value1, key2, value2, ...) if (!tmp.isEmpty()) { - typeAttributes = new String[tmp.size()]; // initialize Strings - for (i = 0; i < tmp.size(); i++) { - typeAttributes[i] = (String) tmp.elementAt(i); - } + typeAttributes = tmp.toArray(new String[tmp.size()]); } } } catch (NumberFormatException e) { // parsing type number failed: - log.error("In " + IGUIConstants.TYPEDEF_FILE + ": Type " + typeName + " has invalid type number '" + root.getAttribute("number").getValue() + "'."); + LOG.error("In " + IGUIConstants.TYPEDEF_FILE + ": Type " + typeName + " has invalid type number '" + root.getAttribute("number").getValue() + "'."); return false; } // parse 'ignore' elements - Element signore = root.getChild(XML_IGNORE); + final Element signore = root.getChild(XML_IGNORE); if (signore != null) { // load all attributes in the ignore section children = signore.getChildren(XML_ATTRIBUTE); @@ -186,7 +178,7 @@ elem = (Element) children.get(i); a1 = elem.getAttribute(CFArchAttrib.XML_KEY_ARCH); if (a1 == null) { - log.error("In '" + XML_IGNORE + "' section of type " + typeName + ": " + XML_ATTRIBUTE + " missing '" + CFArchAttrib.XML_KEY_ARCH + "'."); + LOG.error("In '" + XML_IGNORE + "' section of type " + typeName + ": " + XML_ATTRIBUTE + " missing '" + CFArchAttrib.XML_KEY_ARCH + "'."); } else { ignoreTable.put(a1.getValue().trim(), ""); } @@ -198,15 +190,15 @@ elem = (Element) children.get(i); a1 = elem.getAttribute("name"); if (a1 == null) { - log.error("In '" + XML_IGNORE + "' section of type " + typeName + ": ignore_list missing 'name'."); + LOG.error("In '" + XML_IGNORE + "' section of type " + typeName + ": ignore_list missing 'name'."); } else if (tlist.getIgnoreListTable().containsKey(a1.getValue().trim())) { // just copy everything from ignorelist to this ignore section - Vector ignlist = (Vector) (tlist.getIgnoreListTable().get(a1.getValue().trim())); + final Vector ignlist = (Vector) (tlist.getIgnoreListTable().get(a1.getValue().trim())); for (int k = 0; k < ignlist.size(); k++) { ignoreTable.put((String) (ignlist.elementAt(k)), ""); } } else { - log.error("In '" + XML_IGNORE + "' section of type " + typeName + ": ignore_list with name \"" + a1.getValue() + "\" is undefined."); + LOG.error("In '" + XML_IGNORE + "' section of type " + typeName + ": ignore_list with name \"" + a1.getValue() + "\" is undefined."); } } } @@ -223,10 +215,11 @@ } // load import_type + String importName = null; if ((elem = root.getChild(XML_IMPORT_TYPE)) != null) { a1 = elem.getAttribute("name"); if (a1 == null) { - log.error("In file '" + IGUIConstants.TYPEDEF_FILE + "': Type " + typeName + " has " + XML_IMPORT_TYPE + " element without 'name'."); + LOG.error("In file '" + IGUIConstants.TYPEDEF_FILE + "': Type " + typeName + " has " + XML_IMPORT_TYPE + " element without 'name'."); } else { importName = a1.getValue().trim(); } @@ -234,6 +227,8 @@ // now get all children and proccess them in order: children = root.getChildren(); + boolean inSection; + String section = "?"; for (i = 0; children != null && i < children.size(); i++) { elem = (Element) children.get(i); // attribute directly in type element @@ -245,14 +240,14 @@ if (elem.getName().equalsIgnoreCase(XML_SECTION) && !elem.getChildren().isEmpty()) { a1 = elem.getAttribute("name"); if (a1 == null) { - log.warn("In " + IGUIConstants.TYPEDEF_FILE + ": Type " + typeName + " contains a " + XML_SECTION + " missing 'name'."); + LOG.warn("In " + IGUIConstants.TYPEDEF_FILE + ": Type " + typeName + " contains a " + XML_SECTION + " missing 'name'."); inSection = false; // we'll treat the attributes as "sectionless" } else { // get section name section = a1.getValue().trim(); inSection = true; // we are now inside a section sectionNum++; // increment number of valid sections - secNames.addElement(section); // tmp. store name + secNames.add(section); // tmp. store name } // parse all attributes in the section @@ -269,19 +264,16 @@ // ------ now generate the array of attributes: ------ // calculate how many attributes we've got - int j; - int t = 0; - int numDef = 0; // number of default attribs which are not ignored - int importNum = 0; // number if imported attribs - j = attrList.size(); + int j = attrList.size(); // don't forget about the default attribs + int numDef = 0; if (defaultArchType != null && defaultArchType.attr != null && defaultArchType.attr.length > 0) { // create an array to store the refernces to the default atrribs: - CFArchAttrib[] defList = new CFArchAttrib[defaultArchType.attr.length]; + final CFArchAttrib[] defList = new CFArchAttrib[defaultArchType.attr.length]; - for (; t < defaultArchType.attr.length; t++) { + for (int t = 0; t < defaultArchType.attr.length; t++) { // add all... [truncated message content] |
From: <der...@us...> - 2006-06-01 23:55:56
|
Revision: 106 Author: derdanny Date: 2006-06-01 16:09:01 -0700 (Thu, 01 Jun 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=106&view=rev Log Message: ----------- Changed some int x/y and width/height pairs to Point and Dimension. Added some final modifiers. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMainView.java trunk/crossfire/src/cfeditor/CMapControl.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/crossfire/src/cfeditor/CMapViewIFrame.java trunk/crossfire/src/cfeditor/CNewMapDialog.java trunk/crossfire/src/cfeditor/CopyBuffer.java trunk/crossfire/src/cfeditor/MapArchObject.java trunk/crossfire/src/cfeditor/ReplaceDialog.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-06-01 00:15:21 UTC (rev 105) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-06-01 23:09:01 UTC (rev 106) @@ -34,6 +34,7 @@ import java.awt.Point; import java.awt.Rectangle; import java.awt.Toolkit; +import java.awt.Dimension; import java.io.File; import java.io.IOException; import java.util.Enumeration; @@ -428,8 +429,8 @@ getPlainFont().getSize()) > 13; } - void setMapAndArchPosition(int archid, int x, int y) { - currentMap.getMapView().setMapAndArchPosition(archid, x, y); + void setMapAndArchPosition(final int archid, final Point pos) { + currentMap.getMapView().setMapAndArchPosition(archid, pos); } /** @@ -573,23 +574,22 @@ return JFontChooser.msgToHtml(msg, getPlainFont()); } - boolean addArchToMap(int archnr, int mapx, int mapy, int intern, boolean join) { - return currentMap.addArchToMap(archnr, mapx, mapy, intern, join); + boolean addArchToMap(final int archnr, final Point pos, final int intern, final boolean join) { + return currentMap.addArchToMap(archnr, pos, intern, join); } - boolean insertArchToMap(ArchObject newarch, int archnr, ArchObject next, int mapx, int mapy, boolean join) { - return currentMap.insertArchToMap(newarch, archnr, next, mapx, mapy, join); + boolean insertArchToMap(final ArchObject newarch, final int archnr, final ArchObject next, final Point pos, final boolean join) { + return currentMap.insertArchToMap(newarch, archnr, next, pos, join); } - public void deleteMapArch(int index, int mapx, int mapy, boolean refreshMap, boolean join) { - currentMap.deleteMapArch(index, mapx, mapy, refreshMap, join); + public void deleteMapArch(final int index, final Point pos, final boolean refreshMap, final boolean join) { + currentMap.deleteMapArch(index, pos, refreshMap, join); } - public ArchObject getMapArch(int index, int mapx, int mapy) { - return currentMap.getMapArch(index, mapx, mapy); + public ArchObject getMapArch(final int index, final Point pos) { + return currentMap.getMapArch(index, pos); } - public CMainView getMainView() { return mainView; } @@ -1322,17 +1322,16 @@ * @param archText map text * @param loreText lore text * @param strMapTitle map name - * @param mapWidth width of map - * @param mapHeight height of map + * @param mapSize size of map */ - void setLevelProperties(CMapControl level, String archText, String loreText, String strMapTitle, int mapWidth, int mapHeight) { + void setLevelProperties(final CMapControl level, final String archText, final String loreText, final String strMapTitle, final Dimension mapSize) { if (level != null) { - level.setProperties(archText, loreText, strMapTitle, mapWidth, mapHeight); + level.setProperties(archText, loreText, strMapTitle, mapSize); refreshMenusAndToolbars(); } } - void setPickmapsLocked(boolean state) { + void setPickmapsLocked(final boolean state) { pickmapsLocked = state; } @@ -1358,7 +1357,6 @@ ArchObject exit; // selected exit object CMapControl oldmap; // store control of active map (to evt. close it later) String path; // exit path - int dx, dy; // exit destination coords. exit = currentMap.getMapModel().getExit(); @@ -1369,16 +1367,17 @@ } path = exit.getAttributeString("slaying", getArch(exit.getNodeNr())); - dx = exit.getAttributeValue("hp", getArch(exit.getNodeNr())); - dy = exit.getAttributeValue("sp", getArch(exit.getNodeNr())); + final Point exitPos = new Point(); + exitPos.x = exit.getAttributeValue("hp", getArch(exit.getNodeNr())); + exitPos.y = exit.getAttributeValue("sp", getArch(exit.getNodeNr())); if (path.length() == 0 || (currentMap.getMapFile() != null && path.equals(currentMap.getMapFile().getName()))) { // path points to the same map - if (dx == 0 && dy == 0) { + if (exitPos.x == 0 && exitPos.y == 0) { showMessage("Destination Invalid", "This exit points nowhere."); - } else if (currentMap.pointValid(dx, dy)) { - currentMap.getMapView().setHotspot(dx, dy); + } else if (currentMap.pointValid(exitPos)) { + currentMap.getMapView().setHotspot(exitPos.x, exitPos.y); } else { showMessage("Destination Invalid", "The destination of this exit is outside the map."); } @@ -1407,12 +1406,12 @@ oldmap = currentMap; // store old map control openFile(newfile); // open the new map - if (dx == 0 && dy == 0) { + if (exitPos.x == 0 && exitPos.y == 0) { // use the entry point defined by the map header - dx = currentMap.getMapModel().getMapArchObject().getEnterX(); - dy = currentMap.getMapModel().getMapArchObject().getEnterY(); + exitPos.x = currentMap.getMapModel().getMapArchObject().getEnterX(); + exitPos.y = currentMap.getMapModel().getMapArchObject().getEnterY(); } - currentMap.getMapView().setHotspot(dx, dy); // set hotspot + currentMap.getMapView().setHotspot(exitPos.x, exitPos.y); // set hotspot // Update the main view so the new map instantly pops up. mainView.update(mainView.getGraphics()); @@ -1420,7 +1419,7 @@ closeLevel(oldmap, false); // close the old map } if (log.isDebugEnabled()) { - log.debug("exit: '" + path + "' " + dx + ", " + dy); + log.debug("exit: '" + path + "' " + exitPos.x + ", " + exitPos.y); } } Modified: trunk/crossfire/src/cfeditor/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainView.java 2006-06-01 00:15:21 UTC (rev 105) +++ trunk/crossfire/src/cfeditor/CMainView.java 2006-06-01 23:09:01 UTC (rev 106) @@ -303,8 +303,8 @@ if (pmap != null && pmap.getMapView().isHighlight()) { // now try to get the topmost object ArchObject arch = null; - if (pmap.pointValid(pmap.getMapView().getHighlightStart().x, pmap.getMapView().getHighlightStart().y)) { - arch = pmap.getMapModel().getBottomArchObject(pmap.getMapView().getHighlightStart().x, pmap.getMapView().getHighlightStart().y); + if (pmap.pointValid(pmap.getMapView().getHighlightStart())) { + arch = pmap.getMapModel().getBottomArchObject(pmap.getMapView().getHighlightStart()); } if (arch != null) { // so here we return the arch from the pickmap Modified: trunk/crossfire/src/cfeditor/CMapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapControl.java 2006-06-01 00:15:21 UTC (rev 105) +++ trunk/crossfire/src/cfeditor/CMapControl.java 2006-06-01 23:09:01 UTC (rev 106) @@ -28,6 +28,7 @@ import cfeditor.arch.ArchObjectIterator; import cfeditor.arch.ArchObjectIteratorDeleteMapArch; import java.awt.Point; +import java.awt.Dimension; import java.io.File; import java.util.Iterator; @@ -143,12 +144,14 @@ */ public void addEditType(int newType) { // calculate only if needed + final Dimension size = mapModel.getMapSize(); + final Point pos = new Point(); if (!hasEditType(newType)) { - for (int posx = 0; posx < mapModel.getMapWidth(); posx++) { - for (int posy = 0; posy < mapModel.getMapHeight(); posy++) { - Iterator it = mapModel.getArchObjects(posx, posy); + for (pos.x = 0; pos.x < size.width; pos.x++) { + for (pos.y = 0; pos.y < size.height; pos.y++) { + final Iterator it = mapModel.getArchObjects(pos); while (it.hasNext()) { - ArchObject arch = (ArchObject) it.next(); + final ArchObject arch = (ArchObject) it.next(); // calculate the new edit type if (arch.getRefFlag() && arch.getMapMultiHead() != null) { // multi tails get the value from their head @@ -220,65 +223,72 @@ mapModel.freeMapArchObject(); } - boolean addArchToMap(int archnr, int mapx, int mapy, int intern, boolean join, - boolean insertBelow) { - return mapModel.addArchToMap(archnr, mapx, mapy, intern, join, insertBelow); + 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(int archnr, int xx, int yy, int intern, boolean join) { - return addArchToMap(archnr, xx, yy, intern, join, false); + public boolean addArchToMap(final int archnr, final Point pos, final int intern, final boolean join) { + return addArchToMap(archnr, pos, intern, join, false); } - public boolean insertArchToMap(ArchObject newarch, int archnr, ArchObject next, int mapx, int mapy, boolean join) { - return mapModel.insertArchToMap(newarch, archnr, next, mapx, mapy, join); + /** wrapper method for addArchToMap, always inserting new arches on top */ + @Deprecated public boolean addArchToMap(int archnr, int xx, int yy, int intern, 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(ArchObject arch, boolean insertBelow) { mapModel.addArchObjectToMap(arch, insertBelow); } - public void addArchObjectToMap(ArchObject arch) { + public void addArchObjectToMap(final ArchObject arch) { mapModel.addArchObjectToMap(arch, false); } - public void deleteMapArch(int index, int mapx, int mapy, - boolean refreshMap, boolean join) { - mapModel.deleteMapArch(index, mapx, mapy, refreshMap, join); + public void deleteMapArch(final int index, final Point pos, final boolean refreshMap, final boolean join) { + mapModel.deleteMapArch(index, pos, refreshMap, join); } - public ArchObject getMapArch(int index, int mapx, int mapy) { - return mapModel.getMapArch(index, mapx, mapy); + public ArchObject getMapArch(final int index, final Point pos) { + return mapModel.getMapArch(index, pos); } - public String getMapTilePath(int direction) { + public String getMapTilePath(final int direction) { return mapModel.getMapArchObject().getTilePath(direction); } - public ArchObjectIterator getArchObjects(int x, int y) { - return mapModel.getArchObjects(x, y); + public ArchObjectIterator getArchObjects(final Point pos) { + return mapModel.getArchObjects(pos); } - public ArchObjectIteratorDeleteMapArch getArchObjectsDeleteMapArch(int x, int y, boolean refreshMap, boolean join) { - return mapModel.getArchObjectsDeleteMapArch(x, y, refreshMap, join); + public ArchObjectIteratorDeleteMapArch getArchObjectsDeleteMapArch(final Point pos, final boolean refreshMap, final boolean join) { + return mapModel.getArchObjectsDeleteMapArch(pos, refreshMap, join); } - public boolean containsArchObject(int x, int y) { - return mapModel.containsArchObject(x, y); + public boolean containsArchObject(final Point pos) { + return mapModel.containsArchObject(pos); } - public ArchObject getBottomArchObject(int x, int y) { - return mapModel.getBottomArchObject(x, y); + @Deprecated public boolean containsArchObject(final int x, final int y) { + return containsArchObject(new Point(x, y)); } - public ArchObject getTopArchObject(int x, int y) { - return mapModel.getTopArchObject(x, y); + public ArchObject getBottomArchObject(final Point pos) { + return mapModel.getBottomArchObject(pos); } - public void setArchObject(int x, int y, ArchObject arch) { - mapModel.setArchObject(x, y, arch); + 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. @@ -302,14 +312,12 @@ * @param archText map text * @param loreText lore text * @param strMapTitle map name - * @param mapWidth width of map - * @param mapHeight height of map + * @param newSize size of map */ - protected void setProperties(String archText, String loreText, String strMapTitle, - int mapWidth, int mapHeight) { + protected void setProperties(final String archText, final String loreText, String strMapTitle, final Dimension newSize) { // resize this map - if (mapWidth != getMapWidth() || mapHeight != getMapHeight()) { - resizeMap(mapWidth, mapHeight); + if (!newSize.equals(getMapSize())) { + resizeMap(newSize); } setNewMapText(archText); // change map text @@ -375,19 +383,27 @@ } /** + * 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. */ - public int getMapWidth() { - return mapModel.getMapWidth(); + @Deprecated public int getMapWidth() { + return getMapSize().width; } /** * Returns the height of the level. * @return map height. */ - public int getMapHeight() { - return mapModel.getMapHeight(); + @Deprecated public int getMapHeight() { + return getMapSize().height; } /** @@ -405,9 +421,9 @@ // TODO implement this int getDisplayMapWidth() { if (showTiles) { - return mapModel.getMapWidth() + eastWidth + westWidth; + return mapModel.getMapSize().width + eastWidth + westWidth; } else { - return mapModel.getMapWidth(); + return mapModel.getMapSize().width; } } @@ -417,9 +433,9 @@ */ int getDisplayMapHeight() { if (showTiles) { - return mapModel.getMapWidth() + northHeight + southHeight; + return mapModel.getMapSize().height + northHeight + southHeight; } else { - return mapModel.getMapHeight(); + return mapModel.getMapSize().height; } } @@ -445,28 +461,30 @@ } } + @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 posx x coordinate - * @param posy y coordinate + * @param pos coordinate to check. * @return true if this point is located within the map boundaries */ - public boolean pointValid(int posx, int posy) { - return mapModel.pointValid(posx, posy); + public boolean pointValid(final Point pos) { + return mapModel.pointValid(pos); } - public boolean checkResizeMap(int newWidth, int newHeight) { - return mapModel.checkResizeMap(newWidth, newHeight); + public boolean checkResizeMap(final Dimension dim) { + return mapModel.checkResizeMap(dim); } /** * Resize the map. - * @param newWidth the new level width. - * @param newHeight the new level height. + * @param size the new level size. */ - void resizeMap(int newWidth, int newHeight) { - mapModel.resizeMap(newWidth, newHeight); + void resizeMap(final Dimension size) { + mapModel.resizeMap(size); } /** @return The level name. */ Modified: trunk/crossfire/src/cfeditor/CMapFileEncode.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapFileEncode.java 2006-06-01 00:15:21 UTC (rev 105) +++ trunk/crossfire/src/cfeditor/CMapFileEncode.java 2006-06-01 23:09:01 UTC (rev 106) @@ -36,6 +36,8 @@ 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; /** @@ -82,11 +84,13 @@ map.writeMapArch(bufferedWriter); // first, write all one tile parts - for (int x = 0; x < map.getWidth(); x++) { - for (int y = 0; y < map.getHeight(); y++) { - Iterator it = mapModel.getArchObjects(x, y); + final Dimension size = map.getMapSize(); + final Point pos = new Point(); + for (pos.x = 0; pos.x < size.width; pos.x++) { + for (pos.y = 0; pos.y < size.height; pos.y++) { + final Iterator it = mapModel.getArchObjects(pos); while (it.hasNext()) { - ArchObject node = (ArchObject) it.next(); + final ArchObject node = (ArchObject) it.next(); // only non muli suckers if (node.getMapMultiHead() == null && node.getMapMultiNext() == null) { if (!writeMapArch(node, false)) { @@ -98,11 +102,11 @@ } // second, we drop the multi part suckers out - for (int x = 0; x < map.getWidth(); x++) { - for (int y = 0; y < map.getHeight(); y++) { - Iterator it = mapModel.getArchObjects(x, y); + for (pos.x = 0; pos.x < size.width; pos.x++) { + for (pos.y = 0; pos.y < size.height; pos.y++) { + final Iterator it = mapModel.getArchObjects(pos); while (it.hasNext()) { - ArchObject node = (ArchObject) it.next(); + final ArchObject node = (ArchObject) it.next(); // search only for heads! if (node.getRefCount() > 0 && node.getMapMultiNext() != null) { /* old version: Both heads and tails got written into the mapfile Modified: trunk/crossfire/src/cfeditor/CMapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapModel.java 2006-06-01 00:15:21 UTC (rev 105) +++ trunk/crossfire/src/cfeditor/CMapModel.java 2006-06-01 23:09:01 UTC (rev 106) @@ -33,6 +33,7 @@ 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; @@ -61,12 +62,9 @@ */ private ArchObject[][] m_mapGrid; - /** The width of the level (in tiles). Is always positive. */ - private int m_mapWidth; + /** Size of this map. */ + private final Dimension mapSize = new Dimension(); - /** The height of the level (in tiles). Is always positive. */ - private int m_mapHeight; - /** Flag that indicates if the level has been changed since last save. */ private boolean m_fLevelChanged = false; @@ -85,15 +83,13 @@ public CMapModel(final CMainControl mc, final CMapControl control, final MapArchObject map) { m_main_control = mc; m_control = control; - m_mapWidth = map.getWidth(); - m_mapHeight = map.getHeight(); + mapSize.setSize(map.getMapSize()); - m_mapGrid = initMap(m_mapWidth, m_mapHeight); + m_mapGrid = initMap(); m_mapArch = map; - setMapX(m_mapWidth); - setMapY(m_mapHeight); + m_mapArch.setMapSize(mapSize); } /** @@ -102,14 +98,13 @@ * @return the ArchObject to show; the object(s) must not be modified */ @Nullable public ArchObject getMouseRightPosObject() { - final int mx = m_control.getMapView().getMapMouseRightPos().x; - final int my = m_control.getMapView().getMapMouseRightPos().y; + final Point pos = m_control.getMapView().getMapMouseRightPos(); - if (mx == -1 || my == -1 || !pointValid(mx, my)) { + if (pos.x == -1 || pos.y == -1 || !pointValid(pos)) { return null; } - return m_mapGrid[mx][my]; + return m_mapGrid[pos.x][pos.y]; } /** @@ -130,22 +125,6 @@ } /** - * Update the map width. - * @param len the new map width - */ - public void setMapX(final int len) { - m_mapArch.setWidth(len); - } - - /** - * Update the map height. - * @param len the new map height - */ - public void setMapY(final int len) { - m_mapArch.setHeight(len); - } - - /** * Place a list of arches onto the map. * @param arch the head of the arches list; may be null to insert nothing */ @@ -211,90 +190,128 @@ * Return the width of the level. * @return the width of the level */ - public int getMapWidth() { - return m_mapWidth; + @Deprecated public int getMapWidth() { + return mapSize.width; } /** * Returns the height of the level. * @return The height of the level. */ - int getMapHeight() { - return m_mapHeight; + @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 */ - @Nullable public ArchObject getBottomArchObject(final int x, final int y) { - if (!pointValid(x, y)) { + @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[x][y]; + 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 int x, final int y) { - ArchObject result = getBottomArchObject(x, y); + 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 int x, final int y, final ArchObject arch) { - if (!pointValid(x, y)) { + public void setArchObject(final Point pos, final ArchObject arch) { + if (!pointValid(pos)) { throw new IllegalArgumentException(); } if (arch == null) { throw new IllegalArgumentException(); } - m_mapGrid[x][y] = arch; + m_mapGrid[pos.x][pos.y] = arch; } /** * Return an Iterator of all ArchObjects in the given location. The * Iterator supports deleting objects. */ - public ArchObjectIteratorDeleteMapArch getArchObjectsDeleteMapArch(final int x, final int y, final boolean refreshMap, final boolean join) { - return new ArchObjectIteratorDeleteMapArch(this, getBottomArchObject(x, y), x, y, refreshMap, join); + @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 ArchObjectIteratorDeleteArchMapObject getArchObjectsDeleteArchMapObject(final int x, final int y) { - return new ArchObjectIteratorDeleteArchMapObject(this, getBottomArchObject(x, y)); + 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. */ - public ArchObjectIterator getArchObjects(final int x, final int y) { - return new ArchObjectIterator(getBottomArchObject(x, y)); + @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. */ - public boolean containsArchObject(final int x, final int y) { - return pointValid(x, y) && m_mapGrid[x][y] != null; + @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. - * @param width the width of the new map - * @param height the height of the new map * @return the empty map grid */ - private ArchObject[][] initMap(final int width, final int height) { - final ArchObject[][] map = new ArchObject[width][height]; - for (int y = 0; y < height; y++) { - for (int x = 0; x < width; x++) { + 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; } } @@ -316,7 +333,7 @@ for (int c = 0; c <= count; c++) { final int mapx = xx + m_main_control.getArchObjectStack().getArch(archnr + c).getRefX(); final int mapy = yy + m_main_control.getArchObjectStack().getArch(archnr + c).getRefY(); - if (mapx < 0 || mapy < 0 || mapx >= m_mapWidth || mapy >= m_mapHeight) { + if (mapx < 0 || mapy < 0 || mapx >= mapSize.width|| mapy >= mapSize.height) { // outside map return false; } @@ -420,12 +437,15 @@ } } + @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 xx insert-location on this map - * @param yy insert-location on this map + * @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 @@ -434,15 +454,15 @@ * inserted below * @return true if insertion successful, false if not */ - public boolean addArchToMap(int archnr, final int xx, final int yy, final int intern, final boolean join, final boolean insert_below) { + 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 >= m_main_control.getArchObjectStack().getArchCount() - || xx == -1 || yy == -1 || xx >= m_mapWidth || yy >= m_mapHeight) { + || pos.x == -1 || pos.y == -1 || pos.x >= mapSize.width|| pos.y >= mapSize.height) { // invalid parameter return false; } - if (!testArchToMap(archnr, xx, yy, intern)) { + if (!testArchToMap(archnr, pos.x, pos.y, intern)) { // does not fit on map return false; } @@ -451,7 +471,7 @@ if (m_main_control.getAutojoin() && join == JOIN_ENABLE && m_main_control.getJoinlist() != null && newarch.getJoinList() != null && !newarch.isMulti()) { // do autojoining if enabled - archnr = newarch.getJoinList().join_insert(this, xx, yy); + archnr = newarch.getJoinList().join_insert(this, pos.x, pos.y); if (archnr == -1) { return false; // only one autojoin type per square allowed } @@ -462,8 +482,8 @@ oldarch = null; startarch = null; for (int c = 0; c <= count; c++) { - final int mapx = xx + m_main_control.getArchObjectStack().getArch(archnr + c).getRefX(); - final int mapy = yy + m_main_control.getArchObjectStack().getArch(archnr + c).getRefY(); + final int mapx = pos.x + m_main_control.getArchObjectStack().getArch(archnr + c).getRefX(); + final int mapy = pos.y + m_main_control.getArchObjectStack().getArch(archnr + c).getRefY(); newarch = m_main_control.getArchObjectStack().newArchObjectInstance(archnr + c); if (oldarch != null) { newarch.setMapMultiHead(startarch); @@ -509,6 +529,9 @@ return true; } + @Deprecated public boolean insertArchToMap(ArchObject newarch, int archnr, final ArchObject next, final int mapx, final int mapy, final boolean join) { + return insertArchToMap(newarch, archnr, next, new Point(mapx, mapy), join); + } /** * 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 @@ -522,16 +545,15 @@ * @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 mapx map position to insert the new arch - * @param mapy map position to insert the new arch + * @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 int mapx, final int mapy, final boolean join) { + public boolean insertArchToMap(ArchObject newarch, int archnr, final ArchObject next, final Point pos, final boolean join) { ArchObject node; // map coords must be valid - if (!m_control.pointValid(mapx, mapy)) { + if (!m_control.pointValid(pos)) { return false; } @@ -545,13 +567,13 @@ archnr = newarch.getNodeNr(); } // insert a new instance of the default arch (number 'archnr') - if (!m_control.addArchToMap(archnr, mapx, mapy, -1, join)) { + if (!m_control.addArchToMap(archnr, pos, -1, join)) { return false; } } else { // insert the given 'newarch' (multis not allowed here yet - sorry) if (!newarch.isMulti()) { - newarch = newarch.getClone(mapx, mapy); // create a clone + newarch = newarch.getClone(pos.x, pos.y); // create a clone m_control.addArchObjectToMap(newarch); // insert it to the map } else { return false; // tried to insert multi (probably from pickmap) @@ -559,7 +581,7 @@ } // jump to the end of the list (-> grab "topmost" arch) - for (node = m_mapGrid[mapx][mapy]; + for (node = m_mapGrid[pos.x][pos.y]; node != null && node.getNextArch() != null; node = node.getNextArch()) { ; @@ -583,7 +605,7 @@ } else { // create clone from a pickmap if (!newarch.isMulti()) { - invnew = newarch.getClone(mapx, mapy); + invnew = newarch.getClone(pos.x, pos.y); } else { return false; } @@ -669,23 +691,25 @@ return; } + @Deprecated @Nullable public ArchObject getMapArch(final int id, final int xx, final int yy) { + return getMapArch(id, new Point(xx, yy)); + } /** - * Get the arch from the map with the specified 'id', at location (xx, yy). - * @param xx x-location - * @param yy y-location + * Get the arch from the map with the specified 'id', at location pos. + * @param pos Location of ArchObject. * @param id ID number of arch (-> <code>arch.getMyID()</code>) * @return the specified arch, or null if not found */ - @Nullable public ArchObject getMapArch(final int id, final int xx, final int yy) { + @Nullable public ArchObject getMapArch(final int id, final Point pos) { ArchObject node; - if (m_mapGrid == null || xx < 0 || xx >= m_mapWidth || yy < 0 || yy >= m_mapHeight) { + if (m_mapGrid == null || pos.x < 0 || pos.x >= mapSize.width || pos.y < 0 || pos.y >= mapSize.height) { return null; } // first, try to find the tile we had selected node = null; - final Iterator it = getArchObjects(xx, yy); + final Iterator it = getArchObjects(pos.x, pos.y); while (it.hasNext()) { node = (ArchObject) it.next(); @@ -727,20 +751,23 @@ return null; } + @Deprecated public void deleteMapArch(final int id, final int xx, final int yy, final boolean refresh_map, final boolean join) { + deleteMapArch(id, new Point(xx, yy), refresh_map, join); + } + /** * Delete an existing arch from the map. (If the specified arch doesn't * exist, nothing happens.) (This includes deletion of multiparts and * inventory.) * @param id ID of the arch to be removed (->arch.getMyID()) - * @param xx location of the arch to be removed - * @param yy location of the arch to be removed + * @param pos location of the arch to be removed * @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 */ - public void deleteMapArch(final int id, final int xx, final int yy, final boolean refresh_map, final boolean join) { + public void deleteMapArch(final int id, final Point pos, final boolean refresh_map, final boolean join) { // first, try to find the tile we had selected - final Iterator it = getArchObjectsDeleteArchMapObject(xx, yy); + final Iterator it = getArchObjectsDeleteArchMapObject(pos); while (it.hasNext()) { final ArchObject node = (ArchObject) it.next(); @@ -752,7 +779,7 @@ if (m_main_control.getAutojoin() && join == JOIN_ENABLE && m_main_control.getJoinlist() != null && temp.getJoinList() != null && !temp.isMulti()) { // remove connections to the deleted arch - temp.getJoinList().join_delete(this, xx, yy); + temp.getJoinList().join_delete(this, pos.x, pos.y); } break; @@ -856,8 +883,8 @@ * every single ArchObject of the map... */ public void freeMapArchObject() { - for (int x = 0; x < m_mapWidth; x++) { - for (int y = 0; y < m_mapHeight; y++) { + for (int x = 0; x < mapSize.width; x++) { + for (int y = 0; y < mapSize.height; y++) { while (m_mapGrid[x][y] != null) { deleteArchMapObject(m_mapGrid[x][y]); } @@ -910,15 +937,17 @@ return m_mapArch; } + @Deprecated public boolean pointValid(final int posx, final int posy) { + return pointValid(new Point(posx, posy)); + } + /** * Check whether the given coordinate is within map bounds. - * @param posx the x-coordinate to check - * @param posy the y-coordinate to check + * @param pos the coordinates to check. * @return true=the given coordinates are within map bounds */ - public boolean pointValid(final int posx, final int posy) { - return 0 <= posx && posx < getMapWidth() - && 0 <= posy && posy < getMapHeight(); + public boolean pointValid(final Point pos) { + return pos.x >= 0 && pos.x < mapSize.width && pos.y >= 0 && pos.y < mapSize.height; } /** @@ -958,17 +987,19 @@ return exit; } + @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 newWidth the new level width. - * @param newHeight the new level height. + * @param newSize the new level size. * @return true if objects would be cut off */ - public boolean checkResizeMap(final int newWidth, final int newHeight) { - if (m_mapWidth > newWidth) { + public boolean checkResizeMap(final Dimension newSize) { + if (mapSize.width > newSize.width) { // search the right stripe (as far as being cut off) - for (int x = newWidth; x < m_mapWidth; x++) { - for (int y = 0; y < m_mapHeight; y++) { + for (int x = newSize.width; x < mapSize.width; x++) { + for (int y = 0; y < mapSize.height; y++) { if (m_mapGrid[x][y] != null) { return true; } @@ -976,10 +1007,10 @@ } } - if (m_mapHeight > newHeight) { + if (mapSize.height > newSize.height) { // search the bottom stripe (as far as being cut off) - for (int y = newHeight; y < m_mapHeight; y++) { - for (int x = 0; x < m_mapWidth; x++) { + for (int y = newSize.height; y < mapSize.height; y++) { + for (int x = 0; x < mapSize.width; x++) { if (m_mapGrid[x][y] != null) { return true; } @@ -990,20 +1021,23 @@ return false; } + @Deprecated void resizeMap(final int newWidth, final int newHeight) { + resizeMap(new Dimension(newWidth, newHeight)); + } + /** * 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 newWidth new map width - * @param newHeight new map height + * @param newSize new map size. */ - void resizeMap(int newWidth, int newHeight) { + void resizeMap(final Dimension newSize) { // don't allow negative values - if (newWidth < 0) { - newWidth = 0; + if (newSize.width < 0) { + newSize.width = 0; } - if (newHeight < 0) { - newHeight = 0; + if (newSize.height < 0) { + newSize.height = 0; } // no other thread may access this mapmodel while resizing @@ -1011,10 +1045,10 @@ // first delete all arches in the area that will get cut off // (this is especially important to remove all multipart-objects // reaching into that area) - if (m_mapWidth > newWidth) { + if (mapSize.width > newSize.width) { // clear out the right stripe (as far as being cut off) - for (int x = newWidth; x < m_mapWidth; x++) { - for (int y = 0; y < m_mapHeight; y++) { + for (int x = newSize.width; x < mapSize.width; x++) { + for (int y = 0; y < mapSize.height; y++) { // for every map square: delete all arches on it final Iterator it = getArchObjectsDeleteMapArch(x, y, false, false); while (it.hasNext()) { @@ -1025,12 +1059,12 @@ } } - if (m_mapHeight > newHeight) { + if (mapSize.height > newSize.height) { // clear out the bottom stripe (as far as being cut off) // (and yes, there is an area getting sweeped twice - and yes it could // be optimized you smartass - but I don't care!) - for (int y = newHeight; y < m_mapHeight; y++) { - for (int x = 0; x < m_mapWidth; x++) { + for (int y = newSize.height; y < mapSize.height; y++) { + for (int x = 0; x < mapSize.height; x++) { // for every map square: delete all arches on it final Iterator it = getArchObjectsDeleteMapArch(x, y, false, false); while (it.hasNext()) { @@ -1043,17 +1077,17 @@ // Now the critical step: create an ArchObject array of new dimension, // copy all objects and set it to replace the current one. - final ArchObject[][] newGrid = new ArchObject[newWidth][newHeight]; + final ArchObject[][] newGrid = new ArchObject[newSize.width][newSize.height]; // fill it with nulls - for (int x = 0; x < newWidth; x++) { - for (int y = 0; y < newHeight; y++) { + for (int x = 0; x < newSize.width; x++) { + for (int y = 0; y < newSize.height; y++) { newGrid[x][y] = null; } } // relink all arches to the new grid - for (int x = 0; x < Math.min(newWidth, m_mapWidth); x++) { - for (int y = 0; y < Math.min(newHeight, m_mapHeight); y++) { + for (int x = 0; x < Math.min(newSize.width, mapSize.width); x++) { + for (int y = 0; y < Math.min(newSize.height, mapSize.height); y++) { newGrid[x][y] = m_mapGrid[x][y]; } } @@ -1062,10 +1096,8 @@ m_mapGrid = newGrid; // adjust the map and model attributes - m_mapHeight = newHeight; - m_mapWidth = newWidth; - m_mapArch.setWidth(newWidth); - m_mapArch.setHeight(newHeight); + mapSize.setSize(newSize.width, newSize.height); + m_mapArch.setMapSize(newSize); // an important last point: if there is a highlighted area in a region // that got cut off - unhilight it! @@ -1103,7 +1135,7 @@ * @return whether a match was found */ public boolean filterSquare(Filter filter, FilterConfig config, int x, int y) { - if (x < 0 || y < 0 || x >= getMapWidth() || y >= getMapHeight()) { + if (x < 0 || y < 0 || x >= mapSize.width || y >= mapSize.height) { return false; } Modified: trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java 2006-06-01 00:15:21 UTC (rev 105) +++ trunk/crossfire/src/cfeditor/CMapPropertiesDialog.java 2006-06-01 23:09:01 UTC (rev 106) @@ -186,8 +186,9 @@ createPanelLine(mapPanel, m_nameField, 16, m_level.getMapName(), "Name: "); createPanelLine(mapPanel, m_regionField, 16, map.getMapRegion(), "Region: "); - createPanelLine(mapPanel, m_levelWidthField, 10, String.valueOf(m_level.getMapWidth()), "Width: "); - createPanelLine(mapPanel, m_levelHeightField, 10, String.valueOf(m_level.getMapHeight()), "Height: "); + final Dimension mapSize = m_level.getMapSize(); + createPanelLine(mapPanel, m_levelWidthField, 10, String.valueOf(mapSize.width), "Width: "); + createPanelLine(mapPanel, m_levelHeightField, 10, String.valueOf(mapSize.height), "Height: "); createPanelCBox(mapPanel, m_unique, map.isUnique(), " Unique Map"); createPanelCBox(mapPanel, m_outdoor, map.isOutdoor(), " Outdoor Map"); createPanelCBox(mapPanel, m_fixedReset, map.isFixedReset(), " Fixed Reset"); @@ -450,7 +451,7 @@ boolean modifyTilepaths = false; // true when map tile-paths were modified // tmp variables for parsing - int t_width, t_height; + final Dimension size = new Dimension(); int t_enter_x, t_enter_y; int t_reset_timeout, t_swap_time; int t_difficulty, t_darkness; @@ -464,8 +465,8 @@ // first check if the entries are all okay try { // try to parse everything - t_width = parseProperty(m_levelWidthField.getText(), "Width"); - t_height = parseProperty(m_levelHeightField.getText(), "Height"); + size.width = parseProperty(m_levelWidthField.getText(), "Width"); + size.height = parseProperty(m_levelHeightField.getText(), "Height"); t_enter_x = parseProperty(m_enterX.getText(), "Enter X"); t_enter_y = parseProperty(m_enterY.getText(), "Enter Y"); t_swap_time = parseProperty(m_swapTime.getText(), "Swap Time"); @@ -501,7 +502,7 @@ } // Now do some sanity checks: - if (t_width < 1 || t_height < 1) { + if (size.width < 1 || size.height < 1) { m_control.showMessage( "Illegal Value", "Level dimensions must be greater than zero."); @@ -525,17 +526,16 @@ } // if the mapsize has been modified, see if we should ask for a confirm - if (m_level.checkResizeMap(t_width, t_height)) { - if (!askConfirmResize(t_width, t_height)) { + if (m_level.checkResizeMap(size)) { + if (!askConfirmResize(size)) { // resizing has been cancelled - t_width = m_level.getMapWidth(); - t_height = m_level.getMapHeight(); + size.setSize(m_level.getMapSize()); } } // now that all is well, write the new values into the maparch m_control.setLevelProperties(m_level, m_textArea.getText(), m_loreArea.getText(), - m_nameField.getText(), t_width, t_height); + m_nameField.getText(), size); map.setMapRegion(t_region); map.setEnterX(t_enter_x); @@ -665,8 +665,9 @@ m_loreArea.setText(m_level.getMapLore()); m_nameField.setText(m_level.getMapName()); m_regionField.setText("" + map.getMapRegion()); - m_levelWidthField.setText("" + map.getWidth()); - m_levelHeightField.setText("" + map.getHeight()); + final Dimension mapSize = map.getMapSize(); + m_levelWidthField.setText(String.valueOf(mapSize.width)); + m_levelHeightField.setText(String.valueOf(mapSize.height)); m_enterX.setText("" + map.getEnterX()); m_enterY.setText("" + map.getEnterY()); m_swapTime.setText("" + map.getSwapTime()); @@ -713,9 +714,9 @@ * popup dialog disables all other windows (and threads). * @return true if user confirmed, false if user cancelled resize */ - private boolean askConfirmResize(int newWidth, int newHeight) { + private boolean askConfirmResize(final Dimension size) { return JOptionPane.showConfirmDialog(this, - "You selected a new map size of " + newWidth + "x" + newHeight + ". If the map was\n" + + "You selected a new map size of " + size.width + "x" + size.height + ". If the map was\n" + "resized in this way, some objects would get cut off and deleted.\n" + "Are you really sure you want this?", "Confirm", Modified: trunk/crossfire/src/cfeditor/CMapTileList.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapTileList.java 2006-06-01 00:15:21 UTC (rev 105) +++ trunk/crossfire/src/cfeditor/CMapTileList.java 2006-06-01 23:09:01 UTC (rev 106) @@ -30,6 +30,7 @@ import java.awt.Component; import java.awt.GridLayout; import java.awt.Rectangle; +import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; @@ -179,7 +180,7 @@ } else if ((e.getModifiers() & MouseEvent.BUTTON3_MASK) != 0 || ((e.getModifiers() & MouseEvent.BUTTON1_MASK) != 0 && e.isShiftDown())) { // --- right mouse button: insert arch --- - String entry; + final String entry; if ((list.locationToIndex(e.getPoint()) >= 0 || list.getModel().getSize() > 0) && mainControl.getArchPanelSelection() != null) { @@ -191,16 +192,17 @@ entry = model.getElementAt(list.locationToIndex(e.getPoint())).toString(); } - int num = Integer.parseInt(entry.substring(0, 10)); - int mapx = Integer.parseInt(entry.substring(10, 20)); - int mapy = Integer.parseInt(entry.substring(20, 30)); + final int num = Integer.parseInt(entry.substring(0, 10)); + final Point pos = new Point(); + pos.x = Integer.parseInt(entry.substring(10, 20)); + pos.y = Integer.parseInt(entry.substring(20, 30)); // find the lowest Y-coord. in list, to see if selection points below it // (We need this because JDK 1.4 doesn't give locationToIndex -1 when below) int lowestY = 0; if (list.getFirstVisibleIndex() != -1) { try { - Rectangle bounds = list.getCellBounds(list.getFirstVisibleIndex(), + final Rectangle bounds = list.getCellBounds(list.getFirstVisibleIndex(), list.getLastVisibleIndex()); lowestY = (int) (bounds.getY() + bounds.getHeight()); } catch (NullPointerException ne) { @@ -211,9 +213,9 @@ // insert arch next to selected position if (list.locationToIndex(e.getPoint()) < 0 || (lowestY != -10 && (int) (e.getPoint().getY()) > lowestY)) { - mainControl.insertArchToMap(mainControl.getArchPanelSelection(), mainControl.getPanelArch(), null, mapx, mapy, CMapModel.JOIN_ENABLE); + mainControl.insertArchToMap(mainControl.getArchPanelSelection(), mainControl.getPanelArch(), null, pos, CMapModel.JOIN_ENABLE); } else { - mainControl.insertArchToMap(mainControl.getArchPanelSelection(), mainControl.getPanelArch(), mainControl.getMapArch(num, mapx, mapy), mapx, mapy, CMapModel.JOIN_ENABLE); + mainControl.insertArchToMap(mainControl.getArchPanelSelection(), mainControl.getPanelArch(), mainControl.getMapArch(num, pos), pos, CMapModel.JOIN_ENABLE); } // refresh @@ -230,30 +232,32 @@ @Nullable public ArchObject getMapTileSelection() { // find the selected entry if one - int index = list.getSelectedIndex(); + final int index = list.getSelectedIndex(); if (index >= list.getModel().getSize() || index < 0 || list.getModel().getSize() <= 0 || mainControl.getCurrentMap() == null) { return null; } // parse selected entry and get the arch object - String entry = model.getElementAt(index).toString(); - int num = Integer.parseInt(entry.substring(0, 10)); - int mapx = Integer.parseInt(entry.substring(10, 20)); - int mapy = Integer.parseInt(entry.substring(20, 30)); + final String entry = model.getElementAt(index).toString(); + final int num = Integer.parseInt(entry.substring(0, 10)); + final Point pos = new Point(); + pos.x = Integer.parseInt(entry.substring(10, 20)); + pos.y = Integer.parseInt(entry.substring(20, 30)); - return mainControl.getMapArch(num, mapx, mapy); + return mainControl.getMapArch(num, pos); } /** Insert a tile index of list, this will delete it. */ - void deleteIndexFromList(int index) { + void deleteIndexFromList(final int index) { if (index != -1 && index < list.getModel().getSize()) { - ArchObject temp = getMapTileSelection(); - String entry = model.getElementAt(index).toString(); - int num = Integer.parseInt(entry.substring(0, 10)); - int mapx = Integer.parseInt(entry.substring(10, 20)); - int mapy = Integer.parseInt(entry.substring(20, 30)); - mainControl.deleteMapArch(num, mapx, mapy, true, CMapModel.JOIN_ENABLE); + final ArchObject temp = getMapTileSelection(); + final String entry = model.getElementAt(index).toString(); + final int num = Integer.parseInt(entry.substring(0, 10)); + final Point pos = new Point(); + pos.x = Integer.parseInt(entry.substring(10, 20)); + pos.y = Integer.parseInt(entry.substring(20, 30)); + mainControl.deleteMapArch(num, pos, true, CMapModel.JOIN_ENABLE); mainView.setMapTileList(mainControl.getCurrentMap(), (temp == null ? -1 : temp.getMyID())); } } @@ -261,7 +265,7 @@ void appExitNotify() { } - public int getPanelArch(int oldindex) { + public int getPanelArch(final int oldindex) { int index = -1; if (oldindex == -1) { @@ -426,14 +430,14 @@ */ super.getListCellRendererComponent(list, value, index, iss, chf); - String entry = value.toString(); - int num = Integer.parseInt(entry.substring(0, 10)); - int mapx = Integer.parseInt(entry.substring(10, 20)); - int mapy = Integer.parseInt(entry.substring(20, 30)); - int indent = Integer.parseInt(entry.substring(30, 40)); + final String entry = value.toString(); + final int num = Integer.parseInt(entry.substring(0, 10)); + final Point pos = new Point(); + pos.x = Integer.parseInt(entry.substring(10, 20)); + pos.y = Integer.parseInt(entry.substring(20, 30)); + final int indent = Integer.parseInt(entry.substring(30, 40)); - ArchObject arch = mainControl.getMapArch(num, mapx, mapy); - ArchObject tmp; + ArchObject arch = mainControl.getMapArch(num, pos); //String label; // We must set a disabled Icon (even though we don't want it) Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-06-01 00:15:21 UTC (rev 105) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-06-01 23:09:01 UTC (rev 106) @@ -74,10 +74,9 @@ private final CMainControl mainControl; - private int mapWidth; + /** Size of the map. */ + private final Dimension mapSize = new Dimension(); - private int mapHeight; - /** The tile palette renderer. */ private final CLevelRenderer renderer; @@ -112,8 +111,8 @@ /** * Constructs a level view. - * @param mc the main controller - * @param control the controller of this view + * @param mainControl the main controller + * @param mapControl the controller of this view * @param initial the initial view position to show; null=show top left * corner */ @@ -357,18 +356,17 @@ /** Refreshes the data in the view from the model. */ void refreshDataFromModel() { - Dimension forcedSize; - mapWidth = mapControl.getMapWidth(); - mapHeight = mapControl.getMapHeight(); + final Dimension forcedSize; + mapSize.setSize(mapControl.getMapSize()); log.debug("refreshDataFromModel"); // define how much drawing space we need for the map if (IGUIConstants.isoView) { forcedSize = new Dimension( - (isPickmap() ? 3 + 2 * IGUIConstants.TILE_ISO_YLEN : mapHeight * IGUIConstants.TILE_ISO_YLEN) + mapWidth * IGUIConstants.TILE_ISO_YLEN + IGUIConstants.TILE_ISO_XLEN, - ((isPickmap() ? Math.max(mapHeight - 2, 0) : mapHeight) * IGUIConstants.TILE_ISO_YLEN + (mapWidth - mapHeight) * IGUICo... [truncated message content] |
From: <chr...@us...> - 2006-06-01 00:15:30
|
Revision: 105 Author: christianhujer Date: 2006-05-31 17:15:21 -0700 (Wed, 31 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=105&view=rev Log Message: ----------- Removed old email address. Modified Paths: -------------- trunk/src/doc/transform.xslt Modified: trunk/src/doc/transform.xslt =================================================================== --- trunk/src/doc/transform.xslt 2006-05-31 22:05:15 UTC (rev 104) +++ trunk/src/doc/transform.xslt 2006-06-01 00:15:21 UTC (rev 105) @@ -64,7 +64,7 @@ <a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml11" alt="Valid XHTML 1.1" height="31" width="88" class="now" /></a> <a href="http://jigsaw.w3.org/css-validator/check/referer"><img src="http://jigsaw.w3.org/css-validator/images/vcss" width="88" height="31" alt="Valid CSS!" /></a> <!--<a href="http://www.jetbrains.com/idea/"><img src="http://www.jetbrains.com/idea/opensource/img/banners/idea88x31_blue.gif" alt="The best Java IDE" width="88" height="31" /></a>--> - Feedback: <a href="mailto:ch...@ri...">webmaster</a> + Feedback: <a href="mailto:ch...@ri...">webmaster</a> <xsl:if test="/html:html/html:head/html:meta[@name='Date']"> <br /> <xsl:value-of select="/html:html/html:head/html:meta[@name='Date']/@content" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <der...@us...> - 2006-05-31 22:05:30
|
Revision: 104 Author: derdanny Date: 2006-05-31 15:05:15 -0700 (Wed, 31 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=104&view=rev Log Message: ----------- Deleted multiple @Nullable annotations. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CFTreasureListTree.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/PluginParameterFactory.java trunk/crossfire/src/cfeditor/arch/ArchObject.java trunk/crossfire/src/cfeditor/parameter/ArchParameter.java trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditControl.java trunk/crossfire/src/cfeditor/textedit/textarea/DefaultInputHandler.java Modified: trunk/crossfire/src/cfeditor/CFTreasureListTree.java =================================================================== --- trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-05-31 21:39:59 UTC (rev 103) +++ trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-05-31 22:05:15 UTC (rev 104) @@ -695,7 +695,7 @@ * If nothing is selected, null is returned. * @throws CGridderException when user selected an invalid treasurelist (e.g. a god-list) */ - @Nullable @Nullable private String getSelectedTreasureList() throws CGridderException { + @Nullable private String getSelectedTreasureList() throws CGridderException { // return null when nothing is selected if (isSelectionEmpty()) { return null; Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-05-31 21:39:59 UTC (rev 103) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-05-31 22:05:15 UTC (rev 104) @@ -966,7 +966,7 @@ * @param initial the view position to show initially * @return The map controller to manipulate this map. */ - @Nullable @Nullable @Nullable public CMapControl openFile(File file, boolean show, Point initial) { + @Nullable public CMapControl openFile(File file, boolean show, Point initial) { ArchObject start; MapArchObject maparch; CMapControl control = null; Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-05-31 21:39:59 UTC (rev 103) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-05-31 22:05:15 UTC (rev 104) @@ -408,7 +408,7 @@ * @return a <code>Point</code> array containing the coords of the tiles * which need to be redrawn */ - @Nullable @Nullable Point[] calcArchRedraw(ArchObject arch) { + @Nullable Point[] calcArchRedraw(ArchObject arch) { if (arch == null) { // safety check return null; } Modified: trunk/crossfire/src/cfeditor/PluginParameterFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/PluginParameterFactory.java 2006-05-31 21:39:59 UTC (rev 103) +++ trunk/crossfire/src/cfeditor/PluginParameterFactory.java 2006-05-31 22:05:15 UTC (rev 104) @@ -50,7 +50,7 @@ return createParameter(parameterNode.getChildText("type"), parameterNode); } - @Nullable @Nullable public static PluginParameter createParameter(String type) { + @Nullable public static PluginParameter createParameter(String type) { if (type == null) { type = "java.lang.String"; } @@ -73,7 +73,7 @@ } } - @Nullable @Nullable public static PluginParameter createParameter(String type, Element parameterNode) { + @Nullable public static PluginParameter createParameter(String type, Element parameterNode) { if (type == null) { type = "java.lang.String"; } Modified: trunk/crossfire/src/cfeditor/arch/ArchObject.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObject.java 2006-05-31 21:39:59 UTC (rev 103) +++ trunk/crossfire/src/cfeditor/arch/ArchObject.java 2006-05-31 22:05:15 UTC (rev 104) @@ -1384,7 +1384,7 @@ * @return A String with all lines which don't match the type-definitions.<br> * If no such "errors" encountered, null is returned. */ - @Nullable @Nullable public String getSyntaxErrors(CFArchType type) { + @Nullable public String getSyntaxErrors(CFArchType type) { ArchObject defarch = getDefaultArch(); if (typelist != null && archText != null && archText.length() > 0) { Modified: trunk/crossfire/src/cfeditor/parameter/ArchParameter.java =================================================================== --- trunk/crossfire/src/cfeditor/parameter/ArchParameter.java 2006-05-31 21:39:59 UTC (rev 103) +++ trunk/crossfire/src/cfeditor/parameter/ArchParameter.java 2006-05-31 22:05:15 UTC (rev 104) @@ -30,7 +30,7 @@ parameterType = getParameterType(); } - @Nullable @Nullable private ArchObject locateArch(String name) { + @Nullable private ArchObject locateArch(String name) { ArchObjectStack stack = CMainControl.getInstance().getArchObjectStack(); if (ArchObjectStack.getLoadStatus() != ArchObjectStack.IS_COMPLETE) { return null; Modified: trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditControl.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditControl.java 2006-05-31 21:39:59 UTC (rev 103) +++ trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditControl.java 2006-05-31 22:05:15 UTC (rev 104) @@ -341,7 +341,7 @@ /** * @return file path of active tab, null if no path is available */ - @Nullable @Nullable final String getActiveFilePath() { + @Nullable final String getActiveFilePath() { if (view != null && opened != null && view.getSelectedIndex() >= 0 && opened.size() > 0) { // get stored path final String path = (String) opened.elementAt(view.getSelectedIndex()); Modified: trunk/crossfire/src/cfeditor/textedit/textarea/DefaultInputHandler.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/DefaultInputHandler.java 2006-05-31 21:39:59 UTC (rev 103) +++ trunk/crossfire/src/cfeditor/textedit/textarea/DefaultInputHandler.java 2006-05-31 22:05:15 UTC (rev 104) @@ -260,7 +260,7 @@ * <code>KeyEvent</code> class, without the <code>VK_</code> prefix. * @param keyStroke a string description of the key stroke */ - @Nullable @Nullable @Nullable public static KeyStroke parseKeyStroke(final String keyStroke) { + @Nullable public static KeyStroke parseKeyStroke(final String keyStroke) { if (keyStroke == null) { return null; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <der...@us...> - 2006-05-31 21:41:03
|
Revision: 103 Author: derdanny Date: 2006-05-31 14:39:59 -0700 (Wed, 31 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=103&view=rev Log Message: ----------- Added @Nullable and @Override annotations. Modified Paths: -------------- trunk/crossfire/src/cfeditor/AutojoinList.java trunk/crossfire/src/cfeditor/BshThread.java trunk/crossfire/src/cfeditor/CArchPanel.java trunk/crossfire/src/cfeditor/CArchPanelPan.java trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/crossfire/src/cfeditor/CFArchTypeList.java trunk/crossfire/src/cfeditor/CFTreasureListTree.java trunk/crossfire/src/cfeditor/CFilterControl.java trunk/crossfire/src/cfeditor/CGUIUtils.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMainToolbar.java trunk/crossfire/src/cfeditor/CMainView.java trunk/crossfire/src/cfeditor/CMapArchPanel.java trunk/crossfire/src/cfeditor/CMapFileDecode.java trunk/crossfire/src/cfeditor/CMapModel.java trunk/crossfire/src/cfeditor/CMapTileList.java trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/CMapViewIFrame.java trunk/crossfire/src/cfeditor/CPickmapPanel.java trunk/crossfire/src/cfeditor/CScriptController.java trunk/crossfire/src/cfeditor/CScriptModel.java trunk/crossfire/src/cfeditor/CScriptView.java trunk/crossfire/src/cfeditor/CStartupScreen.java trunk/crossfire/src/cfeditor/FaceObject.java trunk/crossfire/src/cfeditor/JFontChooser.java trunk/crossfire/src/cfeditor/PluginParameter.java trunk/crossfire/src/cfeditor/PluginParameterFactory.java trunk/crossfire/src/cfeditor/ScriptArchData.java trunk/crossfire/src/cfeditor/TrackedBufferedInputStream.java trunk/crossfire/src/cfeditor/arch/ArchObject.java trunk/crossfire/src/cfeditor/arch/ArchObjectIteratorDeleteArchMapObject.java trunk/crossfire/src/cfeditor/arch/ArchObjectIteratorDeleteMapArch.java trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java trunk/crossfire/src/cfeditor/filter/NamedFilterList.java trunk/crossfire/src/cfeditor/gui/ArchComboBox.java trunk/crossfire/src/cfeditor/gui/CloseableTabbedPane.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/FilterCheckBoxEntry.java trunk/crossfire/src/cfeditor/menu/LocationMenuEntry.java trunk/crossfire/src/cfeditor/menu/SeparatorMenuEntry.java trunk/crossfire/src/cfeditor/menu/SimpleMenuEntry.java trunk/crossfire/src/cfeditor/menu/SwitchedMenuEntry.java trunk/crossfire/src/cfeditor/parameter/ArchParameter.java trunk/crossfire/src/cfeditor/parameter/BooleanParameter.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/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/StringParameter.java trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditControl.java trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditView.java trunk/crossfire/src/cfeditor/textedit/textarea/CTokenMarker.java trunk/crossfire/src/cfeditor/textedit/textarea/DefaultInputHandler.java trunk/crossfire/src/cfeditor/textedit/textarea/HTMLTokenMarker.java trunk/crossfire/src/cfeditor/textedit/textarea/InputHandler.java trunk/crossfire/src/cfeditor/textedit/textarea/JEditTextArea.java trunk/crossfire/src/cfeditor/textedit/textarea/PythonTokenMarker.java trunk/crossfire/src/cfeditor/textedit/textarea/SyntaxDocument.java trunk/crossfire/src/cfeditor/textedit/textarea/SyntaxStyle.java trunk/crossfire/src/cfeditor/textedit/textarea/TextAreaPainter.java trunk/crossfire/src/cfeditor/textedit/textarea/Token.java trunk/daimonin/src/daieditor/gui/map/MapTilePane.java Modified: trunk/crossfire/src/cfeditor/AutojoinList.java =================================================================== --- trunk/crossfire/src/cfeditor/AutojoinList.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/AutojoinList.java 2006-05-31 21:39:59 UTC (rev 103) @@ -30,6 +30,7 @@ import java.io.FileNotFoundException; import java.io.IOException; import org.apache.log4j.Logger; +import org.jetbrains.annotations.Nullable; /** * The <code>AutojoinList</code> class contains a list of (typically wall-)arches which @@ -319,7 +320,7 @@ * @param y location to search * @return arch which is part of this joinlist, null if no such arch exists */ - private ArchObject findArchOfJoinlist(CMapModel map, int x, int y) { + @Nullable private ArchObject findArchOfJoinlist(CMapModel map, int x, int y) { ArchObject tmp_arch = map.getTopArchObject(x, y); // we look through the arches at the given location (top to bottom): for (; tmp_arch != null; tmp_arch = tmp_arch.getPrevArch()) { Modified: trunk/crossfire/src/cfeditor/BshThread.java =================================================================== --- trunk/crossfire/src/cfeditor/BshThread.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/BshThread.java 2006-05-31 21:39:59 UTC (rev 103) @@ -50,7 +50,7 @@ this.script = script; } - public void run() { + @Override public void run() { try { interpreter.set("scriptThread", this); interpreter.eval(script.getCode()); Modified: trunk/crossfire/src/cfeditor/CArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanel.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/CArchPanel.java 2006-05-31 21:39:59 UTC (rev 103) @@ -35,6 +35,7 @@ import javax.swing.JTabbedPane; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; +import org.jetbrains.annotations.Nullable; /** * The <code>CArchPanel</code> holds the tile palette. @@ -145,7 +146,7 @@ } } - public ArchObject getArchPanelSelection() { + @Nullable public ArchObject getArchPanelSelection() { if (selectedPanel == null) { return null; } @@ -275,7 +276,7 @@ * Overridden to store and restore the divider location upon * UI change. */ - public void updateUI() { + @Override public void updateUI() { int dividerLocation = getDividerLocation(); int dividerSize = getDividerSize(); super.updateUI(); Modified: trunk/crossfire/src/cfeditor/CArchPanelPan.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-05-31 21:39:59 UTC (rev 103) @@ -109,7 +109,7 @@ // listening for mouse-click events in the ArchPanel list theList.addMouseListener(new MouseAdapter() { - public void mousePressed(final MouseEvent e) { + @Override public void mousePressed(final MouseEvent e) { // In JDK 1.4 it is required to transfer focus back to mapview after // every click in the panel, otherwise the menu-shortcuts stop working if (mainControl.getCurrentMap() != null && @@ -259,7 +259,7 @@ /* This is the only method defined by ListCellRenderer. We just * reconfigure the Jlabel each time we're called. */ - public Component getListCellRendererComponent(final JList list, + @Override public Component getListCellRendererComponent(final JList list, final Object value, // value to display final int index, // cell index final boolean iss, // is the cell selected Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-05-31 21:39:59 UTC (rev 103) @@ -65,6 +65,7 @@ import javax.swing.text.StyleConstants; import javax.swing.text.StyleContext; import org.apache.log4j.Logger; +import org.jetbrains.annotations.Nullable; /** * CAttribDialog poses the GUI for CF object attributes @@ -162,7 +163,7 @@ // when close-box is selected, execute the 'closeDialog' method and nothing else setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { - public void windowClosing(final WindowEvent event) { + @Override public void windowClosing(final WindowEvent event) { closeDialog(); } }); @@ -558,7 +559,7 @@ * with the central part of the dialog window. * All further calls rebuild the existing tabbedpane and return null. */ - private JScrollPane buildAttr() { + @Nullable private JScrollPane buildAttr() { boolean initialCall = false; if (tabbedPane == null) { @@ -597,7 +598,7 @@ * @param secId the identifier of the section * @return a <code>Component</code> containing the attribute panel */ - private Component makeAttribPanel(final int secId) { + @Nullable private Component makeAttribPanel(final int secId) { int number = 0; // number of attributes in this section boolean isText = false; // true if this section contains a textfield boolean hasBitmask = false; // true if this section contains a bitmask attribute Modified: trunk/crossfire/src/cfeditor/CFArchTypeList.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-05-31 21:39:59 UTC (rev 103) @@ -614,7 +614,7 @@ * The description of this filter. For example: "JPG and GIF Images" * @return filter description */ - public String getDescription() { + @Override public String getDescription() { return "spellist.h"; } @@ -623,7 +623,7 @@ * @param f any file * @return true if the file is accepted as spellist */ - public boolean accept(File f) { + @Override public boolean accept(File f) { return f.isDirectory() || f.getName().equalsIgnoreCase("spellist.h"); } } Modified: trunk/crossfire/src/cfeditor/CFTreasureListTree.java =================================================================== --- trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-05-31 21:39:59 UTC (rev 103) @@ -54,6 +54,7 @@ import javax.swing.tree.DefaultTreeCellRenderer; import javax.swing.tree.TreePath; import org.apache.log4j.Logger; +import org.jetbrains.annotations.Nullable; /** * The CFTreasureListTree class fully manages the Crossfire treausrelists. @@ -207,7 +208,7 @@ * If no attribute dialog is attached, or this dialog is hidden, * null is returned. */ - public static CAttribDialog getParentDialog() { + @Nullable public static CAttribDialog getParentDialog() { if (instance != null && instance.frame != null && instance.frame.isShowing()) { return instance.parentDialog; } @@ -694,7 +695,7 @@ * If nothing is selected, null is returned. * @throws CGridderException when user selected an invalid treasurelist (e.g. a god-list) */ - private String getSelectedTreasureList() throws CGridderException { + @Nullable @Nullable private String getSelectedTreasureList() throws CGridderException { // return null when nothing is selected if (isSelectionEmpty()) { return null; @@ -798,7 +799,7 @@ return clone; } - public String toString() { + @Override public String toString() { return content.toString(); } @@ -858,7 +859,7 @@ * @return String representation of this treasure object. This is * what gets displayed on the tree. */ - public String toString() { + @Override public String toString() { return (nrof == UNSET ? "" : nrof + " ") + name + (type == TREASUREONE_LIST ? " [one]" : "") + (magic == UNSET ? "" : " +" + magic) + (chance == UNSET ? "" : " (" + chance + " %)"); } @@ -958,7 +959,7 @@ } /** The cell-drawing method. */ - public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, + @Override public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { // first use the standard renderer to paint it all super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); Modified: trunk/crossfire/src/cfeditor/CFilterControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CFilterControl.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/CFilterControl.java 2006-05-31 21:39:59 UTC (rev 103) @@ -18,6 +18,7 @@ import cfeditor.menu.BasicMenuEntry; import javax.swing.JComponent; import javax.swing.JMenu; +import org.jetbrains.annotations.Nullable; /** * @author tchize @@ -148,15 +149,15 @@ super("<<set me>>"); } - protected void update() { + @Override protected void update() { // nothing to do } - protected void updateItem(JComponent item) { + @Override protected void updateItem(JComponent item) { // nothing to do } - public JComponent getMenuBarComponent() { + @Override public JComponent getMenuBarComponent() { JMenu menu = new JMenu(getName()); BasicMenuEntry outEntry = filterList.createMenuEntry(filterOutConfig); outEntry.setName("Filter view"); @@ -172,11 +173,11 @@ return menu; } - public JComponent getMenuItemComponent() { + @Override public JComponent getMenuItemComponent() { return getMenuBarComponent(); } - public JComponent getToolbarComponent() { + @Override @Nullable public JComponent getToolbarComponent() { return null; } } Modified: trunk/crossfire/src/cfeditor/CGUIUtils.java =================================================================== --- trunk/crossfire/src/cfeditor/CGUIUtils.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/CGUIUtils.java 2006-05-31 21:39:59 UTC (rev 103) @@ -160,7 +160,7 @@ * @param y The y-coordinate of the pixel. * @param rgb The pixels colour in default RGB ColorModel. */ - public int filterRGB(int x, int y, int rgb) { + @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); Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-05-31 21:39:59 UTC (rev 103) @@ -49,6 +49,7 @@ import javax.swing.UnsupportedLookAndFeelException; import javax.swing.filechooser.FileFilter; import org.apache.log4j.Logger; +import org.jetbrains.annotations.Nullable; import net.sf.japi.util.filter.file.EndingFileFilter; import net.sf.japi.swing.ActionFactory; @@ -965,7 +966,7 @@ * @param initial the view position to show initially * @return The map controller to manipulate this map. */ - public CMapControl openFile(File file, boolean show, Point initial) { + @Nullable @Nullable @Nullable public CMapControl openFile(File file, boolean show, Point initial) { ArchObject start; MapArchObject maparch; CMapControl control = null; @@ -1212,11 +1213,11 @@ fileChooser.setSelectedFile(new File(filename)); // set a file filter for "*.png" files fileChooser.setFileFilter(new FileFilter() { - public String getDescription() { + @Override public String getDescription() { return "*.png"; } - public boolean accept(File f) { + @Override public boolean accept(File f) { return f.isDirectory() || f.getName().endsWith(".png"); } }); Modified: trunk/crossfire/src/cfeditor/CMainToolbar.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainToolbar.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/CMainToolbar.java 2006-05-31 21:39:59 UTC (rev 103) @@ -37,6 +37,7 @@ import javax.swing.JPopupMenu; import javax.swing.JRadioButtonMenuItem; import javax.swing.JToolBar; +import org.jetbrains.annotations.Nullable; /** * <code>CMainTolbar</code> implements the main toolbar of the application. @@ -97,7 +98,7 @@ m_popupMenu = new CPopupMenu(); addMouseListener( new MouseAdapter() { - public void mousePressed(MouseEvent event) { + @Override public void mousePressed(MouseEvent event) { if ((event.getModifiers() & MouseEvent.META_MASK) != 0) { m_popupMenu.show(CMainToolbar.this, event.getX(), event.getY()); } @@ -112,7 +113,7 @@ * @param strLabel The label text. * @return The label text or null if labels should not be visible. */ - private String checkLabel(String strLabel) { + @Nullable private String checkLabel(String strLabel) { if (m_eIconAndLabelVisibility == SHOW_ICONS_ONLY) { return null; } @@ -125,7 +126,7 @@ * @param strIcon The icon name. * @return The icon name or null if icons should not be visible. */ - private String checkIcon(String strIcon) { + @Nullable private String checkIcon(String strIcon) { if (m_eIconAndLabelVisibility == SHOW_LABELS_ONLY) { return null; } Modified: trunk/crossfire/src/cfeditor/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainView.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/CMainView.java 2006-05-31 21:39:59 UTC (rev 103) @@ -46,6 +46,7 @@ import javax.swing.UIManager; import javax.swing.event.InternalFrameEvent; import javax.swing.event.InternalFrameListener; +import org.jetbrains.annotations.Nullable; /** * The main view of the level editor. Contains the "desktop" for internal level @@ -147,7 +148,7 @@ setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener( new WindowAdapter() { - public void windowClosing(WindowEvent event) { + @Override public void windowClosing(WindowEvent event) { mainControl.exitWanted(); } }); @@ -529,7 +530,7 @@ * Returns all level windows that exist in the main view. * @return All level windows */ - Enumeration getAllLevelWindows() { + @Nullable Enumeration getAllLevelWindows() { if (mapViews != null && mapViews.size() > 0) { return mapViews.elements(); } @@ -746,7 +747,7 @@ * Overridden to store and restore the divider location upon * UI change. */ - public void updateUI() { + @Override public void updateUI() { int dividerLocation = getDividerLocation(); int dividerSize = getDividerSize(); super.updateUI(); Modified: trunk/crossfire/src/cfeditor/CMapArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-05-31 21:39:59 UTC (rev 103) @@ -83,11 +83,11 @@ /** Serial Version UID. */ private static final long serialVersionUID = 1L; - public boolean getScrollableTracksViewportWidth() { + @Override public boolean getScrollableTracksViewportWidth() { return getSize().width < getParent().getSize().width; } - public void setSize(Dimension d) { + @Override public void setSize(Dimension d) { if (d.width < getParent().getSize().width) { d.width = getParent().getSize().width; } @@ -922,7 +922,7 @@ * Overridden to store and restore the divider location upon * UI change. */ - public void updateUI() { + @Override public void updateUI() { int dividerLocation = getDividerLocation(); int dividerSize = getDividerSize(); super.updateUI(); Modified: trunk/crossfire/src/cfeditor/CMapFileDecode.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapFileDecode.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/CMapFileDecode.java 2006-05-31 21:39:59 UTC (rev 103) @@ -30,6 +30,7 @@ import java.io.FileReader; import java.io.IOException; import org.apache.log4j.Logger; +import org.jetbrains.annotations.Nullable; /** * This class handles the reading of a mapfile and parsing the data @@ -141,7 +142,7 @@ * @return the new parsed <code>ArchObject</code> * @throws IOException when an I/O-error occured during file reading */ - public ArchObject readArch(BufferedReader myInput, String thisLine, ArchObject container) + @Nullable public ArchObject readArch(BufferedReader myInput, String thisLine, ArchObject container) throws IOException { ArchObject arch; String thisLine2; Modified: trunk/crossfire/src/cfeditor/CMapModel.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapModel.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/CMapModel.java 2006-05-31 21:39:59 UTC (rev 103) @@ -35,6 +35,7 @@ import java.awt.Point; import java.util.Iterator; import org.apache.log4j.Logger; +import org.jetbrains.annotations.Nullable; /** * The level model that represents a level. @@ -100,7 +101,7 @@ * map-tiles panel. * @return the ArchObject to show; the object(s) must not be modified */ - public ArchObject getMouseRightPosObject() { + @Nullable public ArchObject getMouseRightPosObject() { final int mx = m_control.getMapView().getMapMouseRightPos().x; final int my = m_control.getMapView().getMapMouseRightPos().y; @@ -226,7 +227,7 @@ * Return the bottom {@link ArchObject} in the given location. * @return the ArchObject, or null if no object is present */ - public ArchObject getBottomArchObject(final int x, final int y) { + @Nullable public ArchObject getBottomArchObject(final int x, final int y) { if (!pointValid(x, y)) { return null; } @@ -675,7 +676,7 @@ * @param id ID number of arch (-> <code>arch.getMyID()</code>) * @return the specified arch, or null if not found */ - public ArchObject getMapArch(final int id, final int xx, final int yy) { + @Nullable public ArchObject getMapArch(final int id, final int xx, final int yy) { ArchObject node; if (m_mapGrid == null || xx < 0 || xx >= m_mapWidth || yy < 0 || yy >= m_mapHeight) { @@ -708,7 +709,7 @@ * @param id ID number of arch (-> <code>arch.getMyID()</code>) * @return the specified arch, or null if not found */ - public ArchObject findInvObject(final ArchObject node, final int id) { + @Nullable public ArchObject findInvObject(final ArchObject node, final int id) { final Iterator it = node.getInventory(); while (it.hasNext()) { final ArchObject arch = (ArchObject) it.next(); @@ -925,7 +926,7 @@ * teleporter, exit, pit etc.) * @return ArchObject exit-arch if existent, otherwise null */ - public ArchObject getExit() { + @Nullable public ArchObject getExit() { final Point hspot = m_control.getMapView().getHighlightStart(); // selected spot if (hspot.x < 0 || hspot.y < 0) { Modified: trunk/crossfire/src/cfeditor/CMapTileList.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapTileList.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/CMapTileList.java 2006-05-31 21:39:59 UTC (rev 103) @@ -48,6 +48,7 @@ import static javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; +import org.jetbrains.annotations.Nullable; /** * The panel that holds the map-tiles of the selected map square. (The window @@ -153,7 +154,7 @@ * listen for mouse events in the panel */ list.addMouseListener(new MouseAdapter() { - public void mousePressed(MouseEvent e) { + @Override public void mousePressed(MouseEvent e) { if (e.getModifiers() == MouseEvent.BUTTON1_MASK && !e.isShiftDown() && !e.isControlDown()) { // --- left mouse button: select arch --- @@ -227,7 +228,7 @@ }); } - public ArchObject getMapTileSelection() { + @Nullable public ArchObject getMapTileSelection() { // find the selected entry if one int index = list.getSelectedIndex(); if (index >= list.getModel().getSize() || index < 0 @@ -412,7 +413,7 @@ /* This is the only method defined by ListCellRenderer. We just * reconfigure the Jlabel each time we're called. */ - public Component getListCellRendererComponent( + @Override public Component getListCellRendererComponent( JList list, Object value, // value to display int index, // cell index Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-05-31 21:39:59 UTC (rev 103) @@ -51,6 +51,7 @@ import javax.swing.JScrollPane; import javax.swing.JViewport; import org.apache.log4j.Logger; +import org.jetbrains.annotations.Nullable; /** * <code>CMapViewBasic</code> is the true mapview object. However, it is not @@ -407,7 +408,7 @@ * @return a <code>Point</code> array containing the coords of the tiles * which need to be redrawn */ - Point[] calcArchRedraw(ArchObject arch) { + @Nullable @Nullable Point[] calcArchRedraw(ArchObject arch) { if (arch == null) { // safety check return null; } @@ -644,7 +645,7 @@ resizeBackBuffer(); /*taken from java doc, scroll while dragged*/ MouseMotionListener doScrollRectToVisible = new MouseMotionAdapter() { - public void mouseDragged(MouseEvent e) { + @Override public void mouseDragged(MouseEvent e) { Rectangle r = new Rectangle(e.getX(), e.getY(), 1, 1); ((JComponent) e.getSource()).scrollRectToVisible(r); } @@ -688,7 +689,7 @@ return bufImage; } - public void paintComponent(Graphics grfx) { + @Override public void paintComponent(Graphics grfx) { if (isPickmap) { paintComponent((Graphics2D) grfx, false); } else { @@ -1118,7 +1119,7 @@ new Color(0.0f, 1.0f, 1.0f, 0.33f)}; /*taken from java doc, scroll while dragged*/ MouseMotionListener doScrollRectToVisible = new MouseMotionAdapter() { - public void mouseDragged(MouseEvent e) { + @Override public void mouseDragged(MouseEvent e) { Rectangle r = new Rectangle(e.getX(), e.getY(), 1, 1); ((JComponent) e.getSource()).scrollRectToVisible(r); } @@ -1176,7 +1177,7 @@ return bufImage; } - public void paintComponent(Graphics grfx) { + @Override public void paintComponent(Graphics grfx) { paintComponent(grfx, false); } Modified: trunk/crossfire/src/cfeditor/CMapViewIFrame.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewIFrame.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/CMapViewIFrame.java 2006-05-31 21:39:59 UTC (rev 103) @@ -123,7 +123,7 @@ return view.getViewport(); } - public Dimension getSize() { + @Override public Dimension getSize() { return view.getSize(); } @@ -215,7 +215,7 @@ return view.getViewPosition(); } - public void dispose() { + @Override public void dispose() { super.dispose(); /* workaround jvm 1.4 bug, does not free IFrame * so let's free a maximum of ressources used by Modified: trunk/crossfire/src/cfeditor/CPickmapPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CPickmapPanel.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/CPickmapPanel.java 2006-05-31 21:39:59 UTC (rev 103) @@ -33,6 +33,7 @@ import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import org.apache.log4j.Logger; +import org.jetbrains.annotations.Nullable; /** * The <code>CPickmapPanel</code> manages the pickmap panel @@ -210,7 +211,7 @@ * @param maparch the maparch of the pickmap * @return basic mapview */ - private CMapViewBasic newPickmap(ArchObject start, MapArchObject maparch, File mapFile) { + @Nullable private CMapViewBasic newPickmap(ArchObject start, MapArchObject maparch, File mapFile) { CMapControl map; try { map = new CMapControl(mainControl, start, maparch, true, null); Modified: trunk/crossfire/src/cfeditor/CScriptController.java =================================================================== --- trunk/crossfire/src/cfeditor/CScriptController.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/CScriptController.java 2006-05-31 21:39:59 UTC (rev 103) @@ -34,6 +34,7 @@ import org.jdom.input.SAXBuilder; import org.jdom.output.Format; import org.jdom.output.XMLOutputter; +import org.jetbrains.annotations.Nullable; /** * @author tchize @@ -137,11 +138,11 @@ //show a dialog an propose a filename JFileChooser chooser = new JFileChooser(); FileFilter f = new FileFilter() { - public boolean accept(File f) { + @Override public boolean accept(File f) { return f.getName().endsWith(".xml"); } - public String getDescription() { + @Override public String getDescription() { return "cfeditor script (*.xml)"; } }; @@ -214,7 +215,7 @@ } } - public Filter getScriptAsFilter(CScriptModel script) { + @Nullable public Filter getScriptAsFilter(CScriptModel script) { Interpreter runner = new Interpreter(); try { setInterpreterValues(runner, "filter"); @@ -280,7 +281,7 @@ return view; } - public CScriptModel getScript(int index) { + @Nullable public CScriptModel getScript(int index) { Iterator i = scripts.values().iterator(); CScriptModel m = null; while (i.hasNext() && index-- >= 0) { Modified: trunk/crossfire/src/cfeditor/CScriptModel.java =================================================================== --- trunk/crossfire/src/cfeditor/CScriptModel.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/CScriptModel.java 2006-05-31 21:39:59 UTC (rev 103) @@ -17,6 +17,7 @@ import org.jdom.CDATA; import org.jdom.Element; import org.jdom.IllegalDataException; +import org.jetbrains.annotations.Nullable; /** * @author tchize @@ -89,7 +90,7 @@ this.value = value; } - public Object clone() throws CloneNotSupportedException { + @Override public Object clone() throws CloneNotSupportedException { Parameter p = new Parameter(); p.name = new String(name); p.description = new String(description); @@ -137,7 +138,7 @@ * @param index The index number of parameter * @return the name of parameter */ - public String getParamName(int index) { + @Nullable public String getParamName(int index) { try { return ((PluginParameter) params.get(index)).getName(); } catch (Exception e) { @@ -150,7 +151,7 @@ * @param index the parameter index to get * @return Returns the description of a parameter. */ - public String getParamDescription(int index) { + @Nullable public String getParamDescription(int index) { try { return ((PluginParameter) params.get(index)).getDescription(); } catch (Exception e) { @@ -190,7 +191,7 @@ * @param index the parameter index to get * @return Returns the parameter default value. */ - public Object getParamValue(int index) { + @Nullable public Object getParamValue(int index) { try { Object o = ((PluginParameter) params.get(index)).getValue(); return o; @@ -258,7 +259,7 @@ return params.size() - 1; } - public String toString() { + @Override public String toString() { return name; } @@ -294,7 +295,7 @@ * and a clone of each parameter. The listener are not moved along. * @return a clone of this CScriptModel */ - public Object clone() throws CloneNotSupportedException { + @Override public Object clone() throws CloneNotSupportedException { CScriptModel mdl = new CScriptModel(ctrl); mdl.code = new String(code); mdl.name = new String(name); Modified: trunk/crossfire/src/cfeditor/CScriptView.java =================================================================== --- trunk/crossfire/src/cfeditor/CScriptView.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/CScriptView.java 2006-05-31 21:39:59 UTC (rev 103) @@ -180,11 +180,11 @@ } else if (cmd.equals("$$saveas")) { JFileChooser choose = new JFileChooser(); FileFilter filter = new FileFilter() { - public boolean accept(File f) { + @Override public boolean accept(File f) { return f.isFile() && f.getName().endsWith(".xml"); } - public String getDescription() { + @Override public String getDescription() { return "XML script collection (*.xml)"; } }; @@ -196,11 +196,11 @@ } else if (cmd.equals("$$import")) { JFileChooser choose = new JFileChooser(); FileFilter filter = new FileFilter() { - public boolean accept(File f) { + @Override public boolean accept(File f) { return f.isFile() && f.getName().endsWith(".xml") && f.exists() && f.canWrite(); } - public String getDescription() { + @Override public String getDescription() { return "XML script collection (*.xml)"; } }; Modified: trunk/crossfire/src/cfeditor/CStartupScreen.java =================================================================== --- trunk/crossfire/src/cfeditor/CStartupScreen.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/CStartupScreen.java 2006-05-31 21:39:59 UTC (rev 103) @@ -78,7 +78,7 @@ setBounds(bounds); m_clickListener = new MouseAdapter() { - public void mouseClicked(MouseEvent event) { + @Override public void mouseClicked(MouseEvent event) { close(); } }; @@ -108,7 +108,7 @@ * Overridden to paint the loaded startup image. * @param grfx The graphics context to paint to. */ - public void paint(Graphics grfx) { + @Override public void paint(Graphics grfx) { m_image.paintIcon(this, grfx, 0, 0); //grfx.drawImage(pinga, 0, 0, null); } @@ -117,7 +117,7 @@ * Overridden to startup a timer that then closes this window after * a few seconds. */ - public void setVisible(boolean visible) { + @Override public void setVisible(boolean visible) { if (visible) { super.setVisible(true); m_autoCloseTimer = new Timer(3000, new ActionListener() { Modified: trunk/crossfire/src/cfeditor/FaceObject.java =================================================================== --- trunk/crossfire/src/cfeditor/FaceObject.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/FaceObject.java 2006-05-31 21:39:59 UTC (rev 103) @@ -32,6 +32,7 @@ import java.lang.ref.SoftReference; import javax.swing.ImageIcon; import org.apache.log4j.Logger; +import org.jetbrains.annotations.Nullable; /** * The <code>FaceObject</code> @@ -82,7 +83,7 @@ } } - private synchronized ImageIcon loadFace() { + @Nullable private synchronized ImageIcon loadFace() { if (log.isDebugEnabled()) { log.debug("Getting soft reference to " + name); } Modified: trunk/crossfire/src/cfeditor/JFontChooser.java =================================================================== --- trunk/crossfire/src/cfeditor/JFontChooser.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/JFontChooser.java 2006-05-31 21:39:59 UTC (rev 103) @@ -137,7 +137,7 @@ // actionlistener for the font choose-box fontChooser.addComponentListener(new ComponentAdapter() { - public void componentResized(ComponentEvent e) { + @Override public void componentResized(ComponentEvent e) { dialog.pack(); } }); Modified: trunk/crossfire/src/cfeditor/PluginParameter.java =================================================================== --- trunk/crossfire/src/cfeditor/PluginParameter.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/PluginParameter.java 2006-05-31 21:39:59 UTC (rev 103) @@ -114,7 +114,7 @@ setDescription("[description]"); } - public Object clone() throws CloneNotSupportedException { + @Override public Object clone() throws CloneNotSupportedException { return PluginParameterFactory.createParameter(toXML()); } } Modified: trunk/crossfire/src/cfeditor/PluginParameterFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/PluginParameterFactory.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/PluginParameterFactory.java 2006-05-31 21:39:59 UTC (rev 103) @@ -17,6 +17,7 @@ import java.util.LinkedHashMap; import org.apache.log4j.Logger; import org.jdom.Element; +import org.jetbrains.annotations.Nullable; /** * @author tchize @@ -49,7 +50,7 @@ return createParameter(parameterNode.getChildText("type"), parameterNode); } - public static PluginParameter createParameter(String type) { + @Nullable @Nullable public static PluginParameter createParameter(String type) { if (type == null) { type = "java.lang.String"; } @@ -72,7 +73,7 @@ } } - public static PluginParameter createParameter(String type, Element parameterNode) { + @Nullable @Nullable public static PluginParameter createParameter(String type, Element parameterNode) { if (type == null) { type = "java.lang.String"; } Modified: trunk/crossfire/src/cfeditor/ScriptArchData.java =================================================================== --- trunk/crossfire/src/cfeditor/ScriptArchData.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/ScriptArchData.java 2006-05-31 21:39:59 UTC (rev 103) @@ -48,6 +48,7 @@ import javax.swing.JTextField; import static javax.swing.WindowConstants.HIDE_ON_CLOSE; import org.apache.log4j.Logger; +import org.jetbrains.annotations.Nullable; /** * Subclass of ArchObject to store and manage information about scripted events. @@ -246,7 +247,7 @@ * Create a new ScriptArchData instance, identical to this one. * @return a cloned instance of this ScriptArchData object */ - public ScriptArchData getClone() { + @Nullable public ScriptArchData getClone() { if (eventList != null && eventList.size() > 0) { ScriptArchData clone = new ScriptArchData(); // new instance Modified: trunk/crossfire/src/cfeditor/TrackedBufferedInputStream.java =================================================================== --- trunk/crossfire/src/cfeditor/TrackedBufferedInputStream.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/TrackedBufferedInputStream.java 2006-05-31 21:39:59 UTC (rev 103) @@ -37,7 +37,7 @@ /* (non-Javadoc) * @see java.io.InputStream#mark(int) */ - public synchronized void mark(int max) { + @Override public synchronized void mark(int max) { // TODO Auto-generated method stub super.mark(max); lastPosition = position; @@ -46,7 +46,7 @@ /* (non-Javadoc) * @see java.io.InputStream#read() */ - public synchronized int read() throws IOException { + @Override public synchronized int read() throws IOException { // TODO Auto-generated method stub int result = super.read(); if (result >= 0) { @@ -58,7 +58,7 @@ /* (non-Javadoc) * @see java.io.InputStream#read(byte[], int, int) */ - public synchronized int read(byte[] data, int offset, int length) + @Override public synchronized int read(byte[] data, int offset, int length) throws IOException { // TODO Auto-generated method stub int result = super.read(data, offset, length); @@ -71,7 +71,7 @@ /* (non-Javadoc) * @see java.io.InputStream#reset() */ - public synchronized void reset() throws IOException { + @Override public synchronized void reset() throws IOException { // TODO Auto-generated method stub super.reset(); position = lastPosition; @@ -80,7 +80,7 @@ /* (non-Javadoc) * @see java.io.InputStream#skip(long) */ - public synchronized long skip(long count) throws IOException { + @Override public synchronized long skip(long count) throws IOException { // TODO Auto-generated method stub long realSkipped = super.skip(count); position += realSkipped; Modified: trunk/crossfire/src/cfeditor/arch/ArchObject.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObject.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/arch/ArchObject.java 2006-05-31 21:39:59 UTC (rev 103) @@ -42,6 +42,7 @@ import java.util.ListIterator; import javax.swing.JList; import org.apache.log4j.Logger; +import org.jetbrains.annotations.Nullable; /** * The <code>ArchObject</code> class handles the Crossfire arch objects. @@ -696,7 +697,7 @@ multi.setNext(arch); // if this is null and head != null = last tile } - public ArchObject getMapMultiHead() { + @Nullable public ArchObject getMapMultiHead() { if (multi != null) { return multi.getHead(); // this points to head. Heads points to itsself } @@ -704,7 +705,7 @@ return null; } - public ArchObject getMapMultiNext() { + @Nullable public ArchObject getMapMultiNext() { if (multi != null) { return multi.getNext(); // if this is null and head != null = last tile } @@ -1078,7 +1079,7 @@ * @param str string (attribute) to look for * @param ignore_values if true, lines are matched against 'str' only till the first space (" ") */ - private static String diffTextString(String base, String str, boolean ignore_values) { + @Nullable private static String diffTextString(String base, String str, boolean ignore_values) { int i, j; String line = ""; @@ -1134,7 +1135,7 @@ msgText.append(text); } - public String getMsgText() { + @Nullable public String getMsgText() { if (msgText == null) { return null; } @@ -1151,7 +1152,7 @@ animText.append(text); } - public String getAnimText() { + @Nullable public String getAnimText() { if (animText == null) { return null; } @@ -1383,7 +1384,7 @@ * @return A String with all lines which don't match the type-definitions.<br> * If no such "errors" encountered, null is returned. */ - public String getSyntaxErrors(CFArchType type) { + @Nullable @Nullable public String getSyntaxErrors(CFArchType type) { ArchObject defarch = getDefaultArch(); if (typelist != null && archText != null && archText.length() > 0) { Modified: trunk/crossfire/src/cfeditor/arch/ArchObjectIteratorDeleteArchMapObject.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObjectIteratorDeleteArchMapObject.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/arch/ArchObjectIteratorDeleteArchMapObject.java 2006-05-31 21:39:59 UTC (rev 103) @@ -25,7 +25,7 @@ _model = model; } - public void remove() { + @Override public void remove() { if (_currArchObject == null) { throw new IllegalStateException(); } Modified: trunk/crossfire/src/cfeditor/arch/ArchObjectIteratorDeleteMapArch.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObjectIteratorDeleteMapArch.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/arch/ArchObjectIteratorDeleteMapArch.java 2006-05-31 21:39:59 UTC (rev 103) @@ -37,7 +37,7 @@ _join = join; } - public void remove() { + @Override public void remove() { if (_currArchObject == null) { throw new IllegalStateException(); } Modified: trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/arch/ArchObjectParser.java 2006-05-31 21:39:59 UTC (rev 103) @@ -42,6 +42,7 @@ import org.jdom.Element; import org.jdom.JDOMException; import org.jdom.input.SAXBuilder; +import org.jetbrains.annotations.Nullable; /** * The <code>ArchObjectParser</code> class handles the parsing of arches. @@ -185,7 +186,7 @@ * @param arch_name arch-object name (only for artifacts) * @param index current index on the ArchPanel */ - public ArchObject parseDefArchFromStream(BufferedReader myInput, ArchObject def_arch, String line, String arch_name, int index) { + @Nullable public ArchObject parseDefArchFromStream(BufferedReader myInput, ArchObject def_arch, String line, String arch_name, int index) { String thisLine; // read line with trimmed spaces String thisLine2; // read line, original spaces String oldCath, newCath; // display cathegory Modified: trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java 2006-05-31 21:39:59 UTC (rev 103) @@ -60,6 +60,7 @@ import javax.swing.JPanel; import javax.swing.JProgressBar; import org.apache.log4j.Logger; +import org.jetbrains.annotations.Nullable; /** * The <code>ArchObjectStack</code> contains all the default arches. @@ -142,7 +143,7 @@ return archHashTable; } - public ImageIcon getFace(int i) { + @Nullable public ImageIcon getFace(int i) { if (i >= 0 && i < faceListCount) { return faceObjects[i].getFace(); } @@ -150,7 +151,7 @@ return null; } - public String getFaceName(int i) { + @Nullable public String getFaceName(int i) { if (i >= 0 && i < faceListCount) { return faceObjects[i].getName(); } @@ -166,7 +167,7 @@ return faceListCount; } - public ArchObjectNode getNextNode(ArchObjectNode node) { + @Nullable public ArchObjectNode getNextNode(ArchObjectNode node) { if (node == null) { return archNodeList[0]; } @@ -179,7 +180,7 @@ return null; } - public ArchObject getArch(int i) { + @Nullable public ArchObject getArch(int i) { if (i >= 0 && i < archNodeListCount) { return archNodeList[i].arch; } @@ -187,7 +188,7 @@ return null; } - public ArchObject newArchObjectInstance(int i) { + @Nullable public ArchObject newArchObjectInstance(int i) { if (i < 0 && i >= archNodeListCount) { return null; } Modified: trunk/crossfire/src/cfeditor/filter/NamedFilterList.java =================================================================== --- trunk/crossfire/src/cfeditor/filter/NamedFilterList.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/filter/NamedFilterList.java 2006-05-31 21:39:59 UTC (rev 103) @@ -372,13 +372,13 @@ components.add(fc); } - public JComponent getMenuBarComponent() { + @Override public JComponent getMenuBarComponent() { JMenu menu = new JMenu(getName()); populateComponent(menu); return menu; } - public JComponent getMenuItemComponent() { + @Override public JComponent getMenuItemComponent() { JMenu menu = new JMenu(getName()); populateComponent(menu); return menu; @@ -394,7 +394,7 @@ public btnPopup() { btn.addMouseListener(new MouseAdapter() { - public void mousePressed(MouseEvent e) { + @Override public void mousePressed(MouseEvent e) { ppm.show(btn, e.getX(), e.getY()); } }); @@ -405,7 +405,7 @@ } } - public JComponent getToolbarComponent() { + @Override public JComponent getToolbarComponent() { return new btnPopup().getButton(); } @@ -427,10 +427,10 @@ } } - protected void update() { + @Override protected void update() { } - protected void updateItem(JComponent item) { + @Override protected void updateItem(JComponent item) { } } } Modified: trunk/crossfire/src/cfeditor/gui/ArchComboBox.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/ArchComboBox.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/gui/ArchComboBox.java 2006-05-31 21:39:59 UTC (rev 103) @@ -38,6 +38,7 @@ import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import org.apache.log4j.Logger; +import org.jetbrains.annotations.Nullable; /** * @author tchize @@ -254,7 +255,7 @@ /* (non-Javadoc) * @see javax.swing.ComboBoxEditor#getItem() */ - public Object getItem() { + @Nullable public Object getItem() { // TODO Auto-generated method stub return null; } @@ -407,7 +408,7 @@ /* This is the only method defined by ListCellRenderer. We just * reconfigure the Jlabel each time we're called. */ - public Component getListCellRendererComponent(JList list, + @Override public Component getListCellRendererComponent(JList list, Object value, // value to display int index, // cell index boolean iss, // is the cell selected Modified: trunk/crossfire/src/cfeditor/gui/CloseableTabbedPane.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/CloseableTabbedPane.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/gui/CloseableTabbedPane.java 2006-05-31 21:39:59 UTC (rev 103) @@ -100,7 +100,7 @@ setSelectedComponent(component); } - public void addTab(String title, Component component) { + @Override public void addTab(String title, Component component) { addTab(title, component, true); } @@ -108,7 +108,7 @@ protected class ClosingListener extends MouseAdapter { - public void mouseReleased(MouseEvent e) { + @Override public void mouseReleased(MouseEvent e) { int i = getSelectedIndex(); // nothing selected Modified: trunk/crossfire/src/cfeditor/gui/ScriptManager.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/ScriptManager.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/gui/ScriptManager.java 2006-05-31 21:39:59 UTC (rev 103) @@ -30,6 +30,7 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import org.apache.log4j.Logger; +import org.jetbrains.annotations.Nullable; /** * @author tchize @@ -76,7 +77,7 @@ getController().addChangeListener(l); } - public Object getElementAt(int index) { + @Nullable public Object getElementAt(int index) { try { return ctrl.getScript(index); } catch (Exception e) { Modified: trunk/crossfire/src/cfeditor/menu/AggregateMenuLocation.java =================================================================== --- trunk/crossfire/src/cfeditor/menu/AggregateMenuLocation.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/menu/AggregateMenuLocation.java 2006-05-31 21:39:59 UTC (rev 103) @@ -10,6 +10,7 @@ import java.util.LinkedHashMap; import java.util.Set; import org.apache.log4j.Logger; +import org.jetbrains.annotations.Nullable; public class AggregateMenuLocation extends SimpleMenuLocation { @@ -57,7 +58,7 @@ return location; } - public boolean equals(Object obj) { + @Override public boolean equals(Object obj) { if (obj instanceof WrappedMenuLocation) { WrappedMenuLocation loc = (WrappedMenuLocation) obj; return ((loc.name == null ? name == null : loc.equals(name)) && @@ -66,7 +67,7 @@ return false; } - public int hashCode() { + @Override public int hashCode() { return (name == null ? 0 : name.hashCode()) + (location == null ? 0 : location.hashCode()); } @@ -106,7 +107,7 @@ * @param location The location name. This should not include the * AggregateMenuLocation name as parent. It is a relative path. */ - public MenuLocation getMenuLocation(String location) { + @Nullable public MenuLocation getMenuLocation(String location) { WrappedMenuLocation wml = (WrappedMenuLocation) subMenus.get(location); if (wml != null) { return wml.getLocation(); @@ -115,7 +116,7 @@ } } - public boolean contains(MenuEntry entry) { + @Override public boolean contains(MenuEntry entry) { if (super.contains(entry)) { return true; } @@ -128,7 +129,7 @@ return false; } - public void setMenuManager(MenuManager menuManager) { + @Override public void setMenuManager(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-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/menu/BasicAction.java 2006-05-31 21:39:59 UTC (rev 103) @@ -67,7 +67,7 @@ putValue(MNEMONIC_KEY, new Integer(key)); } - public Object getValue(String key) { + @Override public Object getValue(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-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/menu/BasicMenuEntry.java 2006-05-31 21:39:59 UTC (rev 103) @@ -126,7 +126,7 @@ log.debug("Acton performed done"); } - protected void fireUpdate() { + @Override protected void fireUpdate() { log.debug("fireUpdate()"); getBasicAction().setName(getName()); getBasicAction().setActionCommand(getName()); Modified: trunk/crossfire/src/cfeditor/menu/CheckBoxMenuEntry.java =================================================================== --- trunk/crossfire/src/cfeditor/menu/CheckBoxMenuEntry.java 2006-05-31 21:19:48 UTC (rev 102) +++ trunk/crossfire/src/cfeditor/menu/CheckBoxMenuEntry.java 2006-05-31 21:39:59 UTC (rev 103) @@ -55,11 +55,11 @@ } } - protected void update() { + @Override protected void update() { //getModel().setSelected(isChecked()); } - protected void updateItem(JComponent item) { + @Override protected void updateItem(JComponent item) { defaultUpdateItem(item); if (item instanceof JCheckBoxMenuItem) { ((JCheckBoxMenuItem) item).setSelected(isChecked()); @@ -69,11 +69,11 @@ } } - public JComponent getMenuBarComponent() { + @Override public JComponent getMenuBarComponent() { return new JPanel(); // no supported } - public JComponent getMenuItemComponent() { + @Override public JComponent getMenuItemComponent() { log.debug("getMenuItemComponent()"); JCheckBoxMenuItem chk = new JCheckBoxMenuItem(); initItem(chk); @@ -81,14 +81,14 @@ return chk; } - ... [truncated message content] |
From: <aki...@us...> - 2006-05-31 21:19:55
|
Revision: 102 Author: akirschbaum Date: 2006-05-31 14:19:48 -0700 (Wed, 31 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=102&view=rev Log Message: ----------- Add final where possible. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CUndoStack.java Modified: trunk/crossfire/src/cfeditor/CUndoStack.java =================================================================== --- trunk/crossfire/src/cfeditor/CUndoStack.java 2006-05-31 21:16:08 UTC (rev 101) +++ trunk/crossfire/src/cfeditor/CUndoStack.java 2006-05-31 21:19:48 UTC (rev 102) @@ -32,7 +32,7 @@ * Every operation should add itself to the stack using the add() method. * @author <a href="mailto:mic...@no...">Michael Toennies</a> */ -public class CUndoStack { +public final class CUndoStack { /** The controller of the undo stack model. */ private static CMainControl mainControl; @@ -54,12 +54,12 @@ * @param mapControl the level whose undo/redo stack is to be returned * @return the undo/redo stack for the given level */ - public static CUndoStack getInstance(CMapControl mapControl) { + public static CUndoStack getInstance(final CMapControl mapControl) { if (hashFromLevelToStack.containsKey(mapControl)) { return (CUndoStack) hashFromLevelToStack.get(mapControl); } - CUndoStack instance = new CUndoStack(); + final CUndoStack instance = new CUndoStack(); hashFromLevelToStack.put(mapControl, instance); return instance; } @@ -68,7 +68,7 @@ * Sets the main controller of all undo/redo stack models. * @param mainControl the controller of all undo/redo stacks */ - public static void setMainControl(CMainControl mainControl) { + public static void setMainControl(final CMainControl mainControl) { CUndoStack.mainControl = mainControl; } @@ -88,7 +88,7 @@ * Sets the maximum stack size. * @param size the new maximum stack size */ - void setMaxStackSize(int size) { + void setMaxStackSize(final int size) { maxStackSize = size; } @@ -96,7 +96,7 @@ * Adds a new undoable/redoable operation to the undo/redo stack. * @param undoOp the new operation to be added to the stack */ - public void add(IUndoable undoOp) { + public void add(final IUndoable undoOp) { undoStack.add(undoOp); redoStack.removeAllElements(); if (undoStack.size() > maxStackSize) { @@ -115,7 +115,7 @@ */ public boolean canUndo() { if (undoStack.size() > 0) { - IUndoable op = (IUndoable) undoStack.lastElement(); + final IUndoable op = (IUndoable) undoStack.lastElement(); return op.isUndoable(); } @@ -128,7 +128,7 @@ */ public String getUndoName() { if (canUndo()) { - IUndoable op = (IUndoable) undoStack.lastElement(); + final IUndoable op = (IUndoable) undoStack.lastElement(); return op.getName(); } @@ -138,7 +138,7 @@ /** Undoes the last operation in the undo stack. */ public void undo() { if (canUndo()) { - IUndoable op = (IUndoable) undoStack.lastElement(); + final IUndoable op = (IUndoable) undoStack.lastElement(); undoStack.removeElement(op); op.undo(); redoStack.addElement(op); @@ -156,7 +156,7 @@ */ public boolean canRedo() { if (redoStack.size() > 0) { - IUndoable op = (IUndoable) redoStack.lastElement(); + final IUndoable op = (IUndoable) redoStack.lastElement(); return op.isRedoable(); } @@ -169,7 +169,7 @@ */ public String getRedoName() { if (canRedo()) { - IUndoable op = (IUndoable) redoStack.lastElement(); + final IUndoable op = (IUndoable) redoStack.lastElement(); return op.getName(); } @@ -179,7 +179,7 @@ /** Redoes the last operation in the redo stack. */ public void redo() { if (canRedo()) { - IUndoable op = (IUndoable) redoStack.lastElement(); + final IUndoable op = (IUndoable) redoStack.lastElement(); redoStack.removeElement(op); op.redo(); undoStack.addElement(op); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-05-31 21:16:31
|
Revision: 101 Author: akirschbaum Date: 2006-05-31 14:16:08 -0700 (Wed, 31 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=101&view=rev Log Message: ----------- Unify comments and whitespace. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CUndoStack.java trunk/daimonin/src/daieditor/CUndoStack.java Modified: trunk/crossfire/src/cfeditor/CUndoStack.java =================================================================== --- trunk/crossfire/src/cfeditor/CUndoStack.java 2006-05-31 21:10:54 UTC (rev 100) +++ trunk/crossfire/src/cfeditor/CUndoStack.java 2006-05-31 21:16:08 UTC (rev 101) @@ -110,8 +110,8 @@ /** * Returns whether the last operation in the undo stack can be undone. - * @return True if the last operation in the undo stack can be undone, - * false if not + * @return <code>true</code> if the last operation in the undo stack can be + * undone, <code>false</code> if not */ public boolean canUndo() { if (undoStack.size() > 0) { @@ -151,8 +151,8 @@ /** * Returns whether the last operation in the redo stack can be redone. - * @return true if the last operation in the redo stack can be redone, - * false if not + * @return <code>true</code> if the last operation in the redo stack can be + * redone, <code>false</code> if not */ public boolean canRedo() { if (redoStack.size() > 0) { @@ -189,4 +189,5 @@ } } } -} + +} // class CUndoStack Modified: trunk/daimonin/src/daieditor/CUndoStack.java =================================================================== --- trunk/daimonin/src/daieditor/CUndoStack.java 2006-05-31 21:10:54 UTC (rev 100) +++ trunk/daimonin/src/daieditor/CUndoStack.java 2006-05-31 21:16:08 UTC (rev 101) @@ -54,10 +54,9 @@ /** * Returns the undo stack for the given level controller. - * @param mapControl The level whose undo/redo stack is to be returned. - * @return The undo/redo stack for the given level. + * @param mapControl the level whose undo/redo stack is to be returned + * @return the undo/redo stack for the given level */ - public static CUndoStack getInstance(final MapControl mapControl) { if (hashFromLevelToStack.containsKey(mapControl)) { return hashFromLevelToStack.get(mapControl); @@ -70,7 +69,7 @@ /** * Sets the main controller of all undo/redo stack models. - * @param mainControl The controller of all undo/redo stacks. + * @param mainControl the controller of all undo/redo stacks */ public static void setMainControl(final CMainControl mainControl) { CUndoStack.mainControl = mainControl; @@ -82,7 +81,7 @@ /** * Returns the maximum stack size. - * @return The maximum stack size. + * @return the maximum stack size */ int getMaxStackSize() { return maxStackSize; @@ -90,7 +89,7 @@ /** * Sets the maximum stack size. - * @param size The new maximum stack size. + * @param size the new maximum stack size */ void setMaxStackSize(final int size) { maxStackSize = size; @@ -98,7 +97,7 @@ /** * Adds a new undoable/redoable operation to the undo/redo stack. - * @param undoOp The new operation to be added to the stack. + * @param undoOp the new operation to be added to the stack */ public void add(final IUndoable undoOp) { undoStack.add(undoOp); @@ -114,8 +113,8 @@ /** * Returns whether the last operation in the undo stack can be undone. - * @return True if the last operation in the undo stack can be undone, false - * if not. + * @return <code>true</code> if the last operation in the undo stack can be + * undone, <code>false</code> if not */ public boolean canUndo() { if (undoStack.size() > 0) { @@ -128,7 +127,7 @@ /** * Returns the name of the last operation in the undo stack. - * @return The name of the last operation in the undo stack. + * @return the name of the last operation in the undo stack */ public String getUndoName() { if (canUndo()) { @@ -155,8 +154,8 @@ /** * Returns whether the last operation in the redo stack can be redone. - * @return True if the last operation in the redo stack can be redone, false - * if not. + * @return <code>true</code> if the last operation in the redo stack can be + * redone, <code>false</code> if not */ public boolean canRedo() { if (redoStack.size() > 0) { @@ -169,7 +168,7 @@ /** * Returns the name of the last operation in the redo stack. - * @return The name of the last operation in the redo stack. + * @return the name of the last operation in the redo stack */ public String getRedoName() { if (canRedo()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-05-31 21:15:32
|
Revision: 100 Author: akirschbaum Date: 2006-05-31 14:10:54 -0700 (Wed, 31 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=100&view=rev Log Message: ----------- Rename variable names. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CUndoStack.java trunk/daimonin/src/daieditor/CUndoStack.java Modified: trunk/crossfire/src/cfeditor/CUndoStack.java =================================================================== --- trunk/crossfire/src/cfeditor/CUndoStack.java 2006-05-31 21:04:45 UTC (rev 99) +++ trunk/crossfire/src/cfeditor/CUndoStack.java 2006-05-31 21:10:54 UTC (rev 100) @@ -35,41 +35,41 @@ public class CUndoStack { /** The controller of the undo stack model. */ - private static CMainControl mStatic_control; + private static CMainControl mainControl; /** The shared hashtable that maps levels to undo stacks. */ - private static final WeakHashMap m_hashFromLevelToStack = new WeakHashMap(); + private static final WeakHashMap hashFromLevelToStack = new WeakHashMap(); /** The undo stack. Contains all undoable operations. */ - private final Vector m_undoStack = new Vector(10, 10); + private final Vector undoStack = new Vector(10, 10); /** The redo stack. Contains all redoable operations. */ - private final Vector m_redoStack = new Vector(10, 10); + private final Vector redoStack = new Vector(10, 10); /** The maximum size of the stacks. */ - private int m_maxStackSize = 10; + private int maxStackSize = 10; /** * Returns the undo stack for the given level controller. - * @param level the level whose undo/redo stack is to be returned + * @param mapControl the level whose undo/redo stack is to be returned * @return the undo/redo stack for the given level */ - public static CUndoStack getInstance(CMapControl level) { - if (m_hashFromLevelToStack.containsKey(level)) { - return (CUndoStack) m_hashFromLevelToStack.get(level); + public static CUndoStack getInstance(CMapControl mapControl) { + if (hashFromLevelToStack.containsKey(mapControl)) { + return (CUndoStack) hashFromLevelToStack.get(mapControl); } CUndoStack instance = new CUndoStack(); - m_hashFromLevelToStack.put(level, instance); + hashFromLevelToStack.put(mapControl, instance); return instance; } /** * Sets the main controller of all undo/redo stack models. - * @param control the controller of all undo/redo stacks + * @param mainControl the controller of all undo/redo stacks */ - public static void setMainControl(CMainControl control) { - mStatic_control = control; + public static void setMainControl(CMainControl mainControl) { + CUndoStack.mainControl = mainControl; } /** Constructs an undo/redo stack. */ @@ -81,7 +81,7 @@ * @return the maximum stack size */ int getMaxStackSize() { - return m_maxStackSize; + return maxStackSize; } /** @@ -89,7 +89,7 @@ * @param size the new maximum stack size */ void setMaxStackSize(int size) { - m_maxStackSize = size; + maxStackSize = size; } /** @@ -97,14 +97,14 @@ * @param undoOp the new operation to be added to the stack */ public void add(IUndoable undoOp) { - m_undoStack.add(undoOp); - m_redoStack.removeAllElements(); - if (m_undoStack.size() > m_maxStackSize) { - m_undoStack.removeElementAt(0); + undoStack.add(undoOp); + redoStack.removeAllElements(); + if (undoStack.size() > maxStackSize) { + undoStack.removeElementAt(0); } - if (mStatic_control != null) { - mStatic_control.refreshMenusAndToolbars(); + if (mainControl != null) { + mainControl.refreshMenusAndToolbars(); } } @@ -114,8 +114,8 @@ * false if not */ public boolean canUndo() { - if (m_undoStack.size() > 0) { - IUndoable op = (IUndoable) m_undoStack.lastElement(); + if (undoStack.size() > 0) { + IUndoable op = (IUndoable) undoStack.lastElement(); return op.isUndoable(); } @@ -128,7 +128,7 @@ */ public String getUndoName() { if (canUndo()) { - IUndoable op = (IUndoable) m_undoStack.lastElement(); + IUndoable op = (IUndoable) undoStack.lastElement(); return op.getName(); } @@ -138,13 +138,13 @@ /** Undoes the last operation in the undo stack. */ public void undo() { if (canUndo()) { - IUndoable op = (IUndoable) m_undoStack.lastElement(); - m_undoStack.removeElement(op); + IUndoable op = (IUndoable) undoStack.lastElement(); + undoStack.removeElement(op); op.undo(); - m_redoStack.addElement(op); + redoStack.addElement(op); - if (mStatic_control != null) { - mStatic_control.refreshMenusAndToolbars(); + if (mainControl != null) { + mainControl.refreshMenusAndToolbars(); } } } @@ -155,8 +155,8 @@ * false if not */ public boolean canRedo() { - if (m_redoStack.size() > 0) { - IUndoable op = (IUndoable) m_redoStack.lastElement(); + if (redoStack.size() > 0) { + IUndoable op = (IUndoable) redoStack.lastElement(); return op.isRedoable(); } @@ -169,7 +169,7 @@ */ public String getRedoName() { if (canRedo()) { - IUndoable op = (IUndoable) m_redoStack.lastElement(); + IUndoable op = (IUndoable) redoStack.lastElement(); return op.getName(); } @@ -179,13 +179,13 @@ /** Redoes the last operation in the redo stack. */ public void redo() { if (canRedo()) { - IUndoable op = (IUndoable) m_redoStack.lastElement(); - m_redoStack.removeElement(op); + IUndoable op = (IUndoable) redoStack.lastElement(); + redoStack.removeElement(op); op.redo(); - m_undoStack.addElement(op); + undoStack.addElement(op); - if (mStatic_control != null) { - mStatic_control.refreshMenusAndToolbars(); + if (mainControl != null) { + mainControl.refreshMenusAndToolbars(); } } } Modified: trunk/daimonin/src/daieditor/CUndoStack.java =================================================================== --- trunk/daimonin/src/daieditor/CUndoStack.java 2006-05-31 21:04:45 UTC (rev 99) +++ trunk/daimonin/src/daieditor/CUndoStack.java 2006-05-31 21:10:54 UTC (rev 100) @@ -41,7 +41,7 @@ private static CMainControl mainControl; /** The shared hashtable that maps levels to undo stacks. */ - private static final Map<MapControl, CUndoStack> m_hashFromLevelToStack = new WeakHashMap<MapControl, CUndoStack>(); + private static final Map<MapControl, CUndoStack> hashFromLevelToStack = new WeakHashMap<MapControl, CUndoStack>(); /** The undo stack. Contains all undoable operations. */ private final List<IUndoable> undoStack = new ArrayList<IUndoable>(); @@ -59,12 +59,12 @@ */ public static CUndoStack getInstance(final MapControl mapControl) { - if (m_hashFromLevelToStack.containsKey(mapControl)) { - return m_hashFromLevelToStack.get(mapControl); + if (hashFromLevelToStack.containsKey(mapControl)) { + return hashFromLevelToStack.get(mapControl); } final CUndoStack instance = new CUndoStack(); - m_hashFromLevelToStack.put(mapControl, instance); + hashFromLevelToStack.put(mapControl, instance); return instance; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-05-31 21:04:50
|
Revision: 99 Author: akirschbaum Date: 2006-05-31 14:04:45 -0700 (Wed, 31 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=99&view=rev Log Message: ----------- Rename variable names. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CPickmapPanel.java Modified: trunk/crossfire/src/cfeditor/CPickmapPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CPickmapPanel.java 2006-05-31 20:59:01 UTC (rev 98) +++ trunk/crossfire/src/cfeditor/CPickmapPanel.java 2006-05-31 21:04:45 UTC (rev 99) @@ -46,24 +46,24 @@ /** static instance of this class */ private static CPickmapPanel instance; - private final CMainControl m_control; // main control reference + private final CMainControl mainControl; // main control reference private boolean loadComplete; // true when all pickmaps have been loaded (at least one) private JTabbedPane tabpane = null; // tab pane with pickmaps /** all open pickmaps (the map controllers get stored in the vector). */ - private final Hashtable m_pickmaps = new Hashtable(); + private final Hashtable pickmaps = new Hashtable(); /** the current active pickmap ontop */ - private CMapControl m_currentPickMap; + private CMapControl currentPickMap; /** Constructor */ public CPickmapPanel() { - m_control = CMainControl.getInstance(); + mainControl = CMainControl.getInstance(); instance = this; loadComplete = false; - m_currentPickMap = null; + currentPickMap = null; } /** @return instance of this class */ @@ -84,13 +84,13 @@ * or null if there is no pickmap */ public CMapControl getCurrentPickmap() { - return m_currentPickMap; + return currentPickMap; } /** load all pickmaps and build the pickmap-panel in the process */ public void loadPickmaps() { // the main-panel for pickmaps: - tabpane = m_control.getMainView().getPickmapPanel(); + tabpane = mainControl.getMainView().getPickmapPanel(); File pickmapDir = new File((IGUIConstants.isoView ? CMainControl.getInstance().getArchDefaultFolder() + File.separator + IGUIConstants.PICKMAP_DIR : IGUIConstants.PICKMAP_DIR)); if (!pickmapDir.exists() || !pickmapDir.isDirectory()) { @@ -105,14 +105,14 @@ openPickmap(flist[i]); } } - m_control.refreshMenusAndToolbars(); + mainControl.refreshMenusAndToolbars(); // did we get something? - if (!m_pickmaps.isEmpty()) { + if (!pickmaps.isEmpty()) { loadComplete = true; if (IGUIConstants.isoView) { - m_control.getMainView().movePickmapPanelToFront(); + mainControl.getMainView().movePickmapPanelToFront(); } } @@ -131,20 +131,20 @@ MapArchObject maparch; try { - start = m_control.getMapFileDecoder().decodeMapFile(mapFile, m_control); // parse mapfile - maparch = m_control.getMapFileDecoder().getMapArch(); // get map arch + start = mainControl.getMapFileDecoder().decodeMapFile(mapFile, mainControl); // parse mapfile + maparch = mainControl.getMapFileDecoder().getMapArch(); // get map arch if (start == null) { // The map is totally empty bmapview = newPickmap(start, maparch, mapFile); // init the map } else { // go to ArchObjectParser and add the default arch list information to them - if (!m_control.collectTempList(start, mapFile)) { // get face names, face id, etc. + if (!mainControl.collectTempList(start, mapFile)) { // get face names, face id, etc. return false; } - start = m_control.sortTempList(start); // sort the list (put multiparts at the end) + start = mainControl.sortTempList(start); // sort the list (put multiparts at the end) bmapview = newPickmap(start, maparch, mapFile); // init the map - m_control.deleteTempList(start); // remove temp list connection + mainControl.deleteTempList(start); // remove temp list connection } start = null; @@ -181,7 +181,7 @@ File mapFile = new File((IGUIConstants.isoView ? CMainControl.getInstance().getArchDefaultFolder() + File.separator + IGUIConstants.PICKMAP_DIR + File.separator + maparch.getFileName() : IGUIConstants.PICKMAP_DIR + File.separator + maparch.getFileName())); if (mapFile.exists()) { - m_control.showMessage("Cannot Create Pickmap", "A pickmap named '" + mapFile + "' already exists.\n" + + mainControl.showMessage("Cannot Create Pickmap", "A pickmap named '" + mapFile + "' already exists.\n" + "Either remove the existing one or choose a different name.", JOptionPane.ERROR_MESSAGE); return false; } @@ -213,14 +213,14 @@ private CMapViewBasic newPickmap(ArchObject start, MapArchObject maparch, File mapFile) { CMapControl map; try { - map = new CMapControl(m_control, start, maparch, true, null); + map = new CMapControl(mainControl, start, maparch, true, null); map.getMapView().setAutoscrolls(true); map.setMapFile(mapFile); // add pickmap to hashtable - m_pickmaps.put(mapFile.getName(), map); + pickmaps.put(mapFile.getName(), map); - m_currentPickMap = map; + currentPickMap = map; map.getMapModel().resetLevelChangedFlag(); return map.getMapView().getBasicView(); @@ -228,7 +228,7 @@ } catch (CGridderException error) { map = null; log.error("Failed to create new pickmap.", error); - m_control.handleErrors(error); + mainControl.handleErrors(error); } return null; } @@ -243,12 +243,12 @@ String tmpKey = null; boolean mapClosed = false; - Enumeration keyit = m_pickmaps.keys(); + Enumeration keyit = pickmaps.keys(); while (!mapClosed && keyit.hasMoreElements()) { tmpKey = (String) keyit.nextElement(); - tmpMap = (CMapControl) m_pickmaps.get(tmpKey); + tmpMap = (CMapControl) pickmaps.get(tmpKey); if (tmpMap == map) { - m_pickmaps.remove(tmpKey); + pickmaps.remove(tmpKey); tabpane.remove(tmpMap.getMapView().getBasicView()); mapClosed = true; } @@ -267,7 +267,7 @@ */ public void setActivePickmap(String name) { CMapControl tmpMap = null; - tmpMap = (CMapControl) (m_pickmaps.get(name)); + tmpMap = (CMapControl) (pickmaps.get(name)); if (tmpMap != null) { tabpane.setSelectedComponent(tmpMap.getMapView().getBasicView()); } @@ -282,24 +282,24 @@ return; } - if (m_pickmaps.size() == 0) { - m_currentPickMap = null; + if (pickmaps.size() == 0) { + currentPickMap = null; return; } String newName = tabpane.getTitleAt(tabpane.getSelectedIndex()); - tmp = (CMapControl) m_pickmaps.get(newName); + tmp = (CMapControl) pickmaps.get(newName); if (tmp != null && tmp.getMapFileName().equals(newName)) { // this is the new active pickmap - m_currentPickMap = tmp; // <- new pickmap + currentPickMap = tmp; // <- new pickmap foundMap = true; if (log.isDebugEnabled()) { log.debug("new pickmap: " + newName); } } - if (!foundMap && m_control.getMainView().isPickmapActive() && loadComplete) { + if (!foundMap && mainControl.getMainView().isPickmapActive() && loadComplete) { // error: the new selected pickmap couldn't be found log.error("Bad Error in CPickmapPanel.updateActivePickmap: Selected pickmap couldn't be found!"); } @@ -311,7 +311,7 @@ */ public void addPickmapSelectionListener(JTabbedPane pickpane) { pickpane.addChangeListener(new PickmapSelectionListener( - m_control.getMainView(), pickpane)); + mainControl.getMainView(), pickpane)); } /** @@ -321,7 +321,7 @@ */ public void addArchNPickChangeListener(JTabbedPane pane) { pane.addChangeListener(new ArchNPickChangeListener( - m_control.getMainView(), pane)); + mainControl.getMainView(), pane)); } // ------------------------ subclasses ------------------------ @@ -331,17 +331,17 @@ private CMainView mainview; // main view - private String active_pickmap; // file-name of active pickmap + private String activePickmap; // file-name of active pickmap public PickmapSelectionListener(CMainView mv, JTabbedPane pane) { mainview = mv; tabpane = pane; - active_pickmap = null; + activePickmap = null; } public void stateChanged(ChangeEvent e) { - if (active_pickmap == null || active_pickmap.length() <= 0 || - !tabpane.getTitleAt(tabpane.getSelectedIndex()).equals(active_pickmap)) { + if (activePickmap == null || activePickmap.length() <= 0 || + !tabpane.getTitleAt(tabpane.getSelectedIndex()).equals(activePickmap)) { // new pickmap is active updateActivePickmap(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-05-31 20:59:08
|
Revision: 98 Author: akirschbaum Date: 2006-05-31 13:59:01 -0700 (Wed, 31 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=98&view=rev Log Message: ----------- Fix typo in comment. Modified Paths: -------------- trunk/daimonin/src/daieditor/textedit/scripteditor/ScriptEditMenuBar.java Modified: trunk/daimonin/src/daieditor/textedit/scripteditor/ScriptEditMenuBar.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/scripteditor/ScriptEditMenuBar.java 2006-05-31 20:51:28 UTC (rev 97) +++ trunk/daimonin/src/daieditor/textedit/scripteditor/ScriptEditMenuBar.java 2006-05-31 20:59:01 UTC (rev 98) @@ -97,7 +97,7 @@ menuFile.addSeparator(); // ------ final JMenuItem miSaveAs = new JMenuItem("Save As..."); - //m_save.setIcon(CGUIUtils.getIcon(IGUIConstants.SAVE_LEVEL_SMALLICON)); + //miSaveAs.setIcon(CGUIUtils.getIcon(IGUIConstants.SAVE_LEVEL_SMALLICON)); miSaveAs.setMnemonic('v'); miSaveAs.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent event) { @@ -108,7 +108,7 @@ menuFile.add(miSaveAs); miSave = new JMenuItem("Save"); - //m_save.setIcon(CGUIUtils.getIcon(IGUIConstants.SAVE_LEVEL_SMALLICON)); + //miSave.setIcon(CGUIUtils.getIcon(IGUIConstants.SAVE_LEVEL_SMALLICON)); miSave.setMnemonic('S'); miSave.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, Event.CTRL_MASK)); miSave.addActionListener(new ActionListener() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-05-31 20:51:47
|
Revision: 97 Author: akirschbaum Date: 2006-05-31 13:51:28 -0700 (Wed, 31 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=97&view=rev Log Message: ----------- Unify modifiers. Modified Paths: -------------- trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditView.java trunk/daimonin/src/daieditor/textedit/textarea/KeywordMap.java Modified: trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditView.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditView.java 2006-05-31 20:44:06 UTC (rev 96) +++ trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditView.java 2006-05-31 20:51:28 UTC (rev 97) @@ -263,7 +263,7 @@ * @param message the message to be shown * @return true if the user agrees, false if user disagrees */ - public boolean askConfirm(String title, String message) { + public final boolean askConfirm(String title, String message) { return JOptionPane.showConfirmDialog(this, message, title, JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE) == JOptionPane.YES_OPTION; } Modified: trunk/daimonin/src/daieditor/textedit/textarea/KeywordMap.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/textarea/KeywordMap.java 2006-05-31 20:44:06 UTC (rev 96) +++ trunk/daimonin/src/daieditor/textedit/textarea/KeywordMap.java 2006-05-31 20:51:28 UTC (rev 97) @@ -99,11 +99,11 @@ // protected members private final int mapLength; - public final int getStringMapKey(final String s) { + protected final int getStringMapKey(final String s) { return (Character.toUpperCase(s.charAt(0)) + Character.toUpperCase(s.charAt(s.length() - 1))) % mapLength; } - public final int getSegmentMapKey(final Segment s, final int off, final int len) { + protected final int getSegmentMapKey(final Segment s, final int off, final int len) { return (Character.toUpperCase(s.array[off]) + Character.toUpperCase(s.array[off + len - 1])) % mapLength; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-05-31 20:44:14
|
Revision: 96 Author: akirschbaum Date: 2006-05-31 13:44:06 -0700 (Wed, 31 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=96&view=rev Log Message: ----------- Explicitly set default value. Modified Paths: -------------- trunk/daimonin/src/daieditor/textedit/textarea/TextAreaDefaults.java Modified: trunk/daimonin/src/daieditor/textedit/textarea/TextAreaDefaults.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/textarea/TextAreaDefaults.java 2006-05-31 20:42:06 UTC (rev 95) +++ trunk/daimonin/src/daieditor/textedit/textarea/TextAreaDefaults.java 2006-05-31 20:44:06 UTC (rev 96) @@ -93,6 +93,7 @@ DEFAULTS.eolMarkerColor = new Color(0x009999); DEFAULTS.eolMarkers = false; DEFAULTS.paintInvalid = true; + DEFAULTS.popup = null; } return DEFAULTS; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-05-31 20:42:17
|
Revision: 95 Author: akirschbaum Date: 2006-05-31 13:42:06 -0700 (Wed, 31 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=95&view=rev Log Message: ----------- Explicitly initialize variables. Modified Paths: -------------- trunk/daimonin/src/daieditor/textedit/scripteditor/CFPythonPopup.java trunk/daimonin/src/daieditor/textedit/scripteditor/ScriptEditControl.java Modified: trunk/daimonin/src/daieditor/textedit/scripteditor/CFPythonPopup.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/scripteditor/CFPythonPopup.java 2006-05-31 20:29:53 UTC (rev 94) +++ trunk/daimonin/src/daieditor/textedit/scripteditor/CFPythonPopup.java 2006-05-31 20:42:06 UTC (rev 95) @@ -66,11 +66,11 @@ private static ScriptEditControl control; // control object // list of menu entries (all CFPython commands) - private static String[] menuEntries; + private static String[] menuEntries = null; private final CFPythonPopupMenu menu; - private boolean isReady; // true when this menu has been fully initialized + private boolean isReady = false; // true when this menu has been fully initialized private int caretPos; // caret position in document where this popup was opened Modified: trunk/daimonin/src/daieditor/textedit/scripteditor/ScriptEditControl.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/scripteditor/ScriptEditControl.java 2006-05-31 20:29:53 UTC (rev 94) +++ trunk/daimonin/src/daieditor/textedit/scripteditor/ScriptEditControl.java 2006-05-31 20:42:06 UTC (rev 95) @@ -43,10 +43,10 @@ public final class ScriptEditControl { // static instance of this class (there's only one controller and max. one open window) - private static ScriptEditControl instance; + private static ScriptEditControl instance = null; // last active popup is stored here - private static CFPythonPopup activePopup; + private static CFPythonPopup activePopup = null; private static boolean isStandAlone; // if true, this script pad is run stand-alone (without CFJavaEditor) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-05-31 20:30:24
|
Revision: 94 Author: akirschbaum Date: 2006-05-31 13:29:53 -0700 (Wed, 31 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=94&view=rev Log Message: ----------- Unify serialVersionUID definition. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CArchPanel.java trunk/crossfire/src/cfeditor/CArchPanelPan.java trunk/crossfire/src/cfeditor/CArchQuickView.java trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/crossfire/src/cfeditor/CFTreasureListTree.java trunk/crossfire/src/cfeditor/CGridderException.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMainStatusbar.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/ReplaceDialog.java trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java trunk/crossfire/src/cfeditor/textedit/scripteditor/CFPythonPopup.java trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditMenuBar.java trunk/crossfire/src/cfeditor/textedit/textarea/JEditTextArea.java trunk/crossfire/src/cfeditor/textedit/textarea/SyntaxDocument.java trunk/crossfire/src/cfeditor/textedit/textarea/TextAreaPainter.java trunk/daimonin/src/daieditor/CNewMapDialog.java Modified: trunk/crossfire/src/cfeditor/CArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanel.java 2006-05-31 20:15:34 UTC (rev 93) +++ trunk/crossfire/src/cfeditor/CArchPanel.java 2006-05-31 20:29:53 UTC (rev 94) @@ -45,6 +45,9 @@ private static final String ARCHPANEL_LOCATION_KEY = "MainWindowArchPanel.dividerLocation"; + /** Serial Version UID. */ + private static final long serialVersionUID = 1L; + /** Controller of this subview. */ private final CMainControl mainControl; @@ -72,8 +75,6 @@ /** The active panel. */ private CArchPanelPan selectedPanel; - private static final long serialVersionUID = 6634110300452920361L; - /** * Build Panel. * @param mainControl CMainControl @@ -263,7 +264,8 @@ /** Splitpane class that keeps its size even upon L'n'F change. */ public class CSplitPane extends JSplitPane { - private static final long serialVersionUID = -2537906454141191712L; + /** Serial Version UID. */ + private static final long serialVersionUID = 1L; public CSplitPane(final int newOrientation, final Component newLeftComponent, final Component newRightComponent) { super(newOrientation, newLeftComponent, newRightComponent); Modified: trunk/crossfire/src/cfeditor/CArchPanelPan.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-05-31 20:15:34 UTC (rev 93) +++ trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-05-31 20:29:53 UTC (rev 94) @@ -46,6 +46,9 @@ private static final Logger log = Logger.getLogger(CArchPanel.class); + /** Serial Version UID. */ + private static final long serialVersionUID = 1L; + /** Controller of this subview. */ private final CMainControl mainControl; @@ -65,8 +68,6 @@ private final CArchPanel archPanel; - private static final long serialVersionUID = 8690200410771201444L; - /* Build Panel */ CArchPanelPan(final CArchPanel controlPanel, final CMainControl control) { mainControl = control; @@ -252,7 +253,8 @@ class MyCellRenderer extends DefaultListCellRenderer { - private static final long serialVersionUID = 8377835293086371149L; + /** Serial Version UID. */ + 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/CArchQuickView.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchQuickView.java 2006-05-31 20:15:34 UTC (rev 93) +++ trunk/crossfire/src/cfeditor/CArchQuickView.java 2006-05-31 20:29:53 UTC (rev 94) @@ -40,6 +40,9 @@ */ public final class CArchQuickView extends JPanel { + /** Serial Version UID. */ + private static final long serialVersionUID = 1L; + /** Controller of this subview. */ private final CMainControl mainControl; @@ -51,8 +54,6 @@ private final JLabel archTileText = new JLabel(); - private static final long serialVersionUID = -5176382751320643475L; - public CArchQuickView(final CMainControl mainControl) { this.mainControl = mainControl; setLayout(new BorderLayout(1, 1)); Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-05-31 20:15:34 UTC (rev 93) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-05-31 20:29:53 UTC (rev 94) @@ -74,6 +74,9 @@ private static final Logger log = Logger.getLogger(CAttribDialog.class); + /** Serial Version UID. */ + private static final long serialVersionUID = 1L; + private static int width = 395; private static int height = 505; @@ -144,8 +147,6 @@ // text pane where the summary is displayed private final JTextPane summaryTP; - private static final long serialVersionUID = -2698777800337731252L; - /** * Constructor: Creates the GUI layout and * draws the dialog window. Modified: trunk/crossfire/src/cfeditor/CFTreasureListTree.java =================================================================== --- trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-05-31 20:15:34 UTC (rev 93) +++ trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-05-31 20:29:53 UTC (rev 94) @@ -64,6 +64,9 @@ private static final Logger log = Logger.getLogger(CFTreasureListTree.class); + /** Serial Version UID. */ + private static final long serialVersionUID = 1L; + private static final int UNSET = -1; // unset values public static final String NONE_SYM = "<none>"; // string displayed in attribute dialog for "none" @@ -111,8 +114,6 @@ private boolean hasBeenDisplayed; // true when the dialog has been displayed at least once - private static final long serialVersionUID = -3362350382789644304L; - /** * Construct an empty instance of this object. This method is private, * so it is impossible to create non-static instances of this class. @@ -734,10 +735,11 @@ */ private class TreasureTreeNode extends DefaultMutableTreeNode { + /** Serial Version UID. */ + private static final long serialVersionUID = 1L; + private TreasureObj content; // content object - private static final long serialVersionUID = 4780640296551457898L; - /** Construct tree node with specified content object */ public TreasureTreeNode(TreasureObj content) { super(); @@ -913,6 +915,9 @@ */ public class TreasureCellRenderer extends DefaultTreeCellRenderer { + /** Serial Version UID. */ + private static final long serialVersionUID = 1L; + ImageIcon tlistIcon; // icon for treasurelists ImageIcon tlistOneIcon; // icon for treasure-one-lists @@ -929,8 +934,6 @@ Font bold; // bold (editor-)font - private static final long serialVersionUID = -8349083541227770451L; - /** Constructor: Load icons and initialize fonts */ public TreasureCellRenderer() { plain = CMainControl.getInstance().getPlainFont(); Modified: trunk/crossfire/src/cfeditor/CGridderException.java =================================================================== --- trunk/crossfire/src/cfeditor/CGridderException.java 2006-05-31 20:15:34 UTC (rev 93) +++ trunk/crossfire/src/cfeditor/CGridderException.java 2006-05-31 20:29:53 UTC (rev 94) @@ -31,11 +31,12 @@ */ public class CGridderException extends Exception { + /** Serial Version UID. */ + private static final long serialVersionUID = 1L; + /** The originator of the error. */ private final Object originator; - private static final long serialVersionUID = 2251340997369591264L; - public CGridderException(String strMessage) { super(strMessage); originator = null; Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-05-31 20:15:34 UTC (rev 93) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-05-31 20:29:53 UTC (rev 94) @@ -62,6 +62,9 @@ /** ActionFactory. */ private static final ActionFactory ACTION_FACTORY = getFactory("cfeditor"); + /** Serial Version UID. */ + private static final long serialVersionUID = 1L; + private static final Logger log = Logger.getLogger(CMainControl.class); private static CMainControl instance = null; @@ -179,8 +182,6 @@ // pickmaps cannot be edited while lockedPickmaps is true private boolean pickmapsLocked = false; - private static final long serialVersionUID = -3295116201650899981L; - /** Constructs the main controller and its model and view. */ public CMainControl() { archList = new ArchObjectStack(this); Modified: trunk/crossfire/src/cfeditor/CMainStatusbar.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainStatusbar.java 2006-05-31 20:15:34 UTC (rev 93) +++ trunk/crossfire/src/cfeditor/CMainStatusbar.java 2006-05-31 20:29:53 UTC (rev 94) @@ -39,6 +39,9 @@ */ public class CMainStatusbar extends JPanel { + /** Serial Version UID. */ + private static final long serialVersionUID = 1L; + /** The most recent instance of this statusbar class. */ private static CMainStatusbar staticStatusbar = null; @@ -54,8 +57,6 @@ /** The label that shows the memory status. */ private final JLabel memory; - private static final long serialVersionUID = -2203690197582059957L; - /** * Constructs a statusbar that has the given main controller object set * as its controller. Modified: trunk/crossfire/src/cfeditor/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainView.java 2006-05-31 20:15:34 UTC (rev 93) +++ trunk/crossfire/src/cfeditor/CMainView.java 2006-05-31 20:29:53 UTC (rev 94) @@ -55,6 +55,9 @@ */ public class CMainView extends JFrame implements InternalFrameListener { + /** Serial Version UID. */ + private static final long serialVersionUID = 1L; + /** The key used to store the selected L'n'F to INI file. */ public static final String SELECTED_LNF_KEY = "MainWindow.lnfClass"; @@ -128,8 +131,6 @@ /** when true, archpanel is merged into the bottom panel */ private boolean mapTileListBottom = true; - private static final long serialVersionUID = 5901099964603928121L; - /** * Constructs the main view and registers the given main controller. * @param control The controller of this view. @@ -734,7 +735,8 @@ /** Splitpane class that keeps its size even upon L'n'F change. */ public class CSplitPane extends JSplitPane { - private static final long serialVersionUID = -6920886364860860516L; + /** Serial Version UID. */ + private static final long serialVersionUID = 1L; public CSplitPane(int newOrientation, Component newLeftComponent, Component newRightComponent) { super(newOrientation, newLeftComponent, newRightComponent); Modified: trunk/crossfire/src/cfeditor/CMapArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-05-31 20:15:34 UTC (rev 93) +++ trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-05-31 20:29:53 UTC (rev 94) @@ -64,6 +64,9 @@ */ public class CMapArchPanel extends JPanel { + /** Serial Version UID. */ + private static final long serialVersionUID = 1L; + // constants for the 'task' parameter in editScriptWanted() public static final int SCRIPT_OPEN = 0; @@ -71,15 +74,15 @@ public static final int SCRIPT_REMOVE = 2; - private static final long serialVersionUID = -6554873795284046911L; - // MAN! This is one of these java shitholes // 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() { - static final long serialVersionUID = 3639482039166308078L; + /** Serial Version UID. */ + private static final long serialVersionUID = 1L; + public boolean getScrollableTracksViewportWidth() { return getSize().width < getParent().getSize().width; } @@ -906,7 +909,8 @@ /** Splitpane class that keeps its size even upon L'n'F change. */ public class CSplitPane extends JSplitPane { - private static final long serialVersionUID = -3594074332524371595L; + /** Serial Version UID. */ + private static final long serialVersionUID = 1L; public CSplitPane(int newOrientation, Component newLeftComponent, Modified: trunk/crossfire/src/cfeditor/CMapTileList.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapTileList.java 2006-05-31 20:15:34 UTC (rev 93) +++ trunk/crossfire/src/cfeditor/CMapTileList.java 2006-05-31 20:29:53 UTC (rev 94) @@ -57,6 +57,9 @@ */ public class CMapTileList extends JPanel { + /** Serial Version UID. */ + private static final long serialVersionUID = 1L; + /** Controller of this subview. */ private final CMainControl mainControl; @@ -81,8 +84,6 @@ private int lastClickId = -1; - private static final long serialVersionUID = 689572059070059970L; - /* Build Panel */ CMapTileList(final CMainControl mainControl, final CMainView mainView) { this.mainControl = mainControl; @@ -405,7 +406,8 @@ /** Builds the cells in the map-tile panel. */ class MyCellRenderer extends DefaultListCellRenderer { - private static final long serialVersionUID = -3028268444787655019L; + /** Serial Version UID. */ + 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/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-05-31 20:15:34 UTC (rev 93) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-05-31 20:29:53 UTC (rev 94) @@ -65,6 +65,9 @@ private static final Logger log = Logger.getLogger(CMapViewBasic.class); + /** Serial Version UID. */ + private static final long serialVersionUID = 1L; + /** The controller of this view. */ protected final CMapControl mapControl; @@ -106,8 +109,6 @@ // interface for the mapview frame private final CMapViewInterface frameInterface; - private static final long serialVersionUID = -8154666885418364557L; - /** * Constructs a level view. * @param mc the main controller @@ -587,6 +588,9 @@ */ public class CFlatLevelRenderer extends JComponent implements CLevelRenderer { + /** Serial Version UID. */ + private static final long serialVersionUID = 1L; + private final CMapModel _model; // 32x32 Image and Icon for temprary storing tiles before drawing @@ -614,8 +618,6 @@ private AffineTransform renderTransform; - private static final long serialVersionUID = -9207737870257965895L; - /** Constructor */ CFlatLevelRenderer(CMapModel model, boolean pickmap) { _model = model; @@ -1069,6 +1071,9 @@ public class CIsoLevelRenderer extends JComponent implements CLevelRenderer { + /** Serial Version UID. */ + private static final long serialVersionUID = 1L; + private final CMapModel _model; /** 32x32 Image and Icon for temprary storing tiles before drawing */ @@ -1088,8 +1093,6 @@ private Color[] highLightMask; - private static final long serialVersionUID = 3548973038480355383L; - /** Constructor */ CIsoLevelRenderer(CMapModel model, boolean pickmap) { _model = model; Modified: trunk/crossfire/src/cfeditor/CMapViewIFrame.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewIFrame.java 2006-05-31 20:15:34 UTC (rev 93) +++ trunk/crossfire/src/cfeditor/CMapViewIFrame.java 2006-05-31 20:29:53 UTC (rev 94) @@ -46,6 +46,9 @@ */ class CMapViewIFrame extends JInternalFrame implements CMapViewInterface { + /** Serial Version UID. */ + private static final long serialVersionUID = 1L; + /** The controller of this view. */ private final CMapControl mapControl; @@ -54,8 +57,6 @@ /** the underlying mapview object */ private final CMapViewBasic view; - private static final long serialVersionUID = -4058738726219148598L; - /** * Constructs a level view. * @param mc the main controller Modified: trunk/crossfire/src/cfeditor/CNewMapDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CNewMapDialog.java 2006-05-31 20:15:34 UTC (rev 93) +++ trunk/crossfire/src/cfeditor/CNewMapDialog.java 2006-05-31 20:29:53 UTC (rev 94) @@ -54,6 +54,9 @@ */ public class CNewMapDialog extends CDialogBase { + /** Serial Version UID. */ + private static final long serialVersionUID = 1L; + // map types: public static final int TYPE_CFMAP = 0; @@ -92,8 +95,6 @@ private final JPanel newLevelFromScratchPanel; - private static final long serialVersionUID = -9194625062729020248L; - /** * Constructs a new level dialog. Builds the dialog UI. * @param control the controller of this dialog. Modified: trunk/crossfire/src/cfeditor/ReplaceDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/ReplaceDialog.java 2006-05-31 20:15:34 UTC (rev 93) +++ trunk/crossfire/src/cfeditor/ReplaceDialog.java 2006-05-31 20:29:53 UTC (rev 94) @@ -51,6 +51,9 @@ */ public class ReplaceDialog extends JDialog { + /** Serial Version UID. */ + private static final long serialVersionUID = 1L; + // matching criteria public static final int MATCH_ARCH_NAME = 0; @@ -82,8 +85,6 @@ private OkButtonAL okButtonListener; - private static final long serialVersionUID = 7537369527148210456L; - /** * Construct instance. * @param cm Modified: trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java =================================================================== --- trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java 2006-05-31 20:15:34 UTC (rev 93) +++ trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java 2006-05-31 20:29:53 UTC (rev 94) @@ -1511,12 +1511,13 @@ */ private class CollectProgressBar extends JDialog { + /** Serial Version UID. */ + private static final long serialVersionUID = 1L; + JProgressBar bar; // the progress bar JLabel label; - private static final long serialVersionUID = -3633959822875652319L; - /** * Constructor - builds the window layout and shows it * @param max initial maximum of progress points Modified: trunk/crossfire/src/cfeditor/textedit/scripteditor/CFPythonPopup.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/scripteditor/CFPythonPopup.java 2006-05-31 20:15:34 UTC (rev 93) +++ trunk/crossfire/src/cfeditor/textedit/scripteditor/CFPythonPopup.java 2006-05-31 20:29:53 UTC (rev 94) @@ -57,7 +57,7 @@ /** * Serial Version UID. */ - private static final long serialVersionUID = 9041336072540973409L; + private static final long serialVersionUID = 1L; private static ScriptEditControl control; // control object @@ -253,7 +253,7 @@ /** * Serial Version UID. */ - private static final long serialVersionUID = -8559415985336516117L; + private static final long serialVersionUID = 1L; final JComboBox comboBox; Modified: trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditMenuBar.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditMenuBar.java 2006-05-31 20:15:34 UTC (rev 93) +++ trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditMenuBar.java 2006-05-31 20:29:53 UTC (rev 94) @@ -44,7 +44,7 @@ private static final Logger log = Logger.getLogger(ScriptEditMenuBar.class); /** Serial Version UID. */ - private static final long serialVersionUID = -7022723165514964970L; + private static final long serialVersionUID = 1L; private final ScriptEditControl control; // controler object Modified: trunk/crossfire/src/cfeditor/textedit/textarea/JEditTextArea.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/JEditTextArea.java 2006-05-31 20:15:34 UTC (rev 93) +++ trunk/crossfire/src/cfeditor/textedit/textarea/JEditTextArea.java 2006-05-31 20:29:53 UTC (rev 94) @@ -95,7 +95,7 @@ /** * Serial Version UID. */ - private static final long serialVersionUID = -1060281617538289153L; + private static final long serialVersionUID = 1L; /** * Adding components with this name to the text area will place them left @@ -1688,7 +1688,7 @@ /** * Serial Version UID. */ - private static final long serialVersionUID = -906781128141622273L; + private static final long serialVersionUID = 1L; MutableCaretEvent() { super(JEditTextArea.this); @@ -1950,7 +1950,7 @@ /** * Serial Version UID. */ - private static final long serialVersionUID = -7132615163216882489L; + private static final long serialVersionUID = 1L; private int start; Modified: trunk/crossfire/src/cfeditor/textedit/textarea/SyntaxDocument.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/SyntaxDocument.java 2006-05-31 20:15:34 UTC (rev 93) +++ trunk/crossfire/src/cfeditor/textedit/textarea/SyntaxDocument.java 2006-05-31 20:29:53 UTC (rev 94) @@ -27,7 +27,7 @@ /** * Serial Version UID. */ - private static final long serialVersionUID = -6139136741775818702L; + private static final long serialVersionUID = 1L; /** * Returns the token marker that is to be used to split lines of this Modified: trunk/crossfire/src/cfeditor/textedit/textarea/TextAreaPainter.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/TextAreaPainter.java 2006-05-31 20:15:34 UTC (rev 93) +++ trunk/crossfire/src/cfeditor/textedit/textarea/TextAreaPainter.java 2006-05-31 20:29:53 UTC (rev 94) @@ -41,7 +41,7 @@ /** * Serial Version UID. */ - private static final long serialVersionUID = -1248884662241807313L; + private static final long serialVersionUID = 1L; // package-private members private int currentLineIndex; Modified: trunk/daimonin/src/daieditor/CNewMapDialog.java =================================================================== --- trunk/daimonin/src/daieditor/CNewMapDialog.java 2006-05-31 20:15:34 UTC (rev 93) +++ trunk/daimonin/src/daieditor/CNewMapDialog.java 2006-05-31 20:29:53 UTC (rev 94) @@ -60,7 +60,7 @@ */ public final class CNewMapDialog extends JOptionPane { - /** Serial version UID. */ + /** Serial Version UID. */ private static final long serialVersionUID = 1L; /** ActionFactory. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <der...@us...> - 2006-05-31 20:16:15
|
Revision: 93 Author: derdanny Date: 2006-05-31 13:15:34 -0700 (Wed, 31 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=93&view=rev Log Message: ----------- Moved MapCursor, MapGrid and their Event and Listener classes to gridarta/gui/map. Modified Paths: -------------- trunk/daimonin/src/daieditor/CMainStatusbar.java trunk/daimonin/src/daieditor/CMapTileList.java trunk/daimonin/src/daieditor/CMapViewBasic.java trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java trunk/daimonin/src/daieditor/gui/map/MapCursorControl.java trunk/daimonin/src/daieditor/gui/map/MapUserListener.java trunk/daimonin/src/daieditor/map/MapControl.java trunk/daimonin/src/test/daieditor/gui/map/MapCursorTest.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/gui/map/ 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 Removed Paths: ------------- trunk/daimonin/src/daieditor/gui/map/MapCursor.java trunk/daimonin/src/daieditor/gui/map/MapCursorEvent.java trunk/daimonin/src/daieditor/gui/map/MapCursorListener.java trunk/daimonin/src/daieditor/gui/map/MapGrid.java trunk/daimonin/src/daieditor/gui/map/MapGridEvent.java trunk/daimonin/src/daieditor/gui/map/MapGridListener.java Modified: trunk/daimonin/src/daieditor/CMainStatusbar.java =================================================================== --- trunk/daimonin/src/daieditor/CMainStatusbar.java 2006-05-31 15:00:31 UTC (rev 92) +++ trunk/daimonin/src/daieditor/CMainStatusbar.java 2006-05-31 20:15:34 UTC (rev 93) @@ -25,11 +25,7 @@ package daieditor; -import static net.sf.japi.swing.ActionFactory.getFactory; import daieditor.gui.map.DefaultLevelRenderer; -import daieditor.gui.map.MapCursor; -import daieditor.gui.map.MapCursorEvent; -import daieditor.gui.map.MapCursorListener; import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; @@ -40,7 +36,11 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.border.BevelBorder; +import net.sf.gridarta.gui.map.MapCursor; +import net.sf.gridarta.gui.map.MapCursorEvent; +import net.sf.gridarta.gui.map.MapCursorListener; import net.sf.japi.swing.ActionFactory; +import static net.sf.japi.swing.ActionFactory.getFactory; import org.jetbrains.annotations.Nullable; /** Modified: trunk/daimonin/src/daieditor/CMapTileList.java =================================================================== --- trunk/daimonin/src/daieditor/CMapTileList.java 2006-05-31 15:00:31 UTC (rev 92) +++ trunk/daimonin/src/daieditor/CMapTileList.java 2006-05-31 20:15:34 UTC (rev 93) @@ -25,10 +25,7 @@ package daieditor; -import static net.sf.japi.swing.ActionFactory.getFactory; import daieditor.arch.ArchObject; -import daieditor.gui.map.MapCursorEvent; -import daieditor.gui.map.MapCursorListener; import daieditor.map.MapControl; import daieditor.map.MapSquare; import java.awt.BorderLayout; @@ -54,7 +51,10 @@ import static javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; +import net.sf.gridarta.gui.map.MapCursorEvent; +import net.sf.gridarta.gui.map.MapCursorListener; import net.sf.japi.swing.ActionFactory; +import static net.sf.japi.swing.ActionFactory.getFactory; /** * The panel that displays the arches of the currently selected map square. Modified: trunk/daimonin/src/daieditor/CMapViewBasic.java =================================================================== --- trunk/daimonin/src/daieditor/CMapViewBasic.java 2006-05-31 15:00:31 UTC (rev 92) +++ trunk/daimonin/src/daieditor/CMapViewBasic.java 2006-05-31 20:15:34 UTC (rev 93) @@ -26,10 +26,6 @@ import daieditor.arch.ArchObject; import daieditor.gui.map.DefaultLevelRenderer; -import daieditor.gui.map.MapCursor; -import daieditor.gui.map.MapCursorEvent; -import daieditor.gui.map.MapCursorListener; -import daieditor.gui.map.MapGrid; import daieditor.gui.map.MapUserListener; import daieditor.map.MapControl; import daieditor.map.MapModel; @@ -53,6 +49,10 @@ import javax.imageio.ImageIO; import javax.swing.JScrollPane; import javax.swing.JViewport; +import net.sf.gridarta.gui.map.MapCursor; +import net.sf.gridarta.gui.map.MapCursorEvent; +import net.sf.gridarta.gui.map.MapCursorListener; +import net.sf.gridarta.gui.map.MapGrid; import org.jetbrains.annotations.Nullable; /** Modified: trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java 2006-05-31 15:00:31 UTC (rev 92) +++ trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java 2006-05-31 20:15:34 UTC (rev 93) @@ -44,6 +44,9 @@ import java.awt.image.BufferedImage; import java.util.Map; import javax.swing.ImageIcon; +import net.sf.gridarta.gui.map.MapGrid; +import net.sf.gridarta.gui.map.MapGridEvent; +import net.sf.gridarta.gui.map.MapGridListener; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; Deleted: trunk/daimonin/src/daieditor/gui/map/MapCursor.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapCursor.java 2006-05-31 15:00:31 UTC (rev 92) +++ trunk/daimonin/src/daieditor/gui/map/MapCursor.java 2006-05-31 20:15:34 UTC (rev 93) @@ -1,335 +0,0 @@ -/* - * Daimonin Java Editor. - * Copyright (C) 2006 Daniel Viegas - * - * 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.awt.Dimension; -import java.awt.Point; -import java.awt.Rectangle; -import static java.lang.Math.min; -import javax.swing.event.EventListenerList; -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. - */ -public class MapCursor implements MapGridListener { - - /** Current cursor position. When cursor is active it is highlighted on the MapGrid. */ - private final Point pos = new Point(); - - /** Position where dragging has started. */ - private final Point dragStart = new Point(); - - /** Offset of dragging. (0, 0) when drag is on the starting position. */ - private final Dimension dragOffset = new Dimension(); - - /** Is cursor shown? */ - private boolean isOnMap; - - /** Gets set to <code>true</code> when in drag mode. */ - private boolean isDragging; - - /** Grid where cursor is bound to. */ - private MapGrid mapGrid; - - /** Used to test if coordinates are on the map. Created by MapGrid. */ - private final Rectangle mapRec; - - /** Relative coordinates of directions. */ - public static final int[][] direction = { - {0, -1}, // N - {1, 0}, // E - {0, 1}, // S - {-1, 0}, // W - {1, -1}, // NE - {1, 1}, // SE - {-1, 1}, // SW - {-1, -1} // NW - }; - - private final Point tmpPoint = new Point(); - - /** The MapCursorListeners to inform of changes. */ - private EventListenerList listenerList = new EventListenerList(); - - /** - * Construct a cursor - * @param mapGrid Cursor is bound to this grid - */ - public MapCursor(final MapGrid mapGrid) { - this.mapGrid = mapGrid; - mapRec = mapGrid.getMapRec(); - mapGrid.addMapGridListener(this); - deactivate(); - } - - /** - * Get position of cursor - * @return coordinates of cursor or <code>false</code> if cursor is not active - */ - @Nullable public Point getLocation() { - return isOnMap ? pos : null; - } - - /** - * Move cursor to a new location. If new location is not on map, cursor gets disabled. - * @param p New location. If <code>p == null</code> cursor gets disabled - * @return <code>true</code> if cursor position changed or if it gets disabled - */ - public boolean setLocation(@Nullable final Point p) { - boolean hasChanged = true; - if (p != null && mapRec.contains(p)) { - if (isOnMap) { - if (!pos.equals(p)) { - mapGrid.unSetCursor(pos); - pos.setLocation(p); - mapGrid.setCursor(pos); - fireMapCursorChangedPosEvent(); - } else { - hasChanged = false; - } - } else { - pos.setLocation(p); - mapGrid.setCursor(pos); - isOnMap = true; - fireMapCursorChangedModeEvent(); - fireMapCursorChangedPosEvent(); - } - } else if (isOnMap) { - deactivate(); - } else { - hasChanged = false; - } - return hasChanged; - } - - /** - * Move cursor to a new location. If new location is not on map, cursor does not change. - * @param p New location. If <code>p == null</code> nothing happens - * @return <code>true</code> if cursor position changed - */ - public boolean setLocationSafe(@Nullable final Point p) { - boolean hasChanged = true; - if (p != null && mapRec.contains(p)) { - if (isOnMap) { - if (!pos.equals(p)) { - mapGrid.unSetCursor(pos); - pos.setLocation(p); - mapGrid.setCursor(pos); - } else { - hasChanged = false; - } - } else { - pos.setLocation(p); - isOnMap = true; - fireMapCursorChangedModeEvent(); - } - } else { - hasChanged = false; - } - if (hasChanged) { - fireMapCursorChangedPosEvent(); - } - return hasChanged; - } - - /** Set cursor to drag mode when it is active */ - public void dragStart() { - if (isOnMap && !isDragging) { - dragStart.setLocation(pos); - mapGrid.preSelect(dragStart, pos); - isDragging = true; - dragOffset.setSize(0, 0); - fireMapCursorChangedModeEvent(); - } - } - - /** - * When in drag mode and the point is on the map cursor is moved to this position. - * MapGrid changes preselection accordingly - * @param p new coordinates - * @return <code>true</code> when dragging position changed successfully - */ - public boolean dragTo(@Nullable final Point p) { - if (p != null && mapRec.contains(p) && isDragging && !pos.equals(p)) { - mapGrid.unPreSelect(dragStart, pos); - mapGrid.unSetCursor(pos); - pos.setLocation(p); - mapGrid.preSelect(dragStart, pos); - mapGrid.setCursor(pos); - dragOffset.setSize(pos.x - dragStart.x, pos.y - dragStart.y); - fireMapCursorChangedPosEvent(); - return true; - } - return false; - } - - /** Leave drag mode and undo preselection */ - public void dragRelease() { - if (isDragging) { - mapGrid.unPreSelect(dragStart, pos); - isDragging = false; - fireMapCursorChangedModeEvent(); - } - } - - /** - * Leave drag mode and select preselection using selectionMode - * @param selectionMode Mode how to change selection state - * @see MapGrid.SelectionMode - */ - public void dragSelect(final MapGrid.SelectionMode selectionMode) { - if (isDragging) { - dragRelease(); - mapGrid.select(dragStart, pos, selectionMode); - } - } - - /** Cursor gets deactivated. All selections get lost */ - public void deactivate() { - final boolean hasChanged = isOnMap; - isOnMap = false; - isDragging = false; - mapGrid.unSetCursor(pos); - mapGrid.unSelect(); - if (hasChanged) { - fireMapCursorChangedModeEvent(); - fireMapCursorChangedPosEvent(); - } - } - - /** - * Get cursor state - * @return <code>true</code> if cursor is on the map - */ - public boolean isActive() { - return isOnMap; - } - - /** - * Get offset from start position of dragging. - * @return offset or <code>null</code> when not in drag mode - */ - @Nullable public final Dimension getDragOffset() { - if (isDragging) { - return dragOffset; - } else { - return null; - } - } - - /** - * 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 - */ - public boolean isOnGrid(@Nullable final Point p) { - return p != null && mapRec.contains(p); - } - - /** - * Moves the corsor 1 tile relative to current position - * @param dir Index of #direction see #IGUIConstants - * @return <code>true</code> if cursor really moved - */ - public boolean go(final int dir) { - assert dir >= 0 && dir < 8; - if (isOnMap) { - tmpPoint.setLocation(pos.x + direction[dir][0], pos.y + direction[dir][1]); - if (isDragging) { - return dragTo(tmpPoint); - } else { - return setLocationSafe(tmpPoint); - } - } else { - return false; - } - } - - /** Getter of #isDragging */ - public boolean isDragging() { - return isDragging; - } - - /** - * Register a MapCursorListener - * @param listener MapCursorListener to register - */ - public void addMapCursorListener(final MapCursorListener listener) { - listenerList.add(MapCursorListener.class, listener); - } - - /** - * 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 */ - private void fireMapCursorChangedModeEvent() { - final MapCursorEvent e = new MapCursorEvent(this); - final Object[] listeners = listenerList.getListenerList(); - for (int i = listeners.length - 2; i >= 0; i -= 2) { - //noinspection ObjectEquality - if (listeners[i] == MapCursorListener.class) { - ((MapCursorListener) listeners[i + 1]).mapCursorChangedMode(e); - } - } - } - - /** 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(); - for (int i = listeners.length - 2; i >= 0; i -= 2) { - //noinspection ObjectEquality - if (listeners[i] == MapCursorListener.class) { - ((MapCursorListener) listeners[i + 1]).mapCursorChangedPos(e); - } - } - } - - /** {@inheritDoc} */ - public void mapGridChanged(final MapGridEvent e) { - // We can ignore this event. Normally this MapCursor has caused it. - } - - /** {@inheritDoc} */ - public void mapGridResized(final MapGridEvent e) { - // Test if drag start point is outside map -> move inside - if (isDragging && !mapRec.contains(dragStart)) { - dragStart.x = min(dragStart.x, mapRec.width - 1); - dragStart.y = min(dragStart.y, mapRec.height - 1); - } - // Test if cursor position is outside map -> move inside - if (isOnMap && !mapRec.contains(pos)) { - pos.x = min(pos.x, mapRec.width - 1); - pos.y = min(pos.y, mapRec.height - 1); - mapGrid.setCursor(pos); - fireMapCursorChangedPosEvent(); - } - } -} Modified: trunk/daimonin/src/daieditor/gui/map/MapCursorControl.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapCursorControl.java 2006-05-31 15:00:31 UTC (rev 92) +++ trunk/daimonin/src/daieditor/gui/map/MapCursorControl.java 2006-05-31 20:15:34 UTC (rev 93) @@ -28,6 +28,8 @@ import daieditor.arch.ArchObject; import daieditor.map.MapControl; import java.awt.Point; +import net.sf.gridarta.gui.map.MapCursor; +import net.sf.gridarta.gui.map.MapGrid; /** * This class processes events from the cursor menu. Deleted: trunk/daimonin/src/daieditor/gui/map/MapCursorEvent.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapCursorEvent.java 2006-05-31 15:00:31 UTC (rev 92) +++ trunk/daimonin/src/daieditor/gui/map/MapCursorEvent.java 2006-05-31 20:15:34 UTC (rev 93) @@ -1,40 +0,0 @@ -/* - * Daimonin Java Editor. - * Copyright (C) 2006 Daniel Viegas - * - * 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; - -public class MapCursorEvent extends EventObject { - - /** - * Constructs a prototypical Event. - * @param source The object on which the Event initially occurred. - * @throws IllegalArgumentException if source is null. - */ - public MapCursorEvent(final MapCursor source) { - super(source); - } - - @Override public MapCursor getSource() { - return (MapCursor) super.getSource(); - } -} // class MapCursorEvent Deleted: trunk/daimonin/src/daieditor/gui/map/MapCursorListener.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapCursorListener.java 2006-05-31 15:00:31 UTC (rev 92) +++ trunk/daimonin/src/daieditor/gui/map/MapCursorListener.java 2006-05-31 20:15:34 UTC (rev 93) @@ -1,39 +0,0 @@ -/* - * Daimonin Java Editor. - * Copyright (C) 2006 Daniel Viegas - * - * 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; - -public interface MapCursorListener extends EventListener { - - /** - * This event handler is called when {@link MapCursor} has moved, appeared or disappeared. - * @param e MapCursorEvent - */ - void mapCursorChangedPos(MapCursorEvent e); - - /** - * This event handler is called when {@link MapCursor} changes mode (drag, select). - * @param e MapCursorEvent - */ - void mapCursorChangedMode(MapCursorEvent e); -} // interface MapCursorListener Deleted: trunk/daimonin/src/daieditor/gui/map/MapGrid.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapGrid.java 2006-05-31 15:00:31 UTC (rev 92) +++ trunk/daimonin/src/daieditor/gui/map/MapGrid.java 2006-05-31 20:15:34 UTC (rev 93) @@ -1,442 +0,0 @@ -/* - * Daimonin Java Editor. - * Copyright (C) 2006 Daniel Viegas - * - * 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.awt.Dimension; -import java.awt.Point; -import java.awt.Rectangle; -import static java.lang.Math.min; -import javax.swing.event.EventListenerList; -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 - * @author <a href="mailto:dlv...@gm...">Daniel Viegas</a> - */ -public class MapGrid { - - /** 2D-array to store grid flags. */ - private int[][] gridFlags; - - /** Left upper coordinates of rectangle that is beeing processed. */ - private Point cornerMin = new Point(); - - /** Right lower coordinates of rectangle that is beeing processed. */ - private Point cornerMax = new Point(); - - /** Size of <code>gridFlags[][]</code>. */ - private final Dimension gridSize; - - /** 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; - - /** Selecting - used to distinguish the latest selection from the already selected tiles. RFU. */ - public static final int GRID_FLAG_SELECTING = 1 << 1; - - /** Flag to highlight as information. RFU. */ - public static final int GRID_FLAG_INFORMATION = 1 << 2; - - /** Flag to highlight as warning. RFU. */ - public static final int GRID_FLAG_WARNING = 1 << 3; - - /** Flag to highlight as error. RFU. */ - public static final int GRID_FLAG_ERROR = 1 << 4; - - /** Flag to highlight as fatal. RFU. */ - public static final int GRID_FLAG_FATAL = 1 << 5; - - /** Flag to highlight as part of a connection group. RFU. */ - public static final int GRID_FLAG_CONNECTION = 1 << 6; - - /** Flag to highlight cursor position. */ - public static final int GRID_FLAG_CURSOR = 1 << 7; - - /** The MapGridListeners to inform of changes. */ - private EventListenerList listenerList = new EventListenerList(); - - /** Set to size of grid size. Used to test if coordinates are on the map. */ - private final Rectangle mapRec = new Rectangle(); - - /** - * Create a MapGrid - * @param gridSize Size of the grid - */ - public MapGrid(final Dimension gridSize) { - mapRec.setBounds(0, 0, gridSize.width, gridSize.height); - this.gridSize = mapRec.getSize(); - gridFlags = new int[gridSize.width][gridSize.height]; - } - - /** - * Register a MapGridListener - * @param listener MapGridListener to register - */ - public void addMapGridListener(final MapGridListener listener) { - listenerList.add(MapGridListener.class, listener); - } - - /** - * Remove a MapGridListener - * @param listener MapGridListener to remove - */ - public void removeMapGridListener(final MapGridListener listener) { - listenerList.remove(MapGridListener.class, listener); - } - - /** Returns a Rectangle with position and dimension of this grid. */ - public Rectangle getMapRec() { - return mapRec; - } - - /** - * Resize MapGrid. Old flags will be copied to the new grid. - * @param newSize new grid size - */ - public void resize(final Dimension newSize) { - if (gridSize.equals(newSize)) { - // Nothing to do - return; - } - final int[][] newGridFlags = new int[newSize.width][newSize.height]; - final Point pos = new Point(); - final Dimension minSize = new Dimension(); - minSize.width = min(newSize.width, gridSize.width); - minSize.height = min(newSize.height, gridSize.height); - for (pos.x = 0; pos.x < minSize.width; pos.x++) { - for (pos.y = 0; pos.y < minSize.height; pos.y++) { - newGridFlags[pos.x][pos.y] = gridFlags[pos.x][pos.y]; - } - } - gridFlags = newGridFlags; - gridSize.setSize(newSize); - mapRec.setSize(newSize); - fireMapGridResizeEvent(); - } - - /** Inform all registered listeners that the flags on MapGrid have changed. */ - private void fireMapGridChangedEvent() { - final MapGridEvent e = new MapGridEvent(this); - final Object[] listeners = listenerList.getListenerList(); - for (int i = listeners.length - 2; i >= 0; i -= 2) { - //noinspection ObjectEquality - if (listeners[i] == MapGridListener.class) { - ((MapGridListener) listeners[i + 1]).mapGridChanged(e); - } - } - } - - /** Inform all registered listeners that the size of MapGrid has changed. */ - private void fireMapGridResizeEvent() { - final MapGridEvent e = new MapGridEvent(this); - final Object[] listeners = listenerList.getListenerList(); - for (int i = listeners.length - 2; i >= 0; i -= 2) { - //noinspection ObjectEquality - if (listeners[i] == MapGridListener.class) { - ((MapGridListener) listeners[i + 1]).mapGridResized(e); - } - } - } - - /** Clear all selection and pre-selection flags from the grid. */ - public void unSelect() { - for (int x = 0; x < gridSize.width; x++) { - for (int y = 0; y < gridSize.height; y++) { - gridFlags[x][y] &= ~(GRID_FLAG_SELECTION | GRID_FLAG_SELECTING); - } - } - recChange.setBounds(0, 0, gridSize.width, gridSize.height); - fireMapGridChangedEvent(); - } - - /** - * Unhighlight the given cursor position - * @param pos Map coordinates of tile to unhighlight - */ - public void unSetCursor(final Point pos) { - final int tmpFlags = gridFlags[pos.x][pos.y]; - gridFlags[pos.x][pos.y] &= ~GRID_FLAG_CURSOR; - if (tmpFlags != gridFlags[pos.x][pos.y]) { - recChange.setBounds(pos.x, pos.y, 0, 0); - fireMapGridChangedEvent(); - } - } - - /** - * Highlight the given cursor position - * @param pos Map coordinates of tile to highlight - */ - public void setCursor(final Point pos) { - gridFlags[pos.x][pos.y] |= GRID_FLAG_CURSOR; - recChange.setBounds(pos.x, pos.y, 0, 0); - fireMapGridChangedEvent(); - } - - /** - * 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) - */ - public void preSelect(final Point start, final Point end) { - calcRec(start, end); - for (int x = cornerMin.x; x <= cornerMax.x; x++) { - for (int y = cornerMin.y; y <= cornerMax.y; y++) { - gridFlags[x][y] |= GRID_FLAG_SELECTING; - } - } - recChange.setBounds(mapRec); - fireMapGridChangedEvent(); - } - - /** - * 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) - */ - public void unPreSelect(final Point start, final Point end) { - calcRec(start, end); - for (int x = cornerMin.x; x <= cornerMax.x; x++) { - for (int y = cornerMin.y; y <= cornerMax.y; y++) { - gridFlags[x][y] &= ~GRID_FLAG_SELECTING; - } - } - recChange.setBounds(0, 0, gridSize.width, gridSize.height); - fireMapGridChangedEvent(); - } - - /** - * All tiles in the rectangle defined by dragStart and pos that are preselected - * get selected - * @param dragStart First corner of rectangle - * @param pos Opposite corner of rectangle - * @param selectionMode Method how to handle already selected tiles - */ - public void select(final Point dragStart, final Point pos, final SelectionMode selectionMode) { - calcRec(dragStart, pos); - switch (selectionMode) { - case ADD: - for (int x = cornerMin.x; x <= cornerMax.x; x++) { - for (int y = cornerMin.y; y <= cornerMax.y; y++) { - gridFlags[x][y] |= GRID_FLAG_SELECTION; - } - } - break; - case SUB: - for (int x = cornerMin.x; x <= cornerMax.x; x++) { - for (int y = cornerMin.y; y <= cornerMax.y; y++) { - gridFlags[x][y] &= ~GRID_FLAG_SELECTION; - } - } - break; - case FLIP: - for (int x = cornerMin.x; x <= cornerMax.x; x++) { - for (int y = cornerMin.y; y <= cornerMax.y; y++) { - gridFlags[x][y] ^= GRID_FLAG_SELECTION; - } - } - break; - } - recChange.setBounds(cornerMin.x, cornerMin.y, cornerMax.x - cornerMin.x, cornerMax.y - cornerMin.y); - fireMapGridChangedEvent(); - } - - /** <code>minX, maxX, minY, maxY</code>are set according to the the points <code>p1</code>and<code>p2</code> */ - private void calcRec(final Point p1, final Point p2) { - if (p1.x > p2.x) { - cornerMin.x = p2.x; - cornerMax.x = p1.x; - } else { - cornerMin.x = p1.x; - cornerMax.x = p2.x; - } - if (p1.y > p2.y) { - cornerMin.y = p2.y; - cornerMax.y = p1.y; - } else { - cornerMin.y = p1.y; - cornerMax.y = p2.y; - } - } - - /** - * Check if tile has error flag set - * @param p Point to check - * @return <code>true</code> if 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 - * @param x x-coordinate of tile - * @param y y-coordinate of tile - * @return Grid flags - */ - public final int getFlags(final int x, final int y) { - return gridFlags[x][y]; - } - - /** - * Get flags of tile - * @param p coordinates of tile - * @return Grid flags - */ - public final int getFlags(final Point p) { - return gridFlags[p.x][p.y]; - } - - /** - * Get rectangle where grid was changed. - * width and height is 0 for single tiles - * @return changed rectangle - */ - public Rectangle getRecChange() { - return new Rectangle(recChange); - } - - /** - * Get size of grid - * @return Size of grid - */ - public Dimension getSize() { - return gridSize; - } - - /** - * Get smalles rectangle containing selection - * @return Rectangle containing selection or <code>null</code> if nothing is selected - */ - @Nullable public Rectangle getSelectedRec() { - int x1 = -1; - - for (int x = 0; x < gridSize.width; x++) { - for (int y = 0; y < gridSize.height; y++) { - if ((gridFlags[x][y] & GRID_FLAG_SELECTION) > 0) { - x1 = x; - break; - } - } - if (x1 >= 0) { - break; - } - } - if (x1 >= 0) { - int x2 = -1; - for (int x = gridSize.width - 1; x >= x1; x--) { - for (int y = 0; y < gridSize.height; y++) { - if ((gridFlags[x][y] & GRID_FLAG_SELECTION) > 0) { - x2 = x; - break; - } - } - if (x2 >= 0) { - break; - } - } - int y1 = -1; - for (int y = 0; y < gridSize.height; y++) { - for (int x = 0; x < gridSize.width; x++) { - if ((gridFlags[x][y] & GRID_FLAG_SELECTION) > 0) { - y1 = y; - break; - } - } - if (y1 >= 0) { - break; - } - } - int y2 = -1; - for (int y = gridSize.height - 1; y >= y1; y--) { - for (int x = 0; x < gridSize.width; x++) { - if ((gridFlags[x][y] & GRID_FLAG_SELECTION) > 0) { - y2 = y; - break; - } - } - if (y2 >= 0) { - break; - } - } - return new Rectangle(x1, y1, x2 - x1, y2 - y1); - } - return null; - } - - /** Mark all tiles as selected */ - public void selectAll() { - for (int x = 0; x < gridSize.width; x++) { - for (int y = 0; y < gridSize.height; y++) { - gridFlags[x][y] |= GRID_FLAG_SELECTION; - } - } - fireMapGridChangedEvent(); - } - - /** - * Set error flag at given coordinats - * @param x X coordinate - * @param y Y coordinate - */ - public void setError(final int x, final int y) { - final int oldFlags = gridFlags[x][y]; - gridFlags[x][y] |= GRID_FLAG_ERROR; - if (oldFlags != gridFlags[x][y]) { - fireMapGridChangedEvent(); - } - } - - /** Clears all error flags */ - public void clearErrors() { - boolean errorFound = false; - for (int x = 0; x < gridSize.width; x++) { - for (int y = 0; y < gridSize.height; y++) { - if ((gridFlags[x][y] & GRID_FLAG_ERROR) != 0) { - errorFound = true; - gridFlags[x][y] &= ~GRID_FLAG_ERROR; - } - } - } - if (errorFound) { - fireMapGridChangedEvent(); - } - } - - /** Modes that describe how tiles get selected */ - public enum SelectionMode { - - /** All tiles that are preselected get selected */ - ADD, - /** All tiles that are preselected get unselected */ - SUB, - /** All tiles that are preselected change state of selection */ - FLIP - } - -} // class MapGrid Deleted: trunk/daimonin/src/daieditor/gui/map/MapGridEvent.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapGridEvent.java 2006-05-31 15:00:31 UTC (rev 92) +++ trunk/daimonin/src/daieditor/gui/map/MapGridEvent.java 2006-05-31 20:15:34 UTC (rev 93) @@ -1,41 +0,0 @@ -/* - * Daimonin Java Editor. - * Copyright (C) 2006 Daniel Viegas - * - * 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; - -public class MapGridEvent extends EventObject { - - /** - * Constructs a prototypical Event. - * @param source The object on which the Event initially occurred. - * @throws IllegalArgumentException if source is null. - */ - public MapGridEvent(final MapGrid source) { - super(source); - } - - @Override public MapGrid getSource() { - return (MapGrid) super.getSource(); - } - -} // class MapGridEvent Deleted: trunk/daimonin/src/daieditor/gui/map/MapGridListener.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapGridListener.java 2006-05-31 15:00:31 UTC (rev 92) +++ trunk/daimonin/src/daieditor/gui/map/MapGridListener.java 2006-05-31 20:15:34 UTC (rev 93) @@ -1,40 +0,0 @@ -/* - * Daimonin Java Editor. - * Copyright (C) 2006 Daniel Viegas - * - * 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; - -public interface MapGridListener extends EventListener { - - /** - * This event handler is called when flags on {@link MapGrid} have changed. - * @param e MapGridEvent - */ - void mapGridChanged(MapGridEvent e); - - /** - * This event handler is called when size of {@link MapGrid} has changed. - * @param e MapGridEvent - */ - void mapGridResized(MapGridEvent e); - -} // interface MapGridListener Modified: trunk/daimonin/src/daieditor/gui/map/MapUserListener.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapUserListener.java 2006-05-31 15:00:31 UTC (rev 92) +++ trunk/daimonin/src/daieditor/gui/map/MapUserListener.java 2006-05-31 20:15:34 UTC (rev 93) @@ -37,6 +37,8 @@ import static java.awt.event.MouseEvent.BUTTON3; 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 { Modified: trunk/daimonin/src/daieditor/map/MapControl.java =================================================================== --- trunk/daimonin/src/daieditor/map/MapControl.java 2006-05-31 15:00:31 UTC (rev 92) +++ trunk/daimonin/src/daieditor/map/MapControl.java 2006-05-31 20:15:34 UTC (rev 93) @@ -24,7 +24,6 @@ package daieditor.map; -import static net.sf.japi.swing.ActionFactory.getFactory; import daieditor.CMainControl; import daieditor.CMapViewIFrame; import daieditor.CPickmapPanel; @@ -33,8 +32,6 @@ import daieditor.IGUIConstants; import daieditor.arch.ArchObject; import daieditor.gui.map.LevelRenderer; -import daieditor.gui.map.MapCursor; -import daieditor.gui.map.MapGrid; import daieditor.gui.map.SimpleLevelRenderer; import java.awt.Dimension; import java.awt.Graphics; @@ -50,7 +47,10 @@ import java.util.List; import javax.imageio.ImageIO; import javax.swing.ImageIcon; +import net.sf.gridarta.gui.map.MapCursor; +import net.sf.gridarta.gui.map.MapGrid; import net.sf.japi.swing.ActionFactory; +import static net.sf.japi.swing.ActionFactory.getFactory; import org.jetbrains.annotations.Nullable; /** Modified: trunk/daimonin/src/test/daieditor/gui/map/MapCursorTest.java =================================================================== --- trunk/daimonin/src/test/daieditor/gui/map/MapCursorTest.java 2006-05-31 15:00:31 UTC (rev 92) +++ trunk/daimonin/src/test/daieditor/gui/map/MapCursorTest.java 2006-05-31 20:15:34 UTC (rev 93) @@ -21,13 +21,13 @@ package test.daieditor.gui.map; import daieditor.IGUIConstants; -import daieditor.gui.map.MapCursor; -import daieditor.gui.map.MapCursorEvent; -import daieditor.gui.map.MapCursorListener; -import daieditor.gui.map.MapGrid; import java.awt.Dimension; import java.awt.Point; import junit.framework.JUnit4TestAdapter; +import net.sf.gridarta.gui.map.MapCursor; +import net.sf.gridarta.gui.map.MapCursorEvent; +import net.sf.gridarta.gui.map.MapCursorListener; +import net.sf.gridarta.gui.map.MapGrid; import org.junit.AfterClass; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; Copied: trunk/src/app/net/sf/gridarta/gui/map/MapCursor.java (from rev 92, trunk/daimonin/src/daieditor/gui/map/MapCursor.java) =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapCursor.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/map/MapCursor.java 2006-05-31 20:15:34 UTC (rev 93) @@ -0,0 +1,335 @@ +/* + * Daimonin Java Editor. + * Copyright (C) 2006 Daniel Viegas + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + */ + +package net.sf.gridarta.gui.map; + +import java.awt.Dimension; +import java.awt.Point; +import java.awt.Rectangle; +import static java.lang.Math.min; +import javax.swing.event.EventListenerList; +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. + */ +public class MapCursor implements MapGridListener { + + /** Current cursor position. When cursor is active it is highlighted on the MapGrid. */ + private final Point pos = new Point(); + + /** Position where dragging has started. */ + private final Point dragStart = new Point(); + + /** Offset of dragging. (0, 0) when drag is on the starting position. */ + private final Dimension dragOffset = new Dimension(); + + /** Is cursor shown? */ + private boolean isOnMap; + + /** Gets set to <code>true</code> when in drag mode. */ + private boolean isDragging; + + /** Grid where cursor is bound to. */ + private MapGrid mapGrid; + + /** Used to test if coordinates are on the map. Created by MapGrid. */ + private final Rectangle mapRec; + + /** Relative coordinates of directions. */ + public static final int[][] direction = { + {0, -1}, // N + {1, 0}, // E + {0, 1}, // S + {-1, 0}, // W + {1, -1}, // NE + {1, 1}, // SE + {-1, 1}, // SW + {-1, -1} // NW + }; + + private final Point tmpPoint = new Point(); + + /** The MapCursorListeners to inform of changes. */ + private EventListenerList listenerList = new EventListenerList(); + + /** + * Construct a cursor + * @param mapGrid Cursor is bound to this grid + */ + public MapCursor(final MapGrid mapGrid) { + this.mapGrid = mapGrid; + mapRec = mapGrid.getMapRec(); + mapGrid.addMapGridListener(this); + deactivate(); + } + + /** + * Get position of cursor + * @return coordinates of cursor or <code>false</code> if cursor is not active + */ + @Nullable public Point getLocation() { + return isOnMap ? pos : null; + } + + /** + * Move cursor to a new location. If new location is not on map, cursor gets disabled. + * @param p New location. If <code>p == null</code> cursor gets disabled + * @return <code>true</code> if cursor position changed or if it gets disabled + */ + public boolean setLocation(@Nullable final Point p) { + boolean hasChanged = true; + if (p != null && mapRec.contains(p)) { + if (isOnMap) { + if (!pos.equals(p)) { + mapGrid.unSetCursor(pos); + pos.setLocation(p); + mapGrid.setCursor(pos); + fireMapCursorChangedPosEvent(); + } else { + hasChanged = false; + } + } else { + pos.setLocation(p); + mapGrid.setCursor(pos); + isOnMap = true; + fireMapCursorChangedModeEvent(); + fireMapCursorChangedPosEvent(); + } + } else if (isOnMap) { + deactivate(); + } else { + hasChanged = false; + } + return hasChanged; + } + + /** + * Move cursor to a new location. If new location is not on map, cursor does not change. + * @param p New location. If <code>p == null</code> nothing happens + * @return <code>true</code> if cursor position changed + */ + public boolean setLocationSafe(@Nullable final Point p) { + boolean hasChanged = true; + if (p != null && mapRec.contains(p)) { + if (isOnMap) { + if (!pos.equals(p)) { + mapGrid.unSetCursor(pos); + pos.setLocation(p); + mapGrid.setCursor(pos); + } else { + hasChanged = false; + } + } else { + pos.setLocation(p); + isOnMap = true; + fireMapCursorChangedModeEvent(); + } + } else { + hasChanged = false; + } + if (hasChanged) { + fireMapCursorChangedPosEvent(); + } + return hasChanged; + } + + /** Set cursor to drag mode when it is active */ + public void dragStart() { + if (isOnMap && !isDragging) { + dragStart.setLocation(pos); + mapGrid.preSelect(dragStart, pos); + isDragging = true; + dragOffset.setSize(0, 0); + fireMapCursorChangedModeEvent(); + } + } + + /** + * When in drag mode and the point is on the map cursor is moved to this position. + * MapGrid changes preselection accordingly + * @param p new coordinates + * @return <code>true</code> when dragging position changed successfully + */ + public boolean dragTo(@Nullable final Point p) { + if (p != null && mapRec.contains(p) && isDragging && !pos.equals(p)) { + mapGrid.unPreSelect(dragStart, pos); + mapGrid.unSetCursor(pos); + pos.setLocation(p); + mapGrid.preSelect(dragStart, pos); + mapGrid.setCursor(pos); + dragOffset.setSize(pos.x - dragStart.x, pos.y - dragStart.y); + fireMapCursorChangedPosEvent(); + return true; + } + return false; + } + + /** Leave drag mode and undo preselection */ + public void dragRelease() { + if (isDragging) { + mapGrid.unPreSelect(dragStart, pos); + isDragging = false; + fireMapCursorChangedModeEvent(); + } + } + + /** + * Leave drag mode and select preselection using selectionMode + * @param selectionMode Mode how to change selection state + * @see MapGrid.SelectionMode + */ + public void dragSelect(final MapGrid.SelectionMode selectionMode) { + if (isDragging) { + dragRelease(); + mapGrid.select(dragStart, pos, selectionMode); + } + } + + /** Cursor gets deactivated. All selections get lost */ + public void deactivate() { + final boolean hasChanged = isOnMap; + isOnMap = false; + isDragging = false; + mapGrid.unSetCursor(pos); + mapGrid.unSelect(); + if (hasChanged) { + fireMapCursorChangedModeEvent(); + fireMapCursorChangedPosEvent(); + } + } + + /** + * Get cursor state + * @return <code>true</code> if cursor is on the map + */ + public boolean isActive() { + return isOnMap; + } + + /** + * Get offset from start position of dragging. + * @return offset or <code>null</code> when not in drag mode + */ + @Nullable public final Dimension getDragOffset() { + if (isDragging) { + return dragOffset; + } else { + return null; + } + } + + /** + * 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 + */ + public boolean isOnGrid(@Nullable final Point p) { + return p != null && mapRec.contains(p); + } + + /** + * Moves the corsor 1 tile relative to current position + * @param dir Index of #direction see #IGUIConstants + * @return <code>true</code> if cursor really moved + */ + public boolean go(final int dir) { + assert dir >= 0 && dir < 8; + if (isOnMap) { + tmpPoint.setLocation(pos.x + direction[dir][0], pos.y + direction[dir][1]); + if (isDragging) { + return dragTo(tmpPoint); + } else { + return setLocationSafe(tmpPoint); + } + } else { + return false; + } + } + + /** Getter of #isDragging */ + public boolean isDragging() { + return isDragging; + } + + /** + * Register a MapCursorListener + * @param listener MapCursorListener to register + */ + public void addMapCursorListener(final MapCursorListener listener) { + listenerList.add(MapCursorListener.class, listener); + } + + /** + * 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 */ + private void fireMapCursorChangedModeEvent() { + final MapCursorEvent e = new MapCursorEvent(this); + final Object[] listeners = listenerList.getListenerList(); + for (int i = listeners.length - 2; i >= 0; i -= 2) { + //noinspection ObjectEquality + if (listeners[i] == MapCursorListener.class) { + ((MapCursorListener) listeners[i + 1]).mapCursorChangedMode(e); + } + } + } + + /** 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(); + for (int i = listeners.length - 2; i >= 0; i -= 2) { + //noinspection ObjectEquality + if (listeners[i] == MapCursorListener.class) { + ((MapCursorListener) listeners[i + 1]).mapCursorChangedPos(e); + } + } + } + + /** {@inheritDoc} */ + public void mapGridChanged(final MapGridEvent e) { + // We can ignore this event. Normally this MapCursor has caused it. + } + + /** {@inheritDoc} */ + public void mapGridResized(final MapGridEvent e) { + // Test if drag start point is outside map -> move inside + if (isDragging && !mapRec.contains(dragStart)) { + dragStart.x = min(dragStart.x, mapRec.width - 1); + dragStart.y = min(dragStart.y, mapRec.height - 1); + } + // Test if cursor position is outside map -> move inside + if (isOnMap && !mapRec.contains(pos)) { + pos.x = min(pos.x, mapRec.width - 1); + pos.y = min(pos.y, mapRec.height - 1); + mapGrid.setCursor(pos); + fireMapCursorChangedPosEvent(); + } + } +} Copied: trunk/src/app/net/sf/gridarta/gui/map/MapCursorEvent.java (from rev 92, trunk/daimonin/src/daieditor/gui/map/MapCursorEvent.java) =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapCursorEvent.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/map/MapCursorEvent.java 2006-05-31 20:15:34 UTC (rev 93) @@ -0,0 +1,40 @@ +/* + * Daimonin Java Editor. + * Copyright (C) 2006 Daniel Viegas + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + */ + +package net.sf.gridarta.gui.map; + +import java.util.EventObject; + +public class MapCursorEvent extends EventObject { + + /** + * Constructs a prototypical Event. + * @param source The object on which the Event initially occurred. + * @throws IllegalArgumentException if source is null. + */ + public MapCursorEvent(final MapCursor source) { + super(source); + } + + @Override public MapCursor getSource() { + return (MapCursor) super.getSource(); + } +} // class MapCursorEvent Copied: trunk/src/app/net/sf/gridarta/gui/map/MapCursorListener.java (from rev 92, trunk/daimonin/src/daieditor/gui/map/MapCursorListener.java) =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapCursorListener.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/map/MapCursorListener.java 2006-05-31 20:15:34 UTC (rev 93) @@ -0,0 +1,39 @@ +/* + * Daimonin Java Editor. + * Copyright (C) 2006 Daniel Viegas + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + */ + +package net.sf.gridarta.gui.map; + +import java.util.EventListener; + +public interface MapCursorListener extends EventListener { + + /** + * This event handler is called when {@link MapCursor} has moved, appeared or disappeared. + * @param e MapCursorEvent + */ + void mapCursorChangedPos(MapCursorEvent e); + + /** + * This event handler is called when {@link MapCursor} changes mode (drag, select). + * @param e MapCursorEvent + */ + void mapCursorChangedMode(MapCursorEvent e); +} // interface MapCursorListener Copied: trunk/src/app/net/sf/gridarta/gui/map/MapGrid.java (from rev 92, trunk/daimonin/src/daieditor/gui/map/MapGrid.java) =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapGrid.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/map/MapGrid.java 2006-05-31 20:15:34 UTC (rev 93) @@ -0,0 +1,442 @@ +/* + * Daimonin Java Editor. + * Copyright (C) 2006 Daniel Viegas + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + */ + +package net.sf.gridarta.gui.map; + + +import java.awt.Dimension; +import java.awt.Point; +import java.awt.Rectangle; +import static java.lang.Math.min; +import javax.swing.event.EventListenerList; +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 + * @author <a href="mailto:dlv...@gm...">Daniel Viegas</a> + */ +public class MapGrid { + + /** 2D-array to store grid flags. */ + private int[][] gridFlags; + + /** Left upper coordinates of rectangle that is beeing processed. */ + private Point cornerMin = new Point(); + + /** Right lower coordinates of rectangle that is beeing processed. */ + private Point cornerMax = new Point(); + + /** Size of <code>gridFlags[][]</code>. */ + private final Dimension gridSize; + + /** 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; + + /** Selecting - used to distinguish the latest selection from the already selected tiles. RFU. */ + public static final int GRID_FLAG_SELECTING = 1 << 1; + + /** Flag to highlight as information. RFU. */ + public static final int GRID_FLAG_INFORMATION = 1 << 2; + + /** Flag to highlight as warning. RFU. */ + public static final int GRID_FLAG_WARNING = 1 << 3; + + /** Flag to highlight as error. RFU. */ + public static final int GRID_FLAG_ERROR = 1 << 4; + + /** Fla... [truncated message content] |
From: <aki...@us...> - 2006-05-31 15:00:44
|
Revision: 92 Author: akirschbaum Date: 2006-05-31 08:00:31 -0700 (Wed, 31 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=92&view=rev Log Message: ----------- Add final where possible. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CArchPanelPan.java trunk/crossfire/src/cfeditor/CArchQuickView.java trunk/crossfire/src/cfeditor/CAttribBitmask.java trunk/crossfire/src/cfeditor/CAttribDialog.java trunk/crossfire/src/cfeditor/CFArchAttrib.java Modified: trunk/crossfire/src/cfeditor/CArchPanelPan.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-05-31 10:47:20 UTC (rev 91) +++ trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-05-31 15:00:31 UTC (rev 92) @@ -68,7 +68,7 @@ private static final long serialVersionUID = 8690200410771201444L; /* Build Panel */ - CArchPanelPan(CArchPanel controlPanel, CMainControl control) { + CArchPanelPan(final CArchPanel controlPanel, final CMainControl control) { mainControl = control; archPanel = controlPanel; list = new StringBuffer(""); @@ -86,7 +86,7 @@ theList = new JList(model); theList.setCellRenderer(new MyCellRenderer()); theList.setBackground(IGUIConstants.BG_COLOR); - JScrollPane scrollPane = new JScrollPane(theList); + final JScrollPane scrollPane = new JScrollPane(theList); panelDesktop.add(scrollPane, BorderLayout.CENTER); panelDesktop.add(jbox, BorderLayout.NORTH); scrollPane.setAutoscrolls(true); @@ -95,20 +95,20 @@ jbox.setAutoscrolls(true); jbox.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { showArchList(); } }); theList.addListSelectionListener(new ListSelectionListener() { - public void valueChanged(ListSelectionEvent e) { + public void valueChanged(final ListSelectionEvent e) { showArchListObject(e.getFirstIndex()); } }); // listening for mouse-click events in the ArchPanel list theList.addMouseListener(new MouseAdapter() { - public void mousePressed(MouseEvent e) { + public void mousePressed(final MouseEvent e) { // In JDK 1.4 it is required to transfer focus back to mapview after // every click in the panel, otherwise the menu-shortcuts stop working if (mainControl.getCurrentMap() != null && @@ -137,13 +137,13 @@ try { index = Integer.parseInt(theList.getSelectedValue().toString()); arch = mainControl.getArchObjectStack().getArch(index); - } catch (NullPointerException e) { + } catch (final NullPointerException e) { /* log.info("NullPointerException in showArchListObject()!", e); This happens in JDK 1.4 when you select an arch in panel A, then select Panel B, then Panel A again. (why??) */ - } catch (NumberFormatException e) { + } catch (final NumberFormatException e) { } } mainControl.showArchPanelQuickObject(arch); // send it to quick view @@ -155,8 +155,8 @@ * @param archname name of the arch to add * @param index index of subdir where to add */ - public void addArchPanelArch(int archnr, int index) { - String def = "00000"; + public void addArchPanelArch(final int archnr, final int index) { + final String def = "00000"; String num = Integer.toString(archnr); this.list.append(def.substring(0, 5 - num.length())); @@ -169,7 +169,7 @@ this.listcounter++; } - int addArchPanelCombo(String name) { + int addArchPanelCombo(final String name) { this.setEnabled(false); this.jbox.addItem(name); this.setEnabled(true); @@ -194,7 +194,7 @@ * @return an array of nodenumbers from all arches in this panel */ public int[] getListNodeNrArray() { - int[] numList = new int[(int) (list.length() / 10.)]; + final int[] numList = new int[(int) (list.length() / 10.)]; for (int i = 0; i < (int) (list.length() / 10.); i++) { numList[i] = Integer.parseInt(list.substring(0 + 10 * i, 5 + 10 * i)); @@ -211,12 +211,11 @@ * note that the same indices are used for same arches in 'getListNodeNrArray()' */ public String[] getListCathegoryArray() { - String[] cathList = new String[(int) (list.length() / 10.)]; + final String[] cathList = new String[(int) (list.length() / 10.)]; - int index; for (int i = 0; i < (int) (list.length() / 10.); i++) { try { - index = Integer.parseInt(list.substring(5 + 10 * i, 10 + 10 * i)); + final int index = Integer.parseInt(list.substring(5 + 10 * i, 10 + 10 * i)); cathList[i] = jbox.getItemAt(index).toString().trim(); } catch (NullPointerException e) { log.warn("Nullpointer in getListCathegoryArray()!", e); @@ -232,7 +231,7 @@ void showArchList() { int offset = 0; - int index = this.jbox.getSelectedIndex(); + final int index = this.jbox.getSelectedIndex(); this.model.removeAllElements(); @@ -258,11 +257,11 @@ /* This is the only method defined by ListCellRenderer. We just * reconfigure the Jlabel each time we're called. */ - public Component getListCellRendererComponent(JList list, - Object value, // value to display - int index, // cell index - boolean iss, // is the cell selected - boolean chf) { // the list and the cell have the focus + public Component getListCellRendererComponent(final JList list, + final Object value, // value to display + final int index, // cell index + final boolean iss, // is the cell selected + final boolean chf) { // the list and the cell have the focus /* The DefaultListCellRenderer class will take care of * the JLabels text property, it's foreground and background @@ -272,7 +271,7 @@ /* We additionally set the JLabels icon property here. */ - ArchObject arch = mainControl.getArchObjectStack().getArch(Integer.parseInt(value.toString())); + final ArchObject arch = mainControl.getArchObjectStack().getArch(Integer.parseInt(value.toString())); if (iss) { archPanel.setPanelArch(Integer.parseInt(value.toString())); mainControl.setStatusText(" " + value.toString() + " "); Modified: trunk/crossfire/src/cfeditor/CArchQuickView.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchQuickView.java 2006-05-31 10:47:20 UTC (rev 91) +++ trunk/crossfire/src/cfeditor/CArchQuickView.java 2006-05-31 15:00:31 UTC (rev 92) @@ -38,7 +38,7 @@ * The <code>CArchQuickView</code> holds the tile palette. * @author <a href="mailto:mic...@no...">Michael Toennies</a> */ -public class CArchQuickView extends JPanel { +public final class CArchQuickView extends JPanel { /** Controller of this subview. */ private final CMainControl mainControl; @@ -53,7 +53,7 @@ private static final long serialVersionUID = -5176382751320643475L; - public CArchQuickView(CMainControl mainControl) { + public CArchQuickView(final CMainControl mainControl) { this.mainControl = mainControl; setLayout(new BorderLayout(1, 1)); @@ -64,9 +64,9 @@ mainControl.setPlainFont(archTileText); // setup a panel - JPanel panel = new JPanel(); - GridBagLayout gridbag = new GridBagLayout(); - GridBagConstraints c = new GridBagConstraints(); + final JPanel panel = new JPanel(); + final GridBagLayout gridbag = new GridBagLayout(); + final GridBagConstraints c = new GridBagConstraints(); panel.setLayout(gridbag); c.fill = GridBagConstraints.HORIZONTAL; c.ipadx = 0; @@ -102,7 +102,7 @@ panel.add(archTileText); // put it in a scroller - JScrollPane scrollPane = new JScrollPane(panel); + final JScrollPane scrollPane = new JScrollPane(panel); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); setMinimumSize(new Dimension(1, 1)); @@ -110,7 +110,7 @@ } // show quick info of this arch - void showArchPanelQuickObject(ArchObject arch) { + void showArchPanelQuickObject(final ArchObject arch) { if (arch == null) { archArchNameText.setText("<html><font color=black>Arch:</font></html>"); archObjNameText.setText("<html><font color=black>Name:</font></html>"); @@ -121,7 +121,7 @@ archArchNameText.setText("<html><font color=black>Arch: " + arch.getArchName() + "</font></html>"); if (arch.getObjName() == null || arch.getObjName().length() <= 0) { - ArchObject def = arch.getDefaultArch(); + final ArchObject def = arch.getDefaultArch(); if (def == null || def == arch) { archObjNameText.setText("<html><font color=black>Name: -none- </font></html>"); } else if (def.getObjName() != null && def.getObjName().length() > 0) { Modified: trunk/crossfire/src/cfeditor/CAttribBitmask.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribBitmask.java 2006-05-31 10:47:20 UTC (rev 91) +++ trunk/crossfire/src/cfeditor/CAttribBitmask.java 2006-05-31 15:00:31 UTC (rev 92) @@ -48,7 +48,7 @@ * the user, with the help of the attribute dialog. * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ -public class CAttribBitmask { +public final class CAttribBitmask { private static final Logger log = Logger.getLogger(CAttribBitmask.class); @@ -68,7 +68,7 @@ * Constructor of a bitmask (DEPRECATED!) * @param name array of names for the bit-entries */ - public CAttribBitmask(String[] name) { + public CAttribBitmask(final String[] name) { // initialize arrays bitName = new String[name.length + 1]; //bitValue = new int[name.length+1]; @@ -91,7 +91,7 @@ * Constructor of a bitmask from XML element. * @param root xml bitmask element */ - public CAttribBitmask(Element root) { + public CAttribBitmask(final Element root) { int i; List entries = root.getChildren("entry"); @@ -112,7 +112,7 @@ if (bit > maxBit) { maxBit = bit; // this is the highest bit so far } - } catch (DataConversionException e) { + } catch (final DataConversionException e) { log.warn("Parse error: Bitmask bit '" + a.getValue() + "' (" + elem.getAttribute("name").getValue() + ") is not an integer."); elem.detach(); // remove element from DOM tree } @@ -133,7 +133,7 @@ // fill array and assign 2^i values try { bitName[elem.getAttribute("bit").getIntValue() + 1] = elem.getAttribute("name").getValue(); - } catch (DataConversionException e) { + } catch (final DataConversionException e) { } } @@ -164,7 +164,7 @@ * @return <code>true</code> if the bit is active in mask, otherwise * <code>false</code> */ - private boolean isActive(int index, int mask) { + private static boolean isActive(final int index, final int mask) { return ((int) (Math.pow(2., (double) (index - 1))) & mask) != 0; } @@ -177,7 +177,7 @@ * @return <code>JTextArea</code> with all entries belonging to the bitmask * and proper dimensions */ - public JTextArea getText(int value, JTextArea textf) { + public JTextArea getText(final int value, JTextArea textf) { String text = " "; // text string to return int rows = 1; // rows of textarea int columns = 1; // columns of textarea (actually not needed) @@ -238,23 +238,23 @@ } /** Open a popup frame to select bitmask-entries via chooseboxes. */ - public void popupFrame(CAttribDialog attrDialog, CAttribDialog.BitmaskAttrib guiAttr) { - String title = "Choose " + guiAttr.ref.getNameNew().substring(0, 1).toUpperCase() + guiAttr.ref.getNameNew().substring(1); - JDialog frame = new JDialog(attrDialog, title, true); + 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); frame.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); // panels - JPanel mainPanel = new JPanel(); + final JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); - JPanel gridPanel = new JPanel(new GridLayout(1, 2)); - JPanel leftList = new JPanel(); // left column of checkboxes + final JPanel gridPanel = new JPanel(new GridLayout(1, 2)); + final JPanel leftList = new JPanel(); // left column of checkboxes leftList.setLayout(new BoxLayout(leftList, BoxLayout.Y_AXIS)); - JPanel rightList = new JPanel(); // right column of checkboxes + final JPanel rightList = new JPanel(); // right column of checkboxes rightList.setLayout(new BoxLayout(rightList, BoxLayout.Y_AXIS)); - JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); + final JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); // create checkboxes - JCheckBox[] checkbox = new JCheckBox[number]; + final JCheckBox[] checkbox = new JCheckBox[number]; for (int i = 0; i < number; i++) { checkbox[i] = new JCheckBox(" " + bitName[i + 1]); checkbox[i].setSelected(isActive(i + 1, guiAttr.getValue())); @@ -270,14 +270,14 @@ mainPanel.add(gridPanel); // buttons - JButton okButton = new JButton("Ok"); - JButton cancelButton = new JButton("Cancel"); + final JButton okButton = new JButton("Ok"); + final JButton cancelButton = new JButton("Cancel"); buttonPanel.add(okButton); buttonPanel.add(cancelButton); mainPanel.add(buttonPanel); // attach action listener to the buttons - PopupFrameAL listener = new PopupFrameAL(frame, guiAttr, this, checkbox, attrDialog); + final PopupFrameAL listener = new PopupFrameAL(frame, guiAttr, this, checkbox, attrDialog); okButton.addActionListener(listener); cancelButton.addActionListener(listener); @@ -294,15 +294,15 @@ */ private class PopupFrameAL implements ActionListener { - CAttribBitmask bitmask; // reference to this CAttribBitmask instance + final CAttribBitmask bitmask; // reference to this CAttribBitmask instance JDialog frame; // reference to the popup dialog frame - CAttribDialog.BitmaskAttrib guiAttr; // gui attribute instance + final CAttribDialog.BitmaskAttrib guiAttr; // gui attribute instance - JCheckBox[] checkbox; // array of checkboxes on the frame + final JCheckBox[] checkbox; // array of checkboxes on the frame - CAttribDialog attrDialog; // instance of attribute dialog (parent frame) + final CAttribDialog attrDialog; // instance of attribute dialog (parent frame) /** * Contructor @@ -312,8 +312,8 @@ * @param boxarray array of checkboxes in the popup frame * @param newAttrD attribute dialog frame */ - public PopupFrameAL(JDialog newFrame, CAttribDialog.BitmaskAttrib newGuiAttr, - CAttribBitmask newMask, JCheckBox[] boxarray, CAttribDialog newAttrD) { + public PopupFrameAL(final JDialog newFrame, final CAttribDialog.BitmaskAttrib newGuiAttr, + final CAttribBitmask newMask, final JCheckBox[] boxarray, final CAttribDialog newAttrD) { frame = newFrame; guiAttr = newGuiAttr; bitmask = newMask; @@ -325,7 +325,7 @@ * a button was pressed * @param event the occured <code>ActionEvent</code> (button pressed) */ - public void actionPerformed(ActionEvent event) { + public void actionPerformed(final ActionEvent event) { if (event.getSource() instanceof JButton) { // check if the okay button was pressed if (((JButton) event.getSource()).getText().equalsIgnoreCase("Ok")) { Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-05-31 10:47:20 UTC (rev 91) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-05-31 15:00:31 UTC (rev 92) @@ -70,7 +70,7 @@ * CAttribDialog poses the GUI for CF object attributes * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ -public class CAttribDialog extends JDialog { +public final class CAttribDialog extends JDialog { private static final Logger log = Logger.getLogger(CAttribDialog.class); @@ -154,14 +154,14 @@ * @param defaobj the default ArchObject of 'arch' * @param mcntrl main control */ - CAttribDialog(CFArchTypeList atList, ArchObject aobj, ArchObject defaobj, - CMainControl mcntrl) { + CAttribDialog(final CFArchTypeList atList, final ArchObject aobj, final ArchObject defaobj, + final CMainControl mcntrl) { super(mcntrl.getMainView(), "CF Attribute Dialog", false); // when close-box is selected, execute the 'closeDialog' method and nothing else setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent event) { + public void windowClosing(final WindowEvent event) { closeDialog(); } }); @@ -201,7 +201,7 @@ typeFound = true; } else { // check if all the type-attributes match - int argsNum = (int) (tmp.getTypeAttr().length / 2.); + final int argsNum = (int) (tmp.getTypeAttr().length / 2.); boolean match = true; String archvalue; @@ -248,14 +248,14 @@ // get the type data //type = typelist.getType(typeNr); - JPanel layout = new JPanel(new BorderLayout()); // face, name & type + final JPanel layout = new JPanel(new BorderLayout()); // face, name & type // first split top-left and -right - JScrollPane paneLeft = buildHeader(); - JScrollPane paneRight = buildInv(); + final JScrollPane paneLeft = buildHeader(); + final JScrollPane paneRight = buildInv(); //Create a split pane with the two scroll panes in it. - JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, + final JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, paneLeft, paneRight); splitPane.setOneTouchExpandable(false); splitPane.setDividerLocation(width - inventoryWidth - 2 * dividerSize); @@ -270,15 +270,15 @@ paneCenter = buildAttr(); //Create a split pane with the two scroll panes in it. - JSplitPane splitPane2 = new JSplitPane(JSplitPane.VERTICAL_SPLIT, + final JSplitPane splitPane2 = new JSplitPane(JSplitPane.VERTICAL_SPLIT, splitPane, paneCenter); splitPane2.setOneTouchExpandable(false); splitPane2.setDividerLocation(126); splitPane2.setDividerSize(dividerSize); // split horizontally again - JScrollPane paneButtons = buildButtons(); - JSplitPane splitPane3 = new JSplitPane(JSplitPane.VERTICAL_SPLIT, + final JScrollPane paneButtons = buildButtons(); + final JSplitPane splitPane3 = new JSplitPane(JSplitPane.VERTICAL_SPLIT, splitPane2, paneButtons); splitPane3.setOneTouchExpandable(false); //splitPane3.setDividerLocation(height-buttonBarHeight-34); @@ -311,7 +311,7 @@ * lot more difficult, and probably not very convenient. */ public static void setDefaultBounds() { - int fontsize; // size of current font + final int fontsize; // size of current font if (CMainControl.getInstance().getPlainFont() != null) { fontsize = CMainControl.getInstance().getPlainFont().getSize(); @@ -342,18 +342,17 @@ * @return a <code>JPanel</code> with the combo box in it */ private JPanel buildTypesBox(int boxWidth) { - JPanel lineLayout = new JPanel(new FlowLayout(FlowLayout.RIGHT)); // layout for this line - String []namelist = new String[typelist.getLength()]; // list of typenames + final JPanel lineLayout = new JPanel(new FlowLayout(FlowLayout.RIGHT)); // layout for this line + final String []namelist = new String[typelist.getLength()]; // list of typenames // read all type names CFArchType tmp = typelist.getHead().getNext(); - int selection = -1; // position of selected type in the list for (int i = 0; tmp != null; tmp = tmp.getNext(), i++) { namelist[i] = " " + tmp.getTypeName(); } // the active type appears selected in the box - selection = listNr; + final int selection = listNr; lineLayout.add(new JLabel("Type: ")); // create label @@ -378,7 +377,7 @@ * @param attr spell-attribute * @return the completed <code>JComboBox</code> */ - private JComboBox buildSpellBox(CFArchAttrib attr) { + private JComboBox buildSpellBox(final CFArchAttrib attr) { int active = 0; // active selection in the combo box // first parse the spell-number value from arch @@ -402,7 +401,7 @@ } } - JComboBox spellsel = new JComboBox(typelist.getSpellName()); // set "content" + final JComboBox spellsel = new JComboBox(typelist.getSpellName()); // set "content" spellsel.setPreferredSize(new Dimension((textFieldWidth == 0 ? 197 : textFieldWidth), chooseBoxHeight)); spellsel.setSelectedIndex(active); // set active selection spellsel.setMaximumRowCount(10); @@ -420,9 +419,9 @@ * @param listData Vector with list items and corresponding values * @return the completed <code>JComboBox</code> */ - private JComboBox buildArrayBox(CFArchAttrib attr, Vector listData) { + private JComboBox buildArrayBox(final CFArchAttrib attr, final Vector listData) { // build the array of list-items - String []array = new String[(int) (listData.size() / 2.)]; + final String []array = new String[(int) (listData.size() / 2.)]; boolean hasSelection = false; int active = arch.getAttributeValue(attr.getNameOld(), defarch); @@ -438,7 +437,7 @@ active = 0; } - JComboBox arraysel = new JComboBox(array); // set "content" + final JComboBox arraysel = new JComboBox(array); // set "content" arraysel.setPreferredSize(new Dimension(textFieldWidth == 0 ? 197 : textFieldWidth, chooseBoxHeight)); arraysel.setSelectedIndex(active); // set active selection arraysel.setMaximumRowCount(10); @@ -457,13 +456,13 @@ * @param bitmask the bitmask data for this attribute * @param mainPanel the panel to put everything in */ - private void buildBitmask(CFArchAttrib attr, BitmaskAttrib guiAttr, CAttribBitmask bitmask, JPanel mainPanel) { + private void buildBitmask(final CFArchAttrib attr, final BitmaskAttrib guiAttr, final CAttribBitmask bitmask, final JPanel mainPanel) { // initialize bitmask value guiAttr.setValue(arch.getAttributeValue(attr.getNameOld(), defarch)); guiAttr.bitmask = bitmask; // add button - JButton button = new JButton(attr.getNameNew() + ":"); + final JButton button = new JButton(attr.getNameNew() + ":"); button.setAlignmentX(JButton.CENTER_ALIGNMENT); button.setMargin(new Insets(0, 3, 0, 3)); button.addActionListener(new MaskChangeAL(guiAttr, this)); @@ -480,18 +479,18 @@ * @return a <code>JScrollPane</code> with the upper left part of the dialog window */ private JScrollPane buildHeader() { - JPanel header = new JPanel(new FlowLayout(FlowLayout.RIGHT)); // the final thing, in a panel + final JPanel header = new JPanel(new FlowLayout(FlowLayout.RIGHT)); // the final thing, in a panel - JPanel layout1 = new JPanel(new BorderLayout()); // face, name & type + final JPanel layout1 = new JPanel(new BorderLayout()); // face, name & type imagePanel = new JLabel(mainControl.getArchObjectStack().getFace(arch.getFaceNr())); imagePanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); layout1.add(imagePanel, BorderLayout.WEST); - JPanel layout2 = new JPanel(new GridLayout(2, 1)); + final JPanel layout2 = new JPanel(new GridLayout(2, 1)); - JPanel layout3 = new JPanel(new FlowLayout(FlowLayout.RIGHT)); + final JPanel layout3 = new JPanel(new FlowLayout(FlowLayout.RIGHT)); layout3.add(new JLabel("Name: ")); // create label if (arch.getObjName() != null && arch.getObjName().length() > 0) { nameTF = new JTextField(arch.getObjName(), 16); @@ -512,20 +511,20 @@ header.add(layout1); - JPanel layout4 = new JPanel(new FlowLayout(FlowLayout.RIGHT)); + final JPanel layout4 = new JPanel(new FlowLayout(FlowLayout.RIGHT)); layout4.add(new JLabel("Default Arch: ")); // create label defarchTF = new JTextField(defarch.getArchName(), 16); defarchTF.setEditable(false); layout4.add(defarchTF); - JPanel layout5 = new JPanel(); + final JPanel layout5 = new JPanel(); layout5.add(layout4); header.add(layout5); header.setPreferredSize(new Dimension(width - inventoryWidth - 2 * dividerSize, 70)); // finally put the result into a (non-scrollable) // scrollpane to get the size right - JScrollPane scrollPane = new JScrollPane(header); + final JScrollPane scrollPane = new JScrollPane(header); scrollPane.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); @@ -539,10 +538,10 @@ * @return a <code>JScrollPane</code> with the upper right part of the dialog window */ private JScrollPane buildInv() { - JPanel inv = new JPanel(); // the final thing, in a panel + final JPanel inv = new JPanel(); // the final thing, in a panel inv.add(new JLabel("Inventory:")); // create label - JScrollPane scrollPane = new JScrollPane(inv); + final JScrollPane scrollPane = new JScrollPane(inv); scrollPane.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); @@ -567,7 +566,7 @@ } for (int i = 0; i < type.getSectionNum(); i++) { - Component panel1 = makeAttribPanel(i); + final Component panel1 = makeAttribPanel(i); if (panel1 != null) { tabbedPane.addTab(getSectionName(i), null, panel1); } @@ -597,7 +596,7 @@ * @param secId the identifier of the section * @return a <code>Component</code> containing the attribute panel */ - private Component makeAttribPanel(int secId) { + private Component makeAttribPanel(final int secId) { int number = 0; // number of attributes in this section boolean isText = false; // true if this section contains a textfield boolean hasBitmask = false; // true if this section contains a bitmask attribute @@ -624,7 +623,7 @@ // All attribute-"lines" go into this panel: // We choose the boxlayout only for tabs with bitmasks, because we // need it there. For all other cases, the gridlayout is better. - JPanel panel = new JPanel(); + final JPanel panel = new JPanel(); if (hasBitmask) { panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); } else { @@ -638,14 +637,14 @@ // now create the attribute-GUI-instance DialogAttrib newAttr = null; - int dType = type.getAttr()[i].getDataType(); // data type of the attribute + final int dType = type.getAttr()[i].getDataType(); // data type of the attribute if (dType == CFArchAttrib.T_TEXT) { // special case: we've got a text section isText = true; // text section (need special embedding without additional scrollbars) newAttr = new TextAttrib(); newAttr.ref = type.getAttr()[i]; - JTextArea input; + final JTextArea input; // note that the textarea is initialized with rows/columns: 1, 1 // this is pretty weird, but seems the only way to achieve desired behaviour @@ -665,13 +664,13 @@ newAttr.helpButton = new JButton("?"); newAttr.helpButton.setMargin(new Insets(0, 3, 0, 3)); - JScrollPane scrollPane = new JScrollPane(input); + final JScrollPane scrollPane = new JScrollPane(input); scrollPane.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); //Create a split pane with the two scroll panes in it. - JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, + final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, scrollPane, newAttr.helpButton); splitPane.setDividerSize(0); splitPane.setResizeWeight(1); @@ -686,19 +685,19 @@ dType == CFArchAttrib.T_BOOL_SPEC) { // create an attribute line for BOOL panel2 = new JPanel(new BorderLayout()); // need this layout for consistent resize-behaviour - JPanel panel3 = new JPanel(new FlowLayout(FlowLayout.LEFT)); + final JPanel panel3 = new JPanel(new FlowLayout(FlowLayout.LEFT)); newAttr = new BoolAttrib(); - JCheckBox input; + final JCheckBox input; if (dType == CFArchAttrib.T_BOOL) { // normal bool input = new JCheckBox(" " + type.getAttr()[i].getNameNew(), (arch.getAttributeValue(type.getAttr()[i].getNameOld(), defarch) == 1)); } else { // parse values for customized bool - String trueVal = type.getAttr()[i].getMisc()[0]; + final String trueVal = type.getAttr()[i].getMisc()[0]; if (trueVal.equals("0")) { - String attrString = arch.getAttributeString(type.getAttr()[i].getNameOld(), defarch); + final String attrString = arch.getAttributeString(type.getAttr()[i].getNameOld(), defarch); input = new JCheckBox(" " + type.getAttr()[i].getNameNew(), (attrString.length() == 0 || attrString.equals("0"))); } else { @@ -722,20 +721,20 @@ } else if (dType == CFArchAttrib.T_INT) { // create an attribute line for INT panel2 = new JPanel(new BorderLayout()); - JPanel panel3 = new JPanel(new FlowLayout(FlowLayout.RIGHT)); - JPanel panel4 = new JPanel(new FlowLayout(FlowLayout.LEFT)); + final JPanel panel3 = new JPanel(new FlowLayout(FlowLayout.RIGHT)); + final JPanel panel4 = new JPanel(new FlowLayout(FlowLayout.LEFT)); - JLabel label = new JLabel(type.getAttr()[i].getNameNew() + ": "); + final JLabel label = new JLabel(type.getAttr()[i].getNameNew() + ": "); label.setForeground(IGUIConstants.INT_COLOR); panel3.add(label); // add label newAttr = new IntAttrib(); newAttr.ref = type.getAttr()[i]; - JTextField input; + final JTextField input; // parse value from arch - int fieldLength = (type.getAttr()[i].getInputLength() == 0 ? textFieldColumns : type.getAttr()[i].getInputLength()); - int attrval = arch.getAttributeValue(type.getAttr()[i].getNameOld(), defarch); + final int fieldLength = (type.getAttr()[i].getInputLength() == 0 ? textFieldColumns : type.getAttr()[i].getInputLength()); + final int attrval = arch.getAttributeValue(type.getAttr()[i].getNameOld(), defarch); if (attrval != 0) { input = new JTextField(String.valueOf(attrval), fieldLength); } else { @@ -761,10 +760,10 @@ dType == CFArchAttrib.T_FLOAT) { // create an attribute line for STRING panel2 = new JPanel(new BorderLayout()); - JPanel panel3 = new JPanel(new FlowLayout(FlowLayout.RIGHT)); - JPanel panel4 = new JPanel(new FlowLayout(FlowLayout.LEFT)); + final JPanel panel3 = new JPanel(new FlowLayout(FlowLayout.RIGHT)); + final JPanel panel4 = new JPanel(new FlowLayout(FlowLayout.LEFT)); - JLabel label = new JLabel(type.getAttr()[i].getNameNew() + ": "); + final JLabel label = new JLabel(type.getAttr()[i].getNameNew() + ": "); if (dType == CFArchAttrib.T_STRING) { newAttr = new StringAttrib(); @@ -776,10 +775,10 @@ panel3.add(label); // add label newAttr.ref = type.getAttr()[i]; - JTextField input; + final JTextField input; // parse String from arch - String dtxt; + final String dtxt; if (type.getAttr()[i].getNameOld().equalsIgnoreCase("name")) { if (arch.getObjName() != null && arch.getObjName().length() > 0) { dtxt = arch.getObjName(); @@ -826,10 +825,10 @@ dType == CFArchAttrib.T_LIST) { // create an attribute line for a combo box entry panel2 = new JPanel(new BorderLayout()); - JPanel panel3 = new JPanel(new FlowLayout(FlowLayout.RIGHT)); - JPanel panel4 = new JPanel(new FlowLayout(FlowLayout.LEFT)); + final JPanel panel3 = new JPanel(new FlowLayout(FlowLayout.RIGHT)); + final JPanel panel4 = new JPanel(new FlowLayout(FlowLayout.LEFT)); - JLabel label = new JLabel(type.getAttr()[i].getNameNew() + ": "); + final JLabel label = new JLabel(type.getAttr()[i].getNameNew() + ": "); label.setForeground(IGUIConstants.INT_COLOR); panel3.add(label); // add label @@ -837,7 +836,7 @@ newAttr.ref = type.getAttr()[i]; // create ComboBox with parsed selection - JComboBox input = null; + final JComboBox input; if (dType == CFArchAttrib.T_SPELL || dType == CFArchAttrib.T_ZSPELL) { input = buildSpellBox(type.getAttr()[i]); } else if (dType == CFArchAttrib.T_LIST) { @@ -849,7 +848,10 @@ // error: list data is missing or corrupt panel3.add(new JLabel("Error: Undefined List")); panel3.add(Box.createHorizontalStrut(50)); + input = null; // XXX: is later added to panel3 } + } else { + input = null; // XXX: is later added to panel3 } panel3.add(input); // add spellbox @@ -866,8 +868,8 @@ } else if (dType == CFArchAttrib.T_BITMASK) { // create an attribute entry for a bitmask panel2 = new JPanel(new BorderLayout()); - JPanel panel3 = new JPanel(new FlowLayout(FlowLayout.RIGHT)); - JPanel panel4 = new JPanel(new FlowLayout(FlowLayout.LEFT)); + final JPanel panel3 = new JPanel(new FlowLayout(FlowLayout.RIGHT)); + final JPanel panel4 = new JPanel(new FlowLayout(FlowLayout.LEFT)); newAttr = new BitmaskAttrib(); newAttr.ref = type.getAttr()[i]; @@ -898,18 +900,18 @@ } else if (dType == CFArchAttrib.T_TREASURE) { // create an attribute entry for a treasurelist panel2 = new JPanel(new BorderLayout()); - JPanel panel3 = new JPanel(new FlowLayout(FlowLayout.RIGHT)); - JPanel panel4 = new JPanel(new FlowLayout(FlowLayout.LEFT)); + final JPanel panel3 = new JPanel(new FlowLayout(FlowLayout.RIGHT)); + final JPanel panel4 = new JPanel(new FlowLayout(FlowLayout.LEFT)); // button to view treasurelist tree - JButton viewTTree = new JButton("treasurelist:"); + final JButton viewTTree = new JButton("treasurelist:"); viewTTree.setMargin(new Insets(0, 3, 0, 3)); newAttr = new StringAttrib(); newAttr.ref = type.getAttr()[i]; // textfield (no direct input, text is set by the treasurelist dialog) - JTextField input; + final JTextField input; String treasureName = arch.getAttributeString(type.getAttr()[i].getNameOld(), defarch); if (treasureName.trim().length() == 0 || treasureName.trim().equalsIgnoreCase("none")) { treasureName = CFTreasureListTree.NONE_SYM; @@ -958,8 +960,8 @@ if (!isText) { // for non-text panels: put everything into a scrollpane - JScrollPane scrollPane = new JScrollPane(panel); - JScrollPane scrollPane2 = new JScrollPane(scrollPane); + final JScrollPane scrollPane = new JScrollPane(panel); + final JScrollPane scrollPane2 = new JScrollPane(scrollPane); scrollPane.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); @@ -978,7 +980,7 @@ * @param secId ID of the section * @return name of that section */ - private String getSectionName(int secId) { + private String getSectionName(final int secId) { for (int i = 0; type.getAttr().length > i; i++) { if (type.getAttr()[i].getSecId() == secId) { // we've got the string, now capitalize the first letter @@ -1000,9 +1002,9 @@ * @return a <code>JScrollPane</code> with the lower part of the attribute dialog */ private JScrollPane buildButtons() { - JPanel totalBar = new JPanel(new BorderLayout()); // all buttons - JPanel rightBar = new JPanel(new FlowLayout(FlowLayout.RIGHT)); // right side - JPanel leftBar = new JPanel(new FlowLayout(FlowLayout.LEFT)); // left side + final JPanel totalBar = new JPanel(new BorderLayout()); // all buttons + final JPanel rightBar = new JPanel(new FlowLayout(FlowLayout.RIGHT)); // right side + final JPanel leftBar = new JPanel(new FlowLayout(FlowLayout.LEFT)); // left side helpButton = new JButton("Help"); summaryButton = new JButton("Summary"); @@ -1023,21 +1025,21 @@ // listen for button events cancelButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { // close frame closeDialog(); } }); applyButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { // write settings into the ArchObject applySettings(); } }); okButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { // write settings into the ArchObject, then exit if (applySettings()) { closeDialog(); @@ -1046,14 +1048,14 @@ }); helpButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { // create html-docu on the current type and display it new Help(mainControl.getMainView(), type.createHtmlDocu()).setVisible(true); } }); summaryButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { + public void actionPerformed(final ActionEvent e) { // switch to show the summary of attributes toggleSummary(); } @@ -1062,7 +1064,7 @@ //summaryButton.setEnabled(false); //helpButton.setEnabled(false); - JScrollPane scrollPane = new JScrollPane(totalBar); + final JScrollPane scrollPane = new JScrollPane(totalBar); scrollPane.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); @@ -1078,7 +1080,7 @@ * @param title name of attribute * @param msg message text */ - private void popupHelp(String title, String msg) { + private void popupHelp(final String title, final String msg) { JOptionPane.showMessageDialog(this, msg, "help: " + title, JOptionPane.PLAIN_MESSAGE); } @@ -1089,7 +1091,7 @@ private void toggleSummary() { if (!displaySummary) { // interface is displayed, switch to summary - Document doc = summaryTP.getDocument(); + final Document doc = summaryTP.getDocument(); try { // clear document @@ -1097,7 +1099,7 @@ doc.remove(0, doc.getLength()); } - Style docStyle = summaryTP.getStyle(StyleContext.DEFAULT_STYLE); + final Style docStyle = summaryTP.getStyle(StyleContext.DEFAULT_STYLE); if (mainControl.getPlainFont() != null) { StyleConstants.setFontFamily(docStyle, mainControl.getPlainFont().getFamily()); StyleConstants.setFontSize(docStyle, mainControl.getPlainFont().getSize()); @@ -1109,34 +1111,34 @@ for (DialogAttrib attr = attrHead; attr != null; attr = attr.next) { if (attr.ref.getDataType() == CFArchAttrib.T_BOOL || attr.ref.getDataType() == CFArchAttrib.T_BOOL_SPEC) { - boolean value = ((BoolAttrib) attr).input.isSelected(); // true/false + final boolean value = ((BoolAttrib) attr).input.isSelected(); // true/false if (value) { doc.insertString(doc.getLength(), "<" + attr.ref.getNameNew() + ">\n", docStyle); } } if (attr.ref.getDataType() == CFArchAttrib.T_INT) { - String value = ((IntAttrib) attr).input.getText(); // the attrib value + final String value = ((IntAttrib) attr).input.getText(); // the attrib value if (value != null && value.length() > 0 && !value.equals("0")) { doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + "\n", docStyle); } } if (attr.ref.getDataType() == CFArchAttrib.T_FLOAT) { - String value = ((FloatAttrib) attr).input.getText(); // the attrib value + final String value = ((FloatAttrib) attr).input.getText(); // the attrib value if (value != null && value.length() > 0) { try { // parse float value - double dval = Double.parseDouble(value); + final double dval = Double.parseDouble(value); if (dval != 0) { doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + "\n", docStyle); } - } catch (NumberFormatException e) { + } catch (final NumberFormatException e) { } } } if (attr.ref.getDataType() == CFArchAttrib.T_STRING) { - String value = ((StringAttrib) attr).input.getText(); // the attrib value + final String value = ((StringAttrib) attr).input.getText(); // the attrib value if (value != null && value.length() > 0) { doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + "\n", docStyle); @@ -1145,28 +1147,28 @@ if (attr.ref.getDataType() == CFArchAttrib.T_SPELL || attr.ref.getDataType() == CFArchAttrib.T_ZSPELL || attr.ref.getDataType() == CFArchAttrib.T_LIST) { - String value = ((ListAttrib) attr).input.getSelectedItem().toString().trim(); // the attrib value + final String value = ((ListAttrib) attr).input.getSelectedItem().toString().trim(); // the attrib value if (value != null && value.length() > 0 && !value.startsWith("<")) { doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + "\n", docStyle); } } if (attr.ref.getDataType() == CFArchAttrib.T_BITMASK) { - String value = ((BitmaskAttrib) attr).text.getText().trim(); + final String value = ((BitmaskAttrib) attr).text.getText().trim(); if (value != null && value.length() > 0 && !value.startsWith("<")) { doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + "\n", docStyle); } } if (attr.ref.getDataType() == CFArchAttrib.T_TREASURE) { - String value = ((StringAttrib) attr).input.getText().trim(); // the attrib value + final String value = ((StringAttrib) attr).input.getText().trim(); // the attrib value if (value != null && value.length() > 0 && !value.equals(CFTreasureListTree.NONE_SYM)) { doc.insertString(doc.getLength(), attr.ref.getNameNew() + " = " + value + "\n", docStyle); } } } - } catch (BadLocationException e) { + } catch (final BadLocationException e) { log.error("toggleSummary: Bad Location in Document!", e); } @@ -1195,15 +1197,15 @@ * @return true if the settings were applied, false if error occurred */ private boolean applySettings() { - String oldArchText = arch.getArchText(); // the old ArchText + final String oldArchText = arch.getArchText(); // the old ArchText String newArchText = ""; // the new ArchText for the ArchObject String newName = null; // new object name String newFace = null; // new face name - String oldMsg = arch.getMsgText(); // old arch msg + final String oldMsg = arch.getMsgText(); // old arch msg String newMsg = null; // new arch msg String errors = null; // syntax errors in the archtext int dType; - CFArchType typeStruct = typelist.getTypeOfArch(arch); // the type structure for this arch + final CFArchType typeStruct = typelist.getTypeOfArch(arch); // the type structure for this arch try { for (DialogAttrib attr = attrHead; attr != null; attr = attr.next) { @@ -1218,7 +1220,7 @@ } } else if (dType == CFArchAttrib.T_BOOL_SPEC) { // a boolean attribute with customized true/false values - String valString; // value-string to apply + final String valString; // value-string to apply if (((BoolAttrib) attr).input.isSelected()) { valString = attr.ref.getMisc()[0]; // true string } else { @@ -1243,14 +1245,14 @@ } else { try { if (dType == CFArchAttrib.T_INT) { - int value = 0; // int value from the input form + final int value; // int value from the input form // try to parse String to Int value = Integer.parseInt(((IntAttrib) attr).input.getText().trim()); if (defarch.getAttributeValue(attr.ref.getNameOld(), null) != value) { newArchText = newArchText + attr.ref.getNameOld() + " " + value + "\n"; } } else { - double value = 0; // value from the input form + final double value; // value from the input form double defValue = 0; // value from the default arch // try to parse floating point value = Double.parseDouble(((FloatAttrib) attr).input.getText().trim()); @@ -1262,7 +1264,7 @@ newArchText = newArchText + attr.ref.getNameOld() + " " + value + "\n"; } } - } catch (NumberFormatException e) { + } catch (final NumberFormatException e) { // parsing failed: wrong entry!! JOptionPane.showMessageDialog(this, "Attribute '" + attr.ref.getNameNew() + "' must be a number!", "Input Error", @@ -1272,7 +1274,7 @@ } } else if (dType == CFArchAttrib.T_STRING) { // a String attribute - String inline = ((StringAttrib) attr).input.getText().trim(); + final String inline = ((StringAttrib) attr).input.getText().trim(); if (inline != null) { if (attr.ref.getNameOld().equalsIgnoreCase("name")) { @@ -1311,14 +1313,14 @@ } else if (dType == CFArchAttrib.T_SPELL || dType == CFArchAttrib.T_ZSPELL || dType == CFArchAttrib.T_LIST) { // get attribute value that should go into the arch - int attrVal; // attribute value + final int attrVal; // attribute value if (dType == CFArchAttrib.T_SPELL || dType == CFArchAttrib.T_ZSPELL) { attrVal = typelist.getSpellNum()[((ListAttrib) attr).input.getSelectedIndex()]; } else { // get selected index of ComboBox - attrVal = ((ListAttrib) attr).input.getSelectedIndex(); + final int attrValTmp = ((ListAttrib) attr).input.getSelectedIndex(); // fetch value according to this list entry: - attrVal = ((Integer) ((Vector) (typelist.getListTable().get(attr.ref.getMisc()[0]))).elementAt(2 * attrVal)).intValue(); + attrVal = ((Integer) ((Vector) (typelist.getListTable().get(attr.ref.getMisc()[0]))).elementAt(2 * attrValTmp)).intValue(); } if (attrVal == -1 || (attrVal == 0 && dType != CFArchAttrib.T_SPELL @@ -1333,17 +1335,17 @@ } } else if (dType == CFArchAttrib.T_BITMASK) { // a bitmask attribute (similar to integer, but easier because no parsing needed) - int value = ((BitmaskAttrib) attr).getValue(); // get bitmask value + final int value = ((BitmaskAttrib) attr).getValue(); // get bitmask value if (defarch.getAttributeValue(attr.ref.getNameOld(), null) != value) { newArchText = newArchText + attr.ref.getNameOld() + " " + value + "\n"; } } else if (dType == CFArchAttrib.T_TREASURE) { // a treasurelist attribute - String inline = ((StringAttrib) attr).input.getText().trim(); // input string + final String inline = ((StringAttrib) attr).input.getText().trim(); // input string if (inline != null) { - boolean isNone = (inline.equals(CFTreasureListTree.NONE_SYM) || inline.length() == 0); + final boolean isNone = (inline.equals(CFTreasureListTree.NONE_SYM) || inline.length() == 0); if (!isNone && !CFTreasureListTree.getInstance().containsTreasureList(inline) && !inline.equalsIgnoreCase(defarch.getAttributeString(attr.ref.getNameOld(), null))) { @@ -1370,7 +1372,7 @@ // Also write all the 'fixed' attributes into the archtext for (int i = 0; type.getAttr().length > i; i++) { if (type.getAttr()[i].getDataType() == CFArchAttrib.T_FIXED) { - String defaultValue = defarch.getAttributeString(type.getAttr()[i].getNameOld(), null); + final String defaultValue = defarch.getAttributeString(type.getAttr()[i].getNameOld(), null); if (defaultValue.length() == 0 || (arch.getArchTypNr() != defarch.getArchTypNr() && !defaultValue.equalsIgnoreCase(type.getAttr()[i].getNameNew()))) { // usually, fixed attributes are only applied when *not* defined in the defarch. @@ -1416,7 +1418,7 @@ if (faceChanged) { if (arch.getFaceName() != null) { // we have a non-default face - Integer index = (Integer) mainControl.getArchObjectStack().getFaceHashTable().get(arch.getFaceName()); + final Integer index = (Integer) mainControl.getArchObjectStack().getFaceHashTable().get(arch.getFaceName()); if (index != null) { arch.setFaceNr(index.intValue()); } else { @@ -1424,7 +1426,7 @@ } } else { // we have the default face - Integer index = (Integer) mainControl.getArchObjectStack().getFaceHashTable().get(defarch.getFaceName()); + final Integer index = (Integer) mainControl.getArchObjectStack().getFaceHashTable().get(defarch.getFaceName()); if (index != null) { arch.setFaceNr(index.intValue()); } else { @@ -1476,7 +1478,7 @@ mainControl.getMainView().refreshMapArchPanel(); return true; // apply succeeded - } catch (CGridderException e) { + } catch (final CGridderException e) { } return false; // error (-> try again) @@ -1493,39 +1495,39 @@ * window is closed, which mimics non-event-driven behaviour. * @param errors a textual list of the encountered errors */ - private void askConfirmErrors(String errors) { - JDialog frame = new JDialog(this, "Syntax Errors", true); // dialog freezes parents + private void askConfirmErrors(final String errors) { + final JDialog frame = new JDialog(this, "Syntax Errors", true); // dialog freezes parents frame.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); // closing is handled by listener - JPanel mainPanel = new JPanel(); + final JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); - JPanel headerPanel = new JPanel(new GridLayout(2, 1)); - JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); + final JPanel headerPanel = new JPanel(new GridLayout(2, 1)); + final JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); // create header labels - JLabel header1 = new JLabel("The following lines from the archtext appear to be wrong."); + final JLabel header1 = new JLabel("The following lines from the archtext appear to be wrong."); header1.setForeground(Color.black); - JLabel heade... [truncated message content] |
From: <aki...@us...> - 2006-05-31 10:47:41
|
Revision: 91 Author: akirschbaum Date: 2006-05-31 03:47:20 -0700 (Wed, 31 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=91&view=rev Log Message: ----------- Unify comments and whitespace. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CArchPanel.java trunk/crossfire/src/cfeditor/CArchPanelPan.java trunk/crossfire/src/cfeditor/CArchQuickView.java trunk/crossfire/src/cfeditor/CAttribBitmask.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMainView.java trunk/daimonin/src/daieditor/CArchPanel.java trunk/daimonin/src/daieditor/CArchPanelPan.java trunk/daimonin/src/daieditor/CAttribBitmask.java Modified: trunk/crossfire/src/cfeditor/CArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanel.java 2006-05-31 10:44:36 UTC (rev 90) +++ trunk/crossfire/src/cfeditor/CArchPanel.java 2006-05-31 10:47:20 UTC (rev 91) @@ -257,6 +257,7 @@ public String getTitle() { return title; } + } // class PanelNode /** Splitpane class that keeps its size even upon L'n'F change. */ @@ -279,5 +280,7 @@ setDividerLocation(dividerLocation); setDividerSize(dividerSize); } - } + + } // class CSplitPane + } // class CArchPanel Modified: trunk/crossfire/src/cfeditor/CArchPanelPan.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-05-31 10:44:36 UTC (rev 90) +++ trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-05-31 10:47:20 UTC (rev 91) @@ -150,7 +150,11 @@ } - // add this arch to list of (this) Jlist list + /** + * Add this arch to list of (this) Jlist list. + * @param archname name of the arch to add + * @param index index of subdir where to add + */ public void addArchPanelArch(int archnr, int index) { String def = "00000"; String num = Integer.toString(archnr); @@ -286,5 +290,7 @@ return this; } - } -} + + } // class MyCellRenderer + +} // class CArchPanelPan Modified: trunk/crossfire/src/cfeditor/CArchQuickView.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchQuickView.java 2006-05-31 10:44:36 UTC (rev 90) +++ trunk/crossfire/src/cfeditor/CArchQuickView.java 2006-05-31 10:47:20 UTC (rev 91) @@ -135,17 +135,12 @@ archObjNameText.setText("<html><font color=black>Name: " + arch.getObjName() + "</font></html>"); } - archTypeText.setText("<html><font color=black>Type: " + - mainControl.getArchObjectParser().getArchTypeName(arch.getArchTypNr()) - + " (" + arch.getArchTypNr() + ") </font></html>"); + archTypeText.setText("<html><font color=black>Type: " + mainControl.getArchObjectParser().getArchTypeName(arch.getArchTypNr()) + " (" + arch.getArchTypNr() + ") </font></html>"); if (arch.getRefCount() > 0) { - archTileText.setText("<html><font color=black>Tile: </font><font color=green> multi</font><font color=black> (" + - +(arch.getRefCount() + 1) + " parts) (" + (arch.getRefMaxX() - arch.getRefMaxMX() + 1) + "," + (arch.getRefMaxY() - arch.getRefMaxMY() + 1) - + ")</font></html>"); + archTileText.setText("<html><font color=black>Tile: </font><font color=green> multi</font><font color=black> (" + +(arch.getRefCount() + 1) + " parts) (" + (arch.getRefMaxX() - arch.getRefMaxMX() + 1) + "," + (arch.getRefMaxY() - arch.getRefMaxMY() + 1) + ")</font></html>"); } else { - archTileText.setText("<html><font color=black>Tile: single" - + "</font></html>"); + archTileText.setText("<html><font color=black>Tile: single" + "</font></html>"); } // notify ReplaceDialog @@ -158,4 +153,5 @@ mainControl.showArchPanelQuickObject(mainControl.getArchPanelSelection()); repaint(); } -} + +} // class CArchQuickView Modified: trunk/crossfire/src/cfeditor/CAttribBitmask.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribBitmask.java 2006-05-31 10:44:36 UTC (rev 90) +++ trunk/crossfire/src/cfeditor/CAttribBitmask.java 2006-05-31 10:47:20 UTC (rev 91) @@ -43,19 +43,20 @@ import org.jdom.Element; /** - * This class manages bitmask values which appear in Crossfire - * arch attributes. Attacktype, spellpath and material are such - * bitmasks. They are disguised for the user, with the help of - * the attribute dialog. + * This class manages bitmask values which appear in Crossfire arch attributes. + * Attacktype, spellpath and material are such bitmasks. They are disguised for + * the user, with the help of the attribute dialog. * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ public class CAttribBitmask { private static final Logger log = Logger.getLogger(CAttribBitmask.class); - // maximum number of characters in a line before linebreak (see getText()) - //private static final int MAX_CHARS_PER_LINE = 50; - private static final int MAX_CHARS_PER_LINE = 35; + /** + * Maximum number of characters in a line before linebreak (see {@link + * #getText(int)}). + */ + private static final int MAX_CHARS_PER_LINE = 35; // 50 private final String[] bitName; // array of the names of bitmask-entries @@ -64,7 +65,7 @@ private final int number; // number of bitmask entrys (not counting zero) /** - * Konstructor of a bitmask (DEPRECATED!) + * Constructor of a bitmask (DEPRECATED!) * @param name array of names for the bit-entries */ public CAttribBitmask(String[] name) { @@ -87,7 +88,7 @@ } /** - * Konstructor of a bitmask from XML element + * Constructor of a bitmask from XML element. * @param root xml bitmask element */ public CAttribBitmask(Element root) { @@ -157,10 +158,11 @@ } /** - * check wether the given bit-index is an active bit in the bitmask + * Check whether the given bit-index is an active bit in the bitmask. * @param index index of the bit to check (range from 1-'number') * @param mask bitmask to check against - * @return true if the bit-index is an active bit + * @return <code>true</code> if the bit is active in mask, otherwise + * <code>false</code> */ private boolean isActive(int index, int mask) { return ((int) (Math.pow(2., (double) (index - 1))) & mask) != 0; @@ -347,4 +349,5 @@ } } } -} + +} // class CAttribBitmask Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-05-31 10:44:36 UTC (rev 90) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-05-31 10:47:20 UTC (rev 91) @@ -227,10 +227,8 @@ fontsize = Integer.parseInt(fontDesc.substring(fontDesc.indexOf("|") + 1)); // 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)); + 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) { } } @@ -303,9 +301,7 @@ public void collectCFArches() { if (ArchObjectStack.getLoadStatus() != ArchObjectStack.IS_COMPLETE) { // must not collect arches while arch stack not complete - showMessage("Arches still Loading", - "You have to wait for all arches to be loaded\n" + - "before you can collect them."); + showMessage("Arches still Loading", "You have to wait for all arches to be loaded\nbefore you can collect them."); return; } @@ -440,12 +436,9 @@ */ public void readGlobalSettings() { // Get the directories - strMapDir = CSettings.getInstance(IGUIConstants.APP_NAME).getProperty( - MAP_DIR_KEY, DEFAULT_MAP_DIR); - strArchDir = CSettings.getInstance(IGUIConstants.APP_NAME).getProperty( - ARCH_DIR_KEY, DEFAULT_ARCH_DIR); - strScriptDir = CSettings.getInstance(IGUIConstants.APP_NAME).getProperty( - SCRIPT_DIR_KEY, DEFAULT_SCRIPT_DIR); + strMapDir = CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(MAP_DIR_KEY, DEFAULT_MAP_DIR); + strArchDir = CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(ARCH_DIR_KEY, DEFAULT_ARCH_DIR); + strScriptDir = CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(SCRIPT_DIR_KEY, DEFAULT_SCRIPT_DIR); // set map dir if (strMapDir.length() > 0) { @@ -463,24 +456,19 @@ mapDir = new File(currentDir.getAbsolutePath(), mapDir.getPath()); } - imageSet = new String(CSettings.getInstance(IGUIConstants.APP_NAME).getProperty( - USE_IMAGESET, (IGUIConstants.isoView ? "none" : "base"))); + imageSet = new String(CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(USE_IMAGESET, (IGUIConstants.isoView ? "none" : "base"))); if (imageSet.equalsIgnoreCase("none")) { imageSet = null; } - loadFromarchive = new Boolean(CSettings.getInstance(IGUIConstants.APP_NAME).getProperty( - LOAD_ARCH_COLL, "true")).booleanValue(); + loadFromarchive = new Boolean(CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(LOAD_ARCH_COLL, "true")).booleanValue(); - this.getMainView().setMapTileListBottom(new Boolean(CSettings.getInstance(IGUIConstants.APP_NAME).getProperty( - CMainView.MAPTILE_BOTTOM_KEY, "false")).booleanValue()); + this.getMainView().setMapTileListBottom(new Boolean(CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(CMainView.MAPTILE_BOTTOM_KEY, "false")).booleanValue()); - setPickmapsLocked(new Boolean(CSettings.getInstance(IGUIConstants.APP_NAME).getProperty( - PICKMAPS_LOCKED, "false")).booleanValue()); + setPickmapsLocked(new Boolean(CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(PICKMAPS_LOCKED, "false")).booleanValue()); // docu version - if (IGUIConstants.DOCU_VERSION > (new Integer(CSettings.getInstance(IGUIConstants.APP_NAME).getProperty( - DOCU_VERSION_KEY, "0"))).intValue()) { + if (IGUIConstants.DOCU_VERSION > (new Integer(CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(DOCU_VERSION_KEY, "0"))).intValue()) { // remember to open docu autoPopupDocu = true; // update docu version right now, because we want the help popup only one time @@ -495,8 +483,7 @@ * @param script path of script directory * @param baseImageSet true if base image set is used */ - void setGlobalSettings(String arch, String map, String script, boolean baseImageSet, - boolean load, boolean mapTileBottom) { + void setGlobalSettings(String arch, String map, String script, boolean baseImageSet, boolean load, boolean mapTileBottom) { map = map.replace('\\', '/'); if (map.endsWith("/")) { map = map.substring(0, map.length() - 1); // path should not end with slash @@ -803,18 +790,13 @@ showMessage("Cannot close Pickmap", "There are no pickmaps."); } else { // if pickmap was modified, ask for confirmation: - if (!activePickmap.isLevelChanged() || askConfirm("Close Pickmap " + activePickmap.getMapFileName() + "?", - "If you close the pickmap '" + activePickmap.getMapFileName() + "', all recent\n" + - "changes will be lost. Do you really want to close it?")) { + if (!activePickmap.isLevelChanged() || askConfirm("Close Pickmap " + activePickmap.getMapFileName() + "?", "If you close the pickmap '" + activePickmap.getMapFileName() + "', all recent\nchanges will be lost. Do you really want to close it?")) { File pickmapFile = activePickmap.getMapFile(); // close pickmap closeLevel(activePickmap, true); // also delete pickmap file? - if (askConfirm("Delete File " + activePickmap.getMapFileName() + "?", - "The pickmap '" + activePickmap.getMapFileName() + "' has been closed.\n" + - "Do you also want to remove the pickmap file '" + activePickmap.getMapFileName() + "' from your harddisk?\n" + - "(Doing so will permanently delete the pickmap.)")) { + if (askConfirm("Delete File " + activePickmap.getMapFileName() + "?", "The pickmap '" + activePickmap.getMapFileName() + "' has been closed.\nDo you also want to remove the pickmap file '" + activePickmap.getMapFileName() + "' from your harddisk?\n(Doing so will permanently delete the pickmap.)")) { pickmapFile.delete(); } } @@ -836,9 +818,7 @@ } if (level != null && !forced && level.isLevelChanged()) { - if (askConfirm("Do You Want To Save Changes?", - "Do you want to save changes to map " + - level.getMapNameWithoutMusic() + "?")) { + if (askConfirm("Do You Want To Save Changes?", "Do you want to save changes to map " + level.getMapNameWithoutMusic() + "?")) { if (level.isPlainSaveEnabled()) { level.save(); @@ -1000,8 +980,7 @@ // out of memory!! - display error showMessage("Out of Memory", "Not enough memory available to open more maps!\n" + "You can increase the memory limit by using the '-mx' runtime flag.\n" + - "For example: 'java -mx128m -jar " + IGUIConstants.APP_NAME + ".jar'", - JOptionPane.WARNING_MESSAGE); + "For example: 'java -mx128m -jar " + IGUIConstants.APP_NAME + ".jar'", JOptionPane.WARNING_MESSAGE); return null; } @@ -1039,13 +1018,9 @@ public void openAttrDialog(ArchObject arch) { if (typelist.isEmpty()) { // types.txt is missing! - showMessage("File Missing", - "The definitions-file \"types.txt\" is missing! The\n" + - "attribute interface doesn't work without that file."); + showMessage("File Missing", "The definitions-file \"types.txt\" is missing! The\nattribute interface doesn't work without that file."); } else if (arch != null && arch.getNodeNr() != -1) { - CAttribDialog dwin = new CAttribDialog(typelist, arch, - getArch(arch.getNodeNr()), - this); + CAttribDialog dwin = new CAttribDialog(typelist, arch, getArch(arch.getNodeNr()), this); } } @@ -1348,8 +1323,7 @@ * @param mapWidth width of map * @param mapHeight height of map */ - void setLevelProperties(CMapControl level, String archText, String loreText, String strMapTitle, - int mapWidth, int mapHeight) { + void setLevelProperties(CMapControl level, String archText, String loreText, String strMapTitle, int mapWidth, int mapHeight) { if (level != null) { level.setProperties(archText, loreText, strMapTitle, mapWidth, mapHeight); refreshMenusAndToolbars(); @@ -1490,17 +1464,13 @@ JViewport oldViewPort = oldmap.getMapView().getViewPort(); if (direction == IGUIConstants.SOUTH) { - scrollto = new Rectangle(oldViewPort.getViewRect().x, 0, - oldViewPort.getViewRect().width, oldViewPort.getViewRect().height); + scrollto = new Rectangle(oldViewPort.getViewRect().x, 0, oldViewPort.getViewRect().width, oldViewPort.getViewRect().height); } else if (direction == IGUIConstants.NORTH) { - scrollto = new Rectangle(oldViewPort.getViewRect().x, newViewPort.getViewSize().height - oldViewPort.getViewRect().height, - oldViewPort.getViewRect().width, oldViewPort.getViewRect().height); + scrollto = new Rectangle(oldViewPort.getViewRect().x, newViewPort.getViewSize().height - oldViewPort.getViewRect().height, oldViewPort.getViewRect().width, oldViewPort.getViewRect().height); } else if (direction == IGUIConstants.EAST) { - scrollto = new Rectangle(0, oldViewPort.getViewRect().y, - oldViewPort.getViewRect().width, oldViewPort.getViewRect().height); + scrollto = new Rectangle(0, oldViewPort.getViewRect().y, oldViewPort.getViewRect().width, oldViewPort.getViewRect().height); } else if (direction == IGUIConstants.WEST) { - scrollto = new Rectangle(newViewPort.getViewSize().width - oldViewPort.getViewRect().width, oldViewPort.getViewRect().y, - oldViewPort.getViewRect().width, oldViewPort.getViewRect().height); + scrollto = new Rectangle(newViewPort.getViewSize().width - oldViewPort.getViewRect().width, oldViewPort.getViewRect().y, oldViewPort.getViewRect().width, oldViewPort.getViewRect().height); } if (scrollto.x + scrollto.width > newViewPort.getViewSize().width) { @@ -1552,10 +1522,7 @@ CMapControl 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\n" + - "recent changes will be lost. Do you really want to revert this map?")) { + 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?")) { // okay, then do it: File mfile = modmap.getMapFile(); // store file @@ -1575,18 +1542,14 @@ "Either there are no pickmaps or the loading process is not complete."); } else { if (!getMainView().isPickmapActive()) { - showMessage("Cannot revert Pickmap", "Pickmaps are currently hidden.\n" + - "Please select a pickmap before activating this command."); + showMessage("Cannot revert Pickmap", "Pickmaps are currently hidden.\nPlease select a pickmap before activating this command."); } else { CMapControl activePickmap = CPickmapPanel.getInstance().getCurrentPickmap(); if (activePickmap == null) { showMessage("Cannot revert Pickmap", "There are no pickmaps."); } else { // ask for confirmation - if (!activePickmap.isLevelChanged() || askConfirm( - "Revert Pickmap " + activePickmap.getMapFileName() + "?", - "If you revert the pickmap '" + activePickmap.getMapFileName() + "' to it's last saved state, all\n" + - "recent changes will be lost. Do you really want to revert this pickmap?")) { + if (!activePickmap.isLevelChanged() || askConfirm("Revert Pickmap " + activePickmap.getMapFileName() + "?", "If you revert the pickmap '" + activePickmap.getMapFileName() + "' to it's last saved state, all\nrecent changes will be lost. Do you really want to revert this pickmap?")) { // okay, then do it: File mfile = activePickmap.getMapFile(); // store file Modified: trunk/crossfire/src/cfeditor/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainView.java 2006-05-31 10:44:36 UTC (rev 90) +++ trunk/crossfire/src/cfeditor/CMainView.java 2006-05-31 10:47:20 UTC (rev 91) @@ -145,11 +145,11 @@ setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); addWindowListener( - new WindowAdapter() { - public void windowClosing(WindowEvent event) { - mainControl.exitWanted(); - } - }); + new WindowAdapter() { + public void windowClosing(WindowEvent event) { + mainControl.exitWanted(); + } + }); } /** @@ -160,8 +160,7 @@ CSettings settings = CSettings.getInstance(IGUIConstants.APP_NAME); // set look and feel - String strSelectedLNFName = settings.getProperty(CMainView.SELECTED_LNF_KEY, - UIManager.getCrossPlatformLookAndFeelClassName()); + String strSelectedLNFName = settings.getProperty(CMainView.SELECTED_LNF_KEY, UIManager.getCrossPlatformLookAndFeelClassName()); mainControl.setLookNFeel(strSelectedLNFName); // calculate some default values in case there is no settings file @@ -208,9 +207,7 @@ if (!mapTileListBottom) { // the map tile list is on the right side - splitRightPane = new CSplitPane(CSplitPane.HORIZONTAL_SPLIT, - mapDesktop, - mapTileList); + splitRightPane = new CSplitPane(CSplitPane.HORIZONTAL_SPLIT, mapDesktop, mapTileList); splitRightPane.setDividerLocation(divLocationRight); splitRightPane.setDividerSize(BORDER_SIZE); @@ -218,17 +215,14 @@ getContentPane().add(splitRightPane, BorderLayout.CENTER); mapArchPanel = new CMapArchPanel(mainControl, this); - splitDownPane = new CSplitPane(CSplitPane.VERTICAL_SPLIT, - splitRightPane, - mapArchPanel); + splitDownPane = new CSplitPane(CSplitPane.VERTICAL_SPLIT, splitRightPane, mapArchPanel); splitDownPane.setDividerLocation(divLocationDown); splitDownPane.setDividerSize(BORDER_SIZE); getContentPane().add(splitDownPane, BorderLayout.CENTER); - splitPane = new CSplitPane(CSplitPane.HORIZONTAL_SPLIT, - archPanel, splitDownPane); + splitPane = new CSplitPane(CSplitPane.HORIZONTAL_SPLIT, archPanel, splitDownPane); splitPane.setDividerLocation(divLocation); splitPane.setDividerSize(BORDER_SIZE); @@ -236,25 +230,20 @@ } else { // the map tile list is merged into the bottom panel mapArchPanel = new CMapArchPanel(mainControl, this); - splitRightPane = new CSplitPane(CSplitPane.HORIZONTAL_SPLIT, - mapArchPanel, - mapTileList); + splitRightPane = new CSplitPane(CSplitPane.HORIZONTAL_SPLIT, mapArchPanel, mapTileList); splitRightPane.setDividerLocation(divLocationRight); splitRightPane.setDividerSize(BORDER_SIZE); // split off the bottom panel - splitDownPane = new CSplitPane(CSplitPane.VERTICAL_SPLIT, - mapDesktop, - splitRightPane); + splitDownPane = new CSplitPane(CSplitPane.VERTICAL_SPLIT, mapDesktop, splitRightPane); splitDownPane.setDividerLocation(divLocationDown); splitDownPane.setDividerSize(BORDER_SIZE); getContentPane().add(splitDownPane, BorderLayout.CENTER); // split off the left arch panel - splitPane = new CSplitPane(CSplitPane.HORIZONTAL_SPLIT, - archPanel, splitDownPane); + splitPane = new CSplitPane(CSplitPane.HORIZONTAL_SPLIT, archPanel, splitDownPane); splitPane.setDividerLocation(divLocation); splitPane.setDividerSize(BORDER_SIZE); @@ -508,11 +497,9 @@ // set bounds to maximum size if (!mapTileListBottom) { - mapView.setBounds(0, 0, mapTileList.getX() - BORDER_SIZE - 2, - mapArchPanel.getY() - BORDER_SIZE - 4); + mapView.setBounds(0, 0, mapTileList.getX() - BORDER_SIZE - 2, mapArchPanel.getY() - BORDER_SIZE - 4); } else { - mapView.setBounds(0, 0, mapDesktop.getWidth() - 2, - mapDesktop.getHeight() - 2); + mapView.setBounds(0, 0, mapDesktop.getWidth() - 2, mapDesktop.getHeight() - 2); } //mapView.setBounds(0, 0, 320, 240); mapView.setVisible(true); @@ -554,12 +541,7 @@ * @param error The error to be shown. */ void showError(CGridderException error) { - JOptionPane.showConfirmDialog( - this, - error.getMessage(), - IGUIConstants.APP_NAME + " Error in " + error.getOriginator(), - JOptionPane.OK_OPTION, - JOptionPane.WARNING_MESSAGE); + JOptionPane.showConfirmDialog(this, error.getMessage(), IGUIConstants.APP_NAME + " Error in " + error.getOriginator(), JOptionPane.OK_OPTION, JOptionPane.WARNING_MESSAGE); } /** @@ -584,12 +566,7 @@ * @return Ture if the user agrees, false if user disagrees. */ public boolean askConfirm(String strTitle, String strMessage) { - return JOptionPane.showConfirmDialog( - this, - strMessage, - strTitle, - JOptionPane.YES_NO_OPTION, - JOptionPane.INFORMATION_MESSAGE) == JOptionPane.YES_OPTION; + return JOptionPane.showConfirmDialog(this, strMessage, strTitle, JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE) == JOptionPane.YES_OPTION; } /** @@ -759,9 +736,7 @@ private static final long serialVersionUID = -6920886364860860516L; - public CSplitPane(int newOrientation, - Component newLeftComponent, - Component newRightComponent) { + public CSplitPane(int newOrientation, Component newLeftComponent, Component newRightComponent) { super(newOrientation, newLeftComponent, newRightComponent); } @@ -776,5 +751,7 @@ setDividerLocation(dividerLocation); setDividerSize(dividerSize); } - } -} + + } // class CSplitPane + +} // class CMainView Modified: trunk/daimonin/src/daieditor/CArchPanel.java =================================================================== --- trunk/daimonin/src/daieditor/CArchPanel.java 2006-05-31 10:44:36 UTC (rev 90) +++ trunk/daimonin/src/daieditor/CArchPanel.java 2006-05-31 10:47:20 UTC (rev 91) @@ -130,6 +130,7 @@ if (selectedPanel == null) { return null; } + return selectedPanel.getArchListObject(); } @@ -210,6 +211,7 @@ public CArchPanelPan getData() { return data; } + } // class PanelNode } // class CArchPanel Modified: trunk/daimonin/src/daieditor/CArchPanelPan.java =================================================================== --- trunk/daimonin/src/daieditor/CArchPanelPan.java 2006-05-31 10:44:36 UTC (rev 90) +++ trunk/daimonin/src/daieditor/CArchPanelPan.java 2006-05-31 10:47:20 UTC (rev 91) @@ -178,7 +178,7 @@ } /** - * add this arch to list of (this) Jlist list + * Add this arch to list of (this) Jlist list. * @param archname name of the arch to add * @param index index of subdir where to add */ Modified: trunk/daimonin/src/daieditor/CAttribBitmask.java =================================================================== --- trunk/daimonin/src/daieditor/CAttribBitmask.java 2006-05-31 10:44:36 UTC (rev 90) +++ trunk/daimonin/src/daieditor/CAttribBitmask.java 2006-05-31 10:47:20 UTC (rev 91) @@ -40,14 +40,17 @@ /** * This class manages bitmask values which appear in Daimonin arch attributes. - * Attacktype, spellpath and material are such bitmasks. - * They are disguised for the user, with the help of the attribute dialog. + * Attacktype, spellpath and material are such bitmasks. They are disguised for + * the user, with the help of the attribute dialog. * @author <a href="mailto:and...@gm...">Andreas Vogl</a> * @author <a href="mailto:ch...@it...">Christian Hujer</a> */ public final class CAttribBitmask { - /** Maximum number of characters in a line before linebreak (see {@link #getText(int)}). */ + /** + * Maximum number of characters in a line before linebreak (see {@link + * #getText(int)}). + */ private static final int MAX_CHARS_PER_LINE = 35; // 50 private final String[] bitName; // array of the names of bitmask-entries @@ -55,7 +58,7 @@ private final int number; // number of bitmask entrys (not counting zero) /** - * Constructor of a bitmask from XML element + * Constructor of a bitmask from XML element. * @param bitmasksElement xml bitmask element */ public CAttribBitmask(final XPath xpath, final Element bitmasksElement) throws XPathExpressionException { @@ -72,7 +75,8 @@ * Check whether the given bit-index is an active bit in the bitmask. * @param index index of the bit to check (range from 1-'number') * @param mask bitmask to check against - * @return <code>true</code> if the bit is active in mask, otherwise <code>false</code> + * @return <code>true</code> if the bit is active in mask, otherwise + * <code>false</code> */ private static boolean isActive(final int index, final int mask) { final int bit = 1 << index - 1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-05-31 10:44:43
|
Revision: 90 Author: akirschbaum Date: 2006-05-31 03:44:36 -0700 (Wed, 31 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=90&view=rev Log Message: ----------- Make crossfire editor compilable again. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMainView.java trunk/crossfire/src/cfeditor/CMapViewBasic.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-05-31 10:11:58 UTC (rev 89) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-05-31 10:44:36 UTC (rev 90) @@ -147,6 +147,8 @@ private String strScriptDir; + private String strImageDir; // directory for saving map images + // this flag indicates weither the user has ever changed the // active dir since the program started private boolean hasChangedDir = false; @@ -461,9 +463,6 @@ mapDir = new File(currentDir.getAbsolutePath(), mapDir.getPath()); } - archDir = new File(strArchDir); - scriptDir = new File(strScriptDir); - imageSet = new String(CSettings.getInstance(IGUIConstants.APP_NAME).getProperty( USE_IMAGESET, (IGUIConstants.isoView ? "none" : "base"))); if (imageSet.equalsIgnoreCase("none")) { Modified: trunk/crossfire/src/cfeditor/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainView.java 2006-05-31 10:11:58 UTC (rev 89) +++ trunk/crossfire/src/cfeditor/CMainView.java 2006-05-31 10:44:36 UTC (rev 90) @@ -599,8 +599,6 @@ */ void updateFocus(boolean fCareAboutIconification) { - focusedMapView = null; - // Show the next level (if such exists) for (Enumeration enu = mapViews.elements(); enu.hasMoreElements();) { CMapViewIFrame view = (CMapViewIFrame) enu.nextElement(); @@ -625,7 +623,6 @@ } // No non-iconified level windows found - focusedMapView = null; mainControl.setCurrentLevel(null); } @@ -694,7 +691,6 @@ public void levelViewFocusGainedNotify(CMapViewIFrame view) { mapViews.removeElement(view); mapViews.insertElementAt(view, 0); - focusedMapView = view; CMapControl level = view.getLevel(); mainControl.setCurrentLevel(level); //statusBar.setLevelInfo(level); Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-05-31 10:11:58 UTC (rev 89) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-05-31 10:44:36 UTC (rev 90) @@ -1497,6 +1497,7 @@ Point[] needRedraw = null; // array of tile coords which need to be redrawn Point[] preRedraw = null; // array of tile coords which need to be redrawn boolean needFullRepaint = false; // true if full repaint of map needed + Rectangle previewRect = null; if (mapLoc != null) { // in "locked pickmaps" mode, pickmaps react only to leftclicks @@ -1962,7 +1963,6 @@ void endFill() { fFilling = false; - previewRect = null; startMapLoc = null; // repaint(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-05-31 10:12:08
|
Revision: 89 Author: akirschbaum Date: 2006-05-31 03:11:58 -0700 (Wed, 31 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=89&view=rev Log Message: ----------- Remove unused variables. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMainView.java trunk/crossfire/src/cfeditor/CMapArchPanel.java trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/CNewMapDialog.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-05-31 09:51:06 UTC (rev 88) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-05-31 10:11:58 UTC (rev 89) @@ -141,18 +141,12 @@ // resource directories private File mapDir; - private File archDir; - - private File scriptDir; - private String strMapDir; private String strArchDir; private String strScriptDir; - private String strImageDir = null; // directory for saving map images - // this flag indicates weither the user has ever changed the // active dir since the program started private boolean hasChangedDir = false; Modified: trunk/crossfire/src/cfeditor/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainView.java 2006-05-31 09:51:06 UTC (rev 88) +++ trunk/crossfire/src/cfeditor/CMainView.java 2006-05-31 10:11:58 UTC (rev 89) @@ -113,9 +113,6 @@ /** All open level views. */ private Vector mapViews = new Vector(1, 2); - /** Currently focused level view. */ - private CMapViewIFrame focusedMapView; - /** list of objects on map (right side) */ private CMapTileList mapTileList; Modified: trunk/crossfire/src/cfeditor/CMapArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-05-31 09:51:06 UTC (rev 88) +++ trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-05-31 10:11:58 UTC (rev 89) @@ -104,8 +104,6 @@ private JTabbedPane panelDesktop; - private JPanel panelDesktop2; - private Style currentAttributes; private Document doc; Modified: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-05-31 09:51:06 UTC (rev 88) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2006-05-31 10:11:58 UTC (rev 89) @@ -77,9 +77,6 @@ /** The tile palette renderer. */ private final CLevelRenderer renderer; - //private JScrollPane scrollPane; - private Rectangle previewRect; - private boolean changed = false; private boolean showMapGrid; Modified: trunk/crossfire/src/cfeditor/CNewMapDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CNewMapDialog.java 2006-05-31 09:51:06 UTC (rev 88) +++ trunk/crossfire/src/cfeditor/CNewMapDialog.java 2006-05-31 10:11:58 UTC (rev 89) @@ -90,8 +90,6 @@ private final JTextField mapHeightField; - private JTabbedPane tabbedPane; - private final JPanel newLevelFromScratchPanel; private static final long serialVersionUID = -9194625062729020248L; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-05-31 09:51:32
|
Revision: 88 Author: akirschbaum Date: 2006-05-31 02:51:06 -0700 (Wed, 31 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=88&view=rev Log Message: ----------- Rename variable names. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CFileInputStream.java trunk/crossfire/src/cfeditor/CFileReader.java trunk/crossfire/src/cfeditor/CGUIUtils.java trunk/crossfire/src/cfeditor/CGridderException.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMainMenu.java trunk/crossfire/src/cfeditor/CMainStatusbar.java 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/CMapTileList.java trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/crossfire/src/cfeditor/CMapViewIFrame.java trunk/crossfire/src/cfeditor/CNewMapDialog.java trunk/crossfire/src/cfeditor/arch/ArchObjectStack.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/CMainView.java trunk/daimonin/src/daieditor/CMapArchPanel.java trunk/daimonin/src/daieditor/CMapFileDecode.java trunk/daimonin/src/daieditor/CMapViewBasic.java Modified: trunk/crossfire/src/cfeditor/CFileInputStream.java =================================================================== --- trunk/crossfire/src/cfeditor/CFileInputStream.java 2006-05-30 23:31:10 UTC (rev 87) +++ trunk/crossfire/src/cfeditor/CFileInputStream.java 2006-05-31 09:51:06 UTC (rev 88) @@ -45,9 +45,9 @@ private final String filedir; // directory of the resource file - private boolean is_binfile = false; // true if the resource was opened as binary file + private boolean isBinfile = false; // true if the resource was opened as binary file - private boolean is_jar = false; // true if resource was opened from jar archive + private boolean isJar = false; // true if resource was opened from jar archive // streams private FileInputStream fileInput; // binary file input stream @@ -80,26 +80,26 @@ // in the specified directory fileInput = new FileInputStream(filedir + File.separator + filename); stream = new TrackedBufferedInputStream(fileInput); - is_binfile = true; + isBinfile = true; } catch (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); - is_binfile = true; + isBinfile = true; } catch (FileNotFoundException ex) { // if there is no binary file at all, we try to load it from // the system-jar-archive: inStream = ClassLoader.getSystemResourceAsStream(filename); if (inStream != null) { stream = new TrackedBufferedInputStream(inStream); - is_jar = true; + isJar = true; } } } - if (!is_binfile && !is_jar) { + if (!isBinfile && !isJar) { if (log.isInfoEnabled()) { log.info("File \"" + filename + "\" was not found!"); } Modified: trunk/crossfire/src/cfeditor/CFileReader.java =================================================================== --- trunk/crossfire/src/cfeditor/CFileReader.java 2006-05-30 23:31:10 UTC (rev 87) +++ trunk/crossfire/src/cfeditor/CFileReader.java 2006-05-31 09:51:06 UTC (rev 88) @@ -47,9 +47,9 @@ private final String filedir; // directory of the resource file - private boolean is_ascii = false; // true if the resource was opened as ascii file + private boolean isAscii = false; // true if the resource was opened as ascii file - private boolean is_jar = false; // true if resource was opened from jar archive + private boolean isJar = false; // true if resource was opened from jar archive // streams private FileReader fileRead; @@ -84,27 +84,27 @@ // first we look if the resource is available as normal ascii-file // in the specified directory fileRead = new FileReader(filedir + File.separator + filename); - is_ascii = true; + isAscii = true; } catch (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); - is_ascii = true; + isAscii = true; } catch (FileNotFoundException ex) { // if there is no ascii file at all, we try to load it from // the system-jar-archive: inStream = ClassLoader.getSystemResourceAsStream(filename); if (inStream != null) { streamRead = new InputStreamReader(inStream); - is_jar = true; + isJar = true; } } } - if (is_ascii) { + if (isAscii) { read = new BufferedReader(fileRead); - } else if (is_jar) { + } else if (isJar) { read = new BufferedReader(streamRead); } else { if (log.isInfoEnabled()) { Modified: trunk/crossfire/src/cfeditor/CGUIUtils.java =================================================================== --- trunk/crossfire/src/cfeditor/CGUIUtils.java 2006-05-30 23:31:10 UTC (rev 87) +++ trunk/crossfire/src/cfeditor/CGUIUtils.java 2006-05-31 09:51:06 UTC (rev 88) @@ -49,13 +49,13 @@ private static final Logger log = Logger.getLogger(CGUIUtils.class); /** The instance of GUI utils used internally. */ - private static final CGUIUtils mStatic_instance = new CGUIUtils(); + private static final CGUIUtils staticInstance = new CGUIUtils(); - private static final Hashtable m_nameToImage = new Hashtable(); + private static final Hashtable imageCache = new Hashtable(); /** @return the static instance of this class */ public static CGUIUtils getInstance() { - return mStatic_instance; + return staticInstance; } /** @@ -70,8 +70,8 @@ */ private static ImageIcon getResourceIcon(String dirName, String strIconName) { // first, look if this icon is already available in the Hashtable - if (m_nameToImage.containsKey(strIconName)) { - return (ImageIcon) m_nameToImage.get(strIconName); + if (imageCache.containsKey(strIconName)) { + return (ImageIcon) imageCache.get(strIconName); } // looks like we need to load this icon @@ -106,7 +106,7 @@ // put this icon into the Hashtable if (icon != null) { - m_nameToImage.put(strIconName, icon); + imageCache.put(strIconName, icon); } return icon; @@ -127,7 +127,7 @@ */ public static ImageIcon getGrayScaled(ImageIcon icon) { // Use the static instance to do the grayscaling - return mStatic_instance._getGrayScaled(icon); + return staticInstance._getGrayScaled(icon); } public static JComponent getBox(JComponent c) { Modified: trunk/crossfire/src/cfeditor/CGridderException.java =================================================================== --- trunk/crossfire/src/cfeditor/CGridderException.java 2006-05-30 23:31:10 UTC (rev 87) +++ trunk/crossfire/src/cfeditor/CGridderException.java 2006-05-31 09:51:06 UTC (rev 88) @@ -32,23 +32,23 @@ public class CGridderException extends Exception { /** The originator of the error. */ - private final Object m_originator; + private final Object originator; private static final long serialVersionUID = 2251340997369591264L; public CGridderException(String strMessage) { super(strMessage); - m_originator = null; + originator = null; } public CGridderException(String strMessage, Object originator) { super(strMessage); - m_originator = originator; + this.originator = originator; } public String getOriginator() { - if (m_originator != null) { - return m_originator.getClass().getName(); + if (originator != null) { + return originator.getClass().getName(); } return "unknown"; Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-05-30 23:31:10 UTC (rev 87) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-05-31 09:51:06 UTC (rev 88) @@ -64,7 +64,7 @@ private static final Logger log = Logger.getLogger(CMainControl.class); - private static CMainControl mStatic_control = null; + private static CMainControl instance = null; public static final String DOCU_VERSION_KEY = "docuVersion"; @@ -89,7 +89,7 @@ public static final String PICKMAPS_LOCKED = "pickmapsLocked"; /** The main view. */ - private final CMainView m_view; + private final CMainView mainView; private int tileEdit; @@ -125,44 +125,44 @@ private final ArchObjectStack archList; // the one and only arch list /** All open maps. */ - private final Vector m_levels = new Vector(1, 2); + private final Vector levels = new Vector(1, 2); /** The current top map we are working with */ - private CMapControl m_currentMap; + private CMapControl currentMap; /** The current script controller */ - private final CScriptController m_scriptControl; + private final CScriptController scriptControl; /** The current main directory. */ - private File m_currentDir; + private File currentDir; private String strCurrentDir; // resource directories - private File m_mapDir; + private File mapDir; - private File m_archDir; + private File archDir; - private File m_scriptDir; + private File scriptDir; - private String m_strMapDir; + private String strMapDir; - private String m_strArchDir; + private String strArchDir; - private String m_strScriptDir; + private String strScriptDir; - private String m_strImageDir = null; // directory for saving map images + private String strImageDir = null; // directory for saving map images // this flag indicates weither the user has ever changed the // active dir since the program started - private boolean has_changed_dir = false; + private boolean hasChangedDir = false; private boolean autojoin = false; // indicates weither autojoining is on/off //private boolean isoMapViewDefault; private String imageSet; // Name of used Image Set (null = none) - private boolean load_from_archive = true; // do we load arches from the collected archives? + private boolean loadFromarchive = true; // do we load arches from the collected archives? private boolean autoPopupDocu = false; // time for an automated docu popup? @@ -188,12 +188,12 @@ /** Constructs the main controller and its model and view. */ public CMainControl() { archList = new ArchObjectStack(this); - m_view = new CMainView(this); + mainView = new CMainView(this); - mStatic_control = this; + instance = this; tileEdit = 0; - m_scriptControl = new CScriptController(this); + scriptControl = new CScriptController(this); } /** @@ -201,7 +201,7 @@ * @return static instance of this class */ public static CMainControl getInstance() { - return mStatic_control; + return instance; } /** @@ -214,7 +214,7 @@ // Get the current directory strCurrentDir = System.getProperty("user.dir"); - m_currentDir = new File(strCurrentDir); + currentDir = new File(strCurrentDir); readGlobalSettings(); @@ -222,18 +222,18 @@ CPickmapPanel pickmappanel = new CPickmapPanel(); // apply custom font - String font_desc = CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(USE_FONT); - if (font_desc != null) { + String fontDesc = CSettings.getInstance(IGUIConstants.APP_NAME).getProperty(USE_FONT); + if (fontDesc != null) { int fontsize = 0; // fontsize try { // try to parse fontsize - fontsize = Integer.parseInt(font_desc.substring(font_desc.indexOf("|") + 1)); + fontsize = Integer.parseInt(fontDesc.substring(fontDesc.indexOf("|") + 1)); // okay, now set fonts - newPlainFont(new Font(font_desc.substring(0, font_desc.indexOf("|")), + newPlainFont(new Font(fontDesc.substring(0, fontDesc.indexOf("|")), Font.PLAIN, fontsize)); - newBoldFont(new Font(font_desc.substring(0, font_desc.indexOf("|")), + newBoldFont(new Font(fontDesc.substring(0, fontDesc.indexOf("|")), Font.BOLD, fontsize)); } catch (NumberFormatException e) { } @@ -253,7 +253,7 @@ ScriptEditControl.init(getMapDefaultFolder(), this); // Initialise the main view - m_view.init(doShow); + mainView.init(doShow); loadDefTiles(); if (autoPopupDocu) { // do an automated help popup because the docu version has increased @@ -280,7 +280,7 @@ // now collect all arch you can find in the arch path!! System.gc(); - m_view.updateFocus(false); /*MTMT*/ + mainView.updateFocus(false); /*MTMT*/ } /** @@ -288,7 +288,7 @@ * (This method must not be called before all arches are loaded * into the ArchObjectStack 'archList'!) */ - public void load_joinlist() { + public void loadJoinlist() { joinlist = new AutojoinList(); if (!joinlist.loadList(archList)) { joinlist = null; @@ -296,11 +296,11 @@ } void moveTileUp(ArchObject arch, boolean refresh) { - m_currentMap.getMapModel().moveTileUp(arch, refresh); + currentMap.getMapModel().moveTileUp(arch, refresh); } void moveTileDown(ArchObject arch, boolean refresh) { - m_currentMap.getMapModel().moveTileDown(arch, refresh); + currentMap.getMapModel().moveTileDown(arch, refresh); } /** collect CF arches */ @@ -359,17 +359,17 @@ * A new edit type was selected from the view menu. Now * we activate the new type and calculate it for each arch on * each map where this type has not yet been used. - * @param new_type new selected edit type (should not be more than one) + * @param newType new selected edit type (should not be more than one) */ - void select_edittype(int new_type) { + void selectEditType(int newType) { // calculate the new type for all opened maps: - for (Enumeration enu = m_levels.elements(); enu.hasMoreElements();) { + for (Enumeration enu = levels.elements(); enu.hasMoreElements();) { CMapControl level = (CMapControl) enu.nextElement(); - level.add_edit_type(new_type); // calculate new type + level.addEditType(newType); // calculate new type } - setTileEdit(new_type); // activate the new type for all views + setTileEdit(newType); // activate the new type for all views } // get/set autojoin state @@ -382,7 +382,7 @@ } public void openHelpWindow() { - m_view.openHelpWindow(); + mainView.openHelpWindow(); } // access to ArchNodeList @@ -435,7 +435,7 @@ } void setMapAndArchPosition(int archid, int x, int y) { - m_currentMap.getMapView().setMapAndArchPosition(archid, x, y); + currentMap.getMapView().setMapAndArchPosition(archid, x, y); } /** @@ -444,31 +444,31 @@ */ public void readGlobalSettings() { // Get the directories - m_strMapDir = CSettings.getInstance(IGUIConstants.APP_NAME).getProperty( + strMapDir = CSettings.getInstance(IGUIConstants.APP_NAME).getProperty( MAP_DIR_KEY, DEFAULT_MAP_DIR); - m_strArchDir = CSettings.getInstance(IGUIConstants.APP_NAME).getProperty( + strArchDir = CSettings.getInstance(IGUIConstants.APP_NAME).getProperty( ARCH_DIR_KEY, DEFAULT_ARCH_DIR); - m_strScriptDir = CSettings.getInstance(IGUIConstants.APP_NAME).getProperty( + strScriptDir = CSettings.getInstance(IGUIConstants.APP_NAME).getProperty( SCRIPT_DIR_KEY, DEFAULT_SCRIPT_DIR); // set map dir - if (m_strMapDir.length() > 0) { - m_mapDir = new File(m_strMapDir); + if (strMapDir.length() > 0) { + mapDir = new File(strMapDir); } else { // if map dir not set, default to current dir - if (!m_currentDir.exists()) { + if (!currentDir.exists()) { log.error("in readGlobalSettings(): current dir doesn't exist!"); } - m_mapDir = new File(m_currentDir.getAbsolutePath()); + mapDir = new File(currentDir.getAbsolutePath()); } // if mapdir has no absolute path, set it now - if (m_currentDir.exists() && m_mapDir.getParent() == null && - !m_mapDir.isAbsolute() && !has_changed_dir) { - m_mapDir = new File(m_currentDir.getAbsolutePath(), m_mapDir.getPath()); + if (currentDir.exists() && mapDir.getParent() == null && + !mapDir.isAbsolute() && !hasChangedDir) { + mapDir = new File(currentDir.getAbsolutePath(), mapDir.getPath()); } - m_archDir = new File(m_strArchDir); - m_scriptDir = new File(m_strScriptDir); + archDir = new File(strArchDir); + scriptDir = new File(strScriptDir); imageSet = new String(CSettings.getInstance(IGUIConstants.APP_NAME).getProperty( USE_IMAGESET, (IGUIConstants.isoView ? "none" : "base"))); @@ -476,7 +476,7 @@ imageSet = null; } - load_from_archive = new Boolean(CSettings.getInstance(IGUIConstants.APP_NAME).getProperty( + loadFromarchive = new Boolean(CSettings.getInstance(IGUIConstants.APP_NAME).getProperty( LOAD_ARCH_COLL, "true")).booleanValue(); this.getMainView().setMapTileListBottom(new Boolean(CSettings.getInstance(IGUIConstants.APP_NAME).getProperty( @@ -526,19 +526,19 @@ public static final FileFilter pythonFileFilter = new net.sf.gridarta.gui.HideFileFilterProxy(new EndingFileFilter(true, ACTION_FACTORY.getString("fileDialog.filter.python"), ".py")); public String getMapDefaultFolder() { - return m_strMapDir; + return strMapDir; } public String getArchDefaultFolder() { - return m_strArchDir; + return strArchDir; } public String getScriptDefaultFolder() { - return m_strScriptDir; + return strScriptDir; } public boolean isArchLoadedFromCollection() { - return load_from_archive; + return loadFromarchive; } public boolean isPickmapsLocked() { @@ -547,20 +547,20 @@ /** refresh the active map view, if there is one */ void refreshCurrentMap() { - m_view.refreshMapTileList(); // update tile window - if (m_currentMap != null) { - m_currentMap.repaint(); // update map view (if there is one) + mainView.refreshMapTileList(); // update tile window + if (currentMap != null) { + currentMap.repaint(); // update map view (if there is one) } } // ask arch panel which arch is selectd public ArchObject getArchPanelSelection() { - return m_view.getArchPanelSelection(); + return mainView.getArchPanelSelection(); } // setup quick view window public void showArchPanelQuickObject(ArchObject arch) { - m_view.showArchPanelQuickObject(arch); + mainView.showArchPanelQuickObject(arch); } /** @@ -592,49 +592,49 @@ } boolean addArchToMap(int archnr, int mapx, int mapy, int intern, boolean join) { - return m_currentMap.addArchToMap(archnr, mapx, mapy, intern, join); + return currentMap.addArchToMap(archnr, mapx, mapy, intern, join); } boolean insertArchToMap(ArchObject newarch, int archnr, ArchObject next, int mapx, int mapy, boolean join) { - return m_currentMap.insertArchToMap(newarch, archnr, next, mapx, mapy, join); + return currentMap.insertArchToMap(newarch, archnr, next, mapx, mapy, join); } - public void deleteMapArch(int index, int mapx, int mapy, boolean refresh_map, boolean join) { - m_currentMap.deleteMapArch(index, mapx, mapy, refresh_map, join); + public void deleteMapArch(int index, int mapx, int mapy, boolean refreshMap, boolean join) { + currentMap.deleteMapArch(index, mapx, mapy, refreshMap, join); } public ArchObject getMapArch(int index, int mapx, int mapy) { - return m_currentMap.getMapArch(index, mapx, mapy); + return currentMap.getMapArch(index, mapx, mapy); } public CMainView getMainView() { - return m_view; + return mainView; } public void addArchPanel(String name) { - m_view.addArchPanel(name); + mainView.addArchPanel(name); } public void disableTabPane() { - m_view.disableTabPane(); + mainView.disableTabPane(); } public void enableTabPane() { - m_view.enableTabPane(); + mainView.enableTabPane(); } public int addArchPanelCombo(String name) { - return m_view.addArchPanelCombo(name); + return mainView.addArchPanelCombo(name); } public void addArchPanelArch(int archnr, int index) { - m_view.addArchPanelArch(archnr, index); + mainView.addArchPanelArch(archnr, index); } // selected arch in arch panel public int getPanelArch() { - return m_view.getPanelArch(); + return mainView.getPanelArch(); } public ImageIcon getFace(int i) { @@ -646,7 +646,7 @@ } public void setStatusText(String string) { - m_view.setStatusText(string); + mainView.setStatusText(string); } public ArchObjectStack getArchObjectStack() { @@ -660,11 +660,11 @@ public void setLookNFeel(String strClassName) { try { UIManager.setLookAndFeel(strClassName); - SwingUtilities.updateComponentTreeUI(m_view); + SwingUtilities.updateComponentTreeUI(mainView); // update the look and feel for all open map views - if (m_levels.size() > 0) { - for (Enumeration enu = m_levels.elements(); enu.hasMoreElements();) { + if (levels.size() > 0) { + for (Enumeration enu = levels.elements(); enu.hasMoreElements();) { CMapControl level = (CMapControl) enu.nextElement(); level.getMapView().updateLookAndFeel(); if (log.isDebugEnabled()) { @@ -681,16 +681,16 @@ // Set grid of level, if there is a level public boolean isGridVisible() { - if (m_currentMap == null) { + if (currentMap == null) { return false; } - return m_currentMap.getMapView().isGridVisible(); + return currentMap.getMapView().isGridVisible(); } public void setGridVisibility(boolean fVisible) { - if (m_currentMap != null) { - m_currentMap.getMapView().setGridVisibility(fVisible); + if (currentMap != null) { + currentMap.getMapView().setGridVisibility(fVisible); } } @@ -706,7 +706,7 @@ public void newLevelWanted(String filename) { try { CMainStatusbar.getInstance().setText(" Creating new map..."); - CNewMapDialog levelDialog = new CNewMapDialog(this, m_view, filename, CNewMapDialog.TYPE_CFMAP); + CNewMapDialog levelDialog = new CNewMapDialog(this, mainView, filename, CNewMapDialog.TYPE_CFMAP); CMainStatusbar.getInstance().setText(""); } catch (CGridderException error) { CMainStatusbar.getInstance().setText(" Failed to create new map!"); @@ -718,7 +718,7 @@ public void newPickmapWanted() { try { CMainStatusbar.getInstance().setText(" Creating new pickmap..."); - CNewMapDialog levelDialog = new CNewMapDialog(this, m_view, null, CNewMapDialog.TYPE_PICKMAP); + CNewMapDialog levelDialog = new CNewMapDialog(this, mainView, null, CNewMapDialog.TYPE_PICKMAP); CMainStatusbar.getInstance().setText(""); } catch (CGridderException error) { CMainStatusbar.getInstance().setText(" Failed to create new pickmap!"); @@ -758,9 +758,9 @@ try { map = new CMapControl(this, start, maparch, false, initial); if (show) { - m_view.addLevelView(map.getMapView()); // one view... + mainView.addLevelView(map.getMapView()); // one view... map.getMapView().setAutoscrolls(true); - m_levels.addElement(map); + levels.addElement(map); setCurrentLevel(map); refreshMenusAndToolbars(); } @@ -777,20 +777,20 @@ /** Invoked when the user wants to close the current level. */ public void closeCurrentLevelWanted() { - if (m_currentMap != null) { - closeLevel(m_currentMap, false); - if (m_currentMap != null) { - m_view.setCurrentLevelView(m_currentMap.getMapView()); + if (currentMap != null) { + closeLevel(currentMap, false); + if (currentMap != null) { + mainView.setCurrentLevelView(currentMap.getMapView()); } } } /** Invoked when the user wants to close all levels. */ public void closeAllLevelsWanted() { - for (; m_levels.size() > 0;) { - closeLevel(m_currentMap, false); - if (m_currentMap != null) { - m_view.setCurrentLevelView(m_currentMap.getMapView()); + for (; levels.size() > 0;) { + closeLevel(currentMap, false); + if (currentMap != null) { + mainView.setCurrentLevelView(currentMap.getMapView()); } } } @@ -839,7 +839,7 @@ public boolean closeLevel(CMapControl level, boolean forced) { if (level == null) { - showMessage("CLOSE LEVEL", "FIND NULL LEVEL : " + m_levels.size() + " our map: " + m_currentMap); + showMessage("CLOSE LEVEL", "FIND NULL LEVEL : " + levels.size() + " our map: " + currentMap); } if (level != null && !forced && level.isLevelChanged()) { @@ -861,16 +861,16 @@ level.levelCloseNotify(); } else { // Notify the level about the closing - m_view.setMapTileList(null, -1); + mainView.setMapTileList(null, -1); level.levelCloseNotify(); - m_view.removeLevelView(level.getMapView()); - m_levels.removeElement(level); - m_currentMap = null; + mainView.removeLevelView(level.getMapView()); + levels.removeElement(level); + currentMap = null; - if (m_levels.size() > 0) { - // get next open map we can find and set it to m_currentMap - for (Enumeration enu = m_levels.elements(); enu.hasMoreElements();) { - m_currentMap = (CMapControl) enu.nextElement(); + if (levels.size() > 0) { + // get next open map we can find and set it to currentMap + for (Enumeration enu = levels.elements(); enu.hasMoreElements();) { + currentMap = (CMapControl) enu.nextElement(); } } } @@ -917,13 +917,13 @@ fileChooser.setMultiSelectionEnabled(false); // default folder is the map-folder at first time, then the active folder - if (!has_changed_dir && m_mapDir.exists()) { - fileChooser.setCurrentDirectory(m_mapDir); - } else if (m_currentDir.exists()) { - fileChooser.setCurrentDirectory(m_currentDir); + if (!hasChangedDir && mapDir.exists()) { + fileChooser.setCurrentDirectory(mapDir); + } else if (currentDir.exists()) { + fileChooser.setCurrentDirectory(currentDir); } - int returnVal = fileChooser.showOpenDialog(m_view); + int returnVal = fileChooser.showOpenDialog(mainView); if (returnVal == JFileChooser.APPROVE_OPTION) { if (ArchObjectStack.getLoadStatus() == ArchObjectStack.IS_LOADING) { // ArchStack still loading -> abort! @@ -941,11 +941,11 @@ return; } - has_changed_dir = true; // user has chosen an active dir + hasChangedDir = true; // user has chosen an active dir File file = fileChooser.getSelectedFile(); if ((file.getName().endsWith(".py") || file.getName().endsWith(".PY")) && !file.isDirectory()) { // user selected a python script - well, why not... - m_currentDir = fileChooser.getCurrentDirectory(); + currentDir = fileChooser.getCurrentDirectory(); if (file.exists()) { ScriptEditControl.getInstance().openScriptFile(file.getAbsolutePath()); } else { @@ -955,7 +955,7 @@ // it's a map file, most likely if (file.exists() && !file.isDirectory()) { // everything okay do far, now open up that mapfile - m_currentDir = fileChooser.getCurrentDirectory(); + currentDir = fileChooser.getCurrentDirectory(); openFile(file); } else { // user entered a filename which doesn't yet exist -> create new map @@ -1030,9 +1030,9 @@ if (show) { // finally, show the map and refresh toolbars - m_currentMap.setMapFile(file); - m_currentMap.setActive_edit_type(tileEdit); // map is loaded with current view settings - m_currentMap.getMapModel().resetLevelChangedFlag(); + currentMap.setMapFile(file); + currentMap.setActiveEditType(tileEdit); // map is loaded with current view settings + currentMap.getMapModel().resetLevelChangedFlag(); refreshMenusAndToolbars(); } @@ -1143,11 +1143,11 @@ /** Invoked when user wants to save the current level. */ public void saveCurrentLevelWanted() { - if (m_currentMap == null) { + if (currentMap == null) { return; } - m_currentMap.save(); + currentMap.save(); } /** Save current active pickmap */ @@ -1172,7 +1172,7 @@ /** Invoked when user wants to save the current level to certain file. */ public void saveCurrentLevelAsWanted() { - saveLevelAsWanted(m_currentMap); + saveLevelAsWanted(currentMap); } /** @@ -1190,29 +1190,29 @@ fileChooser.setMultiSelectionEnabled(false); // default folder is the map-folder at first time, then the active folder - if (!has_changed_dir && m_mapDir.exists()) { - fileChooser.setCurrentDirectory(m_mapDir); - } else if (m_currentDir.exists()) { - fileChooser.setCurrentDirectory(m_currentDir); + if (!hasChangedDir && mapDir.exists()) { + fileChooser.setCurrentDirectory(mapDir); + } else if (currentDir.exists()) { + fileChooser.setCurrentDirectory(currentDir); } // if file already exists, select it if (level.getMapFile() != null && level.getMapFile().exists()) { fileChooser.setSelectedFile(level.getMapFile()); } else { - fileChooser.setSelectedFile(new File(m_mapDir, level.getMapFileName())); + fileChooser.setSelectedFile(new File(mapDir, level.getMapFileName())); } - int returnVal = fileChooser.showSaveDialog(m_view); + int returnVal = fileChooser.showSaveDialog(mainView); if (returnVal == JFileChooser.APPROVE_OPTION) { - has_changed_dir = true; // user has chosen an active dir + hasChangedDir = true; // user has chosen an active dir File file = fileChooser.getSelectedFile(); level.saveAs(file); level.setMapFileName(file.getName()); // window title and file name //level.setMapName(file.getName()); // map name (internal) level.setMapFile(file); - m_currentDir = fileChooser.getCurrentDirectory(); + currentDir = fileChooser.getCurrentDirectory(); refreshMenusAndToolbars(); } } @@ -1223,7 +1223,7 @@ * an output file name/path for the png image. */ public void createImageWanted() { - CMapControl mc = m_currentMap; // control of current map + CMapControl mc = currentMap; // control of current map String filename = null; if (mc == null) { @@ -1231,12 +1231,12 @@ showMessage("No Map Open", "You cannot create an image when there is no map open."); } else { try { - if (m_strImageDir == null) { - m_strImageDir = m_mapDir.getAbsolutePath(); + if (strImageDir == null) { + strImageDir = mapDir.getAbsolutePath(); } - filename = m_strImageDir + File.separator + mc.getMapFileName() + ".png"; - JFileChooser fileChooser = new JFileChooser(m_strImageDir); + filename = strImageDir + File.separator + mc.getMapFileName() + ".png"; + JFileChooser fileChooser = new JFileChooser(strImageDir); fileChooser.setDialogTitle("Save Image As"); fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); fileChooser.setMultiSelectionEnabled(false); @@ -1252,11 +1252,11 @@ } }); - int returnVal = fileChooser.showSaveDialog(m_view); + int returnVal = fileChooser.showSaveDialog(mainView); if (returnVal == JFileChooser.APPROVE_OPTION) { // got the filepath, now create image filename = fileChooser.getSelectedFile().getAbsolutePath(); - m_strImageDir = fileChooser.getSelectedFile().getParentFile().getAbsolutePath(); + strImageDir = fileChooser.getSelectedFile().getParentFile().getAbsolutePath(); if (!filename.endsWith(".png")) { filename += ".png"; } @@ -1276,7 +1276,7 @@ * @param filename Name of the png image file to create. */ public void createImageWanted(String filename) { - createImageWanted(m_currentMap, filename); + createImageWanted(currentMap, filename); } /** @@ -1310,7 +1310,7 @@ /** Invoked when user wants to see/edit the level properties. */ void mapPropertiesWanted() { - showMapProperties(m_currentMap); + showMapProperties(currentMap); } /** @@ -1320,7 +1320,7 @@ void showMapProperties(CMapControl level) { if (level != null) { try { - CMapPropertiesDialog dialog = new CMapPropertiesDialog(this, m_view, level); + CMapPropertiesDialog dialog = new CMapPropertiesDialog(this, mainView, level); } catch (CGridderException error) { handleErrors(error); } @@ -1328,7 +1328,7 @@ } boolean isTileShow() { - return m_currentMap.isTileShow(); + return currentMap.isTileShow(); } void setTileShow() { @@ -1340,7 +1340,7 @@ void optionsWanted() { try { - COptionDialog dialog = new COptionDialog(this, m_view); + COptionDialog dialog = new COptionDialog(this, mainView); } catch (CGridderException error) { handleErrors(error); } @@ -1369,8 +1369,8 @@ /** Invoked when user wants to exit from the program. */ void exitWanted() { - if (m_levels.size() > 0) { - for (Enumeration enu = m_levels.elements(); enu.hasMoreElements();) { + if (levels.size() > 0) { + for (Enumeration enu = levels.elements(); enu.hasMoreElements();) { CMapControl level = (CMapControl) enu.nextElement(); closeLevel(level, false); } @@ -1391,7 +1391,7 @@ String path; // exit path int dx, dy; // exit destination coords. - exit = m_currentMap.getMapModel().getExit(); + exit = currentMap.getMapModel().getExit(); if (exit == null) { // no exit found @@ -1403,13 +1403,13 @@ dx = exit.getAttributeValue("hp", getArch(exit.getNodeNr())); dy = exit.getAttributeValue("sp", getArch(exit.getNodeNr())); - if (path.length() == 0 || (m_currentMap.getMapFile() != null && - path.equals(m_currentMap.getMapFile().getName()))) { + if (path.length() == 0 || (currentMap.getMapFile() != null && + path.equals(currentMap.getMapFile().getName()))) { // path points to the same map if (dx == 0 && dy == 0) { showMessage("Destination Invalid", "This exit points nowhere."); - } else if (m_currentMap.pointValid(dx, dy)) { - m_currentMap.getMapView().setHotspot(dx, dy); + } else if (currentMap.pointValid(dx, dy)) { + currentMap.getMapView().setHotspot(dx, dy); } else { showMessage("Destination Invalid", "The destination of this exit is outside the map."); } @@ -1419,14 +1419,14 @@ if (path.startsWith(File.pathSeparator) || path.startsWith("/")) { // we have an absolute path: - newfile = new File(m_mapDir.getAbsolutePath(), path.substring(1)); + newfile = new File(mapDir.getAbsolutePath(), path.substring(1)); } else { // we have a relative path: - if (m_currentMap.getMapFile() == null) { + if (currentMap.getMapFile() == null) { showMessage("Map not Saved", "Please save this map first.", JOptionPane.ERROR_MESSAGE); return; } - newfile = new File(m_currentMap.getMapFile().getParent(), path); + newfile = new File(currentMap.getMapFile().getParent(), path); } if (!newfile.exists() || newfile.isDirectory()) { @@ -1435,18 +1435,18 @@ return; } - oldmap = m_currentMap; // store old map control + oldmap = currentMap; // store old map control openFile(newfile); // open the new map if (dx == 0 && dy == 0) { // use the entry point defined by the map header - dx = m_currentMap.getMapModel().getMapArchObject().getEnterX(); - dy = m_currentMap.getMapModel().getMapArchObject().getEnterY(); + dx = currentMap.getMapModel().getMapArchObject().getEnterX(); + dy = currentMap.getMapModel().getMapArchObject().getEnterY(); } - m_currentMap.getMapView().setHotspot(dx, dy); // set hotspot + currentMap.getMapView().setHotspot(dx, dy); // set hotspot // Update the main view so the new map instantly pops up. - m_view.update(m_view.getGraphics()); + mainView.update(mainView.getGraphics()); closeLevel(oldmap, false); // close the old map } @@ -1464,7 +1464,7 @@ String path; // exit path CMapControl oldmap; // store control of active map (to evt. close it later) - path = m_currentMap.getMapTilePath(direction); + path = currentMap.getMapTilePath(direction); if (path == null || path.length() == 0) { // tile direction not set (due to disabled menus this should normally not happen) @@ -1475,10 +1475,10 @@ if (path.startsWith(File.pathSeparator) || path.startsWith("/")) { // we have an absolute path: - newfile = new File(m_mapDir.getAbsolutePath(), path.substring(1)); + newfile = new File(mapDir.getAbsolutePath(), path.substring(1)); } else { // we have a relative path: - newfile = new File(m_currentMap.getMapFile().getParent(), path); + newfile = new File(currentMap.getMapFile().getParent(), path); } if (!newfile.exists() || newfile.isDirectory()) { @@ -1487,13 +1487,13 @@ return; } - oldmap = m_currentMap; // store old map control + oldmap = currentMap; // store old map control openFile(newfile); // open the new map // set viewport view on the new map if (!IGUIConstants.isoView) { Rectangle scrollto = null; // new vieport rect - JViewport newViewPort = m_currentMap.getMapView().getViewPort(); + JViewport newViewPort = currentMap.getMapView().getViewPort(); JViewport oldViewPort = oldmap.getMapView().getViewPort(); if (direction == IGUIConstants.SOUTH) { @@ -1527,7 +1527,7 @@ } // Update the main view so the new map instantly pops up. - m_view.update(m_view.getGraphics()); + mainView.update(mainView.getGraphics()); closeLevel(oldmap, false); // close the old map } @@ -1535,12 +1535,12 @@ /** Gives focus to the previous window. */ public void previousWindowWanted() { - m_view.previousWindowWanted(); + mainView.previousWindowWanted(); } /** Gives focus to the next window. */ public void nextWindowWanted() { - m_view.nextWindowWanted(); + mainView.nextWindowWanted(); } /** @@ -1549,14 +1549,14 @@ */ public void setCurrentLevel(CMapControl map) { - m_currentMap = map; + currentMap = map; refreshMenusAndToolbars(); //CMainStatusbar.getInstance().setLevelInfo(level); } /** Invoked when user wants to revert the current map to previously saved state */ public void revertCurrentLevelWanted() { - CMapControl modmap = this.m_currentMap; // "modified map" to be reverted + CMapControl modmap = this.currentMap; // "modified map" to be reverted // ask for confirmation if (askConfirm( @@ -1571,7 +1571,7 @@ openFile(mfile, true, initial); // open the new map // Update the main view so the new map instantly pops up. - m_view.update(m_view.getGraphics()); + mainView.update(mainView.getGraphics()); } } @@ -1607,7 +1607,7 @@ CPickmapPanel.getInstance().setActivePickmap(mfile.getName()); // Update the main view so the new map instantly pops up. - m_view.update(m_view.getGraphics()); + mainView.update(mainView.getGraphics()); } } } @@ -1616,15 +1616,15 @@ /** Invoked when the user wants to undo a change in the current level. */ void undoWanted() { - if (m_currentMap != null) { - m_currentMap.undo(); + if (currentMap != null) { + currentMap.undo(); } } /** Invoked when the user wants to redo a change in the current level. */ void redoWanted() { - if (m_currentMap != null) { - m_currentMap.redo(); + if (currentMap != null) { + currentMap.redo(); } } @@ -1633,8 +1633,8 @@ * @return Name of the undo operation. */ public String getUndoName() { - if (m_currentMap != null) { - return m_currentMap.getUndoName(); + if (currentMap != null) { + return currentMap.getUndoName(); } return ""; @@ -1646,8 +1646,8 @@ */ public String getRedoName() { - if (m_currentMap != null) { - return m_currentMap.getRedoName(); + if (currentMap != null) { + return currentMap.getRedoName(); } return ""; @@ -1659,8 +1659,8 @@ */ boolean isUndoPossible() { - if (m_currentMap != null) { - return m_currentMap.isUndoPossible(); + if (currentMap != null) { + return currentMap.isUndoPossible(); } return false; @@ -1672,8 +1672,8 @@ */ boolean isRedoPossible() { - if (m_currentMap != null) { - return m_currentMap.isRedoPossible(); + if (currentMap != null) { + return currentMap.isRedoPossible(); } return false; @@ -1681,66 +1681,66 @@ /** "Clear" was selected from the Edit menu */ public void clearWanted() { - if (m_currentMap == null || m_currentMap.getMapView() == null) { + if (currentMap == null || currentMap.getMapView() == null) { return; // this should never be possible, but I just wanna make sure... } - copybuffer.clear(m_currentMap); + copybuffer.clear(currentMap); } /** "Cut" was selected from the Edit menu */ public void cutWanted() { - if (m_currentMap == null || m_currentMap.getMapView() == null) { + if (currentMap == null || currentMap.getMapView() == null) { return; // this should never be possible, but I just wanna make sure... } - copybuffer.cut(m_currentMap); + copybuffer.cut(currentMap); } /** "Copy" was selected from the Edit menu */ public void copyWanted() { - if (m_currentMap == null || m_currentMap.getMapView() == null) { + if (currentMap == null || currentMap.getMapView() == null) { return; // this should never be possible, but I just wanna make sure... } - copybuffer.copy(m_currentMap); + copybuffer.copy(currentMap); } /** "Paste" was selected from the Edit menu */ public void pasteWanted() { - if (m_currentMap == null || m_currentMap.getMapView() == null) { + if (currentMap == null || currentMap.getMapView() == null) { return; // this should never be possible, but I just wanna make sure... } - copybuffer.paste(m_currentMap); + copybuffer.paste(currentMap); } /** * "Fill" was selected from the Edit menu - * @param fill_below true if "Fill Below" was activated, false if "Fill Above" + * @param fillBelow true if "Fill Below" was activated, false if "Fill Above" */ - public void fillWanted(boolean fill_below) { - if (m_currentMap == null || m_currentMap.getMapView() == null) { + public void fillWanted(boolean fillBelow) { + if (currentMap == null || currentMap.getMapView() == null) { return; // this should never be possible, but I just wanna make sure... } - copybuffer.fill(m_currentMap, fill_below); + copybuffer.fill(currentMap, fillBelow); } /** "Replace" was selected from the Edit menu */ public void replaceWanted() { - if (m_currentMap == null || m_currentMap.getMapView() == null) { + if (currentMap == null || currentMap.getMapView() == null) { return; // this should never be possible, but I just wanna make sure... } - copybuffer.replace(m_currentMap); + copybuffer.replace(currentMap); } /** * is CopyBuffer empty? * @return true if the buffer is empty */ - public boolean isCopyBuffer_empty() { + public boolean isCopyBufferEmpty() { return copybuffer.isEmpty(); } @@ -1749,7 +1749,7 @@ * @return All level windows */ Enumeration getAllLevelWindows() { - return m_view.getAllLevelWindows(); + return mainView.getAllLevelWindows(); } /** @@ -1758,17 +1758,17 @@ */ void setCurrentLevelView(CMapViewIFrame view) { - m_view.setCurrentLevelView(view); + mainView.setCurrentLevelView(view); } /** Notifies that the application is about to exit. */ void appExitNotify() { - m_view.appExitNotify(); // notify main view + mainView.appExitNotify(); // notify main view ScriptEditControl.getInstance().appExitNotify(); // notify scriptpad controller - if (m_currentMap != null) { - m_view.setMapTileList(null, -1); - m_currentMap.appExitNotify(); + if (currentMap != null) { + mainView.setMapTileList(null, -1); + currentMap.appExitNotify(); } // save settings @@ -1776,17 +1776,17 @@ } public void refreshMenus() { - m_view.refreshMenus(); + mainView.refreshMenus(); } /** Refreshes the state of menu items and toolbar buttons. */ public void refreshMenusAndToolbars() { - m_view.refreshMenusAndToolbars(); + mainView.refreshMenusAndToolbars(); } /** Relayouts and repaints the main view. */ public void refreshMainView() { - m_view.refresh(); + mainView.refresh(); } /** @@ -1794,7 +1794,7 @@ * @return True if a level is being edited or false if not. */ boolean isLevelEdited() { - return m_currentMap != null; + return currentMap != null; } /** @@ -1804,7 +1804,7 @@ */ boolean isPlainSaveEnabled() { - return m_currentMap != null && m_currentMap.isPlainSaveEnabled(); + return currentMap != null && currentMap.isPlainSaveEnabled(); } @@ -1873,7 +1873,7 @@ public void handleErrors(CGridderException error) { Toolkit.getDefaultToolkit().beep(); - m_view.showError(error); + mainView.showError(error); } /** @@ -1882,7 +1882,7 @@ * @param strMessage The message to be shown. */ public void showMessage(String strTitle, String strMessage) { - m_view.showMessage(strTitle, strMessage); + mainView.showMessage(strTitle, strMessage); } /** @@ -1892,7 +1892,7 @@ * @param messageType Type of message (see JOptionPane constants) */ public void showMessage(String strTitle, String strMessage, int messageType) { - m_view.showMessage(strTitle, strMessage, messageType); + mainView.showMessage(strTitle, strMessage, messageType); } /** @@ -1903,7 +1903,7 @@ * @return Ture if the user agrees, false if user disagrees. */ public boolean askConfirm(String strTitle, String strMessage) { - return m_view.askConfirm(strTitle, strMessage); + return mainView.askConfirm(strTitle, strMessage); } public CFilterControl getFilterControl() { @@ -1911,7 +1911,7 @@ } public CScriptController getScriptController() { - return m_scriptControl; + return scriptControl; } public ImageIcon getEmptyTileIcon() { @@ -1919,11 +1919,11 @@ } public CMapControl[] getOpenedMaps() { - return (CMapControl[]) m_levels.toArray(new CMapControl[m_levels.size()]); + return (CMapControl[]) levels.toArray(new CMapControl[levels.size()]); } public CMapControl getCurrentMap() { - return m_currentMap; + return currentMap; } public ArchObjectParser getArchObjectParser() { Modified: trunk/crossfire/src/cfeditor/CMainMenu.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainMenu.java 2006-05-30 23:31:10 UTC (rev 87) +++ trunk/crossfire/src/cfeditor/CMainMenu.java 2006-05-31 09:51:06 UTC (rev 88) @@ -574,7 +574,7 @@ new ActionListener() { public void actionPerformed(ActionEvent event) { if (se_monster.isChecked()) { - m_control.select_edittype(IGUIConstants.TILE_EDIT_MONSTER); + m_control.selectEditType(IGUIConstants.TILE_EDIT_MONSTER); } else { m_control.unsetTileEdit(IGUIConstants.TILE_EDIT_MONSTER); } @@ -589,7 +589,7 @@ new ActionListener() { public void actionPerformed(ActionEvent event) { if (se_exit.isChecked()) { - m_control.select_edittype(IGUIConstants.TILE_EDIT_EXIT); + m_control.selectEditType(IGUIConstants.TILE_EDIT_EXIT); } else { m_control.unsetTileEdit(IGUIConstants.TILE_EDIT_EXIT); } @@ -604,7 +604,7 @@ new ActionListener() { public void actionPerformed(ActionEvent event) { if (se_background.isChecked()) { - m_control.select_edittype(IGUIConstants.TILE_EDIT_BACKGROUND); + m_control.selectEditType(IGUIConstants.TILE_EDIT_BACKGROUND); } else { m_control.unsetTileEdit(IGUIConstants.TILE_EDIT_BACKGROUND); } @@ -619,7 +619,7 @@ new ActionListener() { public void actionPerformed(ActionEvent event) { if (se_door.isChecked()) { - m_control.select_edittype(IGUIConstants.TILE_EDIT_DOOR); + m_control.selectEditType(IGUIConstants.TILE_EDIT_DOOR); } else { m_control.unsetTileEdit(IGUIConstants.TILE_EDIT_DOOR); } @@ -633,7 +633,7 @@ new ActionListener() { public void actionPerformed(ActionEvent event) { if (se_wall.isChecked()) { - m_control.select_edittype(IGUIConstants.TILE_EDIT_WALL); + m_control.selectEditType(IGUIConstants.TILE_EDIT_WALL); } else { m_control.unsetTileEdit(IGUIConstants.TILE_EDIT_WALL); } @@ -647,7 +647,7 @@ new ActionListener() { public void actionPerformed(ActionEvent event) { if (se_equip.isChecked()) { - m_control.select_edittype(IGUIConstants.TILE_EDIT_EQUIP); + m_control.selectEditType(IGUIConstants.TILE_EDIT_EQUIP); } else { m_control.unsetTileEdit(IGUIConstants.TILE_EDIT_EQUIP); } @@ -661,7 +661,7 @@ new ActionListener() { public void actionPerformed(ActionEvent event) { if (se_treasure.isChecked()) { - m_control.select_edittype(IGUIConstants.TILE_EDIT_TREASURE); + m_control.selectEditType(IGUIConstants.TILE_EDIT_TREASURE); } else { m_control.unsetTileEdit(IGUIConstants.TILE_EDIT_TREASURE); } @@ -675,7 +675,7 @@ new ActionListener() { public void actionPerformed(ActionEvent event) { if (se_connected.isChecked()) { - m_control.select_edittype(IGUIConstants.TILE_EDIT_CONNECTED); + m_control.selectEditType(IGUIConstants.TILE_EDIT_CONNECTED); } else { m_control.unsetTileEdit(IGUIConstants.TILE_EDIT_CONNECTED); } @@ -1386,7 +1386,7 @@ m_fill_below.setEnabled(true); m_enterExit.setEnabled(true); - m_paste.setEnabled(!m_control.isCopyBuffer_empty()); + m_paste.setEnabled(!m_control.isCopyBufferEmpty()); } else { m_clear.setEnabled(false); m_cut.setEnabled(false); Modified: trunk/crossfire/src/cfeditor/CMainStatusbar.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainStatusbar.java 2006-05-30 23:31:10 UTC (rev 87) +++ trunk/crossfire/src/cfeditor/CMainStatusbar.java 2006-05-31 09:51:06 UTC (rev 88) @@ -40,36 +40,36 @@ public class CMainStatusbar extends JPanel { /** The most recent instance of this statusbar class. */ - private static CMainStatusbar mStatic_statusbar = null; + private static CMainStatusbar staticStatusbar = null; /** Controller of this statusbar view. */ - private final CMainControl m_control; + private final CMainControl mainControl; /** The label that shows the one line text message. */ - private final JLabel m_mainStatusLabel; + private final JLabel status; /** The label that shows the level status. */ - private final JLabel m_levelStatus; + private final JLabel levelStatus; /** The label that shows the memory status. */ - private final JLabel m_memStatus; + private final JLabel memory; private static final long serialVersionUID = -2203690197582059957L; /** * Constructs a statusbar that has the given main controller object set * as its controller. - * @param control The controller of this view. + * @param mainControl The controller of this view. */ - CMainStatusbar(CMainControl control) throws CGridderException { - m_control = control; + CMainStatusbar(CMainControl mainControl) throws CGridderException { + this.mainControl = mainControl; setLayout(new BorderLayout()); JPanel mainPanel = new JPanel(new BorderLayout()); mainPanel.setBorder(new BevelBorder(BevelBorder.LOWERED)); - m_mainStatusLabel = new JLabel(" "); - mainPanel.add(m_mainStatusLabel, BorderLayout.CENTER); + status = new JLabel(" "); + mainPanel.add(status, BorderLayout.CENTER); add(mainPanel, BorderLayout.CENTER); @@ -77,19 +77,19 @@ JPanel levelInfoPanel = new JPanel(new BorderLayout()); levelInfoPanel.setBorder(new BevelBorder(BevelBorder.LOWERED)); - m_levelStatus = new JLabel(" "); - levelInfoPanel.add(m_levelStatus, BorderLayout.CENTER); + levelStatus = new JLabel(" "); + levelInfoPanel.add(levelStatus, BorderLayout.CENTER); infoPanel.add(levelInfoPanel, BorderLayout.CENTER); JPanel memInfoPanel = new JPanel(new BorderLayout()); memInfoPanel.setBorder(new BevelBorder(BevelBorder.LOWERED)); - m_memStatus = new JLabel(" "); - memInfoPanel.add(m_memStatus, BorderLayout.CENTER); + memory = new JLabel(" "); + memInfoPanel.add(memory, BorderLayout.CENTER); infoPanel.add(memInfoPanel, BorderLayout.WEST); mainPanel.add(infoPanel, BorderLayout.EAST); - mStatic_statusbar = this; + staticStatusbar = this; updateFont(); } @@ -98,7 +98,7 @@ * @return The st... [truncated message content] |
From: <chr...@us...> - 2006-05-30 23:31:50
|
Revision: 87 Author: christianhujer Date: 2006-05-30 16:31:10 -0700 (Tue, 30 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=87&view=rev Log Message: ----------- Some work on unifying ScriptArchData. Modified Paths: -------------- trunk/crossfire/build.xml trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/ScriptArchData.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/ScriptArchData.java Added Paths: ----------- trunk/crossfire/src/cfeditor/action.properties trunk/crossfire/src/cfeditor/messages.properties trunk/src/app/net/sf/gridarta/gui/ trunk/src/app/net/sf/gridarta/gui/HideFileFilterProxy.java Removed Paths: ------------- trunk/daimonin/src/daieditor/gui/HideFileFilterProxy.java Modified: trunk/crossfire/build.xml =================================================================== --- trunk/crossfire/build.xml 2006-05-30 23:22:11 UTC (rev 86) +++ trunk/crossfire/build.xml 2006-05-30 23:31:10 UTC (rev 87) @@ -116,9 +116,16 @@ > <!-- pack everything into the jar file --> <fileset dir="${build.dir}" excludes="MANIFEST.MF,test/**"/> + <fileset dir="${src.dir}" includes="**/*.properties" /> <zipfileset src="../lib/japi.jar"> <include name="net/sf/japi/swing/DisposeAction.class" /> + <include name="net/sf/japi/util/filter/file/AbstractFileFilter.class" /> + <include name="net/sf/japi/util/filter/file/FileFilter.class" /> + <include name="net/sf/japi/util/filter/Filter.class" /> + <include name="net/sf/japi/util/filter/file/EndingFileFilter.class" /> + <include name="net/sf/japi/swing/ActionFactory.class" /> + <include name="net/sf/japi/swing/NamedActionMap.class" /> </zipfileset> <!-- creating the manifest --> <manifest> Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-05-30 23:22:11 UTC (rev 86) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-05-30 23:31:10 UTC (rev 87) @@ -24,6 +24,7 @@ package cfeditor; +import static net.sf.japi.swing.ActionFactory.getFactory; import cfeditor.arch.ArchObject; import cfeditor.arch.ArchObjectParser; import cfeditor.arch.ArchObjectStack; @@ -48,6 +49,8 @@ import javax.swing.UnsupportedLookAndFeelException; import javax.swing.filechooser.FileFilter; import org.apache.log4j.Logger; +import net.sf.japi.util.filter.file.EndingFileFilter; +import net.sf.japi.swing.ActionFactory; /** * The main controller of the level editor. Basically the main application. @@ -56,6 +59,9 @@ */ public class CMainControl extends JFrame { + /** ActionFactory. */ + private static final ActionFactory ACTION_FACTORY = getFactory("cfeditor"); + private static final Logger log = Logger.getLogger(CMainControl.class); private static CMainControl mStatic_control = null; @@ -516,6 +522,9 @@ refreshMenusAndToolbars(); } + /** Swing FileFilter for Lua scripts. */ + public static final FileFilter pythonFileFilter = new net.sf.gridarta.gui.HideFileFilterProxy(new EndingFileFilter(true, ACTION_FACTORY.getString("fileDialog.filter.python"), ".py")); + public String getMapDefaultFolder() { return m_strMapDir; } Modified: trunk/crossfire/src/cfeditor/ScriptArchData.java =================================================================== --- trunk/crossfire/src/cfeditor/ScriptArchData.java 2006-05-30 23:22:11 UTC (rev 86) +++ trunk/crossfire/src/cfeditor/ScriptArchData.java 2006-05-30 23:31:10 UTC (rev 87) @@ -46,7 +46,7 @@ import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTextField; -import javax.swing.filechooser.FileFilter; +import static javax.swing.WindowConstants.HIDE_ON_CLOSE; import org.apache.log4j.Logger; /** @@ -66,32 +66,32 @@ public static final int EDATA_EVENT_OPTIONS = 2; // popup frame to edit script paths: - private static JDialog pathFrame = null; + private static JDialog pathFrame; - private static JTextField inputFPath = null; + private static JTextField inputFPath; - private static JTextField inputPlName = null; + private static JTextField inputPlName; - private static JTextField inputEEOptions = null; + private static JTextField inputEEOptions; - private static pathButtonListener ccListener; + private static PathButtonListener ccListener; - private static pathButtonListener okListener; + private static PathButtonListener okListener; // popup frame for new scripts: - private static JDialog newScriptFrame = null; + private static JDialog newScriptFrame; - private static JLabel nsHeading = null; + private static JLabel nsHeading; - private static pathButtonListener nsOkListener = null; + private static PathButtonListener nsOkListener; - private static JComboBox eventTypeBox = null; + private static JComboBox eventTypeBox; - private static JComboBox pluginNameBox = null; + private static JComboBox pluginNameBox; - private static JTextField inputNFPath = null; + private static JTextField inputNFPath; - private static JTextField inputEventOptions = null; + private static JTextField inputEventOptions; private final Vector eventList; // contains list of ScriptedEvents @@ -104,7 +104,7 @@ } /** Initialize the JComboBox with the event types. */ - private synchronized void initEventTypeBoxes() { + private static synchronized void initEventTypeBoxes() { String[] allEventTypes = new String[]{" apply", " attack", " close", " death", " drop", " pickup", " say", " stop", " time", " throw", " trigger"}; @@ -126,10 +126,10 @@ * @param dataType 0: pluginData = "plugin name" * 1: pluginData = "file path" */ - public synchronized void addEventData(String eventType, String eventData, int dataType) { + public synchronized void addEventData(final String eventType, final String eventData, final int dataType) { // first try to find an existing event - ScriptedEvent event; - int index = getScriptedEvent(eventType); + final ScriptedEvent event; + final int index = getScriptedEvent(eventType); // if none exists yet, create new - else take the existing one if (index == -1) { @@ -161,7 +161,7 @@ * @param eventType look for a ScriptedEvent of this type * @return index of ScriptedEvent in 'eventList' if found, -1 if not found */ - private int getScriptedEvent(String eventType) { + private int getScriptedEvent(final String eventType) { ScriptedEvent se; // tmp. event object if (eventList != null && eventList.size() > 0) { @@ -191,7 +191,7 @@ int numEvents = eventList.size(); for (int i = 0; i < numEvents; i++) { - se = (ScriptedEvent) (eventList.elementAt(i)); + se = (ScriptedEvent) eventList.elementAt(i); // validate this event if (!se.isValid()) { // this event is invalid @@ -215,12 +215,12 @@ * (the String is expected to end with '\n', unless empty) */ public String getMapArchEventData() { - StringBuffer buff = new StringBuffer(""); + StringBuilder buff = new StringBuilder(); ScriptedEvent se; // tmp. event object if (eventList != null && eventList.size() > 0) { for (int i = 0; i < eventList.size(); i++) { - se = (ScriptedEvent) (eventList.elementAt(i)); + se = (ScriptedEvent) eventList.elementAt(i); buff.append(se.getMapArchText()); } } @@ -305,13 +305,12 @@ /** * Try to create a reasonable default script name for lazy users :-) - * @param archName the best suitable name for the arch (see - * ArchObject.getBestName()) + * @param archName the best suitable name for the arch (see ArchObject.getBestName()) * @return a nice default script name without whitespaces */ - private String chooseDefaultScriptName(String archName) { + private static String chooseDefaultScriptName(final String archName) { String defScriptName = archName.trim(); - int i = 0; + final int i; if ((i = defScriptName.indexOf(" ")) >= 0) { if (defScriptName.length() > 12 || defScriptName.lastIndexOf(" ") != i) { // if there are several whitespaces or the name is too long, just cut off the end @@ -324,24 +323,22 @@ if (defScriptName.length() >= 3) { defScriptName = defScriptName.substring(0, 1).toUpperCase() + defScriptName.substring(1); } - defScriptName = defScriptName + "Script.py"; + defScriptName += "Script.py"; return defScriptName; } /** * This method is called when the user selects a new event to be created. - * The path relative to the map dir is calculated, and if reasonable, a - * relative path is created (relative to the map the event is on). + * The path relative to the map dir is calculated, and if reasonable, + * a relative path is created (relative to the map the event is on). * @param f script file * @return local event path */ - private String localizeEventPath(File f) { - CMainControl m_control = CMainControl.getInstance(); // main control - File localMapDir = m_control.getCurrentMap().getMapFile().getParentFile(); // local map directory - File mapDir = new File(m_control.getMapDefaultFolder()); // global map directory - File tmp; - String path = ""; + private static String localizeEventPath(final File f) { + CMainControl mainControl = CMainControl.getInstance(); // main control + final File localMapDir = mainControl.getCurrentMap().getMapFile().getParentFile(); // local map directory + File mapDir = new File(mainControl.getMapDefaultFolder()); // global map directory if (!mapDir.exists()) { log.warn("Map directory '" + mapDir.getAbsolutePath() + "' does not exist!"); @@ -349,11 +346,13 @@ } // find out if the scriptfile is in a subdirectory of the map file + File tmp; for (tmp = f.getParentFile(); tmp != null && !tmp.getAbsolutePath().equalsIgnoreCase(localMapDir.getAbsolutePath()); tmp = tmp.getParentFile()) { ; } + String path; if (tmp == null) { // scriptfile is NOT in a subirectory of mapfile -> absolute path path = f.getAbsolutePath().substring(mapDir.getAbsolutePath().length()); @@ -369,54 +368,52 @@ path = path.substring(1); // no leading slash } } - return path; } /** - * A popup is opened and the user can create a new scripting event which - * gets attached to this arch. - * @param panelList 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 panelList JList from the MapArchPanel (script tab) which displays the events */ - public void addEventScript(JList panelList, ArchObject arch) { - String archName = arch.getBestName(arch.getDefaultArch()); + public void addEventScript(final JList panelList, final ArchObject arch) { + final String archName = arch.getBestName(arch.getDefaultArch()); // create a reasonable default script name for lazy users :-) - String defScriptName = chooseDefaultScriptName(archName); + final String defScriptName = chooseDefaultScriptName(archName); if (newScriptFrame == null) { // initialize popup frame newScriptFrame = new JDialog(CMainControl.getInstance().getMainView(), "New Scripted Event", true); - newScriptFrame.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); + newScriptFrame.setDefaultCloseOperation(HIDE_ON_CLOSE); - JPanel main_panel = new JPanel(); - main_panel.setLayout(new BoxLayout(main_panel, BoxLayout.Y_AXIS)); - main_panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 2, 5)); + final JPanel mainPanel = new JPanel(); + mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); + mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 2, 5)); // first line: heading JPanel line = new JPanel(new FlowLayout(FlowLayout.LEFT)); nsHeading = new JLabel("New scripted event for \"" + archName + "\":"); nsHeading.setForeground(Color.black); line.add(nsHeading); - main_panel.add(line); + mainPanel.add(line); // event type - main_panel.add(Box.createVerticalStrut(10)); + mainPanel.add(Box.createVerticalStrut(10)); line = new JPanel(new FlowLayout(FlowLayout.LEFT)); JLabel tlabel1 = new JLabel("Event Type: "); line.add(tlabel1); line.add(eventTypeBox); - //main_panel.add(line); + //mainPanel.add(line); line.add(Box.createHorizontalStrut(10)); // plugin name JLabel tlabel2 = new JLabel("Plugin: "); line.add(tlabel2); line.add(pluginNameBox); - main_panel.add(line); + mainPanel.add(line); // path - main_panel.add(Box.createVerticalStrut(5)); + mainPanel.add(Box.createVerticalStrut(5)); line = new JPanel(new FlowLayout(FlowLayout.LEFT)); JLabel tlabel3 = new JLabel("Script File:"); line.add(tlabel3); @@ -425,66 +422,66 @@ line.add(Box.createHorizontalStrut(diff)); } - main_panel.add(line); + mainPanel.add(line); inputNFPath = new JTextField(defScriptName, 20); - JButton browseb = new JButton("..."); + final JButton browseb = new JButton("..."); browseb.setMargin(new Insets(0, 10, 0, 10)); browseb.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - File home = CMainControl.getInstance().getCurrentMap().getMapFile().getParentFile(); // map dir + public void actionPerformed(final ActionEvent e) { + final File home = CMainControl.getInstance().getCurrentMap().getMapFile().getParentFile(); // map dir - JFileChooser fileChooser = new JFileChooser(); + final JFileChooser fileChooser = new JFileChooser(); fileChooser.setDialogTitle("Select Script File"); fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); fileChooser.setCurrentDirectory(home); fileChooser.setMultiSelectionEnabled(false); - fileChooser.setFileFilter(new FileFilterPython()); + fileChooser.setFileFilter(CMainControl.pythonFileFilter); if (fileChooser.showOpenDialog(newScriptFrame) == JFileChooser.APPROVE_OPTION) { // user has selected a file - File f = fileChooser.getSelectedFile(); + final File f = fileChooser.getSelectedFile(); inputNFPath.setText(localizeEventPath(f)); } } }); line.add(inputNFPath); line.add(browseb); - main_panel.add(line); + mainPanel.add(line); // description line = new JPanel(new FlowLayout(FlowLayout.LEFT)); - JPanel textPanel = new JPanel(); + final JPanel textPanel = new JPanel(); textPanel.setLayout(new BoxLayout(textPanel, BoxLayout.Y_AXIS)); JLabel tlabel = new JLabel("When you specify an existing file, the new event will be linked"); textPanel.add(tlabel); tlabel = new JLabel("to that existing script. Otherwise a new script file is created."); textPanel.add(tlabel); line.add(textPanel); - main_panel.add(line); + mainPanel.add(line); // event options input - main_panel.add(Box.createVerticalStrut(10)); + mainPanel.add(Box.createVerticalStrut(10)); line = new JPanel(new FlowLayout(FlowLayout.LEFT)); tlabel = new JLabel("Event Options: "); line.add(tlabel); inputEventOptions = new JTextField(25); line.add(inputEventOptions); - main_panel.add(line); + mainPanel.add(line); // button panel: - main_panel.add(Box.createVerticalStrut(10)); + mainPanel.add(Box.createVerticalStrut(10)); line = new JPanel(new FlowLayout(FlowLayout.RIGHT)); - JButton nsOkButton = new JButton("OK"); - nsOkListener = new pathButtonListener(true, newScriptFrame, this); + final JButton nsOkButton = new JButton("OK"); + nsOkListener = new PathButtonListener(true, newScriptFrame, this); nsOkButton.addActionListener(nsOkListener); line.add(nsOkButton); - JButton cancelButton = new JButton("Cancel"); - cancelButton.addActionListener(new pathButtonListener(false, newScriptFrame, null)); + final JButton cancelButton = new JButton("Cancel"); + cancelButton.addActionListener(new PathButtonListener(false, newScriptFrame, null)); line.add(cancelButton); - main_panel.add(line); + mainPanel.add(line); - newScriptFrame.getContentPane().add(main_panel); + newScriptFrame.getContentPane().add(mainPanel); newScriptFrame.pack(); newScriptFrame.setLocationRelativeTo(CMainControl.getInstance().getMainView()); newScriptFrame.setVisible(true); @@ -503,15 +500,14 @@ * 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 */ - public void createNewEvent(JDialog frame) { - CMainControl m_control = CMainControl.getInstance(); // main control + public void createNewEvent(final JDialog frame) { + CMainControl mainControl = CMainControl.getInstance(); // main control String scriptPath = inputNFPath.getText().trim(); - String eventType = ((String) (eventTypeBox.getSelectedItem())).trim(); - String pluginName = ((String) (pluginNameBox.getSelectedItem())).trim(); - String eventOptions = inputEventOptions.getText().trim(); + final String eventType = ((String) (eventTypeBox.getSelectedItem())).trim(); + final String pluginName = ((String) (pluginNameBox.getSelectedItem())).trim(); + final String eventOptions = inputEventOptions.getText().trim(); - File localMapDir = m_control.getCurrentMap().getMapFile().getParentFile(); // local map directory - String absScriptPath; // the absolute script path + final File localMapDir = mainControl.getCurrentMap().getMapFile().getParentFile(); // local map directory int replaceIndex = -1; // index of event to replace ('-1' means no replace) // first check if that event type is not already in use @@ -528,17 +524,18 @@ // convert localized scriptPath into real, absolute path scriptPath = scriptPath.replace('\\', '/'); + String absScriptPath; if (scriptPath.startsWith("/")) { // script path is absolute - File mapDir = new File(m_control.getMapDefaultFolder()); // global map directory - if (!mapDir.exists()) { + final File mapDir = new File(mainControl.getMapDefaultFolder()); // global map directory + if (mapDir.exists()) { + absScriptPath = mapDir.getAbsolutePath() + scriptPath; + } else { // if map dir doesn't exist, this is not going to work frame.setVisible(false); - m_control.showMessage("Invalid Map Directory", "The map directory '" + mapDir + "' does not exist!\n" + + mainControl.showMessage("Invalid Map Directory", "The map directory '" + mapDir + "' does not exist!\n" + "Please select menu 'File->Options...' and correct that.", JOptionPane.ERROR_MESSAGE); return; - } else { - absScriptPath = mapDir.getAbsolutePath() + scriptPath; } } else { // script path is relative @@ -556,11 +553,11 @@ if (newScriptFile.exists()) { if (newScriptFile.isFile()) { // file exists -> link it to the event - ScriptedEvent event = new ScriptedEvent(eventType, pluginName, scriptPath, eventOptions); - if (replaceIndex != -1) { - eventList.setElementAt(event, replaceIndex); - } else { + final ScriptedEvent event = new ScriptedEvent(eventType, pluginName, scriptPath, eventOptions); + if (replaceIndex == -1) { eventList.addElement(event); + } else { + eventList.setElementAt(event, replaceIndex); } frame.setVisible(false); // close dialog } @@ -579,14 +576,10 @@ try { // try to create new empty file couldCreateFile = newScriptFile.createNewFile(); - } catch (IOException e) { + } catch (final IOException e) { } - if (!couldCreateFile) { - JOptionPane.showMessageDialog(frame, "File '" + newScriptFile.getName() + "' could not be created.\n" + - "Please check your path and write premissions.", - "Cannot create file", JOptionPane.ERROR_MESSAGE); - } else { + if (couldCreateFile) { // file has been created, now link it to the event ScriptedEvent event = new ScriptedEvent(eventType, pluginName, scriptPath, eventOptions); if (replaceIndex != -1) { @@ -598,6 +591,10 @@ // open new script file ScriptEditControl.getInstance().openScriptFile(newScriptFile.getAbsolutePath()); + } else { + JOptionPane.showMessageDialog(frame, "File '" + newScriptFile.getName() + "' could not be created.\n" + + "Please check your path and write premissions.", + "Cannot create file", JOptionPane.ERROR_MESSAGE); } } } @@ -611,8 +608,6 @@ return eventList == null || eventList.size() == 0; } - // ------------------------------- SUBCLASSES ------------------------------------ - /** Subclass which stores information about one scripted event. */ private class ScriptedEvent { @@ -628,14 +623,14 @@ * Construct a ScriptedEvent of given type (This is used for map-loading) * @param eventType */ - public ScriptedEvent(String eventType) { + ScriptedEvent(final String eventType) { this.eventType = eventType; pluginName = null; filePath = null; } /** Construct a fully initialized ScriptedEvent. */ - public ScriptedEvent(String eventType, String pluginName, String filePath, String eventOptions) { + ScriptedEvent(final String eventType, final String pluginName, final String filePath, final String eventOptions) { this.eventType = eventType; this.pluginName = pluginName; this.filePath = filePath; @@ -666,18 +661,18 @@ /** @return text for this events, how it is written in a mapfile */ public String getMapArchText() { - StringBuffer buff = new StringBuffer(""); - buff.append("event_" + eventType + "_plugin " + pluginName + "\n"); - buff.append("event_" + eventType + " " + filePath + "\n"); + final StringBuilder buff = new StringBuilder(""); + buff.append("event_").append(eventType).append("_plugin ").append(pluginName).append("\n"); + buff.append("event_").append(eventType).append(" ").append(filePath).append("\n"); if (eventOptions != null && eventOptions.trim().length() > 0) { - buff.append("event_" + eventType + "_options " + eventOptions + "\n"); + buff.append("event_").append(eventType).append("_options ").append(eventOptions).append("\n"); } return buff.toString(); } /** @return a cloned instance of this object */ public ScriptedEvent getClone() { - ScriptedEvent clone = new ScriptedEvent(eventType); + final ScriptedEvent clone = new ScriptedEvent(eventType); clone.pluginName = pluginName; clone.filePath = filePath; clone.eventOptions = eventOptions; @@ -687,31 +682,31 @@ /** Opens the script pad to display the script for this event. */ public void openScript() { - CMainControl m_control = CMainControl.getInstance(); // refernce to main control + CMainControl mainControl = CMainControl.getInstance(); // refernce to main control String path = ""; // file path to script file // trying to get the absolute path to scriptfile: if (filePath.startsWith("/")) { // filepath is absolue (to map base directory): - path = m_control.getMapDefaultFolder(); + path = mainControl.getMapDefaultFolder(); path += filePath; } else { // file path is relative to map dir - path = m_control.getCurrentMap().getMapFile().getParentFile().getAbsolutePath(); // map dir + path = mainControl.getCurrentMap().getMapFile().getParentFile().getAbsolutePath(); // map dir if (!path.endsWith("/")) { - path = path + "/"; // append slash to map dir + path += "/"; // append slash to map dir } path += filePath; // append relative path to map dir path = path.replace('\\', '/'); // make sure there's only one kind of slash } // now see if that file really exists: - File scriptFile = new File(path); + final File scriptFile = new File(path); if (scriptFile.exists() && scriptFile.isFile()) { ScriptEditControl.getInstance().openScriptFile(scriptFile.getAbsolutePath()); } else { // file does not exist! - m_control.showMessage("Script file not found", + mainControl.showMessage("Script file not found", "The file '" + path + "' does not exist.\nPlease correct the path.", JOptionPane.ERROR_MESSAGE); } } @@ -758,13 +753,13 @@ // button panel: line = new JPanel(new FlowLayout(FlowLayout.RIGHT)); JButton okButton = new JButton("OK"); - okListener = new pathButtonListener(true, pathFrame, null); + okListener = new PathButtonListener(true, pathFrame, null); okListener.setTargetEvent(this); okButton.addActionListener(okListener); line.add(okButton); JButton cancelButton = new JButton("Cancel"); - ccListener = new pathButtonListener(false, pathFrame, null); + ccListener = new PathButtonListener(false, pathFrame, null); ccListener.setTargetEvent(this); cancelButton.addActionListener(ccListener); line.add(cancelButton); @@ -816,55 +811,56 @@ return filePath; } - public void setPluginName(String name) { + public void setPluginName(final String name) { pluginName = name; } - public void setFilePath(String path) { + public void setFilePath(final String path) { filePath = path; } - public void setEventOptions(String options) { + public void setEventOptions(final String options) { eventOptions = options; } - } + } // class ScriptedEvent + /** * Small class, listening for button-press events in the popup frame for * script paths or create-new-event frame. */ - private class pathButtonListener implements ActionListener { + private class PathButtonListener implements ActionListener { - private JDialog frame = null; + private JDialog frame; - private boolean isOkButton = false; + private boolean isOkButton; - private ScriptedEvent target = null; // target event + private ScriptedEvent target; // target event - private ScriptArchData sdata = null; // script arch data + private ScriptArchData sdata; // script arch data /** * Constructor * @param isOkButton true for ok-buttons * @param frame frame this listener belongs to - * @param sdata this is only set for the ok-button of "create new" - * frame, otherwise null + * @param sdata this is only set for the ok-button of "create new" frame, otherwise null */ - public pathButtonListener(boolean isOkButton, JDialog frame, ScriptArchData sdata) { + PathButtonListener(final boolean isOkButton, final JDialog frame, final ScriptArchData sdata) { this.isOkButton = isOkButton; this.frame = frame; this.sdata = sdata; } - public void setTargetEvent(ScriptedEvent newt) { + public void setTargetEvent(final ScriptedEvent newt) { target = newt; } - public void setSdata(ScriptArchData newsd) { + public void setSdata(final ScriptArchData newsd) { sdata = newsd; } - public void actionPerformed(ActionEvent e) { + /** {@inheritDoc} */ + public void actionPerformed(final ActionEvent e) { if (isOkButton && sdata == null && target != null) { target.modifyEventPath(); // ok button for modifying path } @@ -876,20 +872,7 @@ frame.setVisible(false); // hide dialog } } - } - /** - * FileFilterPython is a subclass which filters *.py files int the - * JFileChooser dialog. - */ - public class FileFilterPython extends FileFilter { + } // class PathButtonListener - public String getDescription() { - return "*.py"; - } - - public boolean accept(File f) { - return f.isDirectory() || f.getName().endsWith(".py"); - } - } -} +} // class ScriptArchData Added: trunk/crossfire/src/cfeditor/action.properties =================================================================== --- trunk/crossfire/src/cfeditor/action.properties (rev 0) +++ trunk/crossfire/src/cfeditor/action.properties 2006-05-30 23:31:10 UTC (rev 87) @@ -0,0 +1,4 @@ +# Warning: This file MUST be ISO-8859-1 +# See http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html#encoding + +ActionFactory.additionalBundles=cfeditor.messages Property changes on: trunk/crossfire/src/cfeditor/action.properties ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/crossfire/src/cfeditor/messages.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages.properties (rev 0) +++ trunk/crossfire/src/cfeditor/messages.properties 2006-05-30 23:31:10 UTC (rev 87) @@ -0,0 +1,4 @@ +# Warning: This file MUST be ISO-8859-1 +# See http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html#encoding + +fileDialog.filter.python=Python Scripts Property changes on: trunk/crossfire/src/cfeditor/messages.properties ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-05-30 23:22:11 UTC (rev 86) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-05-30 23:31:10 UTC (rev 87) @@ -36,7 +36,7 @@ import daieditor.arch.face.FaceObjects; import daieditor.arch.match.MutableOrArchObjectMatcher; import daieditor.arch.match.ViewArchObjectMatcherManager; -import daieditor.gui.HideFileFilterProxy; +import net.sf.gridarta.gui.HideFileFilterProxy; import daieditor.gui.MapFileFilter; import daieditor.gui.map.MapCursorControl; import daieditor.gui.map.MapPreviewAccessory; @@ -738,6 +738,9 @@ /** Swing FileFilter for Lua scripts. */ public static final FileFilter luaFileFilter = new HideFileFilterProxy(new EndingFileFilter(true, ACTION_FACTORY.getString("fileDialog.filter.lua"), ".lua")); + /** Swing FileFilter for Lua scripts. */ + public static final FileFilter pythonFileFilter = new HideFileFilterProxy(new EndingFileFilter(true, ACTION_FACTORY.getString("fileDialog.filter.python"), ".py")); + /** Swing FileFilter for png graphics. */ public static final FileFilter pngFileFilter = new HideFileFilterProxy(new EndingFileFilter(true, ACTION_FACTORY.getString("fileDialog.filter.png"), ".png")); Modified: trunk/daimonin/src/daieditor/ScriptArchData.java =================================================================== --- trunk/daimonin/src/daieditor/ScriptArchData.java 2006-05-30 23:22:11 UTC (rev 86) +++ trunk/daimonin/src/daieditor/ScriptArchData.java 2006-05-30 23:31:10 UTC (rev 87) @@ -104,7 +104,7 @@ } } - /** Initialize the JComboBox with the event types */ + /** Initialize the JComboBox with the event types. */ private static synchronized void initEventTypeBoxes() { pluginNameBox = new JComboBox(new String[]{" Lua "}); pluginNameBox.setSelectedIndex(0); @@ -333,23 +333,23 @@ // event type mainPanel.add(Box.createVerticalStrut(10)); line = new JPanel(new FlowLayout(FlowLayout.LEFT)); - JLabel tlabel = new JLabel("Event Type: "); - line.add(tlabel); + JLabel tlabel1 = new JLabel("Event Type: "); + line.add(tlabel1); line.add(eventTypeBox); //mainPanel.add(line); line.add(Box.createHorizontalStrut(10)); // plugin name - tlabel = new JLabel("Plugin: "); - line.add(tlabel); + JLabel tlabel2 = new JLabel("Plugin: "); + line.add(tlabel2); line.add(pluginNameBox); mainPanel.add(line); // path mainPanel.add(Box.createVerticalStrut(5)); line = new JPanel(new FlowLayout(FlowLayout.LEFT)); - tlabel = new JLabel("Script File:"); - line.add(tlabel); + JLabel tlabel3 = new JLabel("Script File:"); + line.add(tlabel3); mainPanel.add(line); inputNFPath = new JTextField(defScriptName, 20); final JButton browseb = new JButton("..."); @@ -388,10 +388,10 @@ line = new JPanel(new FlowLayout(FlowLayout.LEFT)); final JPanel textPanel = new JPanel(); textPanel.setLayout(new BoxLayout(textPanel, BoxLayout.Y_AXIS)); - tlabel = new JLabel("When you specify an existing file, the new event will be linked"); - textPanel.add(tlabel); - tlabel = new JLabel("to that existing script. Otherwise a new script file is created."); - textPanel.add(tlabel); + tlabel3 = new JLabel("When you specify an existing file, the new event will be linked"); + textPanel.add(tlabel3); + tlabel3 = new JLabel("to that existing script. Otherwise a new script file is created."); + textPanel.add(tlabel3); line.add(textPanel); mainPanel.add(line); @@ -779,10 +779,10 @@ } // class ScriptedEvent /** - * Small class, listening for button-press events in the - * popup frame for script paths or create-new-event frame + * Small class, listening for button-press events in the popup frame for + * script paths or create-new-event frame. */ - private final class PathButtonListener implements ActionListener { + private class PathButtonListener implements ActionListener { private JDialog frame; @@ -827,6 +827,7 @@ frame.setVisible(false); // hide dialog } } + } // class PathButtonListener } // class ScriptArchData Deleted: trunk/daimonin/src/daieditor/gui/HideFileFilterProxy.java =================================================================== --- trunk/daimonin/src/daieditor/gui/HideFileFilterProxy.java 2006-05-30 23:22:11 UTC (rev 86) +++ trunk/daimonin/src/daieditor/gui/HideFileFilterProxy.java 2006-05-30 23:31:10 UTC (rev 87) @@ -1,61 +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; - -import java.io.File; -import net.sf.japi.util.filter.file.AbstractFileFilter; - -/** - * A FileFilter that wraps another FileFilter and filters out CVS and .xvpics files. - * The description and other filtering are taken from the wrapped file filter. - * @author <a href="mailto:Chr...@it...">Christian Hujer</a> - */ -public class HideFileFilterProxy extends AbstractFileFilter { - - /** The other filefilter. */ - private final AbstractFileFilter other; - - /** - * Create a HideFileFilterProxy. - * @param other FileFilter to wrap - */ - public HideFileFilterProxy(final AbstractFileFilter other) { - this.other = other; - } - - /** - * {@inheritDoc} - * Returns the description from the {@link #other} FileFilter. - */ - @Override public String getDescription() { - return other.getDescription(); - } - - /** - * {@inheritDoc} - * First checks whether the file should be hidden, if not, checks the other FileFilter. - */ - @Override public boolean accept(final File file) { - return !(file.isDirectory() && ("CVS".equals(file.getName()) || ".dedit".equals(file.getName()) || ".xvpics".equals(file.getName()))) && ((java.io.FileFilter) other).accept(file); - } - -} // class HideFileFilterProxy Copied: trunk/src/app/net/sf/gridarta/gui/HideFileFilterProxy.java (from rev 83, trunk/daimonin/src/daieditor/gui/HideFileFilterProxy.java) =================================================================== --- trunk/src/app/net/sf/gridarta/gui/HideFileFilterProxy.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/HideFileFilterProxy.java 2006-05-30 23:31:10 UTC (rev 87) @@ -0,0 +1,62 @@ +/* + * Gridarta Map Editor + * Copyright (C) 2005 Christian Hujer + * Copyright (C) 2006 The Gridarta Developers + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + */ + +package net.sf.gridarta.gui; + +import java.io.File; +import net.sf.japi.util.filter.file.AbstractFileFilter; + +/** + * A FileFilter that wraps another FileFilter and filters out CVS and .xvpics files. + * The description and other filtering are taken from the wrapped file filter. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public class HideFileFilterProxy extends AbstractFileFilter { + + /** The other filefilter. */ + private final AbstractFileFilter other; + + /** + * Create a HideFileFilterProxy. + * @param other FileFilter to wrap + */ + public HideFileFilterProxy(final AbstractFileFilter other) { + this.other = other; + } + + /** + * {@inheritDoc} + * Returns the description from the {@link #other} FileFilter. + */ + @Override public String getDescription() { + return other.getDescription(); + } + + /** + * {@inheritDoc} + * First checks whether the file should be hidden, if not, checks the other FileFilter. + */ + @Override public boolean accept(final File file) { + return !(file.isDirectory() && ("CVS".equals(file.getName()) || ".dedit".equals(file.getName()) || ".xvpics".equals(file.getName()))) && ((java.io.FileFilter) other).accept(file); + } + +} // class HideFileFilterProxy This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-05-30 23:22:20
|
Revision: 86 Author: christianhujer Date: 2006-05-30 16:22:11 -0700 (Tue, 30 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=86&view=rev Log Message: ----------- Added missing japi lib. Modified Paths: -------------- trunk/build.xml Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2006-05-30 20:35:49 UTC (rev 85) +++ trunk/build.xml 2006-05-30 23:22:11 UTC (rev 86) @@ -106,6 +106,7 @@ > <classpath> <fileset dir="lib" includes="annotations.jar" /> + <fileset dir="lib" includes="japi.jar" /> </classpath> <compilerarg line="${javac.args}" /> </javac> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-05-30 20:50:33
|
Revision: 85 Author: christianhujer Date: 2006-05-30 13:35:49 -0700 (Tue, 30 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=85&view=rev Log Message: ----------- Improved subversion documentation, corrected some errors. Modified Paths: -------------- trunk/src/doc/subversion.xhtml Modified: trunk/src/doc/subversion.xhtml =================================================================== --- trunk/src/doc/subversion.xhtml 2006-05-30 19:26:14 UTC (rev 84) +++ trunk/src/doc/subversion.xhtml 2006-05-30 20:35:49 UTC (rev 85) @@ -13,7 +13,7 @@ To checkout a normal working copy of the latest development, checkout the trunk. This is what's called HEAD or MAIN/LATEST in other version control systems. </p> - <p><code>svn co https://svn.sourceforge.net/svnroot/gridarta gridarta/trunk</code></p> + <p><code>svn co https://svn.sourceforge.net/svnroot/gridarta/trunk gridarta</code></p> <h2>Rules</h2> <p> Current rules are this: @@ -22,13 +22,31 @@ <li> All files need a mime type. For normal source code, use <code>text/plain</code>. - Use <code>svn propset svn:mime-type text/plain <var>filename</var></code> to set the mime type. + Use this command to set the mime type: + <br /> + <code>svn propset svn:mime-type text/plain <var>filename</var></code> + <br /> + <em>Note:</em> A hook verifies that the mime type is set. </li> <li> All files with a text based mime type need a line ending setting. Gridarta convention is to always use <code>LF</code>. - Use <code>svn propset svn:eol-style LF <var>filename</var></code> to set the line ending style. + Use this command to set the line ending style: + <br /> + <code>svn propset svn:eol-style LF <var>filename</var></code> + <br /> + <em>Note:</em> A hook verifies that the eol style for files with mime type text/* is set. </li> + <li> + All XHTML files of the documentation (<code>src/doc/**/*.xhtml</code>) need a meta element for the edit date: + <br /> + <code><![CDATA[<meta name="Date" content="$]]><![CDATA[Date$" />]]></code> + <br /> + Also, they need their keyword substitution set to <code>Date</code>. + Use <code>svn propset svn:keywords Date <var>filename</var></code> to set the keyword substitution. + <br /> + <em>Note:</em> Because we cannot install custom hooks on SF, this is <em>not</em> checked with a hook. + </li> </ul> <h2>Releases</h2> <p> @@ -38,7 +56,7 @@ <li> A branch with the new release name is created. Usually the branch will increase the minor revision and use it as its name. - Example: <code>svn copy trunk branch/0.8</code>. + Example: <code>svn copy trunk branches/0.8</code>. The policy for branches is that they aren't completely frozen, but only changes required for release and bug fixing are allowed. </li> <li> @@ -48,15 +66,15 @@ <li> The release is published. As a part of the release publishing, a tag with the new release name and patch level is created. - Example: <code>svn copy branch/0.8 tag/0.8.0</code>. + Example: <code>svn copy branches/0.8 tags/0.8.0</code>. The policy for tags is that they are completely frozen, tags must never ever be changed. </li> </ol> <h2>Checking out a released version</h2> <p> - To checkout a released version, use <code>svn co https://svn.sourceforge.net/svnroot/gridarta gridarta/tag/<var>version</var></code> with + To checkout a released version, use <code>svn co https://svn.sourceforge.net/svnroot/gridarta/tags/<var>version</var> gridarta</code> with <var>version</var> being the release name. - To checkout, for example, version <samp>0.8.0</samp>, use <samp>svn co https://svn.sourceforge.net/svnroot/gridarta gridarta/tag/0.8.0</samp>. + To checkout, for example, version <samp>0.8.0</samp>, use <samp>svn co https://svn.sourceforge.net/svnroot/gridarta/tags/0.8.0 gridarta</samp>. </p> </body> </html> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |