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-05-30 19:26:46
|
Revision: 84 Author: christianhujer Date: 2006-05-30 12:26:14 -0700 (Tue, 30 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=84&view=rev Log Message: ----------- Improved documentation: robots exclusion copyright automatic date fixed all css warnings added css validator link Modified Paths: -------------- trunk/build.xml trunk/src/doc/dev/codeStyle.xhtml trunk/src/doc/dev/start.xhtml trunk/src/doc/history.xhtml trunk/src/doc/news/2006-05-27_1.xhtml trunk/src/doc/news/start.xhtml trunk/src/doc/sitestyle.css trunk/src/doc/start.xhtml trunk/src/doc/status404.xhtml trunk/src/doc/subversion.xhtml trunk/src/doc/transform.xslt Added Paths: ----------- trunk/src/doc/copyright.xhtml trunk/src/doc/robots.txt Property Changed: ---------------- trunk/src/doc/dev/codeStyle.xhtml trunk/src/doc/dev/start.xhtml trunk/src/doc/history.xhtml trunk/src/doc/news/2006-05-27_1.xhtml trunk/src/doc/news/start.xhtml trunk/src/doc/start.xhtml trunk/src/doc/status404.xhtml trunk/src/doc/subversion.xhtml Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2006-05-30 06:59:46 UTC (rev 83) +++ trunk/build.xml 2006-05-30 19:26:14 UTC (rev 84) @@ -184,6 +184,7 @@ <include name="dtd/**/*.xml" /> <include name="**/*.css" /> <include name="**/*.png" /> + <include name="robots.txt" /> <exclude name="**/.xvpics/*.png" /> </fileset> </copy> Added: trunk/src/doc/copyright.xhtml =================================================================== --- trunk/src/doc/copyright.xhtml (rev 0) +++ trunk/src/doc/copyright.xhtml 2006-05-30 19:26:14 UTC (rev 84) @@ -0,0 +1,15 @@ +<?xml version="1.1" encoding="utf-8"?> +<!DOCTYPE html PUBLIC "-//JAPI//DTD XHTML 1.1 + XInclude 1.0//EN" "dtd/xhtml11_xinclude10.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de"> + <head> + <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> + <meta name="Date" content="$Date$" /> + <title>Gridarta Copyright</title> + </head> + <body> + <p> + Gridarta is licensed under GPL version 2 or newer. + </p> + <pre><xi:include xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" href="../../COPYING"/></pre> + </body> +</html> Property changes on: trunk/src/doc/copyright.xhtml ___________________________________________________________________ Name: svn:mime-type + text/html Name: svn:keywords + Date Name: svn:eol-style + LF Modified: trunk/src/doc/dev/codeStyle.xhtml =================================================================== --- trunk/src/doc/dev/codeStyle.xhtml 2006-05-30 06:59:46 UTC (rev 83) +++ trunk/src/doc/dev/codeStyle.xhtml 2006-05-30 19:26:14 UTC (rev 84) @@ -3,6 +3,7 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de"> <head> <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> + <meta name="Date" content="$Date$" /> <title>Gridarta Development Documentation: Code Conventions</title> </head> <body> @@ -18,6 +19,7 @@ <ul> <li>Imports are sorted alphabetically by package, within a package alphabetically by class.</li> <li>The *-form of import is not allowed.</li> + <li>Use inline comments rarely. If you have to use inline comments to explain what code does, something is wrong with the code.</li> </ul> </body> </html> Property changes on: trunk/src/doc/dev/codeStyle.xhtml ___________________________________________________________________ Name: svn:keywords + Date Modified: trunk/src/doc/dev/start.xhtml =================================================================== --- trunk/src/doc/dev/start.xhtml 2006-05-30 06:59:46 UTC (rev 83) +++ trunk/src/doc/dev/start.xhtml 2006-05-30 19:26:14 UTC (rev 84) @@ -3,6 +3,7 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de"> <head> <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> + <meta name="Date" content="$Date$" /> <title>Gridarta Development Documentation</title> </head> <body> Property changes on: trunk/src/doc/dev/start.xhtml ___________________________________________________________________ Name: svn:keywords + Date Modified: trunk/src/doc/history.xhtml =================================================================== --- trunk/src/doc/history.xhtml 2006-05-30 06:59:46 UTC (rev 83) +++ trunk/src/doc/history.xhtml 2006-05-30 19:26:14 UTC (rev 84) @@ -3,6 +3,7 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de"> <head> <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> + <meta name="Date" content="$Date$" /> <title>History of Gridarta</title> </head> <body> Property changes on: trunk/src/doc/history.xhtml ___________________________________________________________________ Name: svn:keywords + Date Modified: trunk/src/doc/news/2006-05-27_1.xhtml =================================================================== --- trunk/src/doc/news/2006-05-27_1.xhtml 2006-05-30 06:59:46 UTC (rev 83) +++ trunk/src/doc/news/2006-05-27_1.xhtml 2006-05-30 19:26:14 UTC (rev 84) @@ -3,6 +3,7 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de"> <head> <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> + <meta name="Date" content="$Date$" /> <title>Project Gridarta Started</title> </head> <body> Property changes on: trunk/src/doc/news/2006-05-27_1.xhtml ___________________________________________________________________ Name: svn:keywords + Date Modified: trunk/src/doc/news/start.xhtml =================================================================== --- trunk/src/doc/news/start.xhtml 2006-05-30 06:59:46 UTC (rev 83) +++ trunk/src/doc/news/start.xhtml 2006-05-30 19:26:14 UTC (rev 84) @@ -3,6 +3,7 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de"> <head> <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> + <meta name="Date" content="$Date$" /> <title>Gridarta Project News</title> </head> <body> Property changes on: trunk/src/doc/news/start.xhtml ___________________________________________________________________ Name: svn:keywords + Date Added: trunk/src/doc/robots.txt =================================================================== --- trunk/src/doc/robots.txt (rev 0) +++ trunk/src/doc/robots.txt 2006-05-30 19:26:14 UTC (rev 84) @@ -0,0 +1,4 @@ +User-Agent: W3C-checklink +Disallow: http://validator.w3.org/check?uri=referer +Disallow: http://jigsaw.w3.org/css-validator/check/referer +Disallow: /dev/changelog Property changes on: trunk/src/doc/robots.txt ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Modified: trunk/src/doc/sitestyle.css =================================================================== --- trunk/src/doc/sitestyle.css 2006-05-30 06:59:46 UTC (rev 83) +++ trunk/src/doc/sitestyle.css 2006-05-30 19:26:14 UTC (rev 84) @@ -1,17 +1,16 @@ -html { +html, body { background-color: white; + color:#11111A; } body { margin: auto auto; padding-left: 6%; padding-right: 6%; - background-color: white; - /*background-image: url(http://www.w3.org/Icons/logo-WMVS.png);*/ + /*background-image: url(http://www.w3.org/Icons/logo-WMVS.png); background-attachment: fixed; background-position: 0 0; - background-repeat: no-repeat; - color: #11111A; + background-repeat: no-repeat;*/ font-family: Helvetica, "Trebuchet MS", Arial, sans-serif; font-size: 1em; /* setting base font to user's prefered size */ line-height: 130%; @@ -19,6 +18,7 @@ div.header { background-color: #eee; + color:inherit; height:45px; text-align:center; } @@ -30,6 +30,7 @@ div.content { background-color: white; + color:inherit; border-bottom: 0; border-left: 1px solid #eee; border-right: 1px solid #eee; @@ -43,6 +44,7 @@ background-repeat: no-repeat; background-attachment: scroll; background-position: right; + color:inherit; height:45px; padding-top: 10px; padding-bottom: 0; @@ -68,11 +70,13 @@ margin-left: 222px; font-family: "Bitstream Vera Sans Mono", monospace; color: #888; + background-color:inherit; line-height: 120%; } p.copyright a { color: #88f; + background-color:inherit; text-decoration: none; } @@ -92,6 +96,7 @@ fieldset.screenshot { padding: .5em; background: white; + color:inherit; border: 1px dotted #aaaa77; margin-left: 20px; margin-right: 20px; @@ -99,8 +104,8 @@ } fieldset.screenshot legend { + background-color: #aaaa77; color: #fff; - background-color: #aaaa77; font-size: smaller; padding: .1ex .5ex; border-right: 1px solid gray; @@ -116,21 +121,21 @@ td.java, td.java-ln {vertical-align:top;} tt.java, tt.java-ln, pre.java, pre.java-ln {line-height:1em; margin-bottom:0em;} td.java-ln { text-align:right; } -tt.java-ln, pre.java-ln { color:#888888 } -/* Background */ span.java0 { color:#ffffff; } -/* Line numbers */ span.java1 { color:#808080; } -/* Multi-line comments */ span.java2 { color:#3f7f5f; } -/* Single-line comments */ span.java3 { color:#3f7f5f; } -/* Keywords */ span.java4 { color:#7f0055; font-weight:bold; } -/* Strings */ span.java5 { color:#2a00ff; } -/* Character constants */ span.java6 { color:#990000; } -/* Numeric constants */ span.java7 { color:#990000; } -/* Parenthesis */ span.java8 { color:#000000; } -/* Primitive Types */ span.java9 { color:#7f0055; font-weight:bold; } -/* Others */ span.java10 { color:#000000; } -/* Javadoc keywords */ span.java11 { color:#7f9fbf; } -/* Javadoc HTML tags */ span.java12 { color:#7f7f9f; } -/* Javadoc links */ span.java13 { color:#3f3fbf; } -/* Javadoc others */ span.java14 { color:#3f5fbf; } -/* Undefined */ span.java15 { color:#ff6100; } -/* Annotation */ span.java16 { color:#646464; } + tt.java-ln, pre.java-ln { background-color:inherit; color:#888888; } +/* Background */ span.java0 { background-color:inherit; color:#ffffff; } +/* Line numbers */ span.java1 { background-color:inherit; color:#808080; } +/* Multi-line comments */ span.java2 { background-color:inherit; color:#3f7f5f; } +/* Single-line comments */ span.java3 { background-color:inherit; color:#3f7f5f; } +/* Keywords */ span.java4 { background-color:inherit; color:#7f0055; font-weight:bold; } +/* Strings */ span.java5 { background-color:inherit; color:#2a00ff; } +/* Character constants */ span.java6 { background-color:inherit; color:#990000; } +/* Numeric constants */ span.java7 { background-color:inherit; color:#990000; } +/* Parenthesis */ span.java8 { background-color:inherit; color:#000000; } +/* Primitive Types */ span.java9 { background-color:inherit; color:#7f0055; font-weight:bold; } +/* Others */ span.java10 { background-color:inherit; color:#000000; } +/* Javadoc keywords */ span.java11 { background-color:inherit; color:#7f9fbf; } +/* Javadoc HTML tags */ span.java12 { background-color:inherit; color:#7f7f9f; } +/* Javadoc links */ span.java13 { background-color:inherit; color:#3f3fbf; } +/* Javadoc others */ span.java14 { background-color:inherit; color:#3f5fbf; } +/* Undefined */ span.java15 { background-color:inherit; color:#ff6100; } +/* Annotation */ span.java16 { background-color:inherit; color:#646464; } Modified: trunk/src/doc/start.xhtml =================================================================== --- trunk/src/doc/start.xhtml 2006-05-30 06:59:46 UTC (rev 83) +++ trunk/src/doc/start.xhtml 2006-05-30 19:26:14 UTC (rev 84) @@ -4,7 +4,7 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de"> <head> <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> - <meta name="Date" content="$Date: 2006-04-18 03:01:25 +0200 (Die, 18 Apr 2006) $" /> + <meta name="Date" content="$Date$" /> <meta name="keywords" content="Gridarta, Map Editor, MMORPG, Angelion, Crossfire, Daimonin" /> <meta name="description" content="Gridarta is a Map Editor for 2D MMORPGs, namely Angelion, Crossfire, and Daimonin." /> <link rel="alternate" type="application/rss+xml" title="Project news releases" href="http://sourceforge.net/export/rss2_projnews.php?group_id=166996" /> Property changes on: trunk/src/doc/start.xhtml ___________________________________________________________________ Name: svn:keywords + Date Modified: trunk/src/doc/status404.xhtml =================================================================== --- trunk/src/doc/status404.xhtml 2006-05-30 06:59:46 UTC (rev 83) +++ trunk/src/doc/status404.xhtml 2006-05-30 19:26:14 UTC (rev 84) @@ -3,6 +3,7 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de"> <head> <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> + <meta name="Date" content="$Date$" /> <title>File Not Found</title> </head> <body> Property changes on: trunk/src/doc/status404.xhtml ___________________________________________________________________ Name: svn:keywords + Date Modified: trunk/src/doc/subversion.xhtml =================================================================== --- trunk/src/doc/subversion.xhtml 2006-05-30 06:59:46 UTC (rev 83) +++ trunk/src/doc/subversion.xhtml 2006-05-30 19:26:14 UTC (rev 84) @@ -4,7 +4,7 @@ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de"> <head> <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> - <meta name="Date" content="$Date: 2006-04-03 23:00:14 +0200 (Mon, 03 Apr 2006) $" /> + <meta name="Date" content="$Date$" /> <title>Gridarta Subversion Developer Access</title> </head> <body> Property changes on: trunk/src/doc/subversion.xhtml ___________________________________________________________________ Name: svn:keywords + Date Modified: trunk/src/doc/transform.xslt =================================================================== --- trunk/src/doc/transform.xslt 2006-05-30 06:59:46 UTC (rev 83) +++ trunk/src/doc/transform.xslt 2006-05-30 19:26:14 UTC (rev 84) @@ -62,6 +62,8 @@ <a href="http://sourceforge.net/"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=166996&type=1" alt="SourceForge.net Logo" width="88" height="31" class="now" /></a> <a href="http://sourceforge.net/donate/index.php?group_id=166996"><img src="http://sourceforge.net/images/project-support.jpg" width="88" height="32" alt="Support This Project" class="now" /></a> <a href="http://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> <xsl:if test="/html:html/html:head/html:meta[@name='Date']"> <br /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-05-30 06:59:51
|
Revision: 83 Author: akirschbaum Date: 2006-05-29 23:59:46 -0700 (Mon, 29 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=83&view=rev Log Message: ----------- Update comments. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CArchPanel.java Modified: trunk/crossfire/src/cfeditor/CArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanel.java 2006-05-30 06:35:03 UTC (rev 82) +++ trunk/crossfire/src/cfeditor/CArchPanel.java 2006-05-30 06:59:46 UTC (rev 83) @@ -52,23 +52,32 @@ private int selectedArch; - private final JTabbedPane archAndPickPane; // panel holding both archlist and pickmaps + /** Panel holding both archlist and pickmaps. */ + private final JTabbedPane archAndPickPane; - private final CSplitPane splitPane; // our split pane + /** Our split pane. */ + private final CSplitPane splitPane; - private final JTabbedPane tabDesktop; // the tab panel with arch lists + /** The Tab panel with arch lists. */ + private final JTabbedPane tabDesktop; - private final CArchQuickView archQuickPanel; // data/view of selected objects in tab panel + /** The data/view of selected objects in tab panel. */ + private final CArchQuickView archQuickPanel; - private static PanelNode panelNodeStart; // list of arch panels + /** List of arch panels. */ + private static PanelNode panelNodeStart; private PanelNode panelNodeLast; - private CArchPanelPan selectedPanel; // the active panel + /** The active panel. */ + private CArchPanelPan selectedPanel; private static final long serialVersionUID = 6634110300452920361L; - /* Build Panel */ + /** + * Build Panel. + * @param mainControl CMainControl + */ public CArchPanel(final CMainControl mainControl) { this.mainControl = mainControl; panelNodeStart = null; @@ -128,7 +137,7 @@ return panelNodeStart; } - /** Move the pickmap panel in front of the default-archpanel */ + /** Move the pickmap panel in front of the default-archpanel. */ public void movePickmapPanelToFront() { if (archAndPickPane != null && archAndPickPane.getTabCount() > 1) { archAndPickPane.setSelectedIndex(1); @@ -166,10 +175,6 @@ } } - /** - * Add a new arch panel. This happens during load proccess. - * @param name - */ public void addPanel(final String name) { final PanelNode newnode = new PanelNode(new CArchPanelPan(this, mainControl), name); @@ -252,7 +257,7 @@ public String getTitle() { return title; } - } + } // class PanelNode /** Splitpane class that keeps its size even upon L'n'F change. */ public class CSplitPane extends JSplitPane { @@ -275,4 +280,4 @@ setDividerSize(dividerSize); } } -} +} // class CArchPanel This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-05-30 06:35:20
|
Revision: 82 Author: akirschbaum Date: 2006-05-29 23:35:03 -0700 (Mon, 29 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=82&view=rev Log Message: ----------- Rename variable names. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CFArchAttrib.java trunk/crossfire/src/cfeditor/CFArchType.java trunk/crossfire/src/cfeditor/CFArchTypeList.java trunk/crossfire/src/cfeditor/CFTreasureListTree.java trunk/crossfire/src/cfeditor/CFileReader.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CMapArchPanel.java trunk/daimonin/src/daieditor/CFArchAttrib.java trunk/daimonin/src/daieditor/CFArchType.java trunk/daimonin/src/daieditor/CFArchTypeList.java Modified: trunk/crossfire/src/cfeditor/CFArchAttrib.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchAttrib.java 2006-05-29 21:48:32 UTC (rev 81) +++ trunk/crossfire/src/cfeditor/CFArchAttrib.java 2006-05-30 06:35:03 UTC (rev 82) @@ -81,35 +81,35 @@ private CFArchAttrib next; // next element in the list (/array) - private String name_old; // original attr. name (from the CF arches) + private String nameOld; // original attr. name (from the CF arches) - private String ending_old; // for data_type = 'T_TEXT' this is the terminating string + private String endingOld; // for dataType = 'T_TEXT' this is the terminating string // (example: 'endmsg' for arch message) - private String name_new; // new attr. name (for the user-friendly GUI) + private String nameNew; // new attr. name (for the user-friendly GUI) - private int data_type; // type of attribute data (T_BOOL/T_INT/...) + private int dataType; // type of attribute data (T_BOOL/T_INT/...) private String text; // descrption of this attr. - private int input_length; // optional attribute: set length for input JTextFields + private int inputLength; // optional attribute: set length for input JTextFields private String[] misc; // string array for misc. use // T_BOOL_SPEC uses misc[0]=true value, misc[1]=false value // T_BITMASK uses misc[0] = bitmask name, T_LIST uses misc[0] = list name - private int sec_id; // identifier of the section this attribute is in + private int secId; // identifier of the section this attribute is in private String section; // name of the section this attribute is in /** Constructor */ public CFArchAttrib() { - name_old = ""; - name_new = ""; + nameOld = ""; + nameNew = ""; String text = null; - ending_old = null; + endingOld = null; misc = null; - input_length = 0; // use default length + inputLength = 0; // use default length } /** @@ -129,12 +129,12 @@ // arch syntax key if ((a1 = root.getAttribute(XML_KEY_ARCH)) != null) { - name_old = a1.getValue().trim(); + nameOld = a1.getValue().trim(); } // editor syntax key if ((a1 = root.getAttribute(XML_KEY_EDITOR)) != null) { - name_new = a1.getValue().trim(); + nameNew = a1.getValue().trim(); } // type name @@ -149,7 +149,7 @@ // input length (optional) if ((a1 = root.getAttribute(XML_INPUT_LENGTH)) != null) { try { - input_length = a1.getIntValue(); + inputLength = a1.getIntValue(); } catch (DataConversionException de) { log.error("In '" + IGUIConstants.TYPEDEF_FILE + "': Type " + typeName + " has attribute with invalid length '" + a1.getValue() + "' (must be a number)."); } @@ -157,10 +157,10 @@ // which type of attribute is it? if (atype.equalsIgnoreCase("bool")) { - data_type = T_BOOL; // normal bool + dataType = T_BOOL; // normal bool } else if (atype.equalsIgnoreCase("bool_special")) { // customized boolean type: - data_type = T_BOOL_SPEC; + dataType = T_BOOL_SPEC; // parse true and false values: a1 = root.getAttribute("true"); @@ -174,32 +174,32 @@ misc[0] = a1.getValue().trim(); // string for true misc[1] = a2.getValue().trim(); // string for false } else if (atype.equalsIgnoreCase("int")) { - data_type = T_INT; + dataType = T_INT; } else if (atype.equalsIgnoreCase("float")) { - data_type = T_FLOAT; + dataType = T_FLOAT; } else if (atype.equalsIgnoreCase("string")) { - data_type = T_STRING; + dataType = T_STRING; } else if (atype.equalsIgnoreCase("text")) { - data_type = T_TEXT; + dataType = T_TEXT; // for text data, the terminating string has to be read too if ((a1 = root.getAttribute(XML_KEY_ARCH_BEGIN)) != null) { - name_old = a1.getValue().trim(); + nameOld = a1.getValue().trim(); } if ((a1 = root.getAttribute(XML_KEY_ARCH_END)) != null) { - ending_old = a1.getValue().trim(); + endingOld = a1.getValue().trim(); } - if (name_old == null || name_old.length() == 0 || - ending_old == null || ending_old.length() == 0) { + if (nameOld == null || nameOld.length() == 0 || + endingOld == null || endingOld.length() == 0) { 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")) { // fixed attribute - data_type = T_FIXED; + dataType = T_FIXED; if ((a1 = root.getAttribute("value")) != null) { - name_new = a1.getValue().trim(); + nameNew = a1.getValue().trim(); } else { log.warn("In '" + IGUIConstants.TYPEDEF_FILE + "': Type " + typeName + " has fixed attribute missing 'value'."); return false; @@ -207,16 +207,16 @@ } else if (atype.equalsIgnoreCase("spell")) { // spell attribute if (tlist.getSpellNum() == null) { - data_type = T_INT; // if we have no spells, use an INT field instead + dataType = T_INT; // if we have no spells, use an INT field instead } else { - data_type = T_SPELL; + dataType = T_SPELL; } } else if (atype.equalsIgnoreCase("nz_spell")) { // spell attribute if (tlist.getSpellNum() == null) { - data_type = T_INT; // if we have no spells, use an INT field instead + dataType = T_INT; // if we have no spells, use an INT field instead } else { - data_type = T_ZSPELL; + dataType = T_ZSPELL; } } else if (atype.startsWith("bitmask")) { // got a bitmask attribute @@ -224,7 +224,7 @@ if (tlist.getBitmaskTable().containsKey(bitmaskName)) { // the bitmask is well defined - data_type = T_BITMASK; + dataType = T_BITMASK; misc = new String[1]; misc[0] = bitmaskName; // store bitmask name in misc[0] } else { @@ -236,14 +236,14 @@ if (tlist.getListTable().containsKey(listName)) { // the list is well defined - data_type = T_LIST; + dataType = T_LIST; misc = new String[1]; misc[0] = listName; // store list name in misc[0] } else { log.warn("In '" + IGUIConstants.TYPEDEF_FILE + "', type " + typeName + ": List \"" + listName + "\" is undefined."); } } else if (atype.equalsIgnoreCase("treasurelist")) { - data_type = T_TREASURE; + dataType = T_TREASURE; } else { // unknown type log.warn("In '" + IGUIConstants.TYPEDEF_FILE + "': Type " + typeName + " has an attribute with unknown type: '" + atype + "'."); @@ -273,11 +273,11 @@ stream = new StringReader(root.getText().trim()); bfread = new BufferedReader(stream); String line; - boolean is_first = true; + boolean isFirst = true; while ((line = bfread.readLine()) != null) { // delete extra spaces for every line seperately - buff.append((is_first ? "" : "\n") + line.trim()); - is_first = false; + buff.append((isFirst ? "" : "\n") + line.trim()); + isFirst = false; } text = buff.toString(); @@ -303,7 +303,7 @@ * @param sname section name */ public void setSection(int id, String sname) { - sec_id = id; + secId = id; section = sname; } @@ -316,29 +316,29 @@ newattr.next = next; - newattr.name_old = name_old; - newattr.ending_old = ending_old; - newattr.name_new = name_new; - newattr.data_type = data_type; - newattr.input_length = input_length; + newattr.nameOld = nameOld; + newattr.endingOld = endingOld; + newattr.nameNew = nameNew; + newattr.dataType = dataType; + newattr.inputLength = inputLength; newattr.text = text; // important: we don't create a new instance of 'misc', only a refernce newattr.misc = misc; - newattr.sec_id = sec_id; + newattr.secId = secId; newattr.section = section; return newattr; } public int getSecId() { - return sec_id; + return secId; } - public void setSecId(int new_id) { - sec_id = new_id; + public void setSecId(int newId) { + secId = newId; } public String getSecName() { @@ -346,19 +346,19 @@ } public String getNameOld() { - return name_old; + return nameOld; } public String getEndingOld() { - return ending_old; + return endingOld; } public String getNameNew() { - return name_new; + return nameNew; } public int getDataType() { - return data_type; + return dataType; } public String getText() { @@ -370,22 +370,22 @@ } public int getInputLength() { - return input_length; + return inputLength; } public CFArchAttrib getNext() { return next; } - public void setNext(CFArchAttrib cf_attr) { - next = cf_attr; + public void setNext(CFArchAttrib cfAttr) { + next = cfAttr; } - private void read_till(BufferedReader stream, String tag) throws IOException { - CFileReader.read_till(stream, tag, null); + private void readTill(BufferedReader stream, String tag) throws IOException { + CFileReader.readTill(stream, tag, null); } - private String reads_till(BufferedReader stream, String tag) throws IOException { - return CFileReader.reads_till(stream, tag); + private String readsTill(BufferedReader stream, String tag) throws IOException { + return CFileReader.readsTill(stream, tag); } } Modified: trunk/crossfire/src/cfeditor/CFArchType.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchType.java 2006-05-29 21:48:32 UTC (rev 81) +++ trunk/crossfire/src/cfeditor/CFArchType.java 2006-05-30 06:35:03 UTC (rev 82) @@ -67,13 +67,13 @@ private int typenr; // type number of this CF type - private String t_name; // type name (artificial) + private String typeName; // type name (artificial) - private String[] t_attr; // list of aditional attributes that an object + private String[] typeAttributes; // list of aditional attributes that an object // must have, in order to be of this type: - // t_attr[0] is attr. name, t_attr[1] is attr. value, ... + // typeAttributes[0] is attr. name, typeAttributes[1] is attr. value, ... - private CFArchType head; // head Element (contains default attributes) + private CFArchType defaultArchType; // head Element (contains default attributes) private CFArchType next; // next CFArchType in the list @@ -85,22 +85,22 @@ private CFArchAttrib[] attr; // list of arch attributes (/array)) - private int section_num; // number of attribute-sections + private int sectionNum; // number of attribute-sections /** * Konstructor - * @param head_type the head element of the list + * @param defaultArchType the head element of the list */ - public CFArchType(CFArchType head_type) { + public CFArchType(CFArchType defaultArchType) { next = null; desc = null; use = null; typenr = 0; - t_name = ""; - t_attr = null; - section_num = 2; // there's always the "general" and "special" sections (even if empty) + typeName = ""; + typeAttributes = null; + sectionNum = 2; // there's always the "general" and "special" sections (even if empty) - head = head_type; // set head of list + this.defaultArchType = defaultArchType; // set head of list } /** @@ -113,15 +113,15 @@ */ public boolean load(Element root, CFArchTypeList tlist) { // this vector is used to store a temporare linked list of attributes - Vector attr_list = new Vector(); + Vector attrList = new Vector(); // for internal section handling: - Vector sec_names = new Vector(); // list of section names - boolean in_section = false; // true while section active + 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 - String import_name = null; // name of type to import from (or null) + String importName = null; // name of type to import from (or null) List children; // list of children elements Element elem; // xml element Attribute a1; @@ -131,19 +131,19 @@ if (root.getName().equalsIgnoreCase("default_type")) { // special case: default type (this one contains the default attribs) typenr = -1; - t_name = "default"; + typeName = "default"; log.debug("type: default"); } else { try { // parse the type name - t_name = root.getAttribute("name").getValue().trim(); + typeName = root.getAttribute("name").getValue().trim(); // parse the type number typenr = Integer.parseInt(root.getAttribute("number").getValue().trim()); if (log.isDebugEnabled()) { - log.debug("reading type: " + t_name + ", " + typenr); + log.debug("reading type: " + typeName + ", " + typenr); } // parse 'required' attributes @@ -156,7 +156,7 @@ a1 = elem.getAttribute(CFArchAttrib.XML_KEY_ARCH); a2 = elem.getAttribute(XML_VALUE); if (a1 == null || a2 == null) { - log.error("In '" + XML_REQUIRED + "' element of type " + t_name + ": " + 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()); @@ -165,15 +165,15 @@ // create array and copy vector content into the array: (key1, value1, key2, value2, ...) if (!tmp.isEmpty()) { - t_attr = new String[tmp.size()]; // initialize Strings + typeAttributes = new String[tmp.size()]; // initialize Strings for (i = 0; i < tmp.size(); i++) { - t_attr[i] = (String) tmp.elementAt(i); + typeAttributes[i] = (String) tmp.elementAt(i); } } } } catch (NumberFormatException e) { // parsing type number failed: - log.error("In " + IGUIConstants.TYPEDEF_FILE + ": Type " + t_name + " 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; } @@ -186,7 +186,7 @@ elem = (Element) children.get(i); a1 = elem.getAttribute(CFArchAttrib.XML_KEY_ARCH); if (a1 == null) { - log.error("In '" + XML_IGNORE + "' section of type " + t_name + ": " + 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,7 +198,7 @@ elem = (Element) children.get(i); a1 = elem.getAttribute("name"); if (a1 == null) { - log.error("In '" + XML_IGNORE + "' section of type " + t_name + ": 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())); @@ -206,7 +206,7 @@ ignoreTable.put((String) (ignlist.elementAt(k)), ""); } } else { - log.error("In '" + XML_IGNORE + "' section of type " + t_name + ": 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."); } } } @@ -226,9 +226,9 @@ if ((elem = root.getChild(XML_IMPORT_TYPE)) != null) { a1 = elem.getAttribute("name"); if (a1 == null) { - log.error("In file '" + IGUIConstants.TYPEDEF_FILE + "': Type " + t_name + " has " + XML_IMPORT_TYPE + " element without 'name'."); + log.error("In file '" + IGUIConstants.TYPEDEF_FILE + "': Type " + typeName + " has " + XML_IMPORT_TYPE + " element without 'name'."); } else { - import_name = a1.getValue().trim(); + importName = a1.getValue().trim(); } } @@ -238,21 +238,21 @@ elem = (Element) children.get(i); // attribute directly in type element if (elem.getName().equalsIgnoreCase(XML_ATTRIBUTE)) { - parseAttribute(elem, sec_names, false, null, attr_list, tlist); + parseAttribute(elem, secNames, false, null, attrList, tlist); } // attributes in a section if (elem.getName().equalsIgnoreCase(XML_SECTION) && !elem.getChildren().isEmpty()) { a1 = elem.getAttribute("name"); if (a1 == null) { - log.warn("In " + IGUIConstants.TYPEDEF_FILE + ": Type " + t_name + " contains a " + XML_SECTION + " missing 'name'."); - in_section = false; // we'll treat the attributes as "sectionless" + 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(); - in_section = true; // we are now inside a section - section_num++; // increment number of valid sections - sec_names.addElement(section); // tmp. store name + inSection = true; // we are now inside a section + sectionNum++; // increment number of valid sections + secNames.addElement(section); // tmp. store name } // parse all attributes in the section @@ -261,7 +261,7 @@ elem = (Element) schildren.get(k); if (elem.getName().equalsIgnoreCase(XML_ATTRIBUTE)) { // got an attribute element possibly in a section - parseAttribute(elem, sec_names, in_section, section, attr_list, tlist); + parseAttribute(elem, secNames, inSection, section, attrList, tlist); } } } @@ -271,86 +271,86 @@ // calculate how many attributes we've got int j; int t = 0; - int num_def = 0; // number of default attribs which are not ignored - int import_num = 0; // number if imported attribs + int numDef = 0; // number of default attribs which are not ignored + int importNum = 0; // number if imported attribs - j = attr_list.size(); + j = attrList.size(); // don't forget about the default attribs - if (head != null && head.attr != null && head.attr.length > 0) { + if (defaultArchType != null && defaultArchType.attr != null && defaultArchType.attr.length > 0) { // create an array to store the refernces to the default atrribs: - CFArchAttrib[] def_list = new CFArchAttrib[head.attr.length]; + CFArchAttrib[] defList = new CFArchAttrib[defaultArchType.attr.length]; - for (; t < head.attr.length; t++) { + for (; t < defaultArchType.attr.length; t++) { // add all attributes from the default_type which are not in the ignoreTable - if (!ignoreTable.containsKey(head.attr[t].getNameOld())) { - def_list[num_def] = head.attr[t]; + if (!ignoreTable.containsKey(defaultArchType.attr[t].getNameOld())) { + defList[numDef] = defaultArchType.attr[t]; j++; - num_def++; + numDef++; } } // now also count the importet attribs - CFArchAttrib[] import_list = null; // imported attribs array + CFArchAttrib[] importList = null; // imported attribs array - if (import_name != null) { - CFArchType imp_type = tlist.getHead(); - boolean found_type = false; + if (importName != null) { + CFArchType impType = tlist.getHead(); + boolean foundType = false; // search through all known types, looking for import type - for (; !found_type && imp_type != null && imp_type != this; - imp_type = found_type ? imp_type : imp_type.getNext()) { - if (imp_type.getTypeName().equalsIgnoreCase(import_name)) { - found_type = true; + for (; !foundType && impType != null && impType != this; + impType = foundType ? impType : impType.getNext()) { + if (impType.getTypeName().equalsIgnoreCase(importName)) { + foundType = true; } } - if (found_type) { + if (foundType) { // initialize array to store imported attribs - import_list = new CFArchAttrib[imp_type.attr.length]; + importList = new CFArchAttrib[impType.attr.length]; - for (int z = 0; z < imp_type.attr.length; z++) { - if (!imp_type.attr[z].getSecName().equalsIgnoreCase("general")) { + for (int z = 0; z < impType.attr.length; z++) { + if (!impType.attr[z].getSecName().equalsIgnoreCase("general")) { // import this attrib: - if (!imp_type.attr[z].getSecName().equalsIgnoreCase("general") && - !imp_type.attr[z].getSecName().equalsIgnoreCase("special") && - !sec_names.contains(imp_type.attr[z].getSecName())) { - section_num++; // increment number of valid sections - sec_names.addElement(imp_type.attr[z].getSecName()); + if (!impType.attr[z].getSecName().equalsIgnoreCase("general") && + !impType.attr[z].getSecName().equalsIgnoreCase("special") && + !secNames.contains(impType.attr[z].getSecName())) { + sectionNum++; // increment number of valid sections + secNames.addElement(impType.attr[z].getSecName()); } - import_list[import_num] = imp_type.attr[z].getClone(); + importList[importNum] = impType.attr[z].getClone(); // get section id - int new_id = sec_names.indexOf(imp_type.attr[z].getSecName()); - if (new_id >= 0) { - import_list[import_num].setSecId(new_id + 2); + int newId = secNames.indexOf(impType.attr[z].getSecName()); + if (newId >= 0) { + importList[importNum].setSecId(newId + 2); } - import_num++; + importNum++; j++; } } } else { - log.error("Syntax Error in file '" + filename + "' (" + t_name + "):"); - log.error(" import type \"" + import_name + "\" not found!"); + log.error("Syntax Error in file '" + filename + "' (" + typeName + "):"); + log.error(" import type \"" + importName + "\" not found!"); } } attr = new CFArchAttrib[j]; // create array of appropriate size // first put in the references to the default attribs: - for (int k = num_def; k > 0; k--) { - attr[num_def - k] = def_list[num_def - k]; + for (int k = numDef; k > 0; k--) { + attr[numDef - k] = defList[numDef - k]; if (log.isDebugEnabled()) { - log.debug("*** (" + (num_def - k) + ") " + attr[num_def - k].getNameNew()); + log.debug("*** (" + (numDef - k) + ") " + attr[numDef - k].getNameNew()); } } // next put in the references of imported arches (at end of array) - for (int k = 0; k < import_num; k++) { - attr[j - import_num + k] = import_list[k]; + for (int k = 0; k < importNum; k++) { + attr[j - importNum + k] = importList[k]; if (log.isDebugEnabled()) { - log.debug("*** (" + (j - import_num + k) + ") " + attr[j - import_num + k].getNameNew()); + log.debug("*** (" + (j - importNum + k) + ") " + attr[j - importNum + k].getNameNew()); } } } else { @@ -358,8 +358,8 @@ } // put the list of the (non-default) CFArchAttribs into an array: - for (i = 0; num_def < j && i < attr_list.size(); num_def++, i++) { - attr[num_def] = (CFArchAttrib) (attr_list.elementAt(i)); + for (i = 0; numDef < j && i < attrList.size(); numDef++, i++) { + attr[numDef] = (CFArchAttrib) (attrList.elementAt(i)); } return true; // archtype was parsed correctly @@ -370,34 +370,34 @@ * added to the temporare linked list provided by the parameters (see below). * Assigment of sections to attributes also happens in this method. * @param elem the xml attribute element - * @param sec_names vector storing all section names - * @param in_section true if this attribute belongs to a (custom-defined) section - * @param section name of the section (only relevant if 'in_section'==true) - * @param attr_list linked list of attributes + * @param secNames vector storing all section names + * @param inSection true if this attribute belongs to a (custom-defined) section + * @param section name of the section (only relevant if 'inSection'==true) + * @param attrList linked list of attributes * @param tlist arch type list */ - private void parseAttribute(Element elem, Vector sec_names, boolean in_section, String section, - Vector attr_list, CFArchTypeList tlist) { + private void parseAttribute(Element elem, Vector secNames, boolean inSection, String section, + Vector attrList, CFArchTypeList tlist) { // create new instance CFArchAttrib attrib = new CFArchAttrib(); // parse attribute - if (attrib.load(elem, tlist, t_name)) { + if (attrib.load(elem, tlist, typeName)) { // add this attribute to the list: - if (attr_list.size() > 0) { - ((CFArchAttrib) (attr_list.get(attr_list.size() - 1))).setNext(attrib); + if (attrList.size() > 0) { + ((CFArchAttrib) (attrList.get(attrList.size() - 1))).setNext(attrib); } - attr_list.addElement(attrib); + attrList.addElement(attrib); // parsing succeeded, now assign this attribute to a section if (attrib.getDataType() == CFArchAttrib.T_TEXT) { // text attributes all have their own section - attrib.setSection(section_num, attrib.getNameNew()); - section_num++; - sec_names.addElement(attrib.getNameNew()); // tmp. store name - } else if (in_section) { + attrib.setSection(sectionNum, attrib.getNameNew()); + sectionNum++; + secNames.addElement(attrib.getNameNew()); // tmp. store name + } else if (inSection) { // if the attribute is in a section, so be it: - attrib.setSection(section_num - 1, section); + attrib.setSection(sectionNum - 1, section); } else if (typenr == -1) { // default attributes go into the "General" section attrib.setSection(0, "General"); @@ -421,32 +421,32 @@ String text = ""; // String containing the whole html text // there are two possible text sizes: normal and large - boolean big_font = CMainControl.getInstance().isBigFont(); + boolean bigFont = CMainControl.getInstance().isBigFont(); // write header (not displayed) text += "<HTML>\n<HEAD>\n<META NAME=\"CFJavaEditor\" CONTENT=\"tmp\">\n<TITLE>"; - text += "Type: " + t_name; + text += "Type: " + typeName; text += "</HEAD>\n<BODY>\n"; - text += "<H1 align=center color=navy>Type: " + t_name + "</H1>\n"; // title + text += "<H1 align=center color=navy>Type: " + typeName + "</H1>\n"; // title if (desc != null && desc.trim().length() > 0) { - text += "<P><H" + (big_font ? 2 : 3) + " color=navy>Functionality of " + t_name + ":</H" + (big_font ? 2 : 3) + ">"; - if (big_font) { + text += "<P><H" + (bigFont ? 2 : 3) + " color=navy>Functionality of " + typeName + ":</H" + (bigFont ? 2 : 3) + ">"; + if (bigFont) { text += "<font size=\"4\">"; } text += desc.trim() + "</P>"; - if (big_font) { + if (bigFont) { text += "</font>"; } } if (use != null && use.trim().length() > 0) { - text += "<P><H" + (big_font ? 2 : 3) + " color=navy>Notes on Usage:</H" + (big_font ? 2 : 3) + ">"; - if (big_font) { + text += "<P><H" + (bigFont ? 2 : 3) + " color=navy>Notes on Usage:</H" + (bigFont ? 2 : 3) + ">"; + if (bigFont) { text += "<font size=\"4\">"; } text += use.trim() + "</P>"; - if (big_font) { + if (bigFont) { text += "</font>"; } } @@ -477,8 +477,8 @@ return next; } - public void setNext(CFArchType cf_type) { - next = cf_type; + public void setNext(CFArchType cfType) { + next = cfType; } public CFArchAttrib[] getAttr() { @@ -486,7 +486,7 @@ } public int getSectionNum() { - return section_num; + return sectionNum; } public int getTypeNr() { @@ -494,11 +494,11 @@ } public String getTypeName() { - return t_name; + return typeName; } public String[] getTypeAttr() { - return t_attr; + return typeAttributes; } public String getTypeDesc() { @@ -509,11 +509,11 @@ return use; } - private void read_till(BufferedReader stream, String tag) throws IOException { - CFileReader.read_till(stream, tag, null); + private void readTill(BufferedReader stream, String tag) throws IOException { + CFileReader.readTill(stream, tag, null); } - private String reads_till(BufferedReader stream, String tag) throws IOException { - return CFileReader.reads_till(stream, tag); + private String readsTill(BufferedReader stream, String tag) throws IOException { + return CFileReader.readsTill(stream, tag); } } Modified: trunk/crossfire/src/cfeditor/CFArchTypeList.java =================================================================== --- trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-05-29 21:48:32 UTC (rev 81) +++ trunk/crossfire/src/cfeditor/CFArchTypeList.java 2006-05-30 06:35:03 UTC (rev 82) @@ -58,9 +58,9 @@ private final CFArchType head = new CFArchType(null); // head of CFArchType list (head contains default type) // spell info: - private String[] spell_name; // array of spell names (these all begin with a ' ' space!) + private String[] spellName; // array of spell names (these all begin with a ' ' space!) - private int[] spell_num; // array of spell numbers + private int[] spellNum; // array of spell numbers private Hashtable bitmaskTable; // table with CAttrBitmask objects (value) sorted by name (key) @@ -75,8 +75,8 @@ * file 'types.xml'. */ CFArchTypeList() { - CFArchType cf_type = head; // index of CFArchType list - boolean head_loaded = false; // true when the default type (=head) is loaded + CFArchType cfType = head; // index of CFArchType list + boolean headLoaded = false; // true when the default type (=head) is loaded CFileReader fread = null; // file reader for "types.txt" // initialize the arrays of "special-data" @@ -135,12 +135,12 @@ log.warn("In file '" + IGUIConstants.TYPEDEF_FILE + "': default_type element is missing!"); } else { // create a new CFArchType element - CFArchType new_type = new CFArchType(head); + CFArchType newType = new CFArchType(head); // attach the new CFArchType element to the list // if we manage to parse it properly from the file if (head.load(elem, this)) { - cf_type = head; + cfType = head; //length++; // our list is now one element longer } } @@ -179,13 +179,13 @@ log.warn("In file '" + IGUIConstants.TYPEDEF_FILE + "': found type element without 'name' or 'number'."); } else { // create a new CFArchType element - CFArchType new_type = new CFArchType(head); + CFArchType newType = new CFArchType(head); // attach the new CFArchType element to the list // if we manage to parse it properly from the file - if (new_type.load(elem, this)) { - cf_type.setNext(new_type); - cf_type = cf_type.getNext(); + if (newType.load(elem, this)) { + cfType.setNext(newType); + cfType = cfType.getNext(); length++; // our list is now one element longer } } @@ -240,7 +240,7 @@ } /** @return true if this typelist contains no data */ - public boolean is_empty() { + public boolean isEmpty() { return head == null || head.getNext() == null; } @@ -257,11 +257,11 @@ } public String[] getSpellName() { - return spell_name; + return spellName; } public int[] getSpellNum() { - return spell_num; + return spellNum; } public Hashtable getBitmaskTable() { @@ -277,12 +277,12 @@ } /** - * Read the spells from "spells.xml" into the arrays 'spell_name' - * and 'spell_num'. This method is called at startup + * Read the spells from "spells.xml" into the arrays 'spellName' + * and 'spellNum'. This method is called at startup */ public void loadSpellsFromXML() { - spell_name = null; - spell_num = null; + spellName = null; + spellNum = null; CFileReader reader = null; // input reader int spnum = 0; // number of spells @@ -297,7 +297,7 @@ // retrieve the spell data from the xml Element root = doc.getRootElement(); - Element spell_elem; + Element spellElem; Attribute a; if (root == null || !root.getName().equalsIgnoreCase("spells")) { log.warn("File '" + IGUIConstants.SPELL_FILE + "' lacks root element 'spells'."); @@ -307,30 +307,30 @@ log.warn("File '" + IGUIConstants.SPELL_FILE + "' has no content."); } else { // initialize array with appropriate size - spell_name = new String[spells.size() + 1]; - spell_num = new int[spells.size() + 1]; + spellName = new String[spells.size() + 1]; + spellNum = new int[spells.size() + 1]; // first element is <none> - spell_name[0] = " <none>"; - spell_num[0] = -1; + spellName[0] = " <none>"; + spellNum[0] = -1; int i; int j; for (j = 0, i = 1; j < spells.size(); j++) { - spell_elem = (Element) spells.get(j); + spellElem = (Element) spells.get(j); - if (spell_elem.getAttribute("id") == null) { + if (spellElem.getAttribute("id") == null) { log.warn("In File '" + IGUIConstants.SPELL_FILE + "': Found 'spell' element without 'id'"); - } else if (spell_elem.getAttribute("name") == null) { + } else if (spellElem.getAttribute("name") == null) { log.warn("In File '" + IGUIConstants.SPELL_FILE + "': Found 'spell' element without 'name'"); } else { try { // parse spell number and -name - spell_num[i] = spell_elem.getAttribute("id").getIntValue(); - spell_name[i] = spell_elem.getAttribute("name").getValue().trim(); + spellNum[i] = spellElem.getAttribute("id").getIntValue(); + spellName[i] = spellElem.getAttribute("name").getValue().trim(); i++; } catch (DataConversionException de) { - log.error("in '" + IGUIConstants.SPELL_FILE + "': spell id '" + spell_elem.getAttribute("id").getValue() + "' is not an integer."); + log.error("in '" + IGUIConstants.SPELL_FILE + "': spell id '" + spellElem.getAttribute("id").getValue() + "' is not an integer."); } } } @@ -359,9 +359,9 @@ /** * Opens a file chooser to select the spellist file, * then import spells. - * @param m_control main control + * @param mainControl main control */ - public void importSpellsWanted(CMainControl m_control) { + public void importSpellsWanted(CMainControl mainControl) { // open a file chooser window JFileChooser fileChooser = new JFileChooser(); fileChooser.setDialogTitle("Open CF Spellist File"); @@ -370,7 +370,7 @@ fileChooser.setFileFilter(new SpellFileFilter()); // apply file filter fileChooser.setCurrentDirectory(new File(System.getProperty("user.dir"))); - int returnVal = fileChooser.showOpenDialog(m_control.getMainView()); + int returnVal = fileChooser.showOpenDialog(mainControl.getMainView()); if (returnVal == JFileChooser.APPROVE_OPTION) { // now import spells from selected file @@ -378,11 +378,11 @@ int spnum = importSpells(spellfile); if (spnum > 0) { // yeah it worked - m_control.showMessage("Collect Spells", + mainControl.showMessage("Collect Spells", "Successfully collected " + spnum + " spells."); } else { // spell collect failed - m_control.showMessage("Collect Spells", + mainControl.showMessage("Collect Spells", "Collecting spells failed!\n" + "Maybe the specified file is of wrong format."); } @@ -412,17 +412,17 @@ bufferedReader = new BufferedReader(fileReader); String name; // spellnames - CFileReader.read_till(bufferedReader, "spell spells", null); - CFileReader.read_till(bufferedReader, "{", null); + CFileReader.readTill(bufferedReader, "spell spells", null); + CFileReader.readTill(bufferedReader, "{", null); // reading spellnames one after the other, // this loop is terminated by an EOFException int i = 0; // index for insertion in the vector for (int counter = 0; true; counter++) { - CFileReader.read_till(bufferedReader, "{", "}"); - CFileReader.read_till(bufferedReader, "\"", null); - name = CFileReader.reads_till(bufferedReader, "\""); - CFileReader.read_till(bufferedReader, "}", null); + CFileReader.readTill(bufferedReader, "{", "}"); + CFileReader.readTill(bufferedReader, "\"", null); + name = CFileReader.readsTill(bufferedReader, "\""); + CFileReader.readTill(bufferedReader, "}", null); name = name.trim(); // now insert this string lexographically into the vector @@ -538,16 +538,16 @@ CFArchType type = tmp; // return value: the type of the arch, first one (misc) if no other found ArchObject defarch = arch.getDefaultArch(); - boolean type_found = false; + boolean typeFound = false; - for (int i = 0; tmp != null && !type_found; tmp = tmp.getNext(), i++) { + for (int i = 0; tmp != null && !typeFound; tmp = tmp.getNext(), i++) { if (tmp.getTypeNr() == arch.getArchTypNr()) { if (tmp.getTypeAttr() == null) { // no type-attributes, so we only compared type-numbers - type_found = true; + typeFound = true; } else { // check if all the type-attributes match - int args_num = (int) (tmp.getTypeAttr().length / 2.); + int argsNum = (int) (tmp.getTypeAttr().length / 2.); boolean match = true; String archvalue; @@ -555,7 +555,7 @@ log.debug("# type: " + tmp.getTypeName()); } - for (int t = 0; t < args_num * 2; t += 2) { + for (int t = 0; t < argsNum * 2; t += 2) { archvalue = arch.getAttributeString(tmp.getTypeAttr()[t], defarch); if (!archvalue.equals(tmp.getTypeAttr()[t + 1]) && @@ -566,12 +566,12 @@ // we've got a match after all if (match) { - type_found = true; + typeFound = true; } } // we found our type - if (type_found) { + if (typeFound) { type = tmp; // this is the type we are looking for } } @@ -582,22 +582,22 @@ /** * Find and return the type-structure (<code>CFArchType</code>) that - * matches the given 'type_name'. These type-names are "artificial" + * matches the given 'typeName'. These type-names are "artificial" * names, defined in "types.txt". They appear in the type selection box * in the attribute-dialog. * @return the <code>CFArchType</code> that matches, * or the first (misc) type if no match is found. */ - public CFArchType getTypeByName(String type_name) { + public CFArchType getTypeByName(String typeName) { // return: matching type or first type (misc) if no other found CFArchType type = getHead().getNext(); - boolean type_found = false; // true when type is found + boolean typeFound = false; // true when type is found - for (CFArchType tmp = type; tmp != null && !type_found; tmp = tmp.getNext()) { - if (tmp.getTypeName().equals(type_name.trim())) { + for (CFArchType tmp = type; tmp != null && !typeFound; tmp = tmp.getNext()) { + if (tmp.getTypeName().equals(typeName.trim())) { // we found our type type = tmp; - type_found = true; + typeFound = true; } } Modified: trunk/crossfire/src/cfeditor/CFTreasureListTree.java =================================================================== --- trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-05-29 21:48:32 UTC (rev 81) +++ trunk/crossfire/src/cfeditor/CFTreasureListTree.java 2006-05-30 06:35:03 UTC (rev 82) @@ -775,18 +775,18 @@ needSecondLink.add(clone); } else { // has children, but any *real* children, or just YES/NO? - boolean has_children = false; // true when this list has real children + boolean hasChildren = false; // true when this list has real children TreasureObj content; // tmp. storage for children's TreasureObj - for (clist = children(); clist != null && clist.hasMoreElements() && !has_children;) { + for (clist = children(); clist != null && clist.hasMoreElements() && !hasChildren;) { // check for real children, other than YES/NO objects content = ((TreasureTreeNode) clist.nextElement()).getTreasureObj(); if (content.getType() != TreasureObj.YES && content.getType() != TreasureObj.NO) { - has_children = true; // found a real child + hasChildren = true; // found a real child } } - if (!has_children) { + if (!hasChildren) { // this is a list with nothing but YES/NO in it, needs linking needSecondLink.add(clone); } Modified: trunk/crossfire/src/cfeditor/CFileReader.java =================================================================== --- trunk/crossfire/src/cfeditor/CFileReader.java 2006-05-29 21:48:32 UTC (rev 81) +++ trunk/crossfire/src/cfeditor/CFileReader.java 2006-05-30 06:35:03 UTC (rev 82) @@ -120,7 +120,7 @@ } /** - * read_till - reads characters from the BufferedReader stream + * readTill - reads characters from the BufferedReader stream * till 'tag' is found. If found, the method returns with * stream pointing right after the appearance of 'tag'. * @param stream ascii input stream to read from @@ -130,7 +130,7 @@ * @throws EOFException the end of file was reached, or the 'abort' string * has been encountered */ - public static void read_till(BufferedReader stream, String tag, String abort) + public static void readTill(BufferedReader stream, String tag, String abort) throws IOException { int c; // character value, read from the stream int t = 0; // tag index @@ -176,8 +176,8 @@ } /** - * reads_till - reads characters from the BufferedReader stream - * till 'tag' is found. Similar to read_till(), except that the + * readsTill - reads characters from the BufferedReader stream + * till 'tag' is found. Similar to readTill(), except that the * read String is returned. 'tag' is not included in the returned * String. * @param stream ascii input stream to read from @@ -187,7 +187,7 @@ * @throws IOException an I/O-error occurred while reading the file * @throws EOFException the end of file was reached */ - public static String reads_till(BufferedReader stream, String tag) + public static String readsTill(BufferedReader stream, String tag) throws IOException { String r = ""; // returned string int c; // character value, read from the stream @@ -217,14 +217,14 @@ return r; } - // wrapper method for read_till, using BufferReader from 'this' - public void read_till(String tag, String abort) throws IOException { - read_till(read, tag, abort); + // wrapper method for readTill, using BufferReader from 'this' + public void readTill(String tag, String abort) throws IOException { + readTill(read, tag, abort); } - // wrapper method for reads_till, using BufferReader from 'this' - public String reads_till(String tag) throws IOException { - return reads_till(read, tag); + // wrapper method for readsTill, using BufferReader from 'this' + public String readsTill(String tag) throws IOException { + return readsTill(read, tag); } /** close all open streams, print errormessages if closing failed */ Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2006-05-29 21:48:32 UTC (rev 81) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2006-05-30 06:35:03 UTC (rev 82) @@ -1035,7 +1035,7 @@ * @param arch attr. window is opened for this arch */ public void openAttrDialog(ArchObject arch) { - if (typelist.is_empty()) { + if (typelist.isEmpty()) { // types.txt is missing! showMessage("File Missing", "The definitions-file \"types.txt\" is missing! The\n" + Modified: trunk/crossfire/src/cfeditor/CMapArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-05-29 21:48:32 UTC (rev 81) +++ trunk/crossfire/src/cfeditor/CMapArchPanel.java 2006-05-30 06:35:03 UTC (rev 82) @@ -445,7 +445,7 @@ arch.setArchTypNr(arch.getAttributeValue("type", null)); // specified type } - // Recalculate the edit_type value. It shall stay 100% accurate ;) + // Recalculate the editType value. It shall stay 100% accurate ;) arch.calculateEditType(m_control.getCurrentMap().getActiveEditType()); // if the archtext changed, set the map changed flag Modified: trunk/daimonin/src/daieditor/CFArchAttrib.java =================================================================== --- trunk/daimonin/src/daieditor/CFArchAttrib.java 2006-05-29 21:48:32 UTC (rev 81) +++ trunk/daimonin/src/daieditor/CFArchAttrib.java 2006-05-30 06:35:03 UTC (rev 82) @@ -67,7 +67,7 @@ private String nameOld; // original attr. name (from the CF arches) - private String endingOld; // for data_type = 'T_TEXT' this is the terminating string + private String endingOld; // for dataType = 'T_TEXT' this is the terminating string // (example: 'endmsg' for arch message) private String nameNew; // new attr. name (for the user-friendly GUI) Modified: trunk/daimonin/src/daieditor/CFArchType.java =================================================================== --- trunk/daimonin/src/daieditor/CFArchType.java 2006-05-29 21:48:32 UTC (rev 81) +++ trunk/daimonin/src/daieditor/CFArchType.java 2006-05-30 06:35:03 UTC (rev 82) @@ -75,7 +75,7 @@ private String[] typeAttributes; // list of aditional attributes that an object // must have, in order to be of this type: - // t_attr[0] is attr. name, t_attr[1] is attr. value, ... + // typeAttributes[0] is attr. name, typtAttributes[1] is attr. value, ... private final CFArchType defaultArchType; // contains default attributes @@ -132,7 +132,7 @@ // parse the type number typenr = Integer.parseInt(root.getAttribute("number").trim()); - //System.err.println("reading type: "+t_name+", "+typenr); + //System.err.println("reading type: "+typeName+", "+typenr); // parse 'required' attributes final Element required = getFirstChild(root, XML_REQUIRED); @@ -315,13 +315,13 @@ // first put in the references to the default attribs: for (int k = numDef; k > 0; k--) { attr[numDef - k] = defList[numDef - k]; - //System.err.println("*** ("+(num_def-k)+") "+attr[num_def-k].getNameNew()); + //System.err.println("*** ("+(numDef-k)+") "+attr[numDef-k].getNameNew()); } // next put in the references of imported arches (at end of array) for (int k = 0; k < importNum; k++) { attr[j - importNum + k] = importList[k]; - //System.err.println("*** ("+(j-import_num + k)+") "+attr[j-import_num + k].getNameNew()); + //System.err.println("*** ("+(j-importNum + k)+") "+attr[j-importNum + k].getNameNew()); } } else { attr = new CFArchAttrib[j]; // create array of appropriate size @@ -342,7 +342,7 @@ * @param elem the xml attribute element * @param secNames vector storing all section names * @param inSection true if this attribute belongs to a (custom-defined) section - * @param section name of the section (only relevant if 'in_section'==true) + * @param section name of the section (only relevant if 'inSection'==true) * @param attrList linked list of attributes * @param tlist arch type list */ Modified: trunk/daimonin/src/daieditor/CFArchTypeList.java =================================================================== --- trunk/daimonin/src/daieditor/CFArchTypeList.java 2006-05-29 21:48:32 UTC (rev 81) +++ trunk/daimonin/src/daieditor/CFArchTypeList.java 2006-05-30 06:35:03 UTC (rev 82) @@ -342,7 +342,7 @@ /** * Find and return the type-structure (<code>CFArchType</code>) that - * matches the given 'type_name'. These type-names are "artificial" + * matches the given 'typeName'. These type-names are "artificial" * names, defined in "types.txt". They appear in the type selection box * in the attribute-dialog. * @return the <code>CFArchType</code> that matches, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-05-29 21:48:42
|
Revision: 81 Author: christianhujer Date: 2006-05-29 14:48:32 -0700 (Mon, 29 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=81&view=rev Log Message: ----------- Changed code style to what we've agreed on gridarta-devel and irc. Modified Paths: -------------- trunk/src/doc/dev/codeStyle.xhtml Modified: trunk/src/doc/dev/codeStyle.xhtml =================================================================== --- trunk/src/doc/dev/codeStyle.xhtml 2006-05-29 21:30:31 UTC (rev 80) +++ trunk/src/doc/dev/codeStyle.xhtml 2006-05-29 21:48:32 UTC (rev 81) @@ -10,9 +10,7 @@ This document describes the Code Conventions used for Gridarta. </p> <p> - <a href="http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html">Code Conventions for the JavaTM Programming Language</a> apply with - one exception: - Contents of switch are indented. + <a href="http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html">Code Conventions for the JavaTM Programming Language</a> </p> <p> Additionally, the following set of rules applies: @@ -20,7 +18,6 @@ <ul> <li>Imports are sorted alphabetically by package, within a package alphabetically by class.</li> <li>The *-form of import is not allowed.</li> - <li>The brief of a javadoc comment starts in the first line of the comment, right after <code>/**</code>.</li> </ul> </body> </html> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-05-29 21:30:51
|
Revision: 80 Author: akirschbaum Date: 2006-05-29 14:30:31 -0700 (Mon, 29 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=80&view=rev Log Message: ----------- Rename variable names. 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/CAttribDialog.java trunk/crossfire/src/cfeditor/CMapArchPanel.java trunk/crossfire/src/cfeditor/CMapControl.java trunk/crossfire/src/cfeditor/CMapModel.java trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/daimonin/src/daieditor/CArchPanel.java trunk/daimonin/src/daieditor/CAttribDialog.java Modified: trunk/crossfire/src/cfeditor/CArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanel.java 2006-05-29 21:04:07 UTC (rev 79) +++ trunk/crossfire/src/cfeditor/CArchPanel.java 2006-05-29 21:30:31 UTC (rev 80) @@ -46,17 +46,17 @@ private static final String ARCHPANEL_LOCATION_KEY = "MainWindowArchPanel.dividerLocation"; /** Controller of this subview. */ - private final CMainControl m_control; + private final CMainControl mainControl; /** The "Import..." button. */ private int selectedArch; - private final JTabbedPane m_archAndPickPane; // panel holding both archlist and pickmaps + private final JTabbedPane archAndPickPane; // panel holding both archlist and pickmaps - private final CSplitPane m_splitPane; // our split pane + private final CSplitPane splitPane; // our split pane - private final JTabbedPane m_tabDesktop; // the tab panel with arch lists + private final JTabbedPane tabDesktop; // the tab panel with arch lists private final CArchQuickView archQuickPanel; // data/view of selected objects in tab panel @@ -64,46 +64,46 @@ private PanelNode panelNodeLast; - private CArchPanelPan m_selectedPanel; // the active panel + private CArchPanelPan selectedPanel; // the active panel private static final long serialVersionUID = 6634110300452920361L; /* Build Panel */ - public CArchPanel(final CMainControl control) { - m_control = control; + public CArchPanel(final CMainControl mainControl) { + this.mainControl = mainControl; panelNodeStart = null; panelNodeLast = null; - m_selectedPanel = null; + selectedPanel = null; CSettings settings = CSettings.getInstance(IGUIConstants.APP_NAME); selectedArch = -1; setLayout(new BorderLayout()); - m_tabDesktop = new JTabbedPane(JTabbedPane.TOP); - m_tabDesktop.setBorder(BorderFactory.createEmptyBorder(IGUIConstants.SPACE_PICKARCH_TOP, 0, 0, 0)); - m_control.setBoldFont(m_tabDesktop); - archQuickPanel = new CArchQuickView(control); + tabDesktop = new JTabbedPane(JTabbedPane.TOP); + tabDesktop.setBorder(BorderFactory.createEmptyBorder(IGUIConstants.SPACE_PICKARCH_TOP, 0, 0, 0)); + mainControl.setBoldFont(tabDesktop); + archQuickPanel = new CArchQuickView(mainControl); - // m_archAndPickPane is the panel containing both archpanel and pickmaps - m_archAndPickPane = new JTabbedPane(JTabbedPane.TOP); - m_control.setBoldFont(m_archAndPickPane); - m_archAndPickPane.addTab(" Arch List ", m_tabDesktop); - m_archAndPickPane.addTab(" Pickmaps ", m_control.getMainView().getPickmapPanel()); + // archAndPickPane is the panel containing both archpanel and pickmaps + archAndPickPane = new JTabbedPane(JTabbedPane.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(m_archAndPickPane); + CPickmapPanel.getInstance().addArchNPickChangeListener(archAndPickPane); - m_splitPane = new CSplitPane(CSplitPane.VERTICAL_SPLIT, m_archAndPickPane, archQuickPanel); + splitPane = new CSplitPane(CSplitPane.VERTICAL_SPLIT, archAndPickPane, archQuickPanel); // calculate default value in case there is no settings file Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); int divLocation = Integer.parseInt(settings.getProperty(ARCHPANEL_LOCATION_KEY, "" + (int) (0.77 * 0.9 * screen.getHeight()))); - m_splitPane.setDividerLocation(divLocation); - m_splitPane.setDividerSize(5); - add(m_splitPane, BorderLayout.CENTER); + splitPane.setDividerLocation(divLocation); + splitPane.setDividerSize(5); + add(splitPane, BorderLayout.CENTER); // we must set the list of the selected list depend on combo selection - m_tabDesktop.addChangeListener(new ChangeListener() { + tabDesktop.addChangeListener(new ChangeListener() { public void stateChanged(final ChangeEvent e) { final JTabbedPane tp = (JTabbedPane) e.getSource(); @@ -116,9 +116,9 @@ node = node.next; } - m_selectedPanel = node.data; - if (m_selectedPanel != null) { - m_selectedPanel.showArchList(); + selectedPanel = node.data; + if (selectedPanel != null) { + selectedPanel.showArchList(); } } }); @@ -130,17 +130,17 @@ /** Move the pickmap panel in front of the default-archpanel */ public void movePickmapPanelToFront() { - if (m_archAndPickPane != null && m_archAndPickPane.getTabCount() > 1) { - m_archAndPickPane.setSelectedIndex(1); + if (archAndPickPane != null && archAndPickPane.getTabCount() > 1) { + archAndPickPane.setSelectedIndex(1); } } public ArchObject getArchPanelSelection() { - if (m_selectedPanel == null) { + if (selectedPanel == null) { return null; } - return m_selectedPanel.getArchListObject(); + return selectedPanel.getArchListObject(); } public void showArchPanelQuickObject(final ArchObject arch) { @@ -148,21 +148,21 @@ } public int addArchPanelCombo(final String name) { - return m_selectedPanel.addArchPanelCombo(name); + return selectedPanel.addArchPanelCombo(name); } public void addArchPanelArch(final int archnr, final int index) { - m_selectedPanel.addArchPanelArch(archnr, index); + selectedPanel.addArchPanelArch(archnr, index); } public void disableTabPane() { - m_tabDesktop.setEnabled(false); + tabDesktop.setEnabled(false); } public void enableTabPane() { - m_tabDesktop.setEnabled(true); - if (m_selectedPanel != null) { - m_selectedPanel.showArchList(); + tabDesktop.setEnabled(true); + if (selectedPanel != null) { + selectedPanel.showArchList(); } } @@ -171,7 +171,7 @@ * @param name */ public void addPanel(final String name) { - final PanelNode newnode = new PanelNode(new CArchPanelPan(this, m_control), name); + final PanelNode newnode = new PanelNode(new CArchPanelPan(this, mainControl), name); // chain it to our list of panels if (panelNodeStart == null) { @@ -184,37 +184,37 @@ // insert new panels in alphabetical order int i; - for (i = 0; i < m_tabDesktop.getTabCount() && name.compareToIgnoreCase(m_tabDesktop.getTitleAt(i)) < 0; i++) { + for (i = 0; i < tabDesktop.getTabCount() && name.compareToIgnoreCase(tabDesktop.getTitleAt(i)) < 0; i++) { ; } - this.m_tabDesktop.insertTab(name, null, newnode.data.getPanel(), null, i); + this.tabDesktop.insertTab(name, null, newnode.data.getPanel(), null, i); - // careful: during the build proccess we are setting 'm_selectedPanel' + // careful: during the build proccess we are setting 'selectedPanel' // in spite of the fact that this panel might *not* actually be selected - m_selectedPanel = newnode.data; + selectedPanel = newnode.data; } /** * After the build proccess is completed and the panels have - * been fully constructed, we must correct the 'm_selectedPanel' + * been fully constructed, we must correct the 'selectedPanel' * setting and make sure the arch list is properly drawn. */ public void finishBuildProccess() { - final Component sel = m_tabDesktop.getSelectedComponent(); + final Component sel = tabDesktop.getSelectedComponent(); PanelNode node = panelNodeStart; while (node != null && node.data.getPanel() != sel) { node = node.next; } if (node != null && node.data != null) { - m_selectedPanel = node.data; - m_selectedPanel.showArchList(); + selectedPanel = node.data; + selectedPanel.showArchList(); } } void appExitNotify() { final CSettings settings = CSettings.getInstance(IGUIConstants.APP_NAME); - settings.setProperty(ARCHPANEL_LOCATION_KEY, "" + m_splitPane.getDividerLocation()); + settings.setProperty(ARCHPANEL_LOCATION_KEY, "" + splitPane.getDividerLocation()); } public int getPanelArch() { @@ -231,7 +231,7 @@ } public void updateFont() { - m_control.setBoldFont(m_tabDesktop); + mainControl.setBoldFont(tabDesktop); refresh(); } Modified: trunk/crossfire/src/cfeditor/CArchPanelPan.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-05-29 21:04:07 UTC (rev 79) +++ trunk/crossfire/src/cfeditor/CArchPanelPan.java 2006-05-29 21:30:31 UTC (rev 80) @@ -47,13 +47,13 @@ private static final Logger log = Logger.getLogger(CArchPanel.class); /** Controller of this subview. */ - private final CMainControl m_control; + private final CMainControl mainControl; - private final JList m_list; + private final JList theList; private final DefaultListModel model; - private final JPanel m_panelDesktop; + private final JPanel panelDesktop; private final JComboBox jbox; @@ -61,34 +61,34 @@ private int listcounter; - private int combo_counter; + private int comboCounter; - private final CArchPanel m_panel; + private final CArchPanel archPanel; private static final long serialVersionUID = 8690200410771201444L; /* Build Panel */ - CArchPanelPan(CArchPanel control_panel, CMainControl control) { - m_control = control; - m_panel = control_panel; + CArchPanelPan(CArchPanel controlPanel, CMainControl control) { + mainControl = control; + archPanel = controlPanel; list = new StringBuffer(""); listcounter = 0; - combo_counter = 0; + comboCounter = 0; setLayout(new BorderLayout()); - m_panelDesktop = new JPanel(); - m_panelDesktop.setLayout(new BorderLayout()); + panelDesktop = new JPanel(); + panelDesktop.setLayout(new BorderLayout()); jbox = new JComboBox(); - m_control.setBoldFont(jbox); + mainControl.setBoldFont(jbox); model = new DefaultListModel(); - m_list = new JList(model); - m_list.setCellRenderer(new MyCellRenderer()); - m_list.setBackground(IGUIConstants.BG_COLOR); - JScrollPane scrollPane = new JScrollPane(m_list); - m_panelDesktop.add(scrollPane, BorderLayout.CENTER); - m_panelDesktop.add(jbox, BorderLayout.NORTH); + theList = new JList(model); + theList.setCellRenderer(new MyCellRenderer()); + theList.setBackground(IGUIConstants.BG_COLOR); + JScrollPane scrollPane = new JScrollPane(theList); + panelDesktop.add(scrollPane, BorderLayout.CENTER); + panelDesktop.add(jbox, BorderLayout.NORTH); scrollPane.setAutoscrolls(true); scrollPane.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); @@ -100,20 +100,20 @@ } }); - m_list.addListSelectionListener(new ListSelectionListener() { + theList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { showArchListObject(e.getFirstIndex()); } }); // listening for mouse-click events in the ArchPanel list - m_list.addMouseListener(new MouseAdapter() { + theList.addMouseListener(new MouseAdapter() { public void mousePressed(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 (m_control.getCurrentMap() != null && - m_control.getCurrentMap().getMapView() != null) { - m_control.getCurrentMap().getMapView().requestFocus(); // focus to mapview + if (mainControl.getCurrentMap() != null && + mainControl.getCurrentMap().getMapView() != null) { + mainControl.getCurrentMap().getMapView().requestFocus(); // focus to mapview } } }); @@ -121,11 +121,11 @@ public ArchObject getArchListObject() { ArchObject arch = null; - int index = m_list.getSelectedIndex(); + int index = theList.getSelectedIndex(); if (index != -1) { - index = Integer.parseInt(m_list.getSelectedValue().toString()); - arch = m_control.getArchObjectStack().getArch(index); + index = Integer.parseInt(theList.getSelectedValue().toString()); + arch = mainControl.getArchObjectStack().getArch(index); } return arch; } @@ -135,8 +135,8 @@ if (index != -1) { try { - index = Integer.parseInt(m_list.getSelectedValue().toString()); - arch = m_control.getArchObjectStack().getArch(index); + index = Integer.parseInt(theList.getSelectedValue().toString()); + arch = mainControl.getArchObjectStack().getArch(index); } catch (NullPointerException e) { /* log.info("NullPointerException in showArchListObject()!", e); @@ -146,7 +146,7 @@ } catch (NumberFormatException e) { } } - m_control.showArchPanelQuickObject(arch); // send it to quick view + mainControl.showArchPanelQuickObject(arch); // send it to quick view } @@ -169,15 +169,15 @@ this.setEnabled(false); this.jbox.addItem(name); this.setEnabled(true); - return combo_counter++; + return comboCounter++; } JPanel getPanel() { - return m_panelDesktop; + return panelDesktop; } JList getList() { - return m_list; + return theList; } DefaultListModel getModel() { @@ -268,20 +268,20 @@ /* We additionally set the JLabels icon property here. */ - ArchObject arch = m_control.getArchObjectStack().getArch(Integer.parseInt(value.toString())); + ArchObject arch = mainControl.getArchObjectStack().getArch(Integer.parseInt(value.toString())); if (iss) { - m_panel.setPanelArch(Integer.parseInt(value.toString())); - m_control.setStatusText(" " + value.toString() + " "); + archPanel.setPanelArch(Integer.parseInt(value.toString())); + mainControl.setStatusText(" " + value.toString() + " "); } - m_control.setPlainFont(this); + mainControl.setPlainFont(this); setText(arch.getArchName()); if (arch.getFaceFlag()) { - setIcon(m_control.getNofaceTileIcon()); + setIcon(mainControl.getNofaceTileIcon()); } else if (arch.getFaceNr() == -1) { - setIcon(m_control.getUnknownTileIcon()); + setIcon(mainControl.getUnknownTileIcon()); } else { - setIcon(m_control.getFace(arch.getFaceNr())); + setIcon(mainControl.getFace(arch.getFaceNr())); } return this; Modified: trunk/crossfire/src/cfeditor/CArchQuickView.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchQuickView.java 2006-05-29 21:04:07 UTC (rev 79) +++ trunk/crossfire/src/cfeditor/CArchQuickView.java 2006-05-29 21:30:31 UTC (rev 80) @@ -41,7 +41,7 @@ public class CArchQuickView extends JPanel { /** Controller of this subview. */ - private final CMainControl m_control; + private final CMainControl mainControl; private final JLabel archArchNameText = new JLabel(); @@ -53,15 +53,15 @@ private static final long serialVersionUID = -5176382751320643475L; - public CArchQuickView(CMainControl control) { - m_control = control; + public CArchQuickView(CMainControl mainControl) { + this.mainControl = mainControl; setLayout(new BorderLayout(1, 1)); // set font - m_control.setPlainFont(archArchNameText); - m_control.setPlainFont(archObjNameText); - m_control.setPlainFont(archTypeText); - m_control.setPlainFont(archTileText); + mainControl.setPlainFont(archArchNameText); + mainControl.setPlainFont(archObjNameText); + mainControl.setPlainFont(archTypeText); + mainControl.setPlainFont(archTileText); // setup a panel JPanel panel = new JPanel(); @@ -136,7 +136,7 @@ } archTypeText.setText("<html><font color=black>Type: " + - m_control.getArchObjectParser().getArchTypeName(arch.getArchTypNr()) + mainControl.getArchObjectParser().getArchTypeName(arch.getArchTypNr()) + " (" + arch.getArchTypNr() + ") </font></html>"); if (arch.getRefCount() > 0) { @@ -155,7 +155,7 @@ } void refresh() { - m_control.showArchPanelQuickObject(m_control.getArchPanelSelection()); + mainControl.showArchPanelQuickObject(mainControl.getArchPanelSelection()); repaint(); } } Modified: trunk/crossfire/src/cfeditor/CAttribBitmask.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribBitmask.java 2006-05-29 21:04:07 UTC (rev 79) +++ trunk/crossfire/src/cfeditor/CAttribBitmask.java 2006-05-29 21:30:31 UTC (rev 80) @@ -57,7 +57,7 @@ //private static final int MAX_CHARS_PER_LINE = 50; private static final int MAX_CHARS_PER_LINE = 35; - private final String[] bit_name; // array of the names of bitmask-entries + private final String[] bitName; // array of the names of bitmask-entries private final int maxvalue; // max. possible value @@ -69,21 +69,21 @@ */ public CAttribBitmask(String[] name) { // initialize arrays - bit_name = new String[name.length + 1]; - //bit_value = new int[name.length+1]; + bitName = new String[name.length + 1]; + //bitValue = new int[name.length+1]; // the zero-bit is always <none> - bit_name[0] = "<none>"; - //bit_value[0] = 0; + bitName[0] = "<none>"; + //bitValue[0] = 0; for (int i = 0; i < name.length; i++) { // fill array and assign 2^i values - bit_name[i + 1] = name[i]; - //bit_value[i+1] = (int)(Math.pow(2., (double)(i-1))); + bitName[i + 1] = name[i]; + //bitValue[i+1] = (int)(Math.pow(2., (double)(i-1))); } - number = bit_name.length - 1; - maxvalue = ((int) Math.pow(2., (double) (bit_name.length + 1))) - 1; + number = bitName.length - 1; + maxvalue = ((int) Math.pow(2., (double) (bitName.length + 1))) - 1; } /** @@ -99,7 +99,7 @@ Attribute a; // find highest bit number - int max_bit = 0; + int maxBit = 0; for (i = 0; entries != null && i < entries.size(); i++) { elem = (Element) entries.get(i); if ((a = elem.getAttribute("bit")) == null || elem.getAttribute("name") == null) { @@ -108,8 +108,8 @@ } else { try { int bit = a.getIntValue(); - if (bit > max_bit) { - max_bit = bit; // this is the highest bit so far + if (bit > maxBit) { + maxBit = bit; // this is the highest bit so far } } catch (DataConversionException e) { log.warn("Parse error: Bitmask bit '" + a.getValue() + "' (" + elem.getAttribute("name").getValue() + ") is not an integer."); @@ -120,37 +120,37 @@ entries = root.getChildren("entry"); // retake list, in case we detached some elements // initialize array - bit_name = new String[max_bit + 2]; + bitName = new String[maxBit + 2]; // initialize names array - the zero-bit always stays <none> - for (i = 0; i < max_bit + 2; i++) { - bit_name[i] = "<none>"; + for (i = 0; i < maxBit + 2; i++) { + bitName[i] = "<none>"; } for (i = 0; entries != null && i < entries.size(); i++) { elem = (Element) entries.get(i); // fill array and assign 2^i values try { - bit_name[elem.getAttribute("bit").getIntValue() + 1] = elem.getAttribute("name").getValue(); + bitName[elem.getAttribute("bit").getIntValue() + 1] = elem.getAttribute("name").getValue(); } catch (DataConversionException e) { } } if (log.isDebugEnabled()) { String s = "bitmask '" + root.getAttribute("name") + "':"; - for (i = 0; i < bit_name.length; i++) { - s = s + " " + i + " = " + bit_name[i]; + for (i = 0; i < bitName.length; i++) { + s = s + " " + i + " = " + bitName[i]; } log.debug(s); } - number = bit_name.length - 1; - maxvalue = ((int) Math.pow(2., (double) (bit_name.length + 1))) - 1; + 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!"); - bit_name = new String[1]; - bit_name[0] = "<none>"; + bitName = new String[1]; + bitName[0] = "<none>"; number = 0; maxvalue = 0; } @@ -162,7 +162,7 @@ * @param mask bitmask to check against * @return true if the bit-index is an active bit */ - private boolean is_active(int index, int mask) { + private boolean isActive(int index, int mask) { return ((int) (Math.pow(2., (double) (index - 1))) & mask) != 0; } @@ -182,7 +182,7 @@ // is bitmask empty? if (value <= 0) { - text += bit_name[0]; + text += bitName[0]; columns = text.length(); } else { // value too big? @@ -193,11 +193,11 @@ boolean linebreak = false; int linelength = 0; // length of last line - for (int i = 1; i < bit_name.length; i++) { - if (is_active(i, value)) { + for (int i = 1; i < bitName.length; i++) { + if (isActive(i, value)) { // is a linebreak required? linelength = text.indexOf("\n") >= 0 ? text.substring(text.lastIndexOf("\n")).length() : text.length(); - if (linelength + bit_name[i].length() + 2 > MAX_CHARS_PER_LINE) { + if (linelength + bitName[i].length() + 2 > MAX_CHARS_PER_LINE) { text += ", \n "; linebreak = true; rows++; @@ -206,7 +206,7 @@ } // append text - text += ((text.length() <= 1 || linebreak) ? "" : ", ") + bit_name[i]; + text += ((text.length() <= 1 || linebreak) ? "" : ", ") + bitName[i]; linelength = text.indexOf("\n") >= 0 ? text.substring(text.lastIndexOf("\n")).length() : text.length(); if (linelength > columns) { @@ -236,51 +236,51 @@ } /** Open a popup frame to select bitmask-entries via chooseboxes. */ - public void popup_frame(CAttribDialog attrDialog, CAttribDialog.BitmaskAttrib gui_attr) { - String title = "Choose " + gui_attr.ref.getNameNew().substring(0, 1).toUpperCase() + gui_attr.ref.getNameNew().substring(1); + 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); frame.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); // panels - JPanel main_panel = new JPanel(); - main_panel.setLayout(new BoxLayout(main_panel, BoxLayout.Y_AXIS)); - JPanel grid_panel = new JPanel(new GridLayout(1, 2)); - JPanel left_list = new JPanel(); // left column of checkboxes - left_list.setLayout(new BoxLayout(left_list, BoxLayout.Y_AXIS)); - JPanel right_list = new JPanel(); // right column of checkboxes - right_list.setLayout(new BoxLayout(right_list, BoxLayout.Y_AXIS)); - JPanel button_panel = new JPanel(new FlowLayout(FlowLayout.CENTER)); + 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 + leftList.setLayout(new BoxLayout(leftList, BoxLayout.Y_AXIS)); + JPanel rightList = new JPanel(); // right column of checkboxes + rightList.setLayout(new BoxLayout(rightList, BoxLayout.Y_AXIS)); + JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); // create checkboxes JCheckBox[] checkbox = new JCheckBox[number]; for (int i = 0; i < number; i++) { - checkbox[i] = new JCheckBox(" " + bit_name[i + 1]); - checkbox[i].setSelected(is_active(i + 1, gui_attr.getValue())); + checkbox[i] = new JCheckBox(" " + bitName[i + 1]); + checkbox[i].setSelected(isActive(i + 1, guiAttr.getValue())); if (i % 2 == 0) { - left_list.add(checkbox[i]); + leftList.add(checkbox[i]); } else { - right_list.add(checkbox[i]); + rightList.add(checkbox[i]); } } - grid_panel.add(left_list); - grid_panel.add(right_list); - grid_panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); - main_panel.add(grid_panel); + gridPanel.add(leftList); + gridPanel.add(rightList); + gridPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + mainPanel.add(gridPanel); // buttons - JButton ok_button = new JButton("Ok"); - JButton cancel_button = new JButton("Cancel"); - button_panel.add(ok_button); - button_panel.add(cancel_button); - main_panel.add(button_panel); + JButton okButton = new JButton("Ok"); + 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, gui_attr, this, checkbox, attrDialog); - ok_button.addActionListener(listener); - cancel_button.addActionListener(listener); + PopupFrameAL listener = new PopupFrameAL(frame, guiAttr, this, checkbox, attrDialog); + okButton.addActionListener(listener); + cancelButton.addActionListener(listener); // hurl all this litter into the frame, pack and show it - frame.getContentPane().add(main_panel); + frame.getContentPane().add(mainPanel); frame.pack(); frame.setLocationRelativeTo(attrDialog); frame.setVisible(true); @@ -296,7 +296,7 @@ JDialog frame; // reference to the popup dialog frame - CAttribDialog.BitmaskAttrib gui_attr; // gui attribute instance + CAttribDialog.BitmaskAttrib guiAttr; // gui attribute instance JCheckBox[] checkbox; // array of checkboxes on the frame @@ -304,19 +304,19 @@ /** * Contructor - * @param new_frame thepopup dialog frame - * @param new_gui_attr gui attribute instance - * @param new_mask this CAttribBitmask instance + * @param newFrame thepopup dialog frame + * @param newGuiAttr gui attribute instance + * @param newMask this CAttribBitmask instance * @param boxarray array of checkboxes in the popup frame - * @param new_attrD attribute dialog frame + * @param newAttrD attribute dialog frame */ - public PopupFrameAL(JDialog new_frame, CAttribDialog.BitmaskAttrib new_gui_attr, - CAttribBitmask new_mask, JCheckBox[] boxarray, CAttribDialog new_attrD) { - frame = new_frame; - gui_attr = new_gui_attr; - bitmask = new_mask; + public PopupFrameAL(JDialog newFrame, CAttribDialog.BitmaskAttrib newGuiAttr, + CAttribBitmask newMask, JCheckBox[] boxarray, CAttribDialog newAttrD) { + frame = newFrame; + guiAttr = newGuiAttr; + bitmask = newMask; checkbox = boxarray; - attrDialog = new_attrD; + attrDialog = newAttrD; } /** @@ -328,17 +328,17 @@ // check if the okay button was pressed if (((JButton) event.getSource()).getText().equalsIgnoreCase("Ok")) { // calculate the new bitmask value: - int new_value = 0; + int newValue = 0; for (int i = 0; i < bitmask.number; i++) { if (checkbox[i].isSelected()) { - new_value |= (int) (Math.pow(2., (double) i)); + newValue |= (int) (Math.pow(2., (double) i)); } } // update the text component in the CAttribDialog with the new values - bitmask.getText(new_value, gui_attr.text); + bitmask.getText(newValue, guiAttr.text); attrDialog.update(attrDialog.getGraphics()); - gui_attr.setValue(new_value); + guiAttr.setValue(newValue); } // nuke the dialog frame Modified: trunk/crossfire/src/cfeditor/CAttribDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-05-29 21:04:07 UTC (rev 79) +++ trunk/crossfire/src/cfeditor/CAttribDialog.java 2006-05-29 21:30:31 UTC (rev 80) @@ -78,11 +78,11 @@ private static int height = 505; - private static int button_bar_height = 40; + private static int buttonBarHeight = 40; - private static int inventory_width = 100; + private static int inventoryWidth = 100; - private static final int divider_size = 3; + private static final int dividerSize = 3; // store width of input-textfields, then JChooseBoxes are set to this width too private static int textFieldWidth = 0; @@ -94,16 +94,16 @@ // the center pane of the dialog can either show the attribute // input-interface or the summary of nonzero attributes - // the 'display_summary' flag indicates what is shown: true->summary, false->interface - private boolean display_summary = false; + // the 'displaySummary' flag indicates what is shown: true->summary, false->interface + private boolean displaySummary = false; - private final CMainControl m_control; // reference to the main control + private final CMainControl mainControl; // reference to the main control private final CFArchTypeList typelist; // reference to the list of CF type-data - private DialogAttrib attr_head; // head of the list of attribute-GUI components + private DialogAttrib attrHead; // head of the list of attribute-GUI components - private DialogAttrib attr_tail; // head of the list of attribute-GUI components + private DialogAttrib attrTail; // head of the list of attribute-GUI components private JComboBox typesel; // selection box for type @@ -111,7 +111,7 @@ private JTextField defarchTF; // textfield for name of default arch - private JLabel image_panel; // panel for object's face (png) + private JLabel imagePanel; // panel for object's face (png) private final ArchObject arch; @@ -119,27 +119,27 @@ private CFArchType type; // reference to the type data - private int type_nr; // the type nr. to be applied to the object + private int typeNr; // the type nr. to be applied to the object // this differs from the ArchObject if the type is undefined - private int list_nr; // the position of this type in the type list + private int listNr; // the position of this type in the type list // buttons: - private JButton help_button; + private JButton helpButton; - private JButton summary_button; + private JButton summaryButton; - private JButton ok_button; + private JButton okButton; - private JButton apply_button; + private JButton applyButton; - private JButton cancel_button; + private JButton cancelButton; // central tabbed pane (the place where all the attribute tabs are) private JTabbedPane tabbedPane; // central pane, this is the parent component of above tabbed pane - private final JScrollPane pane_center; + private final JScrollPane paneCenter; // text pane where the summary is displayed private final JTextPane summaryTP; @@ -149,12 +149,12 @@ /** * Constructor: Creates the GUI layout and * draws the dialog window. - * @param at_list the list of CF type-data + * @param atList the list of CF type-data * @param aobj the ArchObject to be displayed by this dialog * @param defaobj the default ArchObject of 'arch' * @param mcntrl main control */ - CAttribDialog(CFArchTypeList at_list, ArchObject aobj, ArchObject defaobj, + CAttribDialog(CFArchTypeList atList, ArchObject aobj, ArchObject defaobj, CMainControl mcntrl) { super(mcntrl.getMainView(), "CF Attribute Dialog", false); @@ -166,19 +166,19 @@ } }); - boolean type_valid = false; // true if the type is valid - attr_head = null; - list_nr = 0; + boolean typeValid = false; // true if the type is valid + attrHead = null; + listNr = 0; - m_control = mcntrl; // reference to the main control - typelist = at_list; // refernce to the typelist + mainControl = mcntrl; // reference to the main control + typelist = atList; // refernce to the typelist CAttribDialog.setDefaultBounds(); // set width/height etc // refernce to the ArchObject if (aobj.isMulti() && aobj.getMapMultiHead() != null) { arch = aobj.getMapMultiHead(); - defarch = m_control.getArchObjectStack().getArch(arch.getNodeNr()); + defarch = mainControl.getArchObjectStack().getArch(arch.getNodeNr()); } else { arch = aobj; defarch = defaobj; // refernce to the default ArchObject @@ -186,22 +186,22 @@ /* set frame icon if (arch.getFaceNr() >= 0) { - setIconImage(m_control.getArchObjectStack().getFace(arch.getFaceNr()).getImage()); + setIconImage(mainControl.getArchObjectStack().getFace(arch.getFaceNr()).getImage()); } */ // check if the type of the object is present in the definitions CFArchType tmp = typelist.getHead().getNext(); - //type_nr = 0; // for invalid types, we take "type 0" + //typeNr = 0; // for invalid types, we take "type 0" type = tmp; - boolean type_found = false; - for (int i = 0; tmp != null && !type_found; tmp = tmp.getNext(), i++) { + boolean typeFound = false; + for (int i = 0; tmp != null && !typeFound; tmp = tmp.getNext(), i++) { if (tmp.getTypeNr() == arch.getArchTypNr()) { if (tmp.getTypeAttr() == null) { // no type-attributes, so we only compared type-numbers - type_found = true; + typeFound = true; } else { // check if all the type-attributes match - int args_num = (int) (tmp.getTypeAttr().length / 2.); + int argsNum = (int) (tmp.getTypeAttr().length / 2.); boolean match = true; String archvalue; @@ -209,7 +209,7 @@ log.debug("# type: " + tmp.getTypeName()); } - for (int t = 0; t < args_num * 2; t += 2) { + for (int t = 0; t < argsNum * 2; t += 2) { archvalue = arch.getAttributeString(tmp.getTypeAttr()[t], defarch); if (log.isDebugEnabled()) { @@ -231,59 +231,59 @@ // we've got a match after all if (match) { - type_found = true; + typeFound = true; } } // we found our type, now save all infos we need - if (type_found) { - type_valid = true; // this is an existing type + if (typeFound) { + typeValid = true; // this is an existing type type = tmp; // save reference to the type-data - type_nr = arch.getArchTypNr(); // CF type number - list_nr = i; // save position in list + typeNr = arch.getArchTypNr(); // CF type number + listNr = i; // save position in list } } } // get the type data - //type = typelist.getType(type_nr); + //type = typelist.getType(typeNr); JPanel layout = new JPanel(new BorderLayout()); // face, name & type // first split top-left and -right - JScrollPane pane_left = build_header(); - JScrollPane pane_right = build_inv(); + JScrollPane paneLeft = buildHeader(); + JScrollPane paneRight = buildInv(); //Create a split pane with the two scroll panes in it. JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, - pane_left, pane_right); + paneLeft, paneRight); splitPane.setOneTouchExpandable(false); - splitPane.setDividerLocation(width - inventory_width - 2 * divider_size); - splitPane.setDividerSize(divider_size + 1); + splitPane.setDividerLocation(width - inventoryWidth - 2 * dividerSize); + splitPane.setDividerSize(dividerSize + 1); //Provide minimum sizes for the two components in the split pane - pane_left.setMinimumSize(new Dimension(width - inventory_width - 2 * divider_size, 120)); - pane_right.setMinimumSize(new Dimension(inventory_width, 120)); + paneLeft.setMinimumSize(new Dimension(width - inventoryWidth - 2 * dividerSize, 120)); + paneRight.setMinimumSize(new Dimension(inventoryWidth, 120)); // Now split horizontally - //JScrollPane pane_center = build_attr(); - pane_center = build_attr(); + //JScrollPane paneCenter = buildAttr(); + paneCenter = buildAttr(); //Create a split pane with the two scroll panes in it. JSplitPane splitPane2 = new JSplitPane(JSplitPane.VERTICAL_SPLIT, - splitPane, pane_center); + splitPane, paneCenter); splitPane2.setOneTouchExpandable(false); splitPane2.setDividerLocation(126); - splitPane2.setDividerSize(divider_size); + splitPane2.setDividerSize(dividerSize); // split horizontally again - JScrollPane pane_buttons = build_buttons(); + JScrollPane paneButtons = buildButtons(); JSplitPane splitPane3 = new JSplitPane(JSplitPane.VERTICAL_SPLIT, - splitPane2, pane_buttons); + splitPane2, paneButtons); splitPane3.setOneTouchExpandable(false); - //splitPane3.setDividerLocation(height-button_bar_height-34); - splitPane3.setDividerLocation((int) (this.getHeight() - pane_buttons.getMinimumSize().height - divider_size)); - splitPane3.setDividerSize(divider_size); + //splitPane3.setDividerLocation(height-buttonBarHeight-34); + splitPane3.setDividerLocation((int) (this.getHeight() - paneButtons.getMinimumSize().height - dividerSize)); + splitPane3.setDividerSize(dividerSize); splitPane3.setResizeWeight(1); getContentPane().add(splitPane3); @@ -297,8 +297,8 @@ this.setResizable(true); // now draw the whole thing: - setBounds(m_control.getMainView().getX() + (m_control.getMainView().getWidth() - width) / 2, - m_control.getMainView().getY() + (m_control.getMainView().getHeight() - height) / 2 - 20, + setBounds(mainControl.getMainView().getX() + (mainControl.getMainView().getWidth() - width) / 2, + mainControl.getMainView().getY() + (mainControl.getMainView().getHeight() - height) / 2 - 20, width, height); setVisible(true); } @@ -323,15 +323,15 @@ // this is for fonts <= 13 (includes default font) width = 395; height = 505 + 30; - button_bar_height = 40; - inventory_width = 95; + buttonBarHeight = 40; + inventoryWidth = 95; chooseBoxHeight = 23; } else { // this is for the somewhat bigger fonts (>= 14) width = 395 + 50; height = 505 + 100; - button_bar_height = 40 + 5; - inventory_width = 120; + buttonBarHeight = 40 + 5; + inventoryWidth = 120; chooseBoxHeight = 25; } } @@ -341,7 +341,7 @@ * @param boxWidth width of the JChooseBox in pixels * @return a <code>JPanel</code> with the combo box in it */ - private JPanel build_TypesBox(int boxWidth) { + 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 @@ -353,7 +353,7 @@ } // the active type appears selected in the box - selection = list_nr; + selection = listNr; lineLayout.add(new JLabel("Type: ")); // create label @@ -378,7 +378,7 @@ * @param attr spell-attribute * @return the completed <code>JComboBox</code> */ - private JComboBox build_SpellBox(CFArchAttrib attr) { + private JComboBox buildSpellBox(CFArchAttrib attr) { int active = 0; // active selection in the combo box // first parse the spell-number value from arch @@ -420,7 +420,7 @@ * @param listData Vector with list items and corresponding values * @return the completed <code>JComboBox</code> */ - private JComboBox build_ArrayBox(CFArchAttrib attr, Vector listData) { + private JComboBox buildArrayBox(CFArchAttrib attr, Vector listData) { // build the array of list-items String []array = new String[(int) (listData.size() / 2.)]; boolean hasSelection = false; @@ -453,25 +453,25 @@ /** * Construct the Panel for bitmask values (this is used for T_BITMASK) * @param attr spell-attribute - * @param gui_attr the gui-instance of the bitmask attribute + * @param guiAttr the gui-instance of the bitmask attribute * @param bitmask the bitmask data for this attribute - * @param main_panel the panel to put everything in + * @param mainPanel the panel to put everything in */ - private void build_Bitmask(CFArchAttrib attr, BitmaskAttrib gui_attr, CAttribBitmask bitmask, JPanel main_panel) { + private void buildBitmask(CFArchAttrib attr, BitmaskAttrib guiAttr, CAttribBitmask bitmask, JPanel mainPanel) { // initialize bitmask value - gui_attr.setValue(arch.getAttributeValue(attr.getNameOld(), defarch)); - gui_attr.bitmask = bitmask; + guiAttr.setValue(arch.getAttributeValue(attr.getNameOld(), defarch)); + guiAttr.bitmask = bitmask; // add button JButton button = new JButton(attr.getNameNew() + ":"); button.setAlignmentX(JButton.CENTER_ALIGNMENT); button.setMargin(new Insets(0, 3, 0, 3)); - button.addActionListener(new MaskChangeAL(gui_attr, this)); - main_panel.add(button); + button.addActionListener(new MaskChangeAL(guiAttr, this)); + mainPanel.add(button); // add the text field - gui_attr.text = bitmask.getText(gui_attr.getValue(), null); - main_panel.add(gui_attr.text); + guiAttr.text = bitmask.getText(guiAttr.getValue(), null); + mainPanel.add(guiAttr.text); } /** @@ -479,15 +479,15 @@ * containing name, type, defarch name and face. * @return a <code>JScrollPane</code> with the upper left part of the dialog window */ - private JScrollPane build_header() { + private JScrollPane buildHeader() { JPanel header = new JPanel(new FlowLayout(FlowLayout.RIGHT)); // the final thing, in a panel JPanel layout1 = new JPanel(new BorderLayout()); // face, name & type - image_panel = new JLabel(m_control.getArchObjectStack().getFace(arch.getFaceNr())); - image_panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); + imagePanel = new JLabel(mainControl.getArchObjectStack().getFace(arch.getFaceNr())); + imagePanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10)); - layout1.add(image_panel, BorderLayout.WEST); + layout1.add(imagePanel, BorderLayout.WEST); JPanel layout2 = new JPanel(new GridLayout(2, 1)); @@ -504,10 +504,10 @@ layout3.add(nameTF); layout2.add(layout3); // name field - layout2.add(build_TypesBox(nameTF.getPreferredSize().width)); // build type-selection box + layout2.add(buildTypesBox(nameTF.getPreferredSize().width)); // build type-selection box layout2.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 4)); - //layout1.add(image_panel, BorderLayout.WEST); + //layout1.add(imagePanel, BorderLayout.WEST); layout1.add(layout2, BorderLayout.EAST); header.add(layout1); @@ -521,7 +521,7 @@ JPanel layout5 = new JPanel(); layout5.add(layout4); header.add(layout5); - header.setPreferredSize(new Dimension(width - inventory_width - 2 * divider_size, 70)); + header.setPreferredSize(new Dimension(width - inventoryWidth - 2 * dividerSize, 70)); // finally put the result into a (non-scrollable) // scrollpane to get the size right @@ -538,7 +538,7 @@ * containing the object's inventory. * @return a <code>JScrollPane</code> with the upper right part of the dialog window */ - private JScrollPane build_inv() { + private JScrollPane buildInv() { JPanel inv = new JPanel(); // the final thing, in a panel inv.add(new JLabel("Inventory:")); // create label @@ -558,12 +558,12 @@ * with the central part of the dialog window. * All further calls rebuild the existing tabbedpane and return null. */ - private JScrollPane build_attr() { - boolean initial_call = false; + private JScrollPane buildAttr() { + boolean initialCall = false; if (tabbedPane == null) { tabbedPane = new JTabbedPane(); - initial_call = true; + initialCall = true; } for (int i = 0; i < type.getSectionNum(); i++) { @@ -576,14 +576,14 @@ // set selected tab tabbedPane.setSelectedIndex(0); - if (initial_call) { + if (initialCall) { // if this is the first time call: // create a scrollpane and put the tabbedpane inside JScrollPane scrollPane = new JScrollPane(tabbedPane); scrollPane.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER); - scrollPane.setSize(width, height - 70 - button_bar_height); + scrollPane.setSize(width, height - 70 - buttonBarHeight); return scrollPane; } @@ -594,26 +594,26 @@ /** * This method creates an attribute panel for one section * of attributes. If the section is empty, null is returned. - * @param sec_id the identifier of the section + * @param secId the identifier of the section * @return a <code>Component</code> containing the attribute panel */ - private Component makeAttribPanel(int sec_id) { + private Component makeAttribPanel(int secId) { int number = 0; // number of attributes in this section - boolean is_text = false; // true if this section contains a textfield - boolean has_bitmask = false; // true if this section contains a bitmask attribute - Component full_panel = null; // return object: the full attrib. panel + boolean isText = false; // true if this section contains a textfield + boolean hasBitmask = false; // true if this section contains a bitmask attribute + Component fullPanel = null; // return object: the full attrib. panel // first we check how many attribs this section has for (int i = 0; type.getAttr().length > i; i++) { - if (type.getAttr()[i].getSecId() == sec_id) { + if (type.getAttr()[i].getSecId() == secId) { // count number of attributes if (type.getAttr()[i].getDataType() != CFArchAttrib.T_FIXED) { number++; } // check for bitmask attributes - if (!has_bitmask && + if (!hasBitmask && (type.getAttr()[i].getDataType() == CFArchAttrib.T_BITMASK)) { - has_bitmask = true; + hasBitmask = true; } } } @@ -625,7 +625,7 @@ // 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(); - if (has_bitmask) { + if (hasBitmask) { panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); } else { panel.setLayout(new GridLayout(number, 1)); @@ -633,18 +633,18 @@ // now add the entrys, line by line for (int i = 0; type.getAttr().length > i; i++) { - if (type.getAttr()[i].getSecId() == sec_id) { + if (type.getAttr()[i].getSecId() == secId) { JPanel panel2 = null; // tmp. Panel for the layout // now create the attribute-GUI-instance - DialogAttrib new_attr = null; - int d_type = type.getAttr()[i].getDataType(); // data type of the attribute + DialogAttrib newAttr = null; + int dType = type.getAttr()[i].getDataType(); // data type of the attribute - if (d_type == CFArchAttrib.T_TEXT) { + if (dType == CFArchAttrib.T_TEXT) { // special case: we've got a text section - is_text = true; // text section (need special embedding without additional scrollbars) - new_attr = new TextAttrib(); - new_attr.ref = type.getAttr()[i]; + isText = true; // text section (need special embedding without additional scrollbars) + newAttr = new TextAttrib(); + newAttr.ref = type.getAttr()[i]; JTextArea input; // note that the textarea is initialized with rows/columns: 1, 1 @@ -662,8 +662,8 @@ input.setBorder(BorderFactory.createEmptyBorder(3, 7, 0, 0)); - new_attr.help_button = new JButton("?"); - new_attr.help_button.setMargin(new Insets(0, 3, 0, 3)); + newAttr.helpButton = new JButton("?"); + newAttr.helpButton.setMargin(new Insets(0, 3, 0, 3)); JScrollPane scrollPane = new JScrollPane(input); scrollPane.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); @@ -672,54 +672,54 @@ //Create a split pane with the two scroll panes in it. JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, - scrollPane, new_attr.help_button); + scrollPane, newAttr.helpButton); splitPane.setDividerSize(0); splitPane.setResizeWeight(1); splitPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); - ((TextAttrib) new_attr).input = input; + ((TextAttrib) newAttr).input = input; - full_panel = splitPane; // return the splitpane + fullPanel = splitPane; // return the splitpane } - if (d_type == CFArchAttrib.T_BOOL || - d_type == CFArchAttrib.T_BOOL_SPEC) { + if (dType == CFArchAttrib.T_BOOL || + 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)); - new_attr = new BoolAttrib(); + newAttr = new BoolAttrib(); JCheckBox input; - if (d_type == CFArchAttrib.T_BOOL) { + 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 true_val = type.getAttr()[i].getMisc()[0]; + String trueVal = type.getAttr()[i].getMisc()[0]; - if (true_val.equals("0")) { - String attr_string = arch.getAttributeString(type.getAttr()[i].getNameOld(), defarch); + if (trueVal.equals("0")) { + String attrString = arch.getAttributeString(type.getAttr()[i].getNameOld(), defarch); input = new JCheckBox(" " + type.getAttr()[i].getNameNew(), - (attr_string.length() == 0 || attr_string.equals("0"))); + (attrString.length() == 0 || attrString.equals("0"))); } else { input = new JCheckBox(" " + type.getAttr()[i].getNameNew(), (arch.getAttributeString( - type.getAttr()[i].getNameOld(), defarch).equals(true_val))); + type.getAttr()[i].getNameOld(), defarch).equals(trueVal))); } } - new_attr.help_button = new JButton("?"); - new_attr.ref = type.getAttr()[i]; - new_attr.help_button.setMargin(new Insets(0, 3, 0, 3)); + newAttr.helpButton = new JButton("?"); + newAttr.ref = type.getAttr()[i]; + newAttr.helpButton.setMargin(new Insets(0, 3, 0, 3)); panel3.add(Box.createRigidArea(new Dimension(3, 20))); - panel3.add(new_attr.help_button); + panel3.add(newAttr.helpButton); // create the offset from help-button and checkbox: panel3.add(Box.createHorizontalStrut((int) (width / 3.3))); panel3.add(input); // add checkbox panel2.add(panel3, BorderLayout.WEST); - ((BoolAttrib) new_attr).input = input; - } else if (d_type == CFArchAttrib.T_INT) { + ((BoolAttrib) newAttr).input = input; + } 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)); @@ -729,8 +729,8 @@ label.setForeground(IGUIConstants.INT_COLOR); panel3.add(label); // add label - new_attr = new IntAttrib(); - new_attr.ref = type.getAttr()[i]; + newAttr = new IntAttrib(); + newAttr.ref = type.getAttr()[i]; JTextField input; // parse value from arch @@ -748,17 +748,17 @@ textFieldWidth = input.getPreferredSize().width; } - new_attr.help_button = new JButton("?"); - new_attr.help_button.setMargin(new Insets(0, 3, 0, 3)); + newAttr.helpButton = new JButton("?"); + newAttr.helpButton.setMargin(new Insets(0, 3, 0, 3)); panel4.add(Box.createRigidArea(new Dimension(3, 20))); - panel4.add(new_attr.help_button); + panel4.add(newAttr.helpButton); panel3.setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 0)); panel2.add(panel3, BorderLayout.EAST); panel2.add(panel4, BorderLayout.WEST); - ((IntAttrib) new_attr).input = input; - } else if (d_type == CFArchAttrib.T_STRING || - d_type == CFArchAttrib.T_FLOAT) { + ((IntAttrib) newAttr).input = input; + } else if (dType == CFArchAttrib.T_STRING ... [truncated message content] |
From: <chr...@us...> - 2006-05-29 21:04:20
|
Revision: 79 Author: christianhujer Date: 2006-05-29 14:04:07 -0700 (Mon, 29 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=79&view=rev Log Message: ----------- Added documentation, cleaned code. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/StackLayout.java Modified: trunk/crossfire/src/cfeditor/gui/StackLayout.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/StackLayout.java 2006-05-29 20:51:11 UTC (rev 78) +++ trunk/crossfire/src/cfeditor/gui/StackLayout.java 2006-05-29 21:04:07 UTC (rev 79) @@ -34,57 +34,67 @@ * A layoutManager which stacks components one on top of the other, * regardless of their size. */ - public class StackLayout implements LayoutManager { + /** The vertical gap between components in pixels. */ private final int vgap; - public StackLayout(int vgap) { + /** + * Create a StackLayout. + * @param vgap vertical gap between components in pixels + */ + public StackLayout(final int vgap) { this.vgap = vgap; } - public void addLayoutComponent(String name, Component comp) { + /** {@inheritDoc} */ + public void addLayoutComponent(final String name, final Component comp) { } - public Dimension preferredLayoutSize(Container parent) { - Insets insets = parent.getInsets(); - int ncomponents = parent.getComponentCount(); + /** {@inheritDoc} */ + public Dimension preferredLayoutSize(final Container parent) { + final Insets insets = parent.getInsets(); + final int ncomponents = parent.getComponentCount(); int w = 0; int h = 0; for (int i = 0; i < ncomponents; i++) { - Component comp = parent.getComponent(i); - Dimension d = comp.getPreferredSize(); + final Component comp = parent.getComponent(i); + final Dimension d = comp.getPreferredSize(); if (w < d.width) { w = d.width; } h += d.height; if (i != 0) { - h += this.vgap; + h += vgap; } } return new Dimension(insets.left + insets.right + w, insets.top + insets.bottom + h); } - public void layoutContainer(Container parent) { - Insets insets = parent.getInsets(); - int x = insets.left; + /** {@inheritDoc} */ + public void layoutContainer(final Container parent) { + final Insets insets = parent.getInsets(); + final int x = insets.left; int y = insets.top; - int w = this.preferredLayoutSize(parent).width; + final int w = preferredLayoutSize(parent).width; - int ncomponents = parent.getComponentCount(); + final int ncomponents = parent.getComponentCount(); for (int i = 0; i < ncomponents; ++i) { - Component comp = parent.getComponent(i); - Dimension d = comp.getPreferredSize(); + final Component comp = parent.getComponent(i); + final Dimension d = comp.getPreferredSize(); comp.setBounds(x, y, w, d.height); - y += (d.height + this.vgap); + y += d.height + vgap; } } - public Dimension minimumLayoutSize(Container parent) { + /** {@inheritDoc} */ + public Dimension minimumLayoutSize(final Container parent) { return preferredLayoutSize(parent); } - public void removeLayoutComponent(Component comp) { + /** {@inheritDoc} */ + public void removeLayoutComponent(final Component comp) { } -} + +} // class StackLayout This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-05-29 20:51:36
|
Revision: 78 Author: christianhujer Date: 2006-05-29 13:51:11 -0700 (Mon, 29 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=78&view=rev Log Message: ----------- Refactored path method to occur only once. Modified Paths: -------------- trunk/daimonin/src/daieditor/PathManager.java trunk/daimonin/src/daieditor/gui/prefs/AppPrefs.java trunk/daimonin/src/daieditor/gui/prefs/ResPrefs.java trunk/daimonin/src/test/daieditor/gui/prefs/AppPrefsTest.java trunk/daimonin/src/test/daieditor/gui/prefs/ResPrefsTest.java Added Paths: ----------- trunk/daimonin/src/test/daieditor/PathManagerTest.java Modified: trunk/daimonin/src/daieditor/PathManager.java =================================================================== --- trunk/daimonin/src/daieditor/PathManager.java 2006-05-29 20:48:42 UTC (rev 77) +++ trunk/daimonin/src/daieditor/PathManager.java 2006-05-29 20:51:11 UTC (rev 78) @@ -163,7 +163,8 @@ private static int findDifference(final String s1, final String s2) { int s1slash = -1; int s2slash = -1; - char c1 = (char) 0, c2 = (char) 0; // initialize for equality for first loop cycle + char c1 = (char) 0; // initialize for equality for first loop cycle + char c2 = (char) 0; for (int index = 0, l1 = s1.length(), l2 = s2.length(); index < l1 && index < l2 && c1 == c2; index++) { c1 = s1.charAt(index); c2 = s2.charAt(index); @@ -193,4 +194,16 @@ return occurrences; } + /** + * Create a reasonable path. + * @param str String to create path from + * @return path + */ + public static String path(final String str) { + String path = str.replaceAll("\\\\", "/"); + path = path.endsWith("/") ? path.substring(0, path.length() - 1) : path; + path = path.startsWith("file:") ? path.substring("file:".length()) : path; + return path; + } + } // class PathManager Modified: trunk/daimonin/src/daieditor/gui/prefs/AppPrefs.java =================================================================== --- trunk/daimonin/src/daieditor/gui/prefs/AppPrefs.java 2006-05-29 20:48:42 UTC (rev 77) +++ trunk/daimonin/src/daieditor/gui/prefs/AppPrefs.java 2006-05-29 20:51:11 UTC (rev 78) @@ -21,7 +21,6 @@ package daieditor.gui.prefs; -import static net.sf.japi.swing.ActionFactory.getFactory; import daieditor.CMainControl; import static daieditor.CMainControl.PREFS_APP_CLIENT; import static daieditor.CMainControl.PREFS_APP_CLIENT_DEFAULT; @@ -30,6 +29,7 @@ import static daieditor.CMainControl.PREFS_APP_SERVER; import static daieditor.CMainControl.PREFS_APP_SERVER_DEFAULT; import static daieditor.IGUIConstants.DIALOG_BORDER; +import daieditor.PathManager; import java.awt.Component; import java.awt.Container; import java.awt.FlowLayout; @@ -46,6 +46,7 @@ import javax.swing.border.CompoundBorder; import javax.swing.border.TitledBorder; import net.sf.japi.swing.ActionFactory; +import static net.sf.japi.swing.ActionFactory.getFactory; import net.sf.japi.swing.JFileChooserButton; import net.sf.japi.swing.prefs.AbstractPrefs; @@ -91,9 +92,9 @@ /** {@inheritDoc} */ public void apply() { - PREFS.put(PREFS_APP_SERVER, path(serverField.getText())); - PREFS.put(PREFS_APP_CLIENT, path(clientField.getText())); - PREFS.put(PREFS_APP_EDITOR, path(editorField.getText())); + PREFS.put(PREFS_APP_SERVER, PathManager.path(serverField.getText())); + PREFS.put(PREFS_APP_CLIENT, PathManager.path(clientField.getText())); + PREFS.put(PREFS_APP_EDITOR, PathManager.path(editorField.getText())); } /** {@inheritDoc} */ @@ -152,14 +153,4 @@ return textField; } - /** - * Create a reasonable path. - * @param str String to create path from - * @return path - */ - public static String path(final String str) { - final String path = str.replaceAll("\\\\", "/"); - return path.endsWith("/") ? path.substring(0, path.length() - 1) : path; - } - } // class AppPrefs Modified: trunk/daimonin/src/daieditor/gui/prefs/ResPrefs.java =================================================================== --- trunk/daimonin/src/daieditor/gui/prefs/ResPrefs.java 2006-05-29 20:48:42 UTC (rev 77) +++ trunk/daimonin/src/daieditor/gui/prefs/ResPrefs.java 2006-05-29 20:51:11 UTC (rev 78) @@ -23,6 +23,7 @@ import daieditor.CMainControl; import static daieditor.IGUIConstants.DIALOG_BORDER; +import daieditor.PathManager; import daieditor.ResourceFileManager; import java.awt.Component; import java.awt.Container; @@ -102,10 +103,10 @@ /** {@inheritDoc} */ public void apply() { - PREFS.put(ResourceFileManager.ARCH_DIR_KEY, path(archField.getText())); - PREFS.put(ResourceFileManager.MAP_DIR_KEY, path(mapField.getText())); - PREFS.put(ResourceFileManager.SCRIPT_DIR_KEY, path(scriptField.getText())); - PREFS.put(ResourceFileManager.MEDIA_DIR_KEY, path(mediaField.getText())); + PREFS.put(ResourceFileManager.ARCH_DIR_KEY, PathManager.path(archField.getText())); + PREFS.put(ResourceFileManager.MAP_DIR_KEY, PathManager.path(mapField.getText())); + PREFS.put(ResourceFileManager.SCRIPT_DIR_KEY, PathManager.path(scriptField.getText())); + PREFS.put(ResourceFileManager.MEDIA_DIR_KEY, PathManager.path(mediaField.getText())); PREFS.putBoolean(CMainControl.LOAD_ARCH_COLL, loadArches.isSelected()); mainControl.initDirs(); ACTION_FACTORY.showOnetimeMessageDialog(this, WARNING_MESSAGE, "optionsRestart"); @@ -206,18 +207,6 @@ return fileField; } - /** - * Create a reasonable path. - * @param str String to create path from - * @return path - */ - public static String path(final String str) { - String path = str.replaceAll("\\\\", "/"); - path = path.endsWith("/") ? path.substring(0, path.length() - 1) : path; - path = path.startsWith("file:") ? path.substring("file:".length()) : path; - return path; - } - /** Class for selecting a file. */ private static class FileField extends JComponent { Added: trunk/daimonin/src/test/daieditor/PathManagerTest.java =================================================================== --- trunk/daimonin/src/test/daieditor/PathManagerTest.java (rev 0) +++ trunk/daimonin/src/test/daieditor/PathManagerTest.java 2006-05-29 20:51:11 UTC (rev 78) @@ -0,0 +1,17 @@ +package test.daieditor; + +import daieditor.PathManager; +import junit.framework.TestCase; + +/** + * Test for {@link PathManager}. + * @author <a href="mailto:ch...@it...">Christian Hujer</a> + */ +public class PathManagerTest extends TestCase { + + /** Test case for {@link PathManager#path(String)}. */ + public void testPath() { + assertEquals("Expecting trailing slash from directories being removed.", "/foo", PathManager.path("/foo/")); + } + +} // class PathManagerTest \ No newline at end of file Property changes on: trunk/daimonin/src/test/daieditor/PathManagerTest.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Modified: trunk/daimonin/src/test/daieditor/gui/prefs/AppPrefsTest.java =================================================================== --- trunk/daimonin/src/test/daieditor/gui/prefs/AppPrefsTest.java 2006-05-29 20:48:42 UTC (rev 77) +++ trunk/daimonin/src/test/daieditor/gui/prefs/AppPrefsTest.java 2006-05-29 20:51:11 UTC (rev 78) @@ -9,9 +9,4 @@ */ public class AppPrefsTest extends TestCase { - /** Test case for {@link AppPrefs#path(String)}. */ - public void testPath() { - assertEquals("Expecting trailing slash from directories being removed.", "/foo", AppPrefs.path("/foo/")); - } - } // class AppPrefsTest \ No newline at end of file Modified: trunk/daimonin/src/test/daieditor/gui/prefs/ResPrefsTest.java =================================================================== --- trunk/daimonin/src/test/daieditor/gui/prefs/ResPrefsTest.java 2006-05-29 20:48:42 UTC (rev 77) +++ trunk/daimonin/src/test/daieditor/gui/prefs/ResPrefsTest.java 2006-05-29 20:51:11 UTC (rev 78) @@ -9,9 +9,4 @@ */ public class ResPrefsTest extends TestCase { - /** Test case for {@link ResPrefs#path(String)}. */ - public void testPath() { - assertEquals("Expecting trailing slash from directories being removed.", "/foo", ResPrefs.path("/foo/")); - } - } // class ResPrefsTest \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-05-29 20:48:59
|
Revision: 77 Author: akirschbaum Date: 2006-05-29 13:48:42 -0700 (Mon, 29 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=77&view=rev Log Message: ----------- Add final/static modifier. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CArchPanel.java Modified: trunk/crossfire/src/cfeditor/CArchPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/CArchPanel.java 2006-05-29 20:35:30 UTC (rev 76) +++ trunk/crossfire/src/cfeditor/CArchPanel.java 2006-05-29 20:48:42 UTC (rev 77) @@ -41,7 +41,7 @@ * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ -public class CArchPanel extends JPanel { +public final class CArchPanel extends JPanel { private static final String ARCHPANEL_LOCATION_KEY = "MainWindowArchPanel.dividerLocation"; @@ -69,7 +69,7 @@ private static final long serialVersionUID = 6634110300452920361L; /* Build Panel */ - public CArchPanel(CMainControl control) { + public CArchPanel(final CMainControl control) { m_control = control; panelNodeStart = null; panelNodeLast = null; @@ -104,13 +104,13 @@ // we must set the list of the selected list depend on combo selection m_tabDesktop.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent e) { - JTabbedPane tp = (JTabbedPane) e.getSource(); + public void stateChanged(final ChangeEvent e) { + final JTabbedPane tp = (JTabbedPane) e.getSource(); // This is weird: we need to compare against SelectedComponent, // and *not* SelectedIndex. The index seemed to get all messed up during // load proccess, leading to odd behaviour and sometimes wrecked panes. - Component sel = tp.getSelectedComponent(); + final Component sel = tp.getSelectedComponent(); PanelNode node = panelNodeStart; while (node != null && node.data.getPanel() != sel) { node = node.next; @@ -143,15 +143,15 @@ return m_selectedPanel.getArchListObject(); } - public void showArchPanelQuickObject(ArchObject arch) { + public void showArchPanelQuickObject(final ArchObject arch) { archQuickPanel.showArchPanelQuickObject(arch); } - public int addArchPanelCombo(String name) { + public int addArchPanelCombo(final String name) { return m_selectedPanel.addArchPanelCombo(name); } - public void addArchPanelArch(int archnr, int index) { + public void addArchPanelArch(final int archnr, final int index) { m_selectedPanel.addArchPanelArch(archnr, index); } @@ -170,8 +170,8 @@ * Add a new arch panel. This happens during load proccess. * @param name */ - public void addPanel(String name) { - PanelNode newnode = new PanelNode(new CArchPanelPan(this, m_control), name); + public void addPanel(final String name) { + final PanelNode newnode = new PanelNode(new CArchPanelPan(this, m_control), name); // chain it to our list of panels if (panelNodeStart == null) { @@ -200,7 +200,7 @@ * setting and make sure the arch list is properly drawn. */ public void finishBuildProccess() { - Component sel = m_tabDesktop.getSelectedComponent(); + final Component sel = m_tabDesktop.getSelectedComponent(); PanelNode node = panelNodeStart; while (node != null && node.data.getPanel() != sel) { node = node.next; @@ -213,7 +213,7 @@ } void appExitNotify() { - CSettings settings = CSettings.getInstance(IGUIConstants.APP_NAME); + final CSettings settings = CSettings.getInstance(IGUIConstants.APP_NAME); settings.setProperty(ARCHPANEL_LOCATION_KEY, "" + m_splitPane.getDividerLocation()); } @@ -221,7 +221,7 @@ return selectedArch; } - public void setPanelArch(int arch) { + public void setPanelArch(final int arch) { selectedArch = arch; } @@ -235,15 +235,15 @@ refresh(); } - public class PanelNode { + public static final class PanelNode { - public CArchPanelPan data; + public final CArchPanelPan data; public PanelNode next; // next node - String title; // title of this PanelNode + final String title; // title of this PanelNode - public PanelNode(CArchPanelPan data, String title) { + public PanelNode(final CArchPanelPan data, final String title) { this.data = data; this.title = title; this.next = null; @@ -259,9 +259,7 @@ private static final long serialVersionUID = -2537906454141191712L; - public CSplitPane(int newOrientation, - Component newLeftComponent, - Component newRightComponent) { + public CSplitPane(final int newOrientation, final Component newLeftComponent, final Component newRightComponent) { super(newOrientation, newLeftComponent, newRightComponent); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-05-29 20:35:57
|
Revision: 76 Author: akirschbaum Date: 2006-05-29 13:35:30 -0700 (Mon, 29 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=76&view=rev Log Message: ----------- Rename variable names. Modified Paths: -------------- trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditControl.java trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditMenuBar.java trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditView.java trunk/crossfire/src/cfeditor/textedit/textarea/InputHandler.java Modified: trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditControl.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditControl.java 2006-05-29 20:17:22 UTC (rev 75) +++ trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditControl.java 2006-05-29 20:35:30 UTC (rev 76) @@ -57,16 +57,16 @@ // default directory to store new scripts in. also used as starting dir for 'open' command private static String defaultScriptDir; - private final CMainControl m_control; // cfeditor main control (is null in stand-alone configuration!) + private final CMainControl mainControl; // cfeditor main control (is null in stand-alone configuration!) private final ScriptEditView view; // view (window with textareas) private final Vector opened; // open tabs, contains absolute filenames (or "<>") in order left to right /** Constructor is private, instance is created by calling 'init()' */ - private ScriptEditControl(final CMainControl m_control) { + private ScriptEditControl(final CMainControl mainControl) { opened = new Vector(); // start with empty vector - this.m_control = m_control; + this.mainControl = mainControl; view = new ScriptEditView(this); // initialize window } @@ -110,7 +110,7 @@ * configuration!) */ final CMainControl getMainControl() { - return m_control; + return mainControl; } /** Notifies that the application is about to exit. */ @@ -139,11 +139,11 @@ * Open a new empty Python script document. */ public final void openScriptFile(final String pathname) { - final File f = new File(pathname); + final File file = new File(pathname); - if (f.exists() && f.isFile()) { - opened.addElement(f.getAbsolutePath()); - view.addTab(f.getName(), f); + if (file.exists() && file.isFile()) { + opened.addElement(file.getAbsolutePath()); + view.addTab(file.getName(), file); } else { if (log.isInfoEnabled()) { log.info("Error in ScriptEditControl.openScriptFile():"); @@ -239,11 +239,11 @@ // if file already exists, select it if (activePath != null) { - final File f = new File(activePath); + final File file = new File(activePath); - if (f != null && f.getParentFile().exists() && f.getParentFile().isDirectory()) { - fileChooser.setCurrentDirectory(f.getParentFile()); - fileChooser.setSelectedFile(f); // select this name + if (file != null && file.getParentFile().exists() && file.getParentFile().isDirectory()) { + fileChooser.setCurrentDirectory(file.getParentFile()); + fileChooser.setSelectedFile(file); // select this name } } else { // set default folder for new scripts @@ -288,8 +288,8 @@ */ public final void saveActiveTab() { if (getActiveFilePath() != null) { - final File f = new File(getActiveFilePath()); // get active path - saveTextToFile(f, getActiveTextArea().getText()); // write text to file + final File file = new File(getActiveFilePath()); // get active path + saveTextToFile(file, getActiveTextArea().getText()); // write text to file } else { System.err.println("ScriptEditControl.saveActiveTab(): Cannot save file without name!"); // Path is missing? This shouldn't happen, but let's do a saveAs instead... @@ -299,31 +299,31 @@ /** * Write the given text into the specified file. - * @param f text gets saved into this file + * @param file text gets saved into this file * @param text text to be saved */ - public final void saveTextToFile(final File f, String text) { + public final void saveTextToFile(final File file, String text) { if (text == null) { text = ""; } - if (f != null) { + if (file != null) { try { - if (!f.exists()) { - if (!f.createNewFile()) { + if (!file.exists()) { + if (!file.createNewFile()) { // failed to create new file - System.err.println("Couldn't create file '" + f.getName() + "'!"); + System.err.println("Couldn't create file '" + file.getName() + "'!"); } } - final FileWriter fwrite = new FileWriter(f); + final FileWriter fwrite = new FileWriter(file); fwrite.write(text); fwrite.close(); } catch (final IOException e) { // tell the user because it is important to know that saving failed - view.showMessage("Write Error", "The file \"" + f.getName() + "\" could not be written.\nPlease use the 'Save As...' menu.", JOptionPane.ERROR_MESSAGE); + view.showMessage("Write Error", "The file \"" + file.getName() + "\" could not be written.\nPlease use the 'Save As...' menu.", JOptionPane.ERROR_MESSAGE); } } else { System.err.println("ScriptEditControl.saveTextToFile(): Cannot save - File is NULL!"); @@ -384,8 +384,8 @@ return "*.py"; } - public boolean accept(final File f) { - return f.isDirectory() || f.getName().endsWith(".py"); + public boolean accept(final File file) { + return file.isDirectory() || file.getName().endsWith(".py"); } } Modified: trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditMenuBar.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditMenuBar.java 2006-05-29 20:17:22 UTC (rev 75) +++ trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditMenuBar.java 2006-05-29 20:35:30 UTC (rev 76) @@ -49,37 +49,37 @@ private final ScriptEditControl control; // controler object // File menu: - private JMenu menu_file; + private JMenu menuFile; - private JMenuItem m_new; + private JMenuItem miNew; - private JMenuItem m_open; + private JMenuItem miOpen; - private JMenuItem m_save_as; + private JMenuItem miSaveAs; - private JMenuItem m_save; + private JMenuItem miSave; - private JMenuItem m_close; + private JMenuItem miClose; - private JMenuItem m_close_all; + private JMenuItem miCloseAll; // Edit menu: - private JMenu menu_edit; + private JMenu menuEdit; - private JMenuItem m_cut; + private JMenuItem miCut; - private JMenuItem m_copy; + private JMenuItem miCopy; - private JMenuItem m_paste; + private JMenuItem miPaste; - private JMenuItem m_find; + private JMenuItem miFind; // Edit menu: - private JMenu menu_settings; + private JMenu menuSettings; - private JMenuItem m_font; + private JMenuItem miFont; - private JMenuItem m_colors; + private JMenuItem miColors; /** * Constructor - Builds the MenuBar. @@ -97,89 +97,89 @@ * Build File menu. */ private void buildFileMenu() { - menu_file = new JMenu("File"); + menuFile = new JMenu("File"); - m_new = new JMenuItem("New Script"); - m_new.setMnemonic('N'); - m_new.addActionListener(new ActionListener() { + miNew = new JMenuItem("New Script"); + miNew.setMnemonic('N'); + miNew.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent event) { // open new script control.openScriptNew(); } }); - menu_file.add(m_new); + menuFile.add(miNew); - m_open = new JMenuItem("Open"); - m_open.setMnemonic('O'); - m_open.addActionListener(new ActionListener() { + miOpen = new JMenuItem("Open"); + miOpen.setMnemonic('O'); + miOpen.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent event) { // open new script control.openUserWanted(); } }); - menu_file.add(m_open); + menuFile.add(miOpen); - menu_file.addSeparator(); // ------ + menuFile.addSeparator(); // ------ - m_save_as = new JMenuItem("Save As..."); - //m_save.setIcon(CGUIUtils.getIcon(IGUIConstants.SAVE_LEVEL_SMALLICON)); - m_save_as.setMnemonic('v'); - m_save_as.addActionListener(new ActionListener() { + miSaveAs = new JMenuItem("Save As..."); + //miSaveAs.setIcon(CGUIUtils.getIcon(IGUIConstants.SAVE_LEVEL_SMALLICON)); + miSaveAs.setMnemonic('v'); + miSaveAs.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent event) { // save as control.saveAsActiveTab(); } }); - menu_file.add(m_save_as); + menuFile.add(miSaveAs); - m_save = new JMenuItem("Save"); - //m_save.setIcon(CGUIUtils.getIcon(IGUIConstants.SAVE_LEVEL_SMALLICON)); - m_save.setMnemonic('S'); - m_save.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, Event.CTRL_MASK)); - m_save.addActionListener(new ActionListener() { + miSave = new JMenuItem("Save"); + //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() { public void actionPerformed(final ActionEvent event) { // save control.saveActiveTab(); } }); - menu_file.add(m_save); + menuFile.add(miSave); - menu_file.addSeparator(); // ------ + menuFile.addSeparator(); // ------ - m_close = new JMenuItem("Close"); - m_close.setMnemonic('C'); - m_close.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, Event.CTRL_MASK)); - m_close.addActionListener(new ActionListener() { + miClose = new JMenuItem("Close"); + miClose.setMnemonic('C'); + miClose.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, Event.CTRL_MASK)); + miClose.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent event) { // close control.closeActiveTab(); } }); - menu_file.add(m_close); + menuFile.add(miClose); - m_close_all = new JMenuItem("Close All"); - m_close_all.setMnemonic('l'); - m_close_all.addActionListener(new ActionListener() { + miCloseAll = new JMenuItem("Close All"); + miCloseAll.setMnemonic('l'); + miCloseAll.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent event) { // close control.closeAllTabs(); } }); - menu_file.add(m_close_all); + menuFile.add(miCloseAll); - add(menu_file); + add(menuFile); } /** * Build Edit Menu. */ private void buildEditMenu() { - menu_edit = new JMenu("Edit"); + menuEdit = new JMenu("Edit"); - m_cut = new JMenuItem("Cut"); - m_cut.setMnemonic('t'); - m_cut.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, Event.CTRL_MASK)); - m_cut.addActionListener(new ActionListener() { + miCut = new JMenuItem("Cut"); + miCut.setMnemonic('t'); + miCut.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, Event.CTRL_MASK)); + miCut.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent event) { // cut final JEditTextArea activeTA = control.getActiveTextArea(); @@ -188,12 +188,12 @@ } } }); - menu_edit.add(m_cut); + menuEdit.add(miCut); - m_copy = new JMenuItem("Copy"); - m_copy.setMnemonic('C'); - m_copy.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, Event.CTRL_MASK)); - m_copy.addActionListener(new ActionListener() { + miCopy = new JMenuItem("Copy"); + miCopy.setMnemonic('C'); + miCopy.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, Event.CTRL_MASK)); + miCopy.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent event) { // copy final JEditTextArea activeTA = control.getActiveTextArea(); @@ -202,12 +202,12 @@ } } }); - menu_edit.add(m_copy); + menuEdit.add(miCopy); - m_paste = new JMenuItem("Paste"); - m_paste.setMnemonic('P'); - m_paste.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, Event.CTRL_MASK)); - m_paste.addActionListener(new ActionListener() { + miPaste = new JMenuItem("Paste"); + miPaste.setMnemonic('P'); + miPaste.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, Event.CTRL_MASK)); + miPaste.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent event) { // paste final JEditTextArea activeTA = control.getActiveTextArea(); @@ -216,14 +216,14 @@ } } }); - menu_edit.add(m_paste); + menuEdit.add(miPaste); - menu_edit.addSeparator(); // ------ + menuEdit.addSeparator(); // ------ - m_find = new JMenuItem("Find"); - m_find.setMnemonic('F'); - m_find.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, Event.CTRL_MASK)); - m_find.addActionListener(new ActionListener() { + miFind = new JMenuItem("Find"); + miFind.setMnemonic('F'); + miFind.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, Event.CTRL_MASK)); + miFind.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent event) { // find if (log.isInfoEnabled()) { @@ -231,48 +231,48 @@ } } }); - menu_edit.add(m_find); + menuEdit.add(miFind); - add(menu_edit); + add(menuEdit); } /** * Build Edit Menu. */ private void buildSettingsMenu() { - menu_settings = new JMenu("Settings"); + menuSettings = new JMenu("Settings"); - m_font = new JMenuItem("Font"); - m_font.setMnemonic('F'); - m_font.addActionListener(new ActionListener() { + miFont = new JMenuItem("Font"); + miFont.setMnemonic('F'); + miFont.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent event) { // set font } }); - menu_settings.add(m_font); + menuSettings.add(miFont); - m_colors = new JMenuItem("Colors"); - m_colors.setMnemonic('C'); - m_colors.addActionListener(new ActionListener() { + miColors = new JMenuItem("Colors"); + miColors.setMnemonic('C'); + miColors.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent event) { // set colors } }); - menu_settings.add(m_colors); + menuSettings.add(miColors); - add(menu_settings); + add(menuSettings); } /** * Refreshes the enable/disable state of all menus. */ public final void refresh() { - m_find.setEnabled(false); - m_colors.setEnabled(false); - m_font.setEnabled(false); + miFind.setEnabled(false); + miColors.setEnabled(false); + miFont.setEnabled(false); // see if there is a path for direct 'save' - m_save.setEnabled(control.getActiveFilePath() != null); + miSave.setEnabled(control.getActiveFilePath() != null); } /** @@ -282,25 +282,25 @@ public void updateFont(final boolean do_redraw) { if (!control.isStandAlone()) { // File menu: - control.getMainControl().setBoldFont(menu_file); - control.getMainControl().setBoldFont(m_new); - control.getMainControl().setBoldFont(m_open); - control.getMainControl().setBoldFont(m_save_as); - control.getMainControl().setBoldFont(m_save); - control.getMainControl().setBoldFont(m_close); - control.getMainControl().setBoldFont(m_close_all); + control.getMainControl().setBoldFont(menuFile); + control.getMainControl().setBoldFont(miNew); + control.getMainControl().setBoldFont(miOpen); + control.getMainControl().setBoldFont(miSaveAs); + control.getMainControl().setBoldFont(miSave); + control.getMainControl().setBoldFont(miClose); + control.getMainControl().setBoldFont(miCloseAll); // Edit menu: - control.getMainControl().setBoldFont(menu_edit); - control.getMainControl().setBoldFont(m_cut); - control.getMainControl().setBoldFont(m_copy); - control.getMainControl().setBoldFont(m_paste); - control.getMainControl().setBoldFont(m_find); + control.getMainControl().setBoldFont(menuEdit); + control.getMainControl().setBoldFont(miCut); + control.getMainControl().setBoldFont(miCopy); + control.getMainControl().setBoldFont(miPaste); + control.getMainControl().setBoldFont(miFind); // Edit menu: - control.getMainControl().setBoldFont(menu_settings); - control.getMainControl().setBoldFont(m_font); - control.getMainControl().setBoldFont(m_colors); + control.getMainControl().setBoldFont(menuSettings); + control.getMainControl().setBoldFont(miFont); + control.getMainControl().setBoldFont(miColors); } if (do_redraw) { Modified: trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditView.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditView.java 2006-05-29 20:17:22 UTC (rev 75) +++ trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditView.java 2006-05-29 20:35:30 UTC (rev 76) @@ -123,9 +123,9 @@ /** * Add a new TextArea Panel to the TabbedPane. * @param title title of this script (filename) - * @param f file where this script is stored, null if new script opened + * @param file file where this script is stored, null if new script opened */ - public final void addTab(final String title, final File f) { + public final void addTab(final String title, final File file) { final JEditTextArea ta = new JEditTextArea(); // open new TextArea //ta.setFont(new Font("Courier New", Font.PLAIN, 12)); ta.setDocument(new SyntaxDocument()); @@ -148,11 +148,11 @@ textAreas.addElement(ta); - if (f != null && f.exists()) { + if (file != null && file.exists()) { // print file into this document try { // open ascii streams - FileReader fread = new FileReader(f); + FileReader fread = new FileReader(file); BufferedReader bfread = new BufferedReader(fread); boolean firstLine = true; @@ -175,9 +175,9 @@ // insert buffer into the document ta.getDocument().insertString(0, buff.toString(), null); } catch (final FileNotFoundException e) { - log.info("addTab(): File '" + f.getName() + "' not found."); + log.info("addTab(): File '" + file.getName() + "' not found."); } catch (final IOException e) { - log.info("addTab(): I/O-Error while reading '" + f.getName() + "'."); + log.info("addTab(): I/O-Error while reading '" + file.getName() + "'."); } catch (final BadLocationException e) { log.info("addTab(): Bad Location in Document!"); } Modified: trunk/crossfire/src/cfeditor/textedit/textarea/InputHandler.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/InputHandler.java 2006-05-29 20:17:22 UTC (rev 75) +++ trunk/crossfire/src/cfeditor/textedit/textarea/InputHandler.java 2006-05-29 20:35:30 UTC (rev 76) @@ -325,8 +325,8 @@ } // remember old values, in case action changes them - final boolean _repeat = repeat; - final int _repeatCount = getRepeatCount(); + final boolean repeatBak = repeat; + final int repeatCountBak = getRepeatCount(); // execute the action if (listener instanceof InputHandler.NonRepeatable) { @@ -342,8 +342,8 @@ if (grabAction == null) { if (recorder != null) { if (!(listener instanceof InputHandler.NonRecordable)) { - if (_repeatCount != 1) { - recorder.actionPerformed(REPEAT, String.valueOf(_repeatCount)); + if (repeatCountBak != 1) { + recorder.actionPerformed(REPEAT, String.valueOf(repeatCountBak)); } recorder.actionPerformed(listener, actionCommand); @@ -352,7 +352,7 @@ // If repeat was true originally, clear it // Otherwise it might have been set by the action, etc - if (_repeat) { + if (repeatBak) { repeat = false; repeatCount = 0; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-05-29 20:17:32
|
Revision: 75 Author: akirschbaum Date: 2006-05-29 13:17:22 -0700 (Mon, 29 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=75&view=rev Log Message: ----------- Remove unused variables/parameters. Modified Paths: -------------- trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditView.java trunk/crossfire/src/cfeditor/textedit/textarea/JEditTextArea.java Modified: trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditView.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditView.java 2006-05-29 20:02:39 UTC (rev 74) +++ trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditView.java 2006-05-29 20:17:22 UTC (rev 75) @@ -94,7 +94,7 @@ setJMenuBar(menuBar); // add menu bar to frame tabPane = new JTabbedPane(JTabbedPane.TOP); // init tab pane - tabPane.addChangeListener(new EditTabListener(control, this)); + tabPane.addChangeListener(new EditTabListener(this)); // set the window icon final ImageIcon icon = CGUIUtils.getIcon("Script.gif"); @@ -303,14 +303,11 @@ */ private final class EditTabListener implements ChangeListener { - private final ScriptEditControl control; // controler - private final ScriptEditView view; // view private int index; // index of selected tab - public EditTabListener(final ScriptEditControl control, final ScriptEditView view) { - this.control = control; + public EditTabListener(final ScriptEditView view) { this.view = view; index = view.getSelectedIndex(); } Modified: trunk/crossfire/src/cfeditor/textedit/textarea/JEditTextArea.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/JEditTextArea.java 2006-05-29 20:02:39 UTC (rev 74) +++ trunk/crossfire/src/cfeditor/textedit/textarea/JEditTextArea.java 2006-05-29 20:17:22 UTC (rev 75) @@ -17,7 +17,6 @@ import java.awt.FontMetrics; import java.awt.Insets; import java.awt.LayoutManager; -import java.awt.Toolkit; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.StringSelection; @@ -334,7 +333,6 @@ return; } - final int oldFirstLine = this.firstLine; this.firstLine = firstLine; if (firstLine != vertical.getValue()) { updateScrollBars(); @@ -366,7 +364,6 @@ lineHeight = painter.getFontMetrics().getHeight(); } - final int oldVisibleLines = visibleLines; visibleLines = height / lineHeight; updateScrollBars(); } @@ -402,7 +399,6 @@ */ public final boolean setOrigin(final int firstLine, final int horizontalOffset) { boolean changed = false; - final int oldFirstLine = this.firstLine; if (horizontalOffset != this.horizontalOffset) { this.horizontalOffset = horizontalOffset; @@ -562,7 +558,6 @@ painter.setCurrentLineTokens(tokens); } - final Toolkit toolkit = painter.getToolkit(); final Font defaultFont = painter.getFont(); final SyntaxStyle[] styles = painter.getStyles(); @@ -647,7 +642,6 @@ } int offset = 0; - final Toolkit toolkit = painter.getToolkit(); final Font defaultFont = painter.getFont(); final SyntaxStyle[] styles = painter.getStyles(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-05-29 20:02:44
|
Revision: 74 Author: akirschbaum Date: 2006-05-29 13:02:39 -0700 (Mon, 29 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=74&view=rev Log Message: ----------- Remove redundant initialization. Modified Paths: -------------- trunk/daimonin/src/daieditor/textedit/textarea/KeywordMap.java Modified: trunk/daimonin/src/daieditor/textedit/textarea/KeywordMap.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/textarea/KeywordMap.java 2006-05-29 19:55:59 UTC (rev 73) +++ trunk/daimonin/src/daieditor/textedit/textarea/KeywordMap.java 2006-05-29 20:02:39 UTC (rev 74) @@ -29,7 +29,6 @@ */ public KeywordMap(final boolean ignoreCase) { this(ignoreCase, 52); - this.ignoreCase = ignoreCase; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-05-29 19:56:11
|
Revision: 73 Author: akirschbaum Date: 2006-05-29 12:55:59 -0700 (Mon, 29 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=73&view=rev Log Message: ----------- Rewrite expression to make variables 'final'. Modified Paths: -------------- trunk/crossfire/src/cfeditor/textedit/textarea/TextAreaPainter.java Modified: trunk/crossfire/src/cfeditor/textedit/textarea/TextAreaPainter.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/TextAreaPainter.java 2006-05-29 19:51:19 UTC (rev 72) +++ trunk/crossfire/src/cfeditor/textedit/textarea/TextAreaPainter.java 2006-05-29 19:55:59 UTC (rev 73) @@ -625,13 +625,15 @@ final int lineStart = textArea.getLineStartOffset(line); final int x1; - int x2; + final int x2; if (textArea.isSelectionRectangular()) { final int lineLen = textArea.getLineLength(line); x1 = textArea._offsetToX(line, Math.min(lineLen, selectionStart - textArea.getLineStartOffset(selectionStartLine))); - x2 = textArea._offsetToX(line, Math.min(lineLen, selectionEnd - textArea.getLineStartOffset(selectionEndLine))); - if (x1 == x2) { - x2++; + final int x3 = textArea._offsetToX(line, Math.min(lineLen, selectionEnd - textArea.getLineStartOffset(selectionEndLine))); + if (x1 == x3) { + x2 = x3 + 1; + } else { + x2 = x3; } } else if (selectionStartLine == selectionEndLine) { x1 = textArea._offsetToX(line, selectionStart - lineStart); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-05-29 19:51:42
|
Revision: 72 Author: akirschbaum Date: 2006-05-29 12:51:19 -0700 (Mon, 29 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=72&view=rev Log Message: ----------- Make fields private or protected; add accessor functions. Modified Paths: -------------- trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditView.java trunk/crossfire/src/cfeditor/textedit/textarea/KeywordMap.java trunk/crossfire/src/cfeditor/textedit/textarea/TextAreaDefaults.java trunk/crossfire/src/cfeditor/textedit/textarea/TextAreaPainter.java trunk/crossfire/src/cfeditor/textedit/textarea/Token.java trunk/crossfire/src/cfeditor/textedit/textarea/TokenMarker.java trunk/daimonin/src/daieditor/textedit/scripteditor/ScriptEditView.java trunk/daimonin/src/daieditor/textedit/textarea/JEditTextArea.java trunk/daimonin/src/daieditor/textedit/textarea/KeywordMap.java trunk/daimonin/src/daieditor/textedit/textarea/SyntaxUtilities.java trunk/daimonin/src/daieditor/textedit/textarea/TextAreaDefaults.java trunk/daimonin/src/daieditor/textedit/textarea/TextAreaPainter.java trunk/daimonin/src/daieditor/textedit/textarea/Token.java trunk/daimonin/src/daieditor/textedit/textarea/TokenMarker.java Modified: trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditView.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditView.java 2006-05-29 19:06:56 UTC (rev 71) +++ trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditView.java 2006-05-29 19:51:19 UTC (rev 72) @@ -303,11 +303,11 @@ */ private final class EditTabListener implements ChangeListener { - final ScriptEditControl control; // controler + private final ScriptEditControl control; // controler - final ScriptEditView view; // view + private final ScriptEditView view; // view - int index; // index of selected tab + private int index; // index of selected tab public EditTabListener(final ScriptEditControl control, final ScriptEditView view) { this.control = control; @@ -330,7 +330,7 @@ */ private static final class EditWindowListener implements WindowListener { - final ScriptEditControl control; // controller + private final ScriptEditControl control; // controller /** * Constructor. Modified: trunk/crossfire/src/cfeditor/textedit/textarea/KeywordMap.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/KeywordMap.java 2006-05-29 19:06:56 UTC (rev 71) +++ trunk/crossfire/src/cfeditor/textedit/textarea/KeywordMap.java 2006-05-29 19:51:19 UTC (rev 72) @@ -97,7 +97,7 @@ } // protected members - protected final int mapLength; + private final int mapLength; protected final int getStringMapKey(final String s) { return (Character.toUpperCase(s.charAt(0)) + Character.toUpperCase(s.charAt(s.length() - 1))) % mapLength; @@ -116,11 +116,11 @@ this.next = next; } - public final char[] keyword; + private final char[] keyword; - public final byte id; + private final byte id; - public final Keyword next; + private final Keyword next; } private final Keyword[] map; Modified: trunk/crossfire/src/cfeditor/textedit/textarea/TextAreaDefaults.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/TextAreaDefaults.java 2006-05-29 19:06:56 UTC (rev 71) +++ trunk/crossfire/src/cfeditor/textedit/textarea/TextAreaDefaults.java 2006-05-29 19:51:19 UTC (rev 72) @@ -178,4 +178,5 @@ public JPopupMenu getPopup() { return popup; } + } // class TextAreaDefaults Modified: trunk/crossfire/src/cfeditor/textedit/textarea/TextAreaPainter.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/TextAreaPainter.java 2006-05-29 19:06:56 UTC (rev 71) +++ trunk/crossfire/src/cfeditor/textedit/textarea/TextAreaPainter.java 2006-05-29 19:51:19 UTC (rev 72) @@ -547,7 +547,7 @@ } } - final protected void paintPlainLine(final Graphics gfx, final int line, final Font defaultFont, final Color defaultColor, int x, int y) { + protected final void paintPlainLine(final Graphics gfx, final int line, final Font defaultFont, final Color defaultColor, int x, int y) { paintHighlight(gfx, line, y); textArea.getLineText(line, currentLine); @@ -567,7 +567,7 @@ * When syntax highlighting is enabled, this method is called from * paintLine() to do the actual drawing of the line. */ - final protected void paintSyntaxLine(final Graphics gfx, final TokenMarker tokenMarker, final int line, final Font defaultFont, final Color defaultColor, int x, int y) { + protected final void paintSyntaxLine(final Graphics gfx, final TokenMarker tokenMarker, final int line, final Font defaultFont, final Color defaultColor, int x, int y) { textArea.getLineText(currentLineIndex, currentLine); currentLineTokens = tokenMarker.markTokens(currentLine, currentLineIndex); @@ -587,7 +587,7 @@ } } - final protected void paintHighlight(final Graphics gfx, final int line, final int y) { + protected final void paintHighlight(final Graphics gfx, final int line, final int y) { if (line >= textArea.getSelectionStartLine() && line <= textArea.getSelectionEndLine()) { paintLineHighlight(gfx, line, y); } @@ -605,7 +605,7 @@ } } - final protected void paintLineHighlight(final Graphics gfx, final int line, int y) { + protected final void paintLineHighlight(final Graphics gfx, final int line, int y) { final int height = fm.getHeight(); y += fm.getLeading() + fm.getMaxDescent(); @@ -653,7 +653,7 @@ } - final protected void paintBracketHighlight(final Graphics gfx, final int line, int y) { + protected final void paintBracketHighlight(final Graphics gfx, final int line, int y) { final int position = textArea.getBracketPosition(); if (position == -1) { return; @@ -668,7 +668,7 @@ gfx.drawRect(x, y, fm.charWidth('(') - 1, fm.getHeight() - 1); } - final protected void paintCaret(final Graphics gfx, final int line, int y) { + protected final void paintCaret(final Graphics gfx, final int line, int y) { if (textArea.isCaretVisible()) { final int offset = textArea.getCaretPosition() - textArea.getLineStartOffset(line); final int caretX = textArea._offsetToX(line, offset); @@ -708,4 +708,5 @@ public void setCurrentLineTokens(Token token) { currentLineTokens = token; } + } // class TextAreaPainter Modified: trunk/crossfire/src/cfeditor/textedit/textarea/Token.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/Token.java 2006-05-29 19:06:56 UTC (rev 71) +++ trunk/crossfire/src/cfeditor/textedit/textarea/Token.java 2006-05-29 19:51:19 UTC (rev 72) @@ -146,4 +146,5 @@ public void setNext(Token next_) { next = next_; } + } // class Token Modified: trunk/crossfire/src/cfeditor/textedit/textarea/TokenMarker.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/TokenMarker.java 2006-05-29 19:06:56 UTC (rev 71) +++ trunk/crossfire/src/cfeditor/textedit/textarea/TokenMarker.java 2006-05-29 19:51:19 UTC (rev 72) @@ -284,8 +284,8 @@ * Creates a new LineInfo object with the specified parameters. */ public LineInfo(final byte token, final Object obj) { - this.token = token; - this.obj = obj; + this.setToken(token); + this.setObj(obj); } /** The id of the last token of the line. */ Modified: trunk/daimonin/src/daieditor/textedit/scripteditor/ScriptEditView.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/scripteditor/ScriptEditView.java 2006-05-29 19:06:56 UTC (rev 71) +++ trunk/daimonin/src/daieditor/textedit/scripteditor/ScriptEditView.java 2006-05-29 19:51:19 UTC (rev 72) @@ -285,7 +285,7 @@ private int index; // index of selected tab - EditTabListener(final ScriptEditView view) { + public EditTabListener(final ScriptEditView view) { this.view = view; index = view.getSelectedIndex(); } @@ -311,7 +311,7 @@ * Constructor. * @param control ScriptEditControl */ - EditWindowListener(final ScriptEditControl control) { + public EditWindowListener(final ScriptEditControl control) { this.control = control; } Modified: trunk/daimonin/src/daieditor/textedit/textarea/JEditTextArea.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/textarea/JEditTextArea.java 2006-05-29 19:06:56 UTC (rev 71) +++ trunk/daimonin/src/daieditor/textedit/textarea/JEditTextArea.java 2006-05-29 19:51:19 UTC (rev 72) @@ -141,14 +141,14 @@ addFocusListener(new FocusHandler()); // Load the defaults - setInputHandler(defaults.inputHandler); - setDocument(defaults.document); - editable = defaults.editable; - caretVisible = defaults.caretVisible; - caretBlinks = defaults.caretBlinks; - electricScroll = defaults.electricScroll; + setInputHandler(defaults.getInputHandler()); + setDocument(defaults.getDocument()); + editable = defaults.getEditable(); + caretVisible = defaults.getCaretVisible(); + caretBlinks = defaults.getCaretBlinks(); + electricScroll = defaults.getElectricScroll(); - popup = defaults.popup; + popup = defaults.getPopup(); // free tab key from the focus traversal manager freeTabKeyFromFocusTraversal(); @@ -515,7 +515,7 @@ */ public final int offsetToX(final int line, final int offset) { // don't use cached tokens - painter.currentLineTokens = null; + painter.setCurrentLineTokens(null); return _offsetToX(line, offset); } @@ -546,18 +546,19 @@ /* If syntax coloring is enabled, we have to do this because * tokens can vary in width */ Token tokens; - if (painter.currentLineIndex == line && painter.currentLineTokens != null) { - tokens = painter.currentLineTokens; + if (painter.getCurrentLineIndex() == line && painter.getCurrentLineTokens() != null) { + tokens = painter.getCurrentLineTokens(); } else { - painter.currentLineIndex = line; - tokens = painter.currentLineTokens = tokenMarker.markTokens(lineSegment, line); + painter.setCurrentLineIndex(line); + tokens = tokenMarker.markTokens(lineSegment, line); + painter.setCurrentLineTokens(tokens); } final Font defaultFont = painter.getFont(); final SyntaxStyle[] styles = painter.getStyles(); while (true) { - final byte id = tokens.id; + final byte id = tokens.getId(); if (id == Token.END) { return x; } @@ -568,7 +569,7 @@ fm = styles[id].getFontMetrics(defaultFont, painter.getGraphics()); } - final int length = tokens.length; + final int length = tokens.getLength(); if (offset + segmentOffset < lineSegment.offset + length) { lineSegment.count = offset - (lineSegment.offset - segmentOffset); @@ -577,7 +578,7 @@ lineSegment.count = length; x += Utilities.getTabbedTextWidth(lineSegment, fm, x, painter, 0); lineSegment.offset += length; - tokens = tokens.next; + tokens = tokens.getNext(); } } } @@ -627,11 +628,12 @@ return segmentCount; } else { Token tokens; - if (painter.currentLineIndex == line && painter .currentLineTokens != null) { - tokens = painter.currentLineTokens; + if (painter.getCurrentLineIndex() == line && painter.getCurrentLineTokens() != null) { + tokens = painter.getCurrentLineTokens(); } else { - painter.currentLineIndex = line; - tokens = painter.currentLineTokens = tokenMarker.markTokens(lineSegment, line); + painter.setCurrentLineIndex(line); + tokens = tokenMarker.markTokens(lineSegment, line); + painter.setCurrentLineTokens(tokens); } int offset = 0; @@ -639,7 +641,7 @@ final SyntaxStyle[] styles = painter.getStyles(); while (true) { - final byte id = tokens.id; + final byte id = tokens.getId(); if (id == Token.END) { return offset; } @@ -650,7 +652,7 @@ fm = styles[id].getFontMetrics(defaultFont, painter.getGraphics()); } - final int length = tokens.length; + final int length = tokens.getLength(); for (int i = 0; i < length; i++) { final char c = segmentArray[segmentOffset + offset + i]; @@ -675,7 +677,7 @@ } offset += length; - tokens = tokens.next; + tokens = tokens.getNext(); } } } @@ -1500,7 +1502,7 @@ protected boolean rectSelect; - final void fireCaretEvent() { + protected final void fireCaretEvent() { final Object[] listeners = listenerList.getListenerList(); for (int i = listeners.length - 2; i >= 0; i--) { if (listeners[i] == CaretListener.class) { @@ -1509,7 +1511,7 @@ } } - final void updateBracketHighlight(final int newCaretPosition) { + protected final void updateBracketHighlight(final int newCaretPosition) { if (newCaretPosition == 0) { bracketPosition = bracketLine = -1; return; @@ -1529,7 +1531,7 @@ bracketLine = bracketPosition = -1; } - final void documentChanged(final DocumentEvent evt) { + protected final void documentChanged(final DocumentEvent evt) { final DocumentEvent.ElementChange ch = evt.getChange(document.getDefaultRootElement()); final int count; Modified: trunk/daimonin/src/daieditor/textedit/textarea/KeywordMap.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/textarea/KeywordMap.java 2006-05-29 19:06:56 UTC (rev 71) +++ trunk/daimonin/src/daieditor/textedit/textarea/KeywordMap.java 2006-05-29 19:51:19 UTC (rev 72) @@ -98,30 +98,30 @@ } // protected members - final int mapLength; + private final int mapLength; - final int getStringMapKey(final String s) { + public final int getStringMapKey(final String s) { return (Character.toUpperCase(s.charAt(0)) + Character.toUpperCase(s.charAt(s.length() - 1))) % mapLength; } - final int getSegmentMapKey(final Segment s, final int off, final int len) { + public 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; } // private members static final class Keyword { - Keyword(final char[] keyword, final byte id, final Keyword next) { + public Keyword(final char[] keyword, final byte id, final Keyword next) { this.keyword = keyword; this.id = id; this.next = next; } - final char[] keyword; + private final char[] keyword; - final byte id; + private final byte id; - final Keyword next; + private final Keyword next; } private final Keyword[] map; Modified: trunk/daimonin/src/daieditor/textedit/textarea/SyntaxUtilities.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/textarea/SyntaxUtilities.java 2006-05-29 19:06:56 UTC (rev 71) +++ trunk/daimonin/src/daieditor/textedit/textarea/SyntaxUtilities.java 2006-05-29 19:51:19 UTC (rev 72) @@ -122,12 +122,12 @@ int offset = 0; while (true) { - final byte id = tokens.id; + final byte id = tokens.getId(); if (id == Token.END) { break; } - final int length = tokens.length; + final int length = tokens.getLength(); if (id == Token.NULL) { if (!defaultColor.equals(gfx.getColor())) { gfx.setColor(defaultColor); @@ -144,7 +144,7 @@ line.offset += length; offset += length; - tokens = tokens.next; + tokens = tokens.getNext(); } return x; Modified: trunk/daimonin/src/daieditor/textedit/textarea/TextAreaDefaults.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/textarea/TextAreaDefaults.java 2006-05-29 19:06:56 UTC (rev 71) +++ trunk/daimonin/src/daieditor/textedit/textarea/TextAreaDefaults.java 2006-05-29 19:51:19 UTC (rev 72) @@ -22,45 +22,45 @@ private static TextAreaDefaults DEFAULTS; - public InputHandler inputHandler; + private InputHandler inputHandler; - public SyntaxDocument document; + private SyntaxDocument document; - public boolean editable; + private boolean editable; - public boolean caretVisible; + private boolean caretVisible; - public boolean caretBlinks; + private boolean caretBlinks; - public boolean blockCaret; + private boolean blockCaret; - public int electricScroll; + private int electricScroll; - public int cols; + private int cols; - public int rows; + private int rows; - public SyntaxStyle[] styles; + private SyntaxStyle[] styles; - public Color caretColor; + private Color caretColor; - public Color selectionColor; + private Color selectionColor; - public Color lineHighlightColor; + private Color lineHighlightColor; - public boolean lineHighlight; + private boolean lineHighlight; - public Color bracketHighlightColor; + private Color bracketHighlightColor; - public boolean bracketHighlight; + private boolean bracketHighlight; - public Color eolMarkerColor; + private Color eolMarkerColor; - public boolean eolMarkers; + private boolean eolMarkers; - public boolean paintInvalid; + private boolean paintInvalid; - public JPopupMenu popup; + private JPopupMenu popup; /** * Returns a new TextAreaDefaults object with the default values filled in. @@ -98,4 +98,84 @@ return DEFAULTS; } + public InputHandler getInputHandler() { + return inputHandler; + } + + public SyntaxDocument getDocument() { + return document; + } + + public boolean getEditable() { + return editable; + } + + public boolean getCaretVisible() { + return caretVisible; + } + + public boolean getCaretBlinks() { + return caretBlinks; + } + + public boolean getBlockCaret() { + return blockCaret; + } + + public int getElectricScroll() { + return electricScroll; + } + + public int getCols() { + return cols; + } + + public int getRows() { + return rows; + } + + public SyntaxStyle[] getStyles() { + return styles; + } + + public Color getCaretColor() { + return caretColor; + } + + public Color getSelectionColor() { + return selectionColor; + } + + public Color getLineHighlightColor() { + return lineHighlightColor; + } + + public boolean getLineHighlight() { + return lineHighlight; + } + + public Color getBracketHighlightColor() { + return bracketHighlightColor; + } + + public boolean getBracketHighlight() { + return bracketHighlight; + } + + public Color getEolMarkerColor() { + return eolMarkerColor; + } + + public boolean getEolMarkers() { + return eolMarkers; + } + + public boolean getPaintInvalid() { + return paintInvalid; + } + + public JPopupMenu getPopup() { + return popup; + } + } // class TextAreaDefaults Modified: trunk/daimonin/src/daieditor/textedit/textarea/TextAreaPainter.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/textarea/TextAreaPainter.java 2006-05-29 19:06:56 UTC (rev 71) +++ trunk/daimonin/src/daieditor/textedit/textarea/TextAreaPainter.java 2006-05-29 19:51:19 UTC (rev 72) @@ -42,11 +42,11 @@ private static final long serialVersionUID = 1L; // package-private members - int currentLineIndex; + private int currentLineIndex; - Token currentLineTokens; + private Token currentLineTokens; - final Segment currentLine; + private final Segment currentLine; // protected members protected final JEditTextArea textArea; @@ -113,19 +113,19 @@ setForeground(Color.black); setBackground(Color.white); - blockCaret = defaults.blockCaret; - styles = defaults.styles; - cols = defaults.cols; - rows = defaults.rows; - caretColor = defaults.caretColor; - selectionColor = defaults.selectionColor; - lineHighlightColor = defaults.lineHighlightColor; - lineHighlight = defaults.lineHighlight; - bracketHighlightColor = defaults.bracketHighlightColor; - bracketHighlight = defaults.bracketHighlight; - paintInvalid = defaults.paintInvalid; - eolMarkerColor = defaults.eolMarkerColor; - eolMarkers = defaults.eolMarkers; + blockCaret = defaults.getBlockCaret(); + styles = defaults.getStyles(); + cols = defaults.getCols(); + rows = defaults.getRows(); + caretColor = defaults.getCaretColor(); + selectionColor = defaults.getSelectionColor(); + lineHighlightColor = defaults.getLineHighlightColor(); + lineHighlight = defaults.getLineHighlight(); + bracketHighlightColor = defaults.getBracketHighlightColor(); + bracketHighlight = defaults.getBracketHighlight(); + paintInvalid = defaults.getPaintInvalid(); + eolMarkerColor = defaults.getEolMarkerColor(); + eolMarkers = defaults.getEolMarkers(); needMetricsUpdate = true; // need to update font metrics before drawing needLineUpdate = true; } @@ -526,7 +526,7 @@ * This is the first method which gets directly called from paint(). All * lines which are sceduled for redraw get drawn with this method. */ - final void paintLine(final Graphics gfx, final TokenMarker tokenMarker, final int line, final int x) { + protected final void paintLine(final Graphics gfx, final TokenMarker tokenMarker, final int line, final int x) { final Font defaultFont = getFont(); final Color defaultColor = getForeground(); @@ -546,7 +546,7 @@ } } - final void paintPlainLine(final Graphics gfx, final int line, final Font defaultFont, final Color defaultColor, int x, int y) { + protected final void paintPlainLine(final Graphics gfx, final int line, final Font defaultFont, final Color defaultColor, int x, int y) { paintHighlight(gfx, line, y); textArea.getLineText(line, currentLine); @@ -566,7 +566,7 @@ * When syntax highlighting is enabled, this method is called from * paintLine() to do the actual drawing of the line. */ - final void paintSyntaxLine(final Graphics gfx, final TokenMarker tokenMarker, final int line, final Font defaultFont, final Color defaultColor, int x, int y) { + protected final void paintSyntaxLine(final Graphics gfx, final TokenMarker tokenMarker, final int line, final Font defaultFont, final Color defaultColor, int x, int y) { textArea.getLineText(currentLineIndex, currentLine); currentLineTokens = tokenMarker.markTokens(currentLine, currentLineIndex); @@ -586,7 +586,7 @@ } } - final void paintHighlight(final Graphics gfx, final int line, final int y) { + protected final void paintHighlight(final Graphics gfx, final int line, final int y) { if (line >= textArea.getSelectionStartLine() && line <= textArea.getSelectionEndLine()) { paintLineHighlight(gfx, line, y); } @@ -604,7 +604,7 @@ } } - final void paintLineHighlight(final Graphics gfx, final int line, int y) { + protected final void paintLineHighlight(final Graphics gfx, final int line, int y) { final int height = fm.getHeight(); y += fm.getLeading() + fm.getMaxDescent(); @@ -654,7 +654,7 @@ } - final void paintBracketHighlight(final Graphics gfx, final int line, int y) { + protected final void paintBracketHighlight(final Graphics gfx, final int line, int y) { final int position = textArea.getBracketPosition(); if (position == -1) { return; @@ -669,7 +669,7 @@ gfx.drawRect(x, y, fm.charWidth('(') - 1, fm.getHeight() - 1); } - final void paintCaret(final Graphics gfx, final int line, int y) { + protected final void paintCaret(final Graphics gfx, final int line, int y) { if (textArea.isCaretVisible()) { final int offset = textArea.getCaretPosition() - textArea.getLineStartOffset(line); final int caretX = textArea._offsetToX(line, offset); @@ -693,4 +693,21 @@ } } } + + public int getCurrentLineIndex() { + return currentLineIndex; + } + + public void setCurrentLineIndex(int lineIndex) { + currentLineIndex = lineIndex; + } + + public Token getCurrentLineTokens() { + return currentLineTokens; + } + + public void setCurrentLineTokens(Token token) { + currentLineTokens = token; + } + } // class TextAreaPainter Modified: trunk/daimonin/src/daieditor/textedit/textarea/Token.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/textarea/Token.java 2006-05-29 19:06:56 UTC (rev 71) +++ trunk/daimonin/src/daieditor/textedit/textarea/Token.java 2006-05-29 19:51:19 UTC (rev 72) @@ -100,13 +100,13 @@ public static final byte END = 127; /** The length of this token. */ - public int length; + private int length; /** The id of this token. */ - public byte id; + private byte id; /** The next token in the linked list. */ - public Token next; + private Token next; /** * Creates a new token. @@ -123,4 +123,28 @@ return "[id=" + id + ",length=" + length + "]"; } + public byte getId() { + return id; + } + + public void setId(byte id_) { + id = id_; + } + + public int getLength() { + return length; + } + + public void setLength(int length_) { + length = length_; + } + + public Token getNext() { + return next; + } + + public void setNext(Token next_) { + next = next_; + } + } // class Token Modified: trunk/daimonin/src/daieditor/textedit/textarea/TokenMarker.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/textarea/TokenMarker.java 2006-05-29 19:06:56 UTC (rev 71) +++ trunk/daimonin/src/daieditor/textedit/textarea/TokenMarker.java 2006-05-29 19:51:19 UTC (rev 72) @@ -258,15 +258,15 @@ lastToken = firstToken; } else if (lastToken == null) { lastToken = firstToken; - firstToken.length = length; - firstToken.id = id; - } else if (lastToken.next == null) { - lastToken.next = new Token(length, id); - lastToken = lastToken.next; + firstToken.setLength(length); + firstToken.setId(id); + } else if (lastToken.getNext() == null) { + lastToken.setNext(new Token(length, id)); + lastToken = lastToken.getNext(); } else { - lastToken = lastToken.next; - lastToken.length = length; - lastToken.id = id; + lastToken = lastToken.getNext(); + lastToken.setLength(length); + lastToken.setId(id); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-05-29 19:07:06
|
Revision: 71 Author: akirschbaum Date: 2006-05-29 12:06:56 -0700 (Mon, 29 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=71&view=rev Log Message: ----------- Make fields private; add accessor functions. Modified Paths: -------------- trunk/crossfire/src/cfeditor/textedit/textarea/TokenMarker.java Modified: trunk/crossfire/src/cfeditor/textedit/textarea/TokenMarker.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/TokenMarker.java 2006-05-29 19:05:57 UTC (rev 70) +++ trunk/crossfire/src/cfeditor/textedit/textarea/TokenMarker.java 2006-05-29 19:06:56 UTC (rev 71) @@ -46,10 +46,10 @@ prev = lineInfo[lineIndex - 1]; } - final byte oldToken = info.token; - final byte token = markTokensImpl(prev == null ? Token.NULL : prev.token, line, lineIndex); + final byte oldToken = info.getToken(); + final byte token = markTokensImpl(prev == null ? Token.NULL : prev.getToken(), line, lineIndex); - info.token = token; + info.setToken(token); /* * This is a foul hack. It stops nextLineRequested @@ -289,14 +289,31 @@ } /** The id of the last token of the line. */ - public byte token; + private byte token; /** * This is for use by the token marker implementations themselves. It * can be used to store anything that is an object and that needs to * exist on a per-line basis. */ - public Object obj; + private Object obj; + + public final byte getToken() { + return token; + } + + public final void setToken(final byte token) { + this.token = token; + } + + public final Object getObj() { + return obj; + } + + public final void setObj(final Object obj) { + this.obj = obj; + } + } // class LineInfo } // class TokenMarker This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-05-29 19:06:10
|
Revision: 70 Author: akirschbaum Date: 2006-05-29 12:05:57 -0700 (Mon, 29 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=70&view=rev Log Message: ----------- Whitespace change. Modified Paths: -------------- trunk/daimonin/src/daieditor/textedit/textarea/TokenMarker.java Modified: trunk/daimonin/src/daieditor/textedit/textarea/TokenMarker.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/textarea/TokenMarker.java 2006-05-29 18:59:39 UTC (rev 69) +++ trunk/daimonin/src/daieditor/textedit/textarea/TokenMarker.java 2006-05-29 19:05:57 UTC (rev 70) @@ -313,6 +313,7 @@ public final void setObj(final Object obj) { this.obj = obj; } + } // class LineInfo } // class TokenMarker This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-05-29 18:59:52
|
Revision: 69 Author: akirschbaum Date: 2006-05-29 11:59:39 -0700 (Mon, 29 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=69&view=rev Log Message: ----------- Replace TAB with spaces. Modified Paths: -------------- trunk/crossfire/src/cfeditor/textedit/textarea/DefaultInputHandler.java trunk/daimonin/src/daieditor/textedit/textarea/DefaultInputHandler.java Modified: trunk/crossfire/src/cfeditor/textedit/textarea/DefaultInputHandler.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/DefaultInputHandler.java 2006-05-29 18:51:18 UTC (rev 68) +++ trunk/crossfire/src/cfeditor/textedit/textarea/DefaultInputHandler.java 2006-05-29 18:59:39 UTC (rev 69) @@ -285,7 +285,7 @@ } } - final String key = keyStroke.substring(index + 1); + final String key = keyStroke.substring(index + 1); if (key.length() == 1) { final char ch = Character.toUpperCase(key.charAt(0)); if (modifiers == 0) { Modified: trunk/daimonin/src/daieditor/textedit/textarea/DefaultInputHandler.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/textarea/DefaultInputHandler.java 2006-05-29 18:51:18 UTC (rev 68) +++ trunk/daimonin/src/daieditor/textedit/textarea/DefaultInputHandler.java 2006-05-29 18:59:39 UTC (rev 69) @@ -282,7 +282,7 @@ } } - final String key = keyStroke.substring(index + 1); + final String key = keyStroke.substring(index + 1); if (key.length() == 1) { final char ch = Character.toUpperCase(key.charAt(0)); if (modifiers == 0) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-05-29 18:51:48
|
Revision: 68 Author: akirschbaum Date: 2006-05-29 11:51:18 -0700 (Mon, 29 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=68&view=rev Log Message: ----------- Unify classes: whitespace changes, add final/static. Modified Paths: -------------- trunk/crossfire/src/cfeditor/textedit/scripteditor/CFPythonPopup.java trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditControl.java trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditMenuBar.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/daimonin/src/daieditor/textedit/scripteditor/CFPythonPopup.java trunk/daimonin/src/daieditor/textedit/scripteditor/ScriptEditControl.java trunk/daimonin/src/daieditor/textedit/scripteditor/ScriptEditMenuBar.java trunk/daimonin/src/daieditor/textedit/scripteditor/ScriptEditView.java trunk/daimonin/src/daieditor/textedit/textarea/CTokenMarker.java trunk/daimonin/src/daieditor/textedit/textarea/DefaultInputHandler.java trunk/daimonin/src/daieditor/textedit/textarea/HTMLTokenMarker.java trunk/daimonin/src/daieditor/textedit/textarea/InputHandler.java Modified: trunk/crossfire/src/cfeditor/textedit/scripteditor/CFPythonPopup.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/scripteditor/CFPythonPopup.java 2006-05-29 08:44:37 UTC (rev 67) +++ trunk/crossfire/src/cfeditor/textedit/scripteditor/CFPythonPopup.java 2006-05-29 18:51:18 UTC (rev 68) @@ -52,8 +52,13 @@ * time consuming task. * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ -public class CFPythonPopup extends JComboBox { +public final class CFPythonPopup extends JComboBox { + /** + * Serial Version UID. + */ + private static final long serialVersionUID = 9041336072540973409L; + private static ScriptEditControl control; // control object // list of menu entries (all CFPython commands) @@ -65,9 +70,9 @@ private int caretPos; // caret position in document where this popup was opened - private static final long serialVersionUID = 9041336072540973409L; - - /** Constructor - builds the CFPython popup menu. */ + /** + * Constructor - builds the CFPython popup menu. + */ public CFPythonPopup() { super(); setBackground(Color.white); // white background @@ -97,10 +102,12 @@ setRequestFocusEnabled(true); } - /** Load the list of CFPython commands from the datafile. */ + /** + * Load the list of CFPython commands from the datafile. + */ public static void loadCommandlist() { CFileReader reader = null; // file reader - Vector cmdList = new Vector(); // temporare list to store commands + final Vector cmdList = new Vector(); // temporare list to store commands int k; try { @@ -113,11 +120,11 @@ } } - String baseDir = (IGUIConstants.isoView ? isoArchDefFolder + File.separator + IGUIConstants.CONFIG_DIR : IGUIConstants.CONFIG_DIR); + final String baseDir = IGUIConstants.isoView ? isoArchDefFolder + File.separator + IGUIConstants.CONFIG_DIR : IGUIConstants.CONFIG_DIR; reader = new CFileReader(baseDir, IGUIConstants.PYTHONMENU_FILE); - String line; // tmp string for reading lines // read file into the cmdList vector: + String line; // tmp string for reading lines line = reader.getReader().readLine(); // read first line while (line != null) { line = line.trim(); @@ -127,8 +134,8 @@ if ((k = line.indexOf("(")) > 0) { line = line.substring(0, k) + "()"; } else { - System.out.println("Parse error in " + IGUIConstants.PYTHONMENU_FILE + ":"); - System.out.println(" \"" + line + "\" missing '()'"); + System.err.println("Parse error in " + IGUIConstants.PYTHONMENU_FILE + ":"); + System.err.println(" \"" + line + "\" missing '()'"); line += "()"; // that line is probably garbage, but will work } cmdList.addElement(line); @@ -141,24 +148,23 @@ // now create the 'menuEntries' array if (cmdList.size() > 0) { - menuEntries = new String[cmdList.size()]; // set array dimensio + menuEntries = new String[cmdList.size()]; // set array dimension for (int i = 0; i < cmdList.size(); i++) { - menuEntries[i] = (String) (cmdList.elementAt(i)); + menuEntries[i] = (String) cmdList.elementAt(i); } - cmdList = null; } // close file reader reader.close(); - } catch (FileNotFoundException e) { - System.out.println("File '" + IGUIConstants.PYTHONMENU_FILE + "' not found."); + } catch (final FileNotFoundException e) { + System.err.println("File '" + IGUIConstants.PYTHONMENU_FILE + "' not found."); return; - } catch (EOFException e) { + } catch (final EOFException e) { // end of file/spell struct reached reader.close(); - } catch (IOException e) { - System.out.println("Cannot read file '" + IGUIConstants.PYTHONMENU_FILE + "'!"); + } catch (final IOException e) { + System.err.println("Cannot read file '" + IGUIConstants.PYTHONMENU_FILE + "'!"); return; } } @@ -168,11 +174,11 @@ * bubblesort because the expected number of objects is low (~300). * @param v Vector to be sorted */ - private static void sortVector(Vector v) { + private static void sortVector(final Vector v) { for (int j = 0; j < v.size() + 1; j++) { for (int i = 0; i < v.size() - 1; i++) { if (((String) v.elementAt(i)).compareToIgnoreCase((String) v.elementAt(i + 1)) > 0) { - Object node = v.elementAt(i); + final Object node = v.elementAt(i); v.setElementAt(v.elementAt(i + 1), i); v.setElementAt(node, i + 1); } @@ -184,7 +190,7 @@ * @return true when this popup menu has been fully initialized and is * ready for use */ - public boolean isInitialized() { + public final boolean isInitialized() { return isReady; } @@ -192,31 +198,33 @@ * Set the caret position where this menu has been invoked. * @param pos caret position in the document */ - public void setCaretPosition(int pos) { + public final void setCaretPosition(final int pos) { this.caretPos = pos; this.getMenu().requestFocus(); control.registerActivePopup(this); } - public CFPythonPopupMenu getMenu() { + public final CFPythonPopupMenu getMenu() { return menu; } // ------------------------ SUBCLASSES ----------------------- - /** Subclass MenuActionListener handles the actionevents for the menu items. */ - private class MenuActionListener implements ActionListener { + /** + * Subclass MenuActionListener handles the actionevents for the menu items. + */ + private final class MenuActionListener implements ActionListener { private final CFPythonPopup popup; private boolean ignore; // while true, all ActionEvents get ignored - public MenuActionListener(CFPythonPopup popup) { + public MenuActionListener(final CFPythonPopup popup) { this.popup = popup; ignore = false; } - public void actionPerformed(ActionEvent e) { + public final void actionPerformed(final ActionEvent e) { if (!ignore) { // get method name to insert String method = popup.getSelectedItem().toString(); @@ -225,8 +233,8 @@ try { // insert method into the document control.getActiveTextArea().getDocument().insertString(caretPos, method, null); - } catch (BadLocationException ex) { - System.out.println("BadLocationException"); + } catch (final BadLocationException ex) { + System.err.println("BadLocationException"); } ignore = true; @@ -235,21 +243,26 @@ popup.getMenu().hide(); // in some JRE versions, this doesn't happen automatically } } - } + } // class MenuActionListener - /** Menu class, inherits from JPopupMenu. */ - public class CFPythonPopupMenu extends BasicComboPopup { + /** + * Menu class, inherits from JPopupMenu. + */ + public static final class CFPythonPopupMenu extends BasicComboPopup { + /** + * Serial Version UID. + */ + private static final long serialVersionUID = -8559415985336516117L; + final JComboBox comboBox; - private static final long serialVersionUID = -8559415985336516117L; - - public CFPythonPopupMenu(JComboBox box) { + public CFPythonPopupMenu(final JComboBox box) { super(box); this.comboBox = box; //this.addMouseListener(new ListenerMenuClick()); this.setPreferredSize(new Dimension(220, 200)); } - } + } // class CFPythonPopupMenu -} +} // class CFPythonPopup Modified: trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditControl.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditControl.java 2006-05-29 08:44:37 UTC (rev 67) +++ trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditControl.java 2006-05-29 18:51:18 UTC (rev 68) @@ -42,7 +42,7 @@ * to the tab bar. * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ -public class ScriptEditControl { +public final class ScriptEditControl { private static final Logger log = Logger.getLogger(ScriptEditControl.class); @@ -64,7 +64,7 @@ private final Vector opened; // open tabs, contains absolute filenames (or "<>") in order left to right /** Constructor is private, instance is created by calling 'init()' */ - private ScriptEditControl(CMainControl m_control) { + private ScriptEditControl(final CMainControl m_control) { opened = new Vector(); // start with empty vector this.m_control = m_control; view = new ScriptEditView(this); // initialize window @@ -75,7 +75,7 @@ * called before once using this class. * @param mapDefFolder map default folder */ - public static void init(String mapDefFolder, CMainControl main_control) { + public static void init(final String mapDefFolder, final CMainControl main_control) { if (instance == null) { isStandAlone = false; instance = new ScriptEditControl(main_control); @@ -88,7 +88,7 @@ * run stand-alone, window close operations will terminate the application. * @param mapDefFolder map default folder */ - private static void init(String mapDefFolder) { + private static void init(final String mapDefFolder) { if (instance == null) { isStandAlone = true; instance = new ScriptEditControl(null); @@ -101,7 +101,7 @@ return instance; } - public boolean isStandAlone() { + public static final boolean isStandAlone() { return isStandAlone; } @@ -109,12 +109,12 @@ * @return instance of cfeditor main control (is null for stand-alone * configuration!) */ - CMainControl getMainControl() { + final CMainControl getMainControl() { return m_control; } /** Notifies that the application is about to exit. */ - public void appExitNotify() { + public final void appExitNotify() { view.appExitNotify(); // notify view } @@ -123,22 +123,26 @@ * popup will be closed (if still open). * @param p active popup to register */ - public void registerActivePopup(CFPythonPopup p) { + public static final void registerActivePopup(final CFPythonPopup p) { activePopup = p; } - /** Open a new empty python script document. */ - public void openScriptNew() { - opened.addElement(new String("<>")); // this script has no filename assigned yet + /** + * Open a new empty Python script document. + */ + public final void openScriptNew() { + opened.addElement("<>"); // this script has no filename assigned yet view.addTab("<New Script>", null); } - /** Open a new empty python script document. */ - public void openScriptFile(String pathname) { - File f = new File(pathname); + /** + * Open a new empty Python script document. + */ + public final void openScriptFile(final String pathname) { + final File f = new File(pathname); if (f.exists() && f.isFile()) { - opened.addElement(new String(f.getAbsolutePath())); + opened.addElement(f.getAbsolutePath()); view.addTab(f.getName(), f); } else { if (log.isInfoEnabled()) { @@ -148,9 +152,11 @@ } } - /** Open a file which is chosen by the user. */ - public void openUserWanted() { - JFileChooser fileChooser = new JFileChooser(); + /** + * Open a file which is chosen by the user. + */ + public final void openUserWanted() { + final JFileChooser fileChooser = new JFileChooser(); fileChooser.setDialogTitle("Open Script File"); fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); fileChooser.setMultiSelectionEnabled(false); @@ -159,14 +165,14 @@ fileChooser.setFileFilter(new FileFilterPython()); // set default folder for new scripts - File baseDir = new File(defaultScriptDir); + final File baseDir = new File(defaultScriptDir); if (baseDir != null && baseDir.exists() && baseDir.isDirectory()) { fileChooser.setCurrentDirectory(baseDir); } - int returnVal = fileChooser.showOpenDialog(view); + final int returnVal = fileChooser.showOpenDialog(view); if (returnVal == JFileChooser.APPROVE_OPTION) { - File file = fileChooser.getSelectedFile(); + final File file = fileChooser.getSelectedFile(); if (file.exists() && !file.isDirectory()) { // everything okay do far, now open up that scriptfile openScriptFile(file.getAbsolutePath()); @@ -177,8 +183,10 @@ } } - /** Close the active script-tab. */ - public void closeActiveTab() { + /** + * Close the active script-tab. + */ + public final void closeActiveTab() { if (view.getSelectedIndex() >= 0 && opened.size() > 0) { opened.removeElementAt(view.getSelectedIndex()); // dump the filename } @@ -200,8 +208,10 @@ } } - /** Close all opened script-tabs. */ - public void closeAllTabs() { + /** + * Close all opened script-tabs. + */ + public final void closeAllTabs() { // simply keep closing active tabs till none are left while (view.getSelectedIndex() >= 0 || opened.size() > 0) { closeActiveTab(); @@ -212,14 +222,14 @@ * Open a filebrowser and prompt the user for a location/name to store this * file. If everything goes fine, the file is saved. */ - public void saveAsActiveTab() { - String activePath = getActiveFilePath(); // active file path ('null' if undefined) - String text = getActiveTextArea().getText(); // Store text data to ensure that the right text is saved later. + public final void saveAsActiveTab() { + final String activePath = getActiveFilePath(); // active file path ('null' if undefined) + final String text = getActiveTextArea().getText(); // Store text data to ensure that the right text is saved later. // User could switch tabs or type text in the meantime, who knows. - int tabIndex = view.getSelectedIndex(); // save tab-index of this script + final int tabIndex = view.getSelectedIndex(); // save tab-index of this script // create the file-chooser dialog: - JFileChooser fileChooser = new JFileChooser(); + final JFileChooser fileChooser = new JFileChooser(); fileChooser.setDialogTitle("Save Script File As"); fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); fileChooser.setMultiSelectionEnabled(false); @@ -229,7 +239,7 @@ // if file already exists, select it if (activePath != null) { - File f = new File(activePath); + final File f = new File(activePath); if (f != null && f.getParentFile().exists() && f.getParentFile().isDirectory()) { fileChooser.setCurrentDirectory(f.getParentFile()); @@ -237,26 +247,23 @@ } } else { // set default folder for new scripts - File baseDir = new File(defaultScriptDir); + final File baseDir = new File(defaultScriptDir); if (baseDir != null && baseDir.exists() && baseDir.isDirectory()) { fileChooser.setCurrentDirectory(baseDir); } } - int returnVal = fileChooser.showSaveDialog(view); + final int returnVal = fileChooser.showSaveDialog(view); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); if (!file.getName().endsWith(".py")) { // We have to attach the ".py" ending to this file - String fname = file.getAbsolutePath(); - file = null; + final String fname = file.getAbsolutePath(); file = new File(fname + ".py"); } // now it is our duty to doublecheck if user attempts to overwrite - if (!file.exists() || (activePath != null && file.getAbsolutePath().equals(activePath)) || - view.askConfirm("Overwrite?", "A file named \"" + file.getName() + "\" already exists.\n" + - "Are you sure you want to overwrite it?")) { + if (!file.exists() || (activePath != null && file.getAbsolutePath().equals(activePath)) || view.askConfirm("Overwrite?", "A file named \"" + file.getName() + "\" already exists.\n" + "Are you sure you want to overwrite it?")) { // looks like we can finally save the data saveTextToFile(file, text); @@ -267,7 +274,7 @@ //String path = (String)(opened.elementAt(tabIndex)); // set new path - opened.setElementAt(new String(file.getAbsolutePath()), tabIndex); + opened.setElementAt(file.getAbsolutePath(), tabIndex); view.setTitleAt(tabIndex, file.getName()); view.refreshMenuBar(); @@ -276,13 +283,15 @@ } } - /** Save the active script-tab to the stored filepath. */ - public void saveActiveTab() { + /** + * Save the active script-tab to the stored filepath. + */ + public final void saveActiveTab() { if (getActiveFilePath() != null) { - File f = new File(getActiveFilePath()); // get active path + final File f = new File(getActiveFilePath()); // get active path saveTextToFile(f, getActiveTextArea().getText()); // write text to file } else { - System.out.println("ScriptEditControl.saveActiveTab(): Cannot save file without name!"); + System.err.println("ScriptEditControl.saveActiveTab(): Cannot save file without name!"); // Path is missing? This shouldn't happen, but let's do a saveAs instead... saveAsActiveTab(); } @@ -293,7 +302,7 @@ * @param f text gets saved into this file * @param text text to be saved */ - public void saveTextToFile(File f, String text) { + public final void saveTextToFile(final File f, String text) { if (text == null) { text = ""; } @@ -303,35 +312,38 @@ if (!f.exists()) { if (!f.createNewFile()) { // failed to create new file - System.out.println("Couldn't create file '" + f.getName() + "'!"); + System.err.println("Couldn't create file '" + f.getName() + "'!"); } } - FileWriter fwrite = new FileWriter(f); + final FileWriter fwrite = new FileWriter(f); fwrite.write(text); fwrite.close(); - } catch (IOException e) { + } catch (final IOException e) { // tell the user because it is important to know that saving failed - view.showMessage("Write Error", "The file \"" + f.getName() + "\" could not be written.\n" + - "Please use the 'Save As...' menu.", JOptionPane.ERROR_MESSAGE); + view.showMessage("Write Error", "The file \"" + f.getName() + "\" could not be written.\nPlease use the 'Save As...' menu.", JOptionPane.ERROR_MESSAGE); } } else { - System.out.println("ScriptEditControl.saveTextToFile(): Cannot save - File is NULL!"); + System.err.println("ScriptEditControl.saveTextToFile(): Cannot save - File is NULL!"); } } - /** @return currently active JEditTextArea, or null if none are open */ - JEditTextArea getActiveTextArea() { + /** + * @return currently active JEditTextArea, or null if none are open + */ + final JEditTextArea getActiveTextArea() { return view.getActiveTextArea(); } - /** @return file path of active tab, null if no path is available */ - String getActiveFilePath() { + /** + * @return file path of active tab, null if no path is available + */ + final String getActiveFilePath() { if (view != null && opened != null && view.getSelectedIndex() >= 0 && opened.size() > 0) { // get stored path - String path = (String) (opened.elementAt(view.getSelectedIndex())); + final String path = (String) opened.elementAt(view.getSelectedIndex()); if (path == null || path.length() == 0 || path.equals("<>")) { return null; @@ -342,13 +354,18 @@ return null; } - /** Global font has been changed, update the menu bar */ + /** + * Global font has been changed, update the menu bar. + */ public void updateGlobalFont() { view.updateGlobalFont(); } - /** Main method for testing purpose. */ - public static void main(String[] args) { + /** + * Main method for testing purpose. + * @param args + */ + public static void main(final String[] args) { init(System.getProperty("user.dir")); getInstance().openScriptNew(); getInstance().openScriptNew(); @@ -367,8 +384,9 @@ return "*.py"; } - public boolean accept(File f) { + public boolean accept(final File f) { return f.isDirectory() || f.getName().endsWith(".py"); } } -} + +} // class ScriptEditControl Modified: trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditMenuBar.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditMenuBar.java 2006-05-29 08:44:37 UTC (rev 67) +++ trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditMenuBar.java 2006-05-29 18:51:18 UTC (rev 68) @@ -25,10 +25,10 @@ import cfeditor.textedit.textarea.InputHandler; import cfeditor.textedit.textarea.JEditTextArea; -import java.awt.Event; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; +import java.awt.Event; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; @@ -39,10 +39,13 @@ * This class implements the MenuBar of the script editor. * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ -public class ScriptEditMenuBar extends JMenuBar { +public final class ScriptEditMenuBar extends JMenuBar { private static final Logger log = Logger.getLogger(ScriptEditMenuBar.class); + /** Serial Version UID. */ + private static final long serialVersionUID = -7022723165514964970L; + private final ScriptEditControl control; // controler object // File menu: @@ -78,10 +81,11 @@ private JMenuItem m_colors; - private static final long serialVersionUID = -7022723165514964970L; - - /** Constructor - Builds the MenuBar. */ - public ScriptEditMenuBar(ScriptEditControl control) { + /** + * Constructor - Builds the MenuBar. + * @param control + */ + public ScriptEditMenuBar(final ScriptEditControl control) { this.control = control; // reference to ScriptEditControl control buildFileMenu(); buildEditMenu(); @@ -89,14 +93,16 @@ refresh(); } - /** Build File menu. */ + /** + * Build File menu. + */ private void buildFileMenu() { menu_file = new JMenu("File"); m_new = new JMenuItem("New Script"); m_new.setMnemonic('N'); m_new.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent event) { + public void actionPerformed(final ActionEvent event) { // open new script control.openScriptNew(); } @@ -106,7 +112,7 @@ m_open = new JMenuItem("Open"); m_open.setMnemonic('O'); m_open.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent event) { + public void actionPerformed(final ActionEvent event) { // open new script control.openUserWanted(); } @@ -119,7 +125,7 @@ //m_save.setIcon(CGUIUtils.getIcon(IGUIConstants.SAVE_LEVEL_SMALLICON)); m_save_as.setMnemonic('v'); m_save_as.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent event) { + public void actionPerformed(final ActionEvent event) { // save as control.saveAsActiveTab(); } @@ -129,10 +135,9 @@ m_save = new JMenuItem("Save"); //m_save.setIcon(CGUIUtils.getIcon(IGUIConstants.SAVE_LEVEL_SMALLICON)); m_save.setMnemonic('S'); - m_save.setAccelerator( - KeyStroke.getKeyStroke(KeyEvent.VK_S, Event.CTRL_MASK)); + m_save.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, Event.CTRL_MASK)); m_save.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent event) { + public void actionPerformed(final ActionEvent event) { // save control.saveActiveTab(); } @@ -145,7 +150,7 @@ m_close.setMnemonic('C'); m_close.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, Event.CTRL_MASK)); m_close.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent event) { + public void actionPerformed(final ActionEvent event) { // close control.closeActiveTab(); } @@ -155,7 +160,7 @@ m_close_all = new JMenuItem("Close All"); m_close_all.setMnemonic('l'); m_close_all.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent event) { + public void actionPerformed(final ActionEvent event) { // close control.closeAllTabs(); } @@ -165,7 +170,9 @@ add(menu_file); } - /** Build Edit Menu. */ + /** + * Build Edit Menu. + */ private void buildEditMenu() { menu_edit = new JMenu("Edit"); @@ -173,9 +180,9 @@ m_cut.setMnemonic('t'); m_cut.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, Event.CTRL_MASK)); m_cut.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent event) { + public void actionPerformed(final ActionEvent event) { // cut - JEditTextArea activeTA = control.getActiveTextArea(); + final JEditTextArea activeTA = control.getActiveTextArea(); if (activeTA != null) { InputHandler.getAction("cut").actionPerformed(new ActionEvent(activeTA, 0, "cut")); } @@ -187,9 +194,9 @@ m_copy.setMnemonic('C'); m_copy.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, Event.CTRL_MASK)); m_copy.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent event) { + public void actionPerformed(final ActionEvent event) { // copy - JEditTextArea activeTA = control.getActiveTextArea(); + final JEditTextArea activeTA = control.getActiveTextArea(); if (activeTA != null) { InputHandler.getAction("copy").actionPerformed(new ActionEvent(activeTA, 0, "copy")); } @@ -201,9 +208,9 @@ m_paste.setMnemonic('P'); m_paste.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, Event.CTRL_MASK)); m_paste.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent event) { + public void actionPerformed(final ActionEvent event) { // paste - JEditTextArea activeTA = control.getActiveTextArea(); + final JEditTextArea activeTA = control.getActiveTextArea(); if (activeTA != null) { InputHandler.getAction("paste").actionPerformed(new ActionEvent(activeTA, 0, "paste")); } @@ -217,7 +224,7 @@ m_find.setMnemonic('F'); m_find.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F, Event.CTRL_MASK)); m_find.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent event) { + public void actionPerformed(final ActionEvent event) { // find if (log.isInfoEnabled()) { log.info("find..."); @@ -229,14 +236,16 @@ add(menu_edit); } - /** Build Edit Menu */ + /** + * Build Edit Menu. + */ private void buildSettingsMenu() { menu_settings = new JMenu("Settings"); m_font = new JMenuItem("Font"); m_font.setMnemonic('F'); m_font.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent event) { + public void actionPerformed(final ActionEvent event) { // set font } }); @@ -245,7 +254,7 @@ m_colors = new JMenuItem("Colors"); m_colors.setMnemonic('C'); m_colors.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent event) { + public void actionPerformed(final ActionEvent event) { // set colors } }); @@ -254,8 +263,10 @@ add(menu_settings); } - /** Refreshes the enable/disable state of all menus. */ - public void refresh() { + /** + * Refreshes the enable/disable state of all menus. + */ + public final void refresh() { m_find.setEnabled(false); m_colors.setEnabled(false); m_font.setEnabled(false); @@ -268,7 +279,7 @@ * Redraws the whole menu with latest custom fonts. * @param do_redraw if true, menu is redrawn at the end */ - public void updateFont(boolean do_redraw) { + public void updateFont(final boolean do_redraw) { if (!control.isStandAlone()) { // File menu: control.getMainControl().setBoldFont(menu_file); @@ -300,4 +311,5 @@ } } } -} + +} // class ScriptEditMenuBar Modified: trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditView.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditView.java 2006-05-29 08:44:37 UTC (rev 67) +++ trunk/crossfire/src/cfeditor/textedit/scripteditor/ScriptEditView.java 2006-05-29 18:51:18 UTC (rev 68) @@ -54,14 +54,17 @@ * ScriptEditControl. No other class should refer to it. * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ -public class ScriptEditView extends JFrame { +public final class ScriptEditView extends JFrame { private static final Logger log = Logger.getLogger(ScriptEditView.class); - /** key used to store the main windows X-coordinate to settings-file. */ + /** Serial Version UID. */ + private static final long serialVersionUID = 1L; + + /** key used to store the main windows x-coordinate to settings-file. */ private static final String WINDOW_X = "ScriptPadWindow.x"; - /** key used to store the main windows Y-coordinate to settings-file. */ + /** key used to store the main windows y-coordinate to settings-file. */ private static final String WINDOW_Y = "ScriptPadWindow.y"; /** key used to store the main windows width to settings-file. */ @@ -78,10 +81,10 @@ private final Vector textAreas; // list of 'JEditTextArea' objects, same order as tabs - private static final long serialVersionUID = -8476542220406619382L; - - /** Build frame but keep it hidden (it is shown when first file is opened). */ - public ScriptEditView(ScriptEditControl control) { + /** + * Build frame but keep it hidden (it is shown when first file is opened). + */ + public ScriptEditView(final ScriptEditControl control) { super("Script Pad"); // window title setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); @@ -94,7 +97,7 @@ tabPane.addChangeListener(new EditTabListener(control, this)); // set the window icon - ImageIcon icon = CGUIUtils.getIcon("Script.gif"); + final ImageIcon icon = CGUIUtils.getIcon("Script.gif"); if (icon != null) { setIconImage(icon.getImage()); } @@ -103,16 +106,16 @@ addWindowListener(new EditWindowListener(control)); // add listener for close box // calculate some default values in case there is no settings file - Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); - int defwidth = (int) (0.6 * screen.getWidth()); - int defheight = (int) (0.8 * screen.getHeight()); + final Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); + final int defwidth = (int) (0.6 * screen.getWidth()); + final int defheight = (int) (0.8 * screen.getHeight()); // get the old location and size - CSettings settings = CSettings.getInstance(IGUIConstants.APP_NAME); - int x = Integer.parseInt(settings.getProperty(WINDOW_X, "" + (int) ((screen.getWidth() - defwidth) / 2.))); - int y = Integer.parseInt(settings.getProperty(WINDOW_Y, "" + (int) ((screen.getHeight() - defheight) / 2.))); - int width = Integer.parseInt(settings.getProperty(WINDOW_WIDTH, "" + defwidth)); - int height = Integer.parseInt(settings.getProperty(WINDOW_HEIGHT, "" + defheight)); + final CSettings settings = CSettings.getInstance(IGUIConstants.APP_NAME); + final int x = Integer.parseInt(settings.getProperty(WINDOW_X, "" + (int) ((screen.getWidth() - defwidth) / 2.))); + final int y = Integer.parseInt(settings.getProperty(WINDOW_Y, "" + (int) ((screen.getHeight() - defheight) / 2.))); + final int width = Integer.parseInt(settings.getProperty(WINDOW_WIDTH, "" + defwidth)); + final int height = Integer.parseInt(settings.getProperty(WINDOW_HEIGHT, "" + defheight)); this.setBounds(x, y, width, height); } @@ -122,8 +125,8 @@ * @param title title of this script (filename) * @param f file where this script is stored, null if new script opened */ - public void addTab(String title, File f) { - JEditTextArea ta = new JEditTextArea(); // open new TextArea + public final void addTab(final String title, final File f) { + final JEditTextArea ta = new JEditTextArea(); // open new TextArea //ta.setFont(new Font("Courier New", Font.PLAIN, 12)); ta.setDocument(new SyntaxDocument()); ta.getDocument().setTokenMarker(new PythonTokenMarker()); @@ -153,17 +156,16 @@ BufferedReader bfread = new BufferedReader(fread); boolean firstLine = true; + final StringBuffer buff = new StringBuffer(""); String line = bfread.readLine(); - StringBuffer buff = new StringBuffer(""); while (line != null) { if (!firstLine) { - buff.append("\n"); + buff.append('\n'); } else { firstLine = false; } buff.append(line); line = bfread.readLine(); - } // close filestreams @@ -172,11 +174,11 @@ // insert buffer into the document ta.getDocument().insertString(0, buff.toString(), null); - } catch (FileNotFoundException e) { + } catch (final FileNotFoundException e) { log.info("addTab(): File '" + f.getName() + "' not found."); - } catch (IOException e) { + } catch (final IOException e) { log.info("addTab(): I/O-Error while reading '" + f.getName() + "'."); - } catch (BadLocationException e) { + } catch (final BadLocationException e) { log.info("addTab(): Bad Location in Document!"); } } @@ -188,8 +190,10 @@ refreshMenuBar(); } - /** Close the active script-tab. */ - public void closeActiveTab() { + /** + * Close the active script-tab. + */ + public final void closeActiveTab() { if (textAreas.size() > 0) { // remove textArea textAreas.removeElementAt(tabPane.getSelectedIndex()); @@ -199,8 +203,10 @@ } } - /** @return the currently active TextArea (in front) */ - public JEditTextArea getActiveTextArea() { + /** + * @return the currently active TextArea (in front) + */ + public final JEditTextArea getActiveTextArea() { if (getTabCount() > 0) { return (JEditTextArea) (textAreas.elementAt(tabPane.getSelectedIndex())); } @@ -208,13 +214,17 @@ return null; // no window is open } - /** @return index of selected tab pane */ - public int getSelectedIndex() { + /** + * @return index of selected tab pane + */ + public final int getSelectedIndex() { return tabPane.getSelectedIndex(); } - /** @return number of open tabs. */ - public int getTabCount() { + /** + * @return number of open tabs + */ + public final int getTabCount() { return tabPane.getTabCount(); } @@ -223,16 +233,20 @@ * @param index index of the tab to change title * @param title new title string */ - public void setTitleAt(int index, String title) { + public final void setTitleAt(final int index, final String title) { tabPane.setTitleAt(index, title); } - /** Refresh the menu bar (update enable/disable state of all menus). */ + /** + * Refresh the menu bar (update enable/disable state of all menus). + */ public void refreshMenuBar() { menuBar.updateFont(true); } - /** Update the global fonts (-> menu bar and tab labels). */ + /** + * Update the global fonts (-> menu bar and tab labels). + */ public void updateGlobalFont() { if (!control.isStandAlone()) { control.getMainControl().setBoldFont(tabPane); @@ -250,22 +264,21 @@ * @return true if the user agrees, false if user disagrees */ public boolean askConfirm(String title, String message) { - return JOptionPane.showConfirmDialog(this, message, title, - JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE) == JOptionPane.YES_OPTION; + return JOptionPane.showConfirmDialog(this, message, title, JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE) == JOptionPane.YES_OPTION; } /** * Shows the given message in the UI. * @param title the title of the message * @param message the message to be shown - * @param messageType Type of message (see JOptionPane constants), defines + * @param messageType type of message (see JOptionPane constants), defines * icon used */ - public void showMessage(String title, String message, int messageType) { + public final void showMessage(final String title, final String message, final int messageType) { JOptionPane.showMessageDialog(this, message, title, messageType); } - public void showMessage(String title, String message) { + public final void showMessage(final String title, final String message) { JOptionPane.showMessageDialog(this, message, title, JOptionPane.INFORMATION_MESSAGE); } @@ -273,10 +286,10 @@ * Notifies that the application is about to exit. The window settings get * saved to the settings file here. */ - void appExitNotify() { + final void appExitNotify() { // store location and size - CSettings settings = CSettings.getInstance(IGUIConstants.APP_NAME); - Rectangle bounds = getBounds(); // window frame bounds + final CSettings settings = CSettings.getInstance(IGUIConstants.APP_NAME); + final Rectangle bounds = getBounds(); // window frame bounds settings.setProperty(WINDOW_X, "" + bounds.x); settings.setProperty(WINDOW_Y, "" + bounds.y); settings.setProperty(WINDOW_WIDTH, "" + bounds.width); @@ -285,40 +298,45 @@ // -------------------------------------- - /** Subclass: Listener for ChangeEvents in the tabPane. */ - private class EditTabListener implements ChangeListener { + /** + * Subclass: Listener for ChangeEvents in the tabPane. + */ + private final class EditTabListener implements ChangeListener { - ScriptEditControl control; // controler + final ScriptEditControl control; // controler - ScriptEditView view; // view + final ScriptEditView view; // view int index; // index of selected tab - public EditTabListener(ScriptEditControl control, ScriptEditView view) { + public EditTabListener(final ScriptEditControl control, final ScriptEditView view) { this.control = control; this.view = view; index = view.getSelectedIndex(); } - public void stateChanged(ChangeEvent e) { + public final void stateChanged(final ChangeEvent e) { if (index != view.getSelectedIndex()) { // active selected tab has changed menuBar.refresh(); // refresh state of menus index = view.getSelectedIndex(); // update index } } - } - /** Subclass: Listener for closebox on the window. */ - private class EditWindowListener implements WindowListener { + } // class EditTabListener - ScriptEditControl control; // controler + /** + * Subclass: Listener for closebox on the window. + */ + private static final class EditWindowListener implements WindowListener { + final ScriptEditControl control; // controller + /** * Constructor. * @param control ScriptEditControl */ - public EditWindowListener(ScriptEditControl control) { + public EditWindowListener(final ScriptEditControl control) { this.control = control; } @@ -326,27 +344,29 @@ * Window closebox has been clicked. * @param e WindowEvent */ - public void windowClosing(WindowEvent e) { + public final void windowClosing(final WindowEvent e) { control.closeAllTabs(); } - public void windowClosed(WindowEvent e) { + public final void windowClosed(final WindowEvent e) { control.closeAllTabs(); // (just make sure tabs are removed...) } - public void windowActivated(WindowEvent e) { + public void windowActivated(final WindowEvent e) { } - public void windowDeactivated(WindowEvent e) { + public void windowDeactivated(final WindowEvent e) { } - public void windowDeiconified(WindowEvent e) { + public void windowDeiconified(final WindowEvent e) { } - public void windowIconified(WindowEvent e) { + public void windowIconified(final WindowEvent e) { } - public void windowOpened(WindowEvent e) { + public void windowOpened(final WindowEvent e) { } - } -} + + } // class EditWindowListener + +} // class ScriptEditView Modified: trunk/crossfire/src/cfeditor/textedit/textarea/CTokenMarker.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/CTokenMarker.java 2006-05-29 08:44:37 UTC (rev 67) +++ trunk/crossfire/src/cfeditor/textedit/textarea/CTokenMarker.java 2006-05-29 18:51:18 UTC (rev 68) @@ -22,24 +22,24 @@ this(true, getKeywords()); } - public CTokenMarker(boolean cpp, KeywordMap keywords) { + public CTokenMarker(final boolean cpp, final KeywordMap keywords) { this.cpp = cpp; this.keywords = keywords; } - public byte markTokensImpl(byte token, Segment line, int lineIndex) { - char[] array = line.array; - int offset = line.offset; + public final byte markTokensImpl(byte token, final Segment line, final int lineIndex) { + final char[] array = line.array; + final int offset = line.offset; lastOffset = offset; lastKeyword = offset; - int length = line.count + offset; + final int length = line.count + offset; boolean backslash = false; loop: for (int i = offset; i < length; i++) { - int i1 = i + 1; + final int i1 = i + 1; - char c = array[i]; + final char c = array[i]; if (c == '\\') { backslash = !backslash; continue; @@ -57,7 +57,8 @@ } addToken(i - lastOffset, token); addToken(length - i, Token.KEYWORD2); - lastOffset = lastKeyword = length; + lastOffset = length; + lastKeyword = length; break loop; } break; @@ -69,7 +70,8 @@ } else { addToken(i - lastOffset, token); token = Token.LITERAL1; - lastOffset = lastKeyword = i; + lastOffset = i; + lastKeyword = i; } break; @@ -80,7 +82,8 @@ } else { addToken(i - lastOffset, token); token = Token.LITERAL2; - lastOffset = lastKeyword = i; + lastOffset = i; + lastKeyword = i; } break; @@ -91,7 +94,8 @@ } backslash = false; addToken(i1 - lastOffset, Token.LABEL); - lastOffset = lastKeyword = i1; + lastOffset = i1; + lastKeyword = i1; } else if (doKeyword(line, i, c)) { break; } @@ -104,7 +108,8 @@ switch (array[i1]) { case '*': addToken(i - lastOffset, token); - lastOffset = lastKeyword = i; + lastOffset = i; + lastKeyword = i; if (length - i > 2 && array[i + 2] == '*') { token = Token.COMMENT2; } else { @@ -115,7 +120,8 @@ case '/': addToken(i - lastOffset, token); addToken(length - i, Token.COMMENT1); - lastOffset = lastKeyword = length; + lastOffset = length; + lastKeyword = length; break loop; } } @@ -136,9 +142,10 @@ if (c == '*' && length - i > 1) { if (array[i1] == '/') { i++; - addToken((i + 1) - lastOffset, token); + addToken(i + 1 - lastOffset, token); token = Token.NULL; - lastOffset = lastKeyword = i + 1; + lastOffset = i + 1; + lastKeyword = i + 1; } } break; @@ -149,7 +156,8 @@ } else if (c == '"') { addToken(i1 - lastOffset, token); token = Token.NULL; - lastOffset = lastKeyword = i1; + lastOffset = i1; + lastKeyword = i1; } break; @@ -159,7 +167,8 @@ } else if (c == '\'') { addToken(i1 - lastOffset, Token.LITERAL1); token = Token.NULL; - lastOffset = lastKeyword = i1; + lastOffset = i1; + lastKeyword = i1; } break; @@ -185,6 +194,7 @@ token = Token.NULL; } + // @devs what is with this fallthrough? Intention or Accident? default: addToken(length - lastOffset, token); break; @@ -253,11 +263,11 @@ private int lastKeyword; - private boolean doKeyword(Segment line, int i, char c) { - int i1 = i + 1; + private boolean doKeyword(final Segment line, final int i, final char c) { + final int i1 = i + 1; - int len = i - lastKeyword; - byte id = keywords.lookup(line, lastKeyword, len); + final int len = i - lastKeyword; + final byte id = keywords.lookup(line, lastKeyword, len); if (id != Token.NULL) { if (lastKeyword != lastOffset) { addToken(lastKeyword - lastOffset, Token.NULL); Modified: trunk/crossfire/src/cfeditor/textedit/textarea/DefaultInputHandler.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/DefaultInputHandler.java 2006-05-29 08:44:37 UTC (rev 67) +++ trunk/crossfire/src/cfeditor/textedit/textarea/DefaultInputHandler.java 2006-05-29 18:51:18 UTC (rev 68) @@ -25,16 +25,25 @@ * @author <a href="mailto:and...@gm...">Andreas Vogl</a> * @version $Id: DefaultInputHandler.java,v 1.7 2006/03/26 00:48:57 akirschbaum Exp $ */ -public class DefaultInputHandler extends InputHandler { +public final class DefaultInputHandler extends InputHandler { + private Hashtable bindings; + + private Hashtable currentBindings; + private static final Logger log = Logger.getLogger(DefaultInputHandler.class); - /** Creates a new input handler with no key bindings defined. */ + /** + * Creates a new input handler with no key bindings defined. + */ public DefaultInputHandler() { - bindings = currentBindings = new Hashtable(); + currentBindings = new Hashtable(); + bindings = currentBindings; } - /** Sets up the default key bindings. */ + /** + * Sets up the default key bindings. + */ public void addDefaultKeyBindings() { addKeyBinding("BACK_SPACE", BACKSPACE); addKeyBinding("C+BACK_SPACE", BACKSPACE_WORD); @@ -93,12 +102,12 @@ * @param keyBinding the key binding * @param action the action */ - public void addKeyBinding(String keyBinding, ActionListener action) { + public void addKeyBinding(final String keyBinding, final ActionListener action) { Hashtable current = bindings; - StringTokenizer st = new StringTokenizer(keyBinding); + final StringTokenizer st = new StringTokenizer(keyBinding); while (st.hasMoreTokens()) { - KeyStroke keyStroke = parseKeyStroke(st.nextToken()); + final KeyStroke keyStroke = parseKeyStroke(st.nextToken()); if (keyStroke == null) { return; } @@ -123,7 +132,7 @@ * implemented. * @param keyBinding the key binding */ - public void removeKeyBinding(String keyBinding) { + public void removeKeyBinding(final String keyBinding) { throw new InternalError("Not yet implemented"); } @@ -144,9 +153,9 @@ * Handle a key pressed event. This will look up the binding for the key * stroke and execute it. */ - public void keyPressed(KeyEvent evt) { - int keyCode = evt.getKeyCode(); - int modifiers = evt.getModifiers(); + public void keyPressed(final KeyEvent evt) { + final int keyCode = evt.getKeyCode(); + final int modifiers = evt.getModifiers(); if (keyCode == KeyEvent.VK_CONTROL || keyCode == KeyEvent.VK_SHIFT @@ -167,8 +176,8 @@ return; } - KeyStroke keyStroke = KeyStroke.getKeyStroke(keyCode, modifiers); - Object o = currentBindings.get(keyStroke); + final KeyStroke keyStroke = KeyStroke.getKeyStroke(keyCode, modifiers); + final Object o = currentBindings.get(keyStroke); if (o == null) { // Don't beep if the user presses some // key we don't know about unless a @@ -186,9 +195,7 @@ return; } else if (o instanceof ActionListener) { currentBindings = bindings; - - executeAction(((ActionListener) o), evt.getSource(), null); - + executeAction((ActionListener) o, evt.getSource(), null); evt.consume(); return; } else if (o instanceof Hashtable) { @@ -199,16 +206,17 @@ } } - /** Handle a key typed event. This inserts the key into the text area. */ - public void keyTyped(KeyEvent evt) { - int modifiers = evt.getModifiers(); - char c = evt.getKeyChar(); + /** + * Handle a key typed event. This inserts the key into the text area. + */ + public void keyTyped(final KeyEvent evt) { + final int modifiers = evt.getModifiers(); + final char c = evt.getKeyChar(); if (c != KeyEvent.CHAR_UNDEFINED && (modifiers & KeyEvent.ALT_MASK) == 0) { if (c >= 0x20 && c != 0x7f) { - KeyStroke keyStroke = KeyStroke.getKeyStroke( - Character.toUpperCase(c)); - Object o = currentBindings.get(keyStroke); + final KeyStroke keyStroke = KeyStroke.getKeyStroke(Character.toUpperCase(c)); + final Object o = currentBindings.get(keyStroke); if (o instanceof Hashtable) { currentBindings = (Hashtable) o; @@ -231,7 +239,7 @@ // 0-9 adds another 'digit' to the repeat number if (repeat && Character.isDigit(c)) { repeatCount *= 10; - repeatCount += (c - '0'); + repeatCount += c - '0'; return; } @@ -251,13 +259,13 @@ * <code>KeyEvent</code> class, without the <code>VK_</code> prefix. * @param keyStroke a string description of the key stroke */ - public static KeyStroke parseKeyStroke(String keyStroke) { + public static KeyStroke parseKeyStroke(final String keyStroke) { if (keyStroke == null) { return null; } int modifiers = 0; - int index = keyStroke.indexOf('+'); + final int index = keyStroke.indexOf('+'); if (index != -1) { for (int i = 0; i < index; i++) { switch (Character.toUpperCase(keyStroke.charAt(i))) { @@ -276,9 +284,10 @@ } } } - String key = keyStroke.substring(index + 1); + + final String key = keyStroke.substring(index + 1); if (key.length() == 1) { - char ch = Character.toUpperCase(key.charAt(0)); + final char ch = Character.toUpperCase(key.charAt(0)); if (modifiers == 0) { return KeyStroke.getKeyStroke(ch); } else { @@ -288,12 +297,11 @@ log.error("Invalid key stroke: " + keyStroke); return null; } else { - int ch; + final int ch; try { - ch = KeyEvent.class.getField("VK_".concat(key)) - .getInt(null); - } catch (Exception e) { + ch = KeyEvent.class.getField("VK_".concat(key)).getInt(null); + } catch (final Exception e) { log.error("Invalid key stroke: " + keyStroke); return null; } @@ -302,12 +310,9 @@ } } - // private members - private Hashtable bindings; + private DefaultInputHandler(final DefaultInputHandler copy) { + currentBindings = copy.bindings; + bindings = currentBindings; + } - private Hashtable currentBindings; - - private DefaultInputHandler(DefaultInputHandler copy) { - bindings = currentBindings = copy.bindings; - } -} +} // class DefaultInputHandler Modified: trunk/crossfire/src/cfeditor/textedit/textarea/HTMLTokenMarker.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/HTMLTokenMarker.java 2006-05-29 08:44:37 UTC (rev 67) +++ trunk/crossfire/src/cfeditor/textedit/textarea/HTMLTokenMarker.java 2006-05-29 18:51:18 UTC (rev 68) @@ -24,24 +24,24 @@ this(true); } - public HTMLTokenMarker(boolean js) { + public HTMLTokenMarker(final boolean js) { this.js = js; keywords = JavaScriptTokenMarker.getKeywords(); } - public byte markTokensImpl(byte token, Segment line, int lineIndex) { - char[] array = line.array; - int offset = line.offset; + public final byte markTokensImpl(byte token, final Segment line, final int lineIndex) { + final char[] array = line.array; + final int offset = line.offset; lastOffset = offset; lastKeyword = offset; - int length = line.c... [truncated message content] |
From: <aki...@us...> - 2006-05-29 08:45:05
|
Revision: 67 Author: akirschbaum Date: 2006-05-29 01:44:37 -0700 (Mon, 29 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=67&view=rev Log Message: ----------- Unified classes: whitespace changes, add final/static. Modified Paths: -------------- trunk/crossfire/src/cfeditor/textedit/textarea/JEditTextArea.java trunk/crossfire/src/cfeditor/textedit/textarea/JavaScriptTokenMarker.java trunk/crossfire/src/cfeditor/textedit/textarea/KeywordMap.java trunk/crossfire/src/cfeditor/textedit/textarea/SyntaxDocument.java trunk/crossfire/src/cfeditor/textedit/textarea/SyntaxStyle.java trunk/crossfire/src/cfeditor/textedit/textarea/SyntaxUtilities.java trunk/crossfire/src/cfeditor/textedit/textarea/TextAreaDefaults.java trunk/crossfire/src/cfeditor/textedit/textarea/TextAreaPainter.java trunk/crossfire/src/cfeditor/textedit/textarea/TextUtilities.java trunk/crossfire/src/cfeditor/textedit/textarea/Token.java trunk/crossfire/src/cfeditor/textedit/textarea/XMLTokenMarker.java trunk/daimonin/src/daieditor/textedit/textarea/JEditTextArea.java trunk/daimonin/src/daieditor/textedit/textarea/KeywordMap.java trunk/daimonin/src/daieditor/textedit/textarea/SyntaxDocument.java trunk/daimonin/src/daieditor/textedit/textarea/SyntaxStyle.java trunk/daimonin/src/daieditor/textedit/textarea/SyntaxUtilities.java trunk/daimonin/src/daieditor/textedit/textarea/TextAreaDefaults.java trunk/daimonin/src/daieditor/textedit/textarea/TextAreaPainter.java trunk/daimonin/src/daieditor/textedit/textarea/TextUtilities.java trunk/daimonin/src/daieditor/textedit/textarea/Token.java Modified: trunk/crossfire/src/cfeditor/textedit/textarea/JEditTextArea.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/JEditTextArea.java 2006-05-28 23:20:56 UTC (rev 66) +++ trunk/crossfire/src/cfeditor/textedit/textarea/JEditTextArea.java 2006-05-29 08:44:37 UTC (rev 67) @@ -82,26 +82,29 @@ * ta.setTokenMarker(new JavaTokenMarker()); * ta.setText("public class Test {\n" * + " public static void main(String[] args) {\n" - * + " System.out.println(\"Hello World\");\n" + * + " System.err.println(\"Hello World\");\n" * + " }\n" * + "}");</pre> * @author Slava Pestov * @author <a href="mailto:and...@gm...">Andreas Vogl</a> * @version $Id: JEditTextArea.java,v 1.11 2006/03/26 00:48:57 akirschbaum Exp $ */ -public class JEditTextArea extends JComponent { +public final class JEditTextArea extends JComponent { private static final Logger log = Logger.getLogger(JEditTextArea.class); /** + * Serial Version UID. + */ + private static final long serialVersionUID = -1060281617538289153L; + + /** * Adding components with this name to the text area will place them left * of the horizontal scroll bar. In jEdit, the status bar is added this * way. */ public static final String LEFT_OF_SCROLLBAR = "los"; - private static final long serialVersionUID = -1060281617538289153L; - /** Creates a new JEditTextArea with the default settings. */ public JEditTextArea() { this(TextAreaDefaults.getDefaults()); @@ -111,7 +114,7 @@ * Creates a new JEditTextArea with the specified settings. * @param defaults the default settings */ - public JEditTextArea(TextAreaDefaults defaults) { + public JEditTextArea(final TextAreaDefaults defaults) { // Enable the necessary events enableEvents(AWTEvent.KEY_EVENT_MASK); @@ -160,7 +163,7 @@ * key normally does not "work" inside the text area. But that would be a pity, * because we need the tab key for indentation. * <p/> - * So what this method does is setting the focus traversal to "tab + <control>", + * So what this method does is setting the focus traversal to "tab + <control>", * in order to "free" the tab key from focus traversal events. * In JDKs above 1.4, this task can be accomplished simply by three lines of code: * <code> @@ -181,29 +184,29 @@ private void freeTabKeyFromFocusTraversal() { try { // preparing the key set first, this should be harmless - Set forwardTraversalKeys = new HashSet(); + final Set forwardTraversalKeys = new HashSet(); forwardTraversalKeys.add(KeyStroke.getKeyStroke("control TAB")); // here we try to access java.awt.KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS - Field field = Class.forName("java.awt.KeyboardFocusManager").getField("FORWARD_TRAVERSAL_KEYS"); - Integer value = new Integer(field.getInt(field)); // store the value of this field + final Field field = Class.forName("java.awt.KeyboardFocusManager").getField("FORWARD_TRAVERSAL_KEYS"); + final Integer value = new Integer(field.getInt(field)); // store the value of this field - Method[] methods = getClass().getMethods(); + final Method[] methods = getClass().getMethods(); if (methods != null) { for (int i = 0; i < methods.length; i++) { // here we try to find the method "setFocusTraversalKeys", and execute it if found if (methods[i].getName().equalsIgnoreCase("setFocusTraversalKeys")) { - methods[i].invoke(this, new Object[]{value, forwardTraversalKeys,}); - // System.out.println("freeTabKeyFromFocusTraversal() succeeded!"); + methods[i].invoke(this, new Object[] { value, forwardTraversalKeys, }); + // System.err.println("freeTabKeyFromFocusTraversal() succeeded!"); } } } - } catch (Exception e) { + } catch (final Exception e) { // If something is undefined which was tried to access above, an exception // is thrown and we end up here. But that's okay, it is intended to happen // for all JDKs 1.3.*. Those older JDKs don't need to set focus traversal anyways. - // System.out.println("freeTabKeyFromFocusTraversal() failed: "+e.getClass().getName()+"\n"+e.getMessage()); + // System.err.println("freeTabKeyFromFocusTraversal() failed: "+e.getClass().getName()+"\n"+e.getMessage()); } } @@ -211,7 +214,7 @@ * Set the TextArea font * @param f font */ - public void setFont(Font f) { + public final void setFont(final Font f) { getPainter().setFont(f); } @@ -229,7 +232,7 @@ * Sets the input handler. * @param inputHandler the new input handler */ - public void setInputHandler(InputHandler inputHandler) { + public final void setInputHandler(final InputHandler inputHandler) { this.inputHandler = inputHandler; } @@ -242,7 +245,7 @@ * Toggles caret blinking. * @param caretBlinks true if the caret should blink, false otherwise */ - public void setCaretBlinkEnabled(boolean caretBlinks) { + public final void setCaretBlinkEnabled(final boolean caretBlinks) { this.caretBlinks = caretBlinks; if (!caretBlinks) { blink = false; @@ -260,7 +263,7 @@ * Sets if the caret should be visible. * @param caretVisible true if the caret should be visible, false otherwise */ - public void setCaretVisible(boolean caretVisible) { + public final void setCaretVisible(final boolean caretVisible) { this.caretVisible = caretVisible; blink = true; @@ -291,7 +294,7 @@ * @param electricScroll the number of lines always visible from the top or * bottom */ - public final void setElectricScroll(int electricScroll) { + public final void setElectricScroll(final int electricScroll) { this.electricScroll = electricScroll; } @@ -300,7 +303,7 @@ * number of lines in the document changes, or when the size of the text * are changes. */ - public void updateScrollBars() { + public final void updateScrollBars() { if (vertical != null && visibleLines != 0) { vertical.setValues(firstLine, visibleLines, 0, getLineCount()); //vertical.setUnitIncrement(2); @@ -308,7 +311,7 @@ vertical.setBlockIncrement(visibleLines); } - int width = painter.getWidth(); + final int width = painter.getWidth(); if (horizontal != null && width != 0) { horizontal.setValues(-horizontalOffset, width, 0, width * 5); //horizontal.setUnitIncrement(painter.getFontMetrics().charWidth('w')); @@ -326,7 +329,7 @@ * Sets the line displayed at the text area's origin without updating the * scroll bars. */ - public void setFirstLine(int firstLine) { + public final void setFirstLine(final int firstLine) { if (firstLine == this.firstLine) { return; } @@ -353,17 +356,17 @@ return; } - int height = painter.getHeight(); + final int height = painter.getHeight(); // get line height - int lineHeight; + final int lineHeight; if (painter == null || painter.getFontMetrics() == null) { lineHeight = painter.getDefaultLineHeight(); // default height might be wrong, take it only when needed } else { lineHeight = painter.getFontMetrics().getHeight(); } - int oldVisibleLines = visibleLines; + final int oldVisibleLines = visibleLines; visibleLines = height / lineHeight; updateScrollBars(); } @@ -378,7 +381,7 @@ * horizontal scrolling. * @param horizontalOffset offset The new horizontal offset */ - public void setHorizontalOffset(int horizontalOffset) { + public final void setHorizontalOffset(final int horizontalOffset) { if (horizontalOffset == this.horizontalOffset) { return; } @@ -397,7 +400,7 @@ * @param horizontalOffset the new horizontal offset * @return true if any of the values were changed, false otherwise */ - public boolean setOrigin(int firstLine, int horizontalOffset) { + public final boolean setOrigin(final int firstLine, final int horizontalOffset) { boolean changed = false; int oldFirstLine = this.firstLine; @@ -425,11 +428,10 @@ * @return true if scrolling was actually performed, false if the caret was * already visible */ - public boolean scrollToCaret() { - int line = getCaretLine(); - int lineStart = getLineStartOffset(line); - int offset = Math.max(0, Math.min(getLineLength(line) - 1, - getCaretPosition() - lineStart)); + public final boolean scrollToCaret() { + final int line = getCaretLine(); + final int lineStart = getLineStartOffset(line); + final int offset = Math.max(0, Math.min(getLineLength(line) - 1, getCaretPosition() - lineStart)); return scrollTo(line, offset); } @@ -439,14 +441,14 @@ * registered for keypress-events. The graphics context must be fully * initialized before calling this method. */ - public void setEditingFocus() { + public final void setEditingFocus() { try { requestFocus(); setCaretVisible(true); focusedComponent = this; setCaretPosition(0); // set caret to 0, 0 coords - } catch (NullPointerException e) { - System.out.println("Nullpointer Excepion in JEditTextArea.setEditingFocus()"); + } catch (final NullPointerException e) { + System.err.println("Nullpointer Excepion in JEditTextArea.setEditingFocus()"); } } @@ -458,7 +460,7 @@ * @return true if scrolling was actually performed, false if the line and * offset was already visible */ - public boolean scrollTo(int line, int offset) { + public final boolean scrollTo(final int line, final int offset) { // visibleLines == 0 before the component is realized // we can't do any proper scrolling then, so we have // this hack... @@ -482,8 +484,8 @@ } } - int x = _offsetToX(line, offset); - int width = painter.getFontMetrics().charWidth('w'); + final int x = _offsetToX(line, offset); + final int width = painter.getFontMetrics().charWidth('w'); if (x < 0) { newHorizontalOffset = Math.min(0, horizontalOffset - x + width + 5); @@ -498,8 +500,8 @@ * Converts a line index to a y co-ordinate. * @param line the line */ - public int lineToY(int line) { - FontMetrics fm = painter.getFontMetrics(); + public final int lineToY(final int line) { + final FontMetrics fm = painter.getFontMetrics(); return (line - firstLine) * fm.getHeight() - (fm.getLeading() + fm.getMaxDescent()); } @@ -507,9 +509,9 @@ * Converts a y co-ordinate to a line index. * @param y the y co-ordinate */ - public int yToLine(int y) { - FontMetrics fm = painter.getFontMetrics(); - int height = fm.getHeight(); + public final int yToLine(final int y) { + final FontMetrics fm = painter.getFontMetrics(); + final int height = fm.getHeight(); return Math.max(0, Math.min(getLineCount() - 1, y / height + firstLine)); } @@ -519,7 +521,7 @@ * @param line the line * @param offset the offset, from the start of the line */ - public final int offsetToX(int line, int offset) { + public final int offsetToX(final int line, final int offset) { // don't use cached tokens painter.setCurrentLineTokens(null); return _offsetToX(line, offset); @@ -532,15 +534,15 @@ * @param line the line * @param offset the offset, from the start of the line */ - public int _offsetToX(int line, int offset) { - TokenMarker tokenMarker = getTokenMarker(); + public final int _offsetToX(final int line, final int offset) { + final TokenMarker tokenMarker = getTokenMarker(); /* Use painter's cached info for speed */ FontMetrics fm = painter.getFontMetrics(); getLineText(line, lineSegment); - int segmentOffset = lineSegment.offset; + final int segmentOffset = lineSegment.offset; int x = horizontalOffset; /* If syntax coloring is disabled, do simple translation */ @@ -548,10 +550,9 @@ lineSegment.count = offset; return x + Utilities.getTabbedTextWidth(lineSegment, fm, x, painter, 0); - + } else { /* If syntax coloring is enabled, we have to do this because * tokens can vary in width */ - } else { Token tokens; if (painter.getCurrentLineIndex() == line && painter.getCurrentLineTokens() != null) { tokens = painter.getCurrentLineTokens(); @@ -561,12 +562,12 @@ painter.setCurrentLineTokens(tokens); } - Toolkit toolkit = painter.getToolkit(); - Font defaultFont = painter.getFont(); - SyntaxStyle[] styles = painter.getStyles(); + final Toolkit toolkit = painter.getToolkit(); + final Font defaultFont = painter.getFont(); + final SyntaxStyle[] styles = painter.getStyles(); - for (; ;) { - byte id = tokens.getId(); + while (true) { + final byte id = tokens.getId(); if (id == Token.END) { return x; } @@ -577,7 +578,7 @@ fm = styles[id].getFontMetrics(defaultFont, painter.getGraphics()); } - int length = tokens.getLength(); + final int length = tokens.getLength(); if (offset + segmentOffset < lineSegment.offset + length) { lineSegment.count = offset - (lineSegment.offset - segmentOffset); @@ -597,24 +598,24 @@ * @param line the line * @param x the x co-ordinate */ - public int xToOffset(int line, int x) { - TokenMarker tokenMarker = getTokenMarker(); + public final int xToOffset(final int line, final int x) { + final TokenMarker tokenMarker = getTokenMarker(); /* Use painter's cached info for speed */ FontMetrics fm = painter.getFontMetrics(); getLineText(line, lineSegment); - char[] segmentArray = lineSegment.array; - int segmentOffset = lineSegment.offset; - int segmentCount = lineSegment.count; + final char[] segmentArray = lineSegment.array; + final int segmentOffset = lineSegment.offset; + final int segmentCount = lineSegment.count; int width = horizontalOffset; if (tokenMarker == null) { for (int i = 0; i < segmentCount; i++) { - char c = segmentArray[i + segmentOffset]; - int charWidth; + final char c = segmentArray[i + segmentOffset]; + final int charWidth; if (c == '\t') { charWidth = (int) painter.nextTabStop(width, i) - width; } else { @@ -646,12 +647,12 @@ } int offset = 0; - Toolkit toolkit = painter.getToolkit(); - Font defaultFont = painter.getFont(); - SyntaxStyle[] styles = painter.getStyles(); + final Toolkit toolkit = painter.getToolkit(); + final Font defaultFont = painter.getFont(); + final SyntaxStyle[] styles = painter.getStyles(); - for (; ;) { - byte id = tokens.getId(); + while (true) { + final byte id = tokens.getId(); if (id == Token.END) { return offset; } @@ -662,11 +663,11 @@ fm = styles[id].getFontMetrics(defaultFont, painter.getGraphics()); } - int length = tokens.getLength(); + final int length = tokens.getLength(); for (int i = 0; i < length; i++) { - char c = segmentArray[segmentOffset + offset + i]; - int charWidth; + final char c = segmentArray[segmentOffset + offset + i]; + final int charWidth; if (c == '\t') { charWidth = (int) painter.nextTabStop(width, offset + i) - width; } else { @@ -697,9 +698,9 @@ * @param x the x co-ordinate of the point * @param y the y co-ordinate of the point */ - public int xyToOffset(int x, int y) { - int line = yToLine(y); - int start = getLineStartOffset(line); + public final int xyToOffset(final int x, final int y) { + final int line = yToLine(y); + final int start = getLineStartOffset(line); return start + xToOffset(line, x); } @@ -712,7 +713,7 @@ * Sets the document this text area is editing. * @param document the document */ - public void setDocument(SyntaxDocument document) { + public final void setDocument(final SyntaxDocument document) { if (this.document == document) { return; } @@ -743,7 +744,7 @@ * <code>getDocument().setTokenMarker()</code>. * @param tokenMarker the token marker */ - public final void setTokenMarker(TokenMarker tokenMarker) { + public final void setTokenMarker(final TokenMarker tokenMarker) { document.setTokenMarker(tokenMarker); } @@ -764,7 +765,7 @@ * Returns the line containing the specified offset. * @param offset the offset */ - public final int getLineOfOffset(int offset) { + public final int getLineOfOffset(final int offset) { return document.getDefaultRootElement().getElementIndex(offset); } @@ -774,9 +775,8 @@ * @return the start offset of the specified line, or -1 if the line is * invalid */ - public int getLineStartOffset(int line) { - Element lineElement = document.getDefaultRootElement() - .getElement(line); + public final int getLineStartOffset(final int line) { + final Element lineElement = document.getDefaultRootElement().getElement(line); if (lineElement == null) { return -1; } else { @@ -790,9 +790,8 @@ * @return the end offset of the specified line, or -1 if the line is * invalid */ - public int getLineEndOffset(int line) { - Element lineElement = document.getDefaultRootElement() - .getElement(line); + public final int getLineEndOffset(final int line) { + final Element lineElement = document.getDefaultRootElement().getElement(line); if (lineElement == null) { return -1; } else { @@ -804,9 +803,8 @@ * Returns the length of the specified line. * @param line the line */ - public int getLineLength(int line) { - Element lineElement = document.getDefaultRootElement() - .getElement(line); + public final int getLineLength(final int line) { + final Element lineElement = document.getDefaultRootElement().getElement(line); if (lineElement == null) { return -1; } else { @@ -814,26 +812,30 @@ } } - /** Returns the entire text of this text area. */ - public String getText() { + /** + * Returns the entire text of this text area. + */ + public final String getText() { try { return document.getText(0, document.getLength()); - } catch (BadLocationException bl) { + } catch (final BadLocationException bl) { bl.printStackTrace(); return null; } } - /** Sets the entire text of this text area. */ - public void setText(String text) { + /** + * Sets the entire text of this text area. + */ + public final void setText(final String text) { try { - document.beginCompoundEdit(); + SyntaxDocument.beginCompoundEdit(); document.remove(0, document.getLength()); document.insertString(0, text, null); - } catch (BadLocationException bl) { + } catch (final BadLocationException bl) { bl.printStackTrace(); } finally { - document.endCompoundEdit(); + SyntaxDocument.endCompoundEdit(); } } @@ -843,10 +845,10 @@ * @param len the length of the substring * @return the substring, or null if the offsets are invalid */ - public final String getText(int start, int len) { + public final String getText(final int start, final int len) { try { return document.getText(start, len); - } catch (BadLocationException bl) { + } catch (final BadLocationException bl) { bl.printStackTrace(); return null; } @@ -859,10 +861,10 @@ * @param len the length of the substring * @param segment the segment */ - public final void getText(int start, int len, Segment segment) { + public final void getText(final int start, final int len, final Segment segment) { try { document.getText(start, len, segment); - } catch (BadLocationException bl) { + } catch (final BadLocationException bl) { bl.printStackTrace(); segment.offset = segment.count = 0; } @@ -873,8 +875,8 @@ * @param lineIndex the line * @return the text, or null if the line is invalid */ - public final String getLineText(int lineIndex) { - int start = getLineStartOffset(lineIndex); + public final String getLineText(final int lineIndex) { + final int start = getLineStartOffset(lineIndex); return getText(start, getLineEndOffset(lineIndex) - start - 1); } @@ -883,8 +885,8 @@ * invalid, the segment will contain a null string. * @param lineIndex the line */ - public final void getLineText(int lineIndex, Segment segment) { - int start = getLineStartOffset(lineIndex); + public final void getLineText(final int lineIndex, final Segment segment) { + final int start = getLineStartOffset(lineIndex); getText(start, getLineEndOffset(lineIndex) - start - 1, segment); } @@ -893,17 +895,19 @@ return selectionStart; } - /** Returns the offset where the selection starts on the specified line. */ - public int getSelectionStart(int line) { + /** + * Returns the offset where the selection starts on the specified line. + */ + public final int getSelectionStart(final int line) { if (line == selectionStartLine) { return selectionStart; } else if (rectSelect) { - Element map = document.getDefaultRootElement(); - int start = selectionStart - map.getElement(selectionStartLine).getStartOffset(); + final Element map = document.getDefaultRootElement(); + final int start = selectionStart - map.getElement(selectionStartLine).getStartOffset(); - Element lineElement = map.getElement(line); - int lineStart = lineElement.getStartOffset(); - int lineEnd = lineElement.getEndOffset() - 1; + final Element lineElement = map.getElement(line); + final int lineStart = lineElement.getStartOffset(); + final int lineEnd = lineElement.getEndOffset() - 1; return Math.min(lineEnd, lineStart + start); } else { return getLineStartOffset(line); @@ -921,7 +925,7 @@ * @param selectionStart the selection start * @see #select(int, int) */ - public final void setSelectionStart(int selectionStart) { + public final void setSelectionStart(final int selectionStart) { select(selectionStart, selectionEnd); } @@ -930,17 +934,19 @@ return selectionEnd; } - /** Returns the offset where the selection ends on the specified line. */ - public int getSelectionEnd(int line) { + /** + * Returns the offset where the selection ends on the specified line. + */ + public final int getSelectionEnd(final int line) { if (line == selectionEndLine) { return selectionEnd; } else if (rectSelect) { - Element map = document.getDefaultRootElement(); - int end = selectionEnd - map.getElement(selectionEndLine).getStartOffset(); + final Element map = document.getDefaultRootElement(); + final int end = selectionEnd - map.getElement(selectionEndLine).getStartOffset(); - Element lineElement = map.getElement(line); - int lineStart = lineElement.getStartOffset(); - int lineEnd = lineElement.getEndOffset() - 1; + final Element lineElement = map.getElement(line); + final int lineStart = lineElement.getStartOffset(); + final int lineEnd = lineElement.getEndOffset() - 1; return Math.min(lineEnd, lineStart + end); } else { return getLineEndOffset(line) - 1; @@ -958,7 +964,7 @@ * @param selectionEnd the selection end * @see #select(int, int) */ - public final void setSelectionEnd(int selectionEnd) { + public final void setSelectionEnd(final int selectionEnd) { select(selectionStart, selectionEnd); } @@ -996,16 +1002,20 @@ * @param caret the caret position * @see #select(int, int) */ - public final void setCaretPosition(int caret) { + public final void setCaretPosition(final int caret) { select(caret, caret); } - /** Selects all text in the document. */ + /** + * Selects all text in the document. + */ public final void selectAll() { select(0, getDocumentLength()); } - /** Moves the mark to the caret position. */ + /** + * Moves the mark to the caret position. + */ public final void selectNone() { select(getCaretPosition(), getCaretPosition()); } @@ -1017,9 +1027,10 @@ * @param start the start offset * @param end the end offset */ - public void select(int start, int end) { - int newStart, newEnd; - boolean newBias; + public final void select(final int start, final int end) { + final int newStart; + final int newEnd; + final boolean newBias; if (start <= end) { newStart = start; newEnd = end; @@ -1038,8 +1049,8 @@ // do all this crap, however we still do the stuff at // the end (clearing magic position, scrolling) if (newStart != selectionStart || newEnd != selectionEnd || newBias != biasLeft) { - int newStartLine = getLineOfOffset(newStart); - int newEndLine = getLineOfOffset(newEnd); + final int newStartLine = getLineOfOffset(newStart); + final int newEndLine = getLineOfOffset(newEnd); if (painter.isBracketHighlightEnabled()) { if (bracketLine != -1) { @@ -1055,8 +1066,7 @@ painter.invalidateLineRange(selectionStartLine, selectionEndLine); painter.invalidateLineRange(newStartLine, newEndLine); - document.addUndoableEdit(new CaretUndo( - selectionStart, selectionEnd)); + SyntaxDocument.addUndoableEdit(new CaretUndo(selectionStart, selectionEnd)); selectionStart = newStart; selectionEnd = newEnd; @@ -1083,7 +1093,9 @@ scrollToCaret(); } - /** Returns the selected text, or null if no selection is active. */ + /** + * Returns the selected text, or null if no selection is active. + */ public final String getSelectedText() { if (selectionStart == selectionEnd) { return null; @@ -1092,25 +1104,25 @@ if (rectSelect) { // Return each row of the selection on a new line - Element map = document.getDefaultRootElement(); + final Element map = document.getDefaultRootElement(); int start = selectionStart - map.getElement(selectionStartLine).getStartOffset(); int end = selectionEnd - map.getElement(selectionEndLine).getStartOffset(); // Certain rectangles satisfy this condition... if (end < start) { - int tmp = end; + final int tmp = end; end = start; start = tmp; } - StringBuffer buf = new StringBuffer(); - Segment seg = new Segment(); + final StringBuffer buf = new StringBuffer(); + final Segment seg = new Segment(); for (int i = selectionStartLine; i <= selectionEndLine; i++) { - Element lineElement = map.getElement(i); + final Element lineElement = map.getElement(i); int lineStart = lineElement.getStartOffset(); - int lineEnd = lineElement.getEndOffset() - 1; + final int lineEnd = lineElement.getEndOffset() - 1; int lineLen = lineEnd - lineStart; lineStart = Math.min(lineStart + start, lineEnd); @@ -1134,7 +1146,7 @@ * Replaces the selection with the specified text. * @param selectedText the replacement text for the selection */ - public void setSelectedText(String selectedText) { + public final void setSelectedText(final String selectedText) { if (!editable) { throw new InternalError("Text component read only"); } @@ -1143,14 +1155,14 @@ try { if (rectSelect) { - Element map = document.getDefaultRootElement(); + final Element map = document.getDefaultRootElement(); int start = selectionStart - map.getElement(selectionStartLine).getStartOffset(); int end = selectionEnd - map.getElement(selectionEndLine).getStartOffset(); // Certain rectangles satisfy this condition... if (end < start) { - int tmp = end; + final int tmp = end; end = start; start = tmp; } @@ -1159,10 +1171,10 @@ int currNewline = 0; for (int i = selectionStartLine; i <= selectionEndLine; i++) { - Element lineElement = map.getElement(i); - int lineStart = lineElement.getStartOffset(); - int lineEnd = lineElement.getEndOffset() - 1; - int rectStart = Math.min(lineEnd, lineStart + start); + final Element lineElement = map.getElement(i); + final int lineStart = lineElement.getStartOffset(); + final int lineEnd = lineElement.getEndOffset() - 1; + final int rectStart = Math.min(lineEnd, lineStart + start); document.remove(rectStart, Math.min(lineEnd - rectStart, end - start)); @@ -1181,7 +1193,7 @@ } if (selectedText != null && currNewline != selectedText.length()) { - int offset = map.getElement(selectionEndLine).getEndOffset() - 1; + final int offset = map.getElement(selectionEndLine).getEndOffset() - 1; document.insertString(offset, "\n", null); document.insertString(offset + 1, selectedText.substring(currNewline + 1), null); } @@ -1191,12 +1203,12 @@ document.insertString(selectionStart, selectedText, null); } } - } catch (BadLocationException bl) { + } catch (final BadLocationException bl) { bl.printStackTrace(); throw new InternalError("Cannot replace selection"); + } finally { // No matter what happends... stops us from leaving document // in a bad state - } finally { document.endCompoundEdit(); } @@ -1213,7 +1225,7 @@ * @param editable true if this text area should be editable, false * otherwise */ - public final void setEditable(boolean editable) { + public final void setEditable(final boolean editable) { this.editable = editable; } @@ -1226,7 +1238,7 @@ * Sets the right click popup menu. * @param popup the popup */ - public final void setRightClickPopup(JPopupMenu popup) { + public final void setRightClickPopup(final JPopupMenu popup) { this.popup = popup; } @@ -1243,7 +1255,7 @@ * position when moving up and down lines. * @param magicCaret the magic caret position */ - public final void setMagicCaretPosition(int magicCaret) { + public final void setMagicCaretPosition(final int magicCaret) { this.magicCaret = magicCaret; } @@ -1254,7 +1266,7 @@ * @see #setSelectedText(String) * @see #isOverwriteEnabled() */ - public void overwriteSetSelectedText(String str) { + public final void overwriteSetSelectedText(final String str) { // Don't overstrike if there is a selection if (!overwrite || selectionStart != selectionEnd) { setSelectedText(str); @@ -1263,22 +1275,22 @@ // Don't overstrike if we're on the end of // the line - int caret = getCaretPosition(); - int caretLineEnd = getLineEndOffset(getCaretLine()); + final int caret = getCaretPosition(); + final int caretLineEnd = getLineEndOffset(getCaretLine()); if (caretLineEnd - caret <= str.length()) { setSelectedText(str); return; } - document.beginCompoundEdit(); + SyntaxDocument.beginCompoundEdit(); try { document.remove(caret, str.length()); document.insertString(caret, str, null); - } catch (BadLocationException bl) { + } catch (final BadLocationException bl) { bl.printStackTrace(); } finally { - document.endCompoundEdit(); + SyntaxDocument.endCompoundEdit(); } } @@ -1292,7 +1304,7 @@ * @param overwrite true if overwrite mode should be enabled, false * otherwise */ - public final void setOverwriteEnabled(boolean overwrite) { + public final void setOverwriteEnabled(final boolean overwrite) { this.overwrite = overwrite; painter.invalidateSelectedLines(); } @@ -1307,7 +1319,7 @@ * @param rectSelect true if the selection should be rectangular, false * otherwise */ - public final void setSelectionRectangular(boolean rectSelect) { + public final void setSelectionRectangular(final boolean rectSelect) { this.rectSelect = rectSelect; painter.invalidateSelectedLines(); } @@ -1332,7 +1344,7 @@ * Adds a caret change listener to this text area. * @param listener the listener */ - public final void addCaretListener(CaretListener listener) { + public final void addCaretListener(final CaretListener listener) { listenerList.add(CaretListener.class, listener); } @@ -1340,7 +1352,7 @@ * Removes a caret change listener from this text area. * @param listener the listener */ - public final void removeCaretListener(CaretListener listener) { + public final void removeCaretListener(final CaretListener listener) { listenerList.remove(CaretListener.class, listener); } @@ -1348,7 +1360,7 @@ * Deletes the selected text from the text area and places it into the * clipboard. */ - public void cut() { + public final void cut() { if (editable) { copy(); setSelectedText(""); @@ -1356,14 +1368,14 @@ } /** Places the selected text into the clipboard. */ - public void copy() { + public final void copy() { if (selectionStart != selectionEnd) { - Clipboard clipboard = getToolkit().getSystemClipboard(); + final Clipboard clipboard = getToolkit().getSystemClipboard(); - String selection = getSelectedText(); + final String selection = getSelectedText(); - int repeatCount = inputHandler.getRepeatCount(); - StringBuffer buf = new StringBuffer(); + final int repeatCount = inputHandler.getRepeatCount(); + final StringBuffer buf = new StringBuffer(); for (int i = 0; i < repeatCount; i++) { buf.append(selection); } @@ -1372,23 +1384,25 @@ } } - /** Inserts the clipboard contents into the text. */ - public void paste() { + /** + * Inserts the clipboard contents into the text. + */ + public final void paste() { if (editable) { - Clipboard clipboard = getToolkit().getSystemClipboard(); + final Clipboard clipboard = getToolkit().getSystemClipboard(); try { // The MacOS MRJ doesn't convert \r to \n, // so do it here String selection = ((String) clipboard.getContents(this).getTransferData(DataFlavor.stringFlavor)).replace('\r', '\n'); - int repeatCount = inputHandler.getRepeatCount(); - StringBuffer buf = new StringBuffer(); + final int repeatCount = inputHandler.getRepeatCount(); + final StringBuffer buf = new StringBuffer(); for (int i = 0; i < repeatCount; i++) { buf.append(selection); } selection = buf.toString(); setSelectedText(selection); - } catch (Exception e) { + } catch (final Exception e) { getToolkit().beep(); log.error("Clipboard does not contain a string"); } @@ -1399,7 +1413,7 @@ * Called by the AWT when this component is removed from it's parent. This * stops clears the currently focused component. */ - public void removeNotify() { + public final void removeNotify() { super.removeNotify(); if (focusedComponent == this) { focusedComponent = null; @@ -1410,7 +1424,7 @@ * Forwards key events directly to the input handler. This is slightly * faster than using a KeyListener because some Swing overhead is avoided. */ - public void processKeyEvent(KeyEvent evt) { + public final void processKeyEvent(final KeyEvent evt) { if (inputHandler == null) { return; } @@ -1431,23 +1445,23 @@ } // protected members - protected static String CENTER = "center"; + protected static final String CENTER = "center"; - protected static String RIGHT = "right"; + protected static final String RIGHT = "right"; - protected static String BOTTOM = "bottom"; + protected static final String BOTTOM = "bottom"; protected static JEditTextArea focusedComponent; - protected static Timer caretTimer; + protected static final Timer caretTimer; - protected TextAreaPainter painter; + protected final TextAreaPainter painter; protected JPopupMenu popup; - protected EventListenerList listenerList; + protected final EventListenerList listenerList; - protected MutableCaretEvent caretEvent; + protected final MutableCaretEvent caretEvent; protected boolean caretBlinks; @@ -1465,9 +1479,9 @@ protected int horizontalOffset; - protected JScrollBar vertical; + protected final JScrollBar vertical; - protected JScrollBar horizontal; + protected final JScrollBar horizontal; protected boolean scrollBarsInitialized; @@ -1475,9 +1489,9 @@ protected SyntaxDocument document; - protected DocumentHandler documentHandler; + protected final DocumentHandler documentHandler; - protected Segment lineSegment; + protected final Segment lineSegment; protected int selectionStart; @@ -1499,8 +1513,8 @@ protected boolean rectSelect; - protected void fireCaretEvent() { - Object[] listeners = listenerList.getListenerList(); + protected final void fireCaretEvent() { + final Object[] listeners = listenerList.getListenerList(); for (int i = listeners.length - 2; i >= 0; i--) { if (listeners[i] == CaretListener.class) { ((CaretListener) listeners[i + 1]).caretUpdate(caretEvent); @@ -1508,38 +1522,37 @@ } } - protected void updateBracketHighlight(int newCaretPosition) { + protected final void updateBracketHighlight(final int newCaretPosition) { if (newCaretPosition == 0) { bracketPosition = bracketLine = -1; return; } try { - int offset = TextUtilities.findMatchingBracket(document, newCaretPosition - 1); + final int offset = TextUtilities.findMatchingBracket(document, newCaretPosition - 1); if (offset != -1) { bracketLine = getLineOfOffset(offset); bracketPosition = offset - getLineStartOffset(bracketLine); return; } - } catch (BadLocationException bl) { + } catch (final BadLocationException bl) { bl.printStackTrace(); } bracketLine = bracketPosition = -1; } - protected void documentChanged(DocumentEvent evt) { - DocumentEvent.ElementChange ch = evt.getChange( - document.getDefaultRootElement()); + protected final void documentChanged(final DocumentEvent evt) { + final DocumentEvent.ElementChange ch = evt.getChange(document.getDefaultRootElement()); - int count; + final int count; if (ch == null) { count = 0; } else { count = ch.getChildrenAdded().length - ch.getChildrenRemoved().length; } - int line = getLineOfOffset(evt.getOffset()); + final int line = getLineOfOffset(evt.getOffset()); if (count == 0) { painter.invalidateLine(line); } else if (line < firstLine) { @@ -1552,9 +1565,9 @@ } } - class ScrollLayout implements LayoutManager { + final class ScrollLayout implements LayoutManager { - public void addLayoutComponent(String name, Component comp) { + public final void addLayoutComponent(final String name, final Component comp) { if (name.equals(CENTER)) { center = comp; } else if (name.equals(RIGHT)) { @@ -1566,7 +1579,7 @@ } } - public void removeLayoutComponent(Component comp) { + public final void removeLayoutComponent(final Component comp) { if (center == comp) { center = null; } @@ -1582,52 +1595,52 @@ } } - public Dimension preferredLayoutSize(Container parent) { - Dimension dim = new Dimension(); - Insets insets = getInsets(); + public final Dimension preferredLayoutSize(final Container parent) { + final Dimension dim = new Dimension(); + final Insets insets = getInsets(); dim.width = insets.left + insets.right; dim.height = insets.top + insets.bottom; - Dimension centerPref = center.getPreferredSize(); + final Dimension centerPref = center.getPreferredSize(); dim.width += centerPref.width; dim.height += centerPref.height; - Dimension rightPref = right.getPreferredSize(); + final Dimension rightPref = right.getPreferredSize(); dim.width += rightPref.width; - Dimension bottomPref = bottom.getPreferredSize(); + final Dimension bottomPref = bottom.getPreferredSize(); dim.height += bottomPref.height; return dim; } - public Dimension minimumLayoutSize(Container parent) { - Dimension dim = new Dimension(); - Insets insets = getInsets(); + public final Dimension minimumLayoutSize(final Container parent) { + final Dimension dim = new Dimension(); + final Insets insets = getInsets(); dim.width = insets.left + insets.right; dim.height = insets.top + insets.bottom; - Dimension centerPref = center.getMinimumSize(); + final Dimension centerPref = center.getMinimumSize(); dim.width += centerPref.width; dim.height += centerPref.height; - Dimension rightPref = right.getMinimumSize(); + final Dimension rightPref = right.getMinimumSize(); dim.width += rightPref.width; - Dimension bottomPref = bottom.getMinimumSize(); + final Dimension bottomPref = bottom.getMinimumSize(); dim.height += bottomPref.height; return dim; } - public void layoutContainer(Container parent) { - Dimension size = parent.getSize(); - Insets insets = parent.getInsets(); - int itop = insets.top; + public final void layoutContainer(final Container parent) { + final Dimension size = parent.getSize(); + final Insets insets = parent.getInsets(); + final int itop = insets.top; int ileft = insets.left; - int ibottom = insets.bottom; - int iright = insets.right; + final int ibottom = insets.bottom; + final int iright = insets.right; - int rightWidth = right.getPreferredSize().width; - int bottomHeight = bottom.getPreferredSize().height; - int centerWidth = size.width - rightWidth - ileft - iright; - int centerHeight = size.height - bottomHeight - itop - ibottom; + final int rightWidth = right.getPreferredSize().width; + final int bottomHeight = bottom.getPreferredSize().height; + final int centerWidth = size.width - rightWidth - ileft - iright; + final int centerHeight = size.height - bottomHeight - itop - ibottom; center.setBounds( ileft, @@ -1642,14 +1655,11 @@ centerHeight); // Lay out all status components, in order - Enumeration status = leftOfScrollBar.elements(); + final Enumeration status = leftOfScrollBar.elements(); while (status.hasMoreElements()) { - Component comp = (Component) status.nextElement(); - Dimension dim = comp.getPreferredSize(); - comp.setBounds(ileft, - itop + centerHeight, - dim.width, - bottomHeight); + final Component comp = (Component) status.nextElement(); + final Dimension dim = comp.getPreferredSize(); + comp.setBounds(ileft, itop + centerHeight, dim.width, bottomHeight); ileft += dim.width; } @@ -1667,38 +1677,41 @@ private Component bottom; - private Vector leftOfScrollBar = new Vector(); - } + private final Vector leftOfScrollBar = new Vector(); + } // class ScrollLayout - static class CaretBlinker implements ActionListener { + static final class CaretBlinker implements ActionListener { - public void actionPerformed(ActionEvent evt) { + public final void actionPerformed(final ActionEvent evt) { if (focusedComponent != null && focusedComponent.hasFocus()) { focusedComponent.blinkCaret(); } } - } + } // class CaretBlinger - class MutableCaretEvent extends CaretEvent { + final class MutableCaretEvent extends CaretEvent { + /** + * Serial Version UID. + */ private static final long serialVersionUID = -906781128141622273L; MutableCaretEvent() { super(JEditTextArea.this); } - public int getDot() { + public final int getDot() { return getCaretPosition(); } - public int getMark() { + public final int getMark() { return getMarkPosition(); } - } + } // class MutableCaretEvent - class AdjustHandler implements AdjustmentListener { + final class AdjustHandler implements AdjustmentListener { - public void adjustmentValueChanged(final AdjustmentEvent evt) { + public final void adjustmentValueChanged(final AdjustmentEvent evt) { if (!scrollBarsInitialized) { return; } @@ -1716,26 +1729,26 @@ } }); } - } + } // class AdjustHandler - class ComponentHandler extends ComponentAdapter { + final class ComponentHandler extends ComponentAdapter { - public void componentResized(ComponentEvent evt) { + public final void componentResized(final ComponentEvent evt) { recalculateVisibleLines(); scrollBarsInitialized = true; } - } + } // class ComponentHandler - class DocumentHandler implements DocumentListener { + final class DocumentHandler implements DocumentListener { - public void insertUpdate(DocumentEvent evt) { + public final void insertUpdate(final DocumentEvent evt) { documentChanged(evt); - int offset = evt.getOffset(); - int length = evt.getLength(); + final int offset = evt.getOffset(); + final int length = evt.getLength(); - int newStart; - int newEnd; + final int newStart; + final int newEnd; if (selectionStart > offset || (selectionStart == selectionEnd && selectionStart == offset)) { newStart = selectionStart + length; @@ -1752,14 +1765,14 @@ select(newStart, newEnd); } - public void removeUpdate(DocumentEvent evt) { + public final void removeUpdate(final DocumentEvent evt) { documentChanged(evt); - int offset = evt.getOffset(); - int length = evt.getLength(); + final int offset = evt.getOffset(); + final int length = evt.getLength(); - int newStart; - int newEnd; + final int newStart; + final int newEnd; if (selectionStart > offset) { if (selectionStart > offset + length) { @@ -1784,42 +1797,43 @@ select(newStart, newEnd); } - public void changedUpdate(DocumentEvent evt) { + public final void changedUpdate(final DocumentEvent evt) { } - } + } // class DocumentHandler - class DragHandler implements MouseMotionListener { + final class DragHandler implements MouseMotionListener { - public void mouseDragged(MouseEvent evt) { + public final void mouseDragged(final MouseEvent evt) { if (popup != null && popup.isVisible()) { return; } - setSelectionRectangular((evt.getModifiers() - & InputEvent.CTRL_MASK) != 0); + setSelectionRectangular((evt.getModifiers() & InputEvent.CTRL_MASK) != 0); select(getMarkPosition(), xyToOffset(evt.getX(), evt.getY())); } - public void mouseMoved(MouseEvent evt) { + public final void mouseMoved(final MouseEvent evt) { } - } - class FocusHandler implements FocusListener { + } // class DragHandler - public void focusGained(FocusEvent evt) { + final class FocusHandler implements FocusListener { + + public final void focusGained(final FocusEvent evt) { setCaretVisible(true); focusedComponent = JEditTextArea.this; } - public void focusLost(FocusEvent evt) { + public final void focusLost(final FocusEvent evt) { setCaretVisible(false); focusedComponent = null; } - } - class MouseHandler extends MouseAdapter { + } // class FocusHandler - public void mousePressed(MouseEvent evt) { + final class MouseHandler extends MouseAdapter { + + public final void mousePressed(final MouseEvent evt) { requestFocus(); // Focus events not fired sometimes? @@ -1831,9 +1845,9 @@ return; } - int line = yToLine(evt.getY()); - int offset = xToOffset(line, evt.getX()); - int dot = getLineStartOffset(line) + offset; + final int line = yToLine(evt.getY()); + final int offset = xToOffset(line, evt.getX()); + final int dot = getLineStartOffset(line) + offset; switch (evt.getClickCount()) { case 1: @@ -1844,7 +1858,7 @@ // it can throw a BLE try { doDoubleClick(evt, line, offset, dot); - } catch (BadLocationException bl) { + } catch (final BadLocationException bl) { bl.printStackTrace(); } break; @@ -1854,8 +1868,7 @@ } } - private void doSingleClick(MouseEvent evt, int line, - int offset, int dot) { + private void doSingleClick(final MouseEvent evt, final int line, final int offset, final int dot) { if ((evt.getModifiers() & InputEvent.SHIFT_MASK) != 0) { rectSelect = (evt.getModifiers() & InputEvent.CTRL_MASK) != 0; select(getMarkPosition(), dot); @@ -1864,16 +1877,14 @@ } } - private void doDoubleClick(MouseEvent evt, int line, - int offset, int dot) throws BadLocationException { + private void doDoubleClick(final MouseEvent evt, final int line, final int offset, final int dot) throws BadLocationException { // Ignore empty lines if (getLineLength(line) == 0) { return; } try { - int bracket = TextUtilities.findMatchingBracket( - document, Math.max(0, dot - 1)); + int bracket = TextUtilities.findMatchingBracket(document, Math.max(0, dot - 1)); if (bracket != -1) { int mark = getMarkPosition(); // Hack @@ -1884,12 +1895,12 @@ select(mark, bracket); return; } - } catch (BadLocationException bl) { + } catch (final BadLocationException bl) { bl.printStackTrace(); } // Ok, it's not a bracket... select the word - String lineText = getLineText(line); + final String lineText = getLineText(line); char ch = lineText.charAt(Math.max(0, offset - 1)); String noWordSep = (String) document.getProperty("noWordSep"); @@ -1899,9 +1910,7 @@ // If the user clicked on a non-letter char, // we select the surrounding non-letters - boolean selectNoLetter = (!Character - .isLetterOrDigit(ch) - && noWordSep.indexOf(ch) == -1); + final boolean selectNoLetter = !Character.isLetterOrDigit(ch) && noWordSep.indexOf(ch) == -1; int wordStart = 0; @@ -1922,7 +1931,7 @@ } } - int lineStart = getLineStartOffset(line); + final int lineStart = getLineStartOffset(line); select(lineStart + wordStart, lineStart + wordEnd); /* @@ -1932,52 +1941,55 @@ int wordEnd = TextUtilities.findWordEnd(lineText, offset, noWordSep); int lineStart = getLineStartOffset(line); - select(lineStart+wordStart, lineStart+wordEnd); + select(lineStart + wordStart, lineStart + wordEnd); */ } - private void doTripleClick(MouseEvent evt, int line, - int offset, int dot) { + private void doTripleClick(final MouseEvent evt, final int line, final int offset, final int dot) { select(getLineStartOffset(line), getLineEndOffset(line) - 1); } - } - class CaretUndo extends AbstractUndoableEdit { + } // class MouseHandler + final class CaretUndo extends AbstractUndoableEdit { + + /** + * Serial Version UID. + */ + private static final long serialVersionUID = -7132615163216882489L; + private int start; private int end; - private static final long serialVersionUID = -7132615163216882489L; - - CaretUndo(int start, int end) { + CaretUndo(final int start, final int end) { this.start = start; this.end = end; } - public boolean isSignificant() { + public final boolean isSignificant() { return false; } - public String getPresentationName() { + public final String getPresentationName() { return "caret move"; } - public void undo() { + public final void undo() { super.undo(); select(start, end); } - public void redo() { + public final void redo() { super.redo(); select(start, end); } - public boolean addEdit(UndoableEdit edit) { + public final boolean addEdit(final UndoableEdit edit) { if (edit instanceof CaretUndo) { - CaretUndo cedit = (CaretUndo) edit; + final CaretUndo ce... [truncated message content] |
From: <der...@us...> - 2006-05-28 23:21:04
|
Revision: 66 Author: derdanny Date: 2006-05-28 16:20:56 -0700 (Sun, 28 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=66&view=rev Log Message: ----------- Fixed #1496473 (Map contents when closing unsaved maps are lost). Modified Paths: -------------- trunk/daimonin/src/daieditor/CMainControl.java Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-05-28 22:05:07 UTC (rev 65) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-05-28 23:20:56 UTC (rev 66) @@ -25,9 +25,8 @@ package daieditor; -import static net.sf.japi.swing.ActionFactory.getFactory; +import static daieditor.CMainView.MAP_TILE_LIST_BOTTOM_DEFAULT; import static daieditor.CMainView.MAP_TILE_LIST_BOTTOM_KEY; -import static daieditor.CMainView.MAP_TILE_LIST_BOTTOM_DEFAULT; import static daieditor.IGUIConstants.TILE_EDIT_NONE; import daieditor.arch.ArchObject; import daieditor.arch.ArchObjectParser; @@ -112,6 +111,7 @@ import static javax.swing.KeyStroke.getKeyStroke; import javax.swing.filechooser.FileFilter; import net.sf.japi.swing.ActionFactory; +import static net.sf.japi.swing.ActionFactory.getFactory; import net.sf.japi.swing.TipOfTheDayManager; import net.sf.japi.swing.prefs.PreferencesGroup; import static net.sf.japi.swing.prefs.PreferencesPane.showPreferencesDialog; @@ -927,9 +927,10 @@ */ public void closeView(final CMapViewIFrame mapViewIFrame) { final MapControl mapControl = mapViewIFrame.getMapControl(); - mapControl.closeView(mapViewIFrame); - if (mapControl.nViews() == 0) { + if (mapControl.nViews() <= 1) { closeLevel(mapControl); + } else { + mapControl.closeView(mapViewIFrame); } } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-05-28 22:05:22
|
Revision: 65 Author: christianhujer Date: 2006-05-28 15:05:07 -0700 (Sun, 28 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=65&view=rev Log Message: ----------- Unified preferences classes: removal of unused serialVersionUID (@serial exclude), renamed prefs to PREFS. Modified Paths: -------------- trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/gui/prefs/AppPrefs.java trunk/daimonin/src/daieditor/gui/prefs/DevPrefs.java trunk/daimonin/src/daieditor/gui/prefs/GUIPrefs.java trunk/daimonin/src/daieditor/gui/prefs/MapValidatorPrefs.java trunk/daimonin/src/daieditor/gui/prefs/MiscPrefs.java trunk/daimonin/src/daieditor/gui/prefs/NetPrefs.java trunk/daimonin/src/daieditor/gui/prefs/ResPrefs.java trunk/daimonin/src/daieditor/gui/prefs/UpdatePrefs.java Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2006-05-28 22:04:50 UTC (rev 64) +++ trunk/daimonin/src/daieditor/CMainControl.java 2006-05-28 22:05:07 UTC (rev 65) @@ -1511,7 +1511,7 @@ new ResPrefs(this), new AppPrefs(), new NetPrefs(), - new GUIPrefs(this), + new GUIPrefs(), new MiscPrefs(), new DevPrefs(), new UpdatePrefs(), Modified: trunk/daimonin/src/daieditor/gui/prefs/AppPrefs.java =================================================================== --- trunk/daimonin/src/daieditor/gui/prefs/AppPrefs.java 2006-05-28 22:04:50 UTC (rev 64) +++ trunk/daimonin/src/daieditor/gui/prefs/AppPrefs.java 2006-05-28 22:05:07 UTC (rev 65) @@ -56,14 +56,11 @@ */ public final class AppPrefs extends AbstractPrefs { - /** Serial Version UID. */ - private static final long serialVersionUID = 1L; - /** Action Facotry. */ private static final ActionFactory ACTION_FACTORY = getFactory("daieditor"); /** Preferences. */ - private static final Preferences prefs = userNodeForPackage(CMainControl.class); + private static final Preferences PREFS = userNodeForPackage(CMainControl.class); /** TextField for server executable. */ private JTextField serverField; @@ -94,16 +91,16 @@ /** {@inheritDoc} */ public void apply() { - prefs.put(PREFS_APP_SERVER, path(serverField.getText())); - prefs.put(PREFS_APP_CLIENT, path(clientField.getText())); - prefs.put(PREFS_APP_EDITOR, path(editorField.getText())); + PREFS.put(PREFS_APP_SERVER, path(serverField.getText())); + PREFS.put(PREFS_APP_CLIENT, path(clientField.getText())); + PREFS.put(PREFS_APP_EDITOR, path(editorField.getText())); } /** {@inheritDoc} */ public void revert() { - serverField.setText(prefs.get(PREFS_APP_SERVER, PREFS_APP_SERVER_DEFAULT)); - clientField.setText(prefs.get(PREFS_APP_CLIENT, PREFS_APP_CLIENT_DEFAULT)); - editorField.setText(prefs.get(PREFS_APP_EDITOR, PREFS_APP_EDITOR_DEFAULT)); + serverField.setText(PREFS.get(PREFS_APP_SERVER, PREFS_APP_SERVER_DEFAULT)); + clientField.setText(PREFS.get(PREFS_APP_CLIENT, PREFS_APP_CLIENT_DEFAULT)); + editorField.setText(PREFS.get(PREFS_APP_EDITOR, PREFS_APP_EDITOR_DEFAULT)); } /** {@inheritDoc} */ @@ -116,9 +113,9 @@ /** {@inheritDoc} */ public boolean isChanged() { return !( - serverField.getText().equals(prefs.get(PREFS_APP_SERVER, PREFS_APP_SERVER_DEFAULT)) - && clientField.getText().equals(prefs.get(PREFS_APP_CLIENT, PREFS_APP_CLIENT_DEFAULT)) - && editorField.getText().equals(prefs.get(PREFS_APP_EDITOR, PREFS_APP_EDITOR_DEFAULT)) + serverField.getText().equals(PREFS.get(PREFS_APP_SERVER, PREFS_APP_SERVER_DEFAULT)) + && clientField.getText().equals(PREFS.get(PREFS_APP_CLIENT, PREFS_APP_CLIENT_DEFAULT)) + && editorField.getText().equals(PREFS.get(PREFS_APP_EDITOR, PREFS_APP_EDITOR_DEFAULT)) ); } @@ -130,9 +127,9 @@ final Box appPanel = createVerticalBox(); appPanel.setBorder(createTitledBorder("optionsApps")); - serverField = createFileField(appPanel, "optionsAppServer", prefs.get(PREFS_APP_SERVER, PREFS_APP_SERVER_DEFAULT), FILES_ONLY); - clientField = createFileField(appPanel, "optionsAppClient", prefs.get(PREFS_APP_CLIENT, PREFS_APP_CLIENT_DEFAULT), FILES_ONLY); - editorField = createFileField(appPanel, "optionsAppEditor", prefs.get(PREFS_APP_EDITOR, PREFS_APP_EDITOR_DEFAULT), FILES_ONLY); + serverField = createFileField(appPanel, "optionsAppServer", PREFS.get(PREFS_APP_SERVER, PREFS_APP_SERVER_DEFAULT), FILES_ONLY); + clientField = createFileField(appPanel, "optionsAppClient", PREFS.get(PREFS_APP_CLIENT, PREFS_APP_CLIENT_DEFAULT), FILES_ONLY); + editorField = createFileField(appPanel, "optionsAppEditor", PREFS.get(PREFS_APP_EDITOR, PREFS_APP_EDITOR_DEFAULT), FILES_ONLY); return appPanel; } Modified: trunk/daimonin/src/daieditor/gui/prefs/DevPrefs.java =================================================================== --- trunk/daimonin/src/daieditor/gui/prefs/DevPrefs.java 2006-05-28 22:04:50 UTC (rev 64) +++ trunk/daimonin/src/daieditor/gui/prefs/DevPrefs.java 2006-05-28 22:05:07 UTC (rev 65) @@ -46,14 +46,11 @@ */ public final class DevPrefs extends AbstractPrefs { - /** Serial Version UID. */ - private static final long serialVersionUID = 1L; - /** Action Facotry. */ private static final ActionFactory ACTION_FACTORY = getFactory("daieditor"); /** Preferences. */ - private static final Preferences prefs = userNodeForPackage(CMainControl.class); + private static final Preferences PREFS = userNodeForPackage(CMainControl.class); /** Use Systme.exit() for exiting the program. */ private JCheckBox systemExit; @@ -78,12 +75,12 @@ /** {@inheritDoc} */ public void apply() { - prefs.putBoolean(PREFS_SYSTEM_EXIT, systemExit.isSelected()); + PREFS.putBoolean(PREFS_SYSTEM_EXIT, systemExit.isSelected()); } /** {@inheritDoc} */ public void revert() { - systemExit.setSelected(prefs.getBoolean(PREFS_SYSTEM_EXIT, PREFS_SYSTEM_EXIT_DEFAULT)); + systemExit.setSelected(PREFS.getBoolean(PREFS_SYSTEM_EXIT, PREFS_SYSTEM_EXIT_DEFAULT)); } /** {@inheritDoc} */ @@ -94,7 +91,7 @@ /** {@inheritDoc} */ public boolean isChanged() { return !( - systemExit.isSelected() == prefs.getBoolean(PREFS_SYSTEM_EXIT, PREFS_SYSTEM_EXIT_DEFAULT) + systemExit.isSelected() == PREFS.getBoolean(PREFS_SYSTEM_EXIT, PREFS_SYSTEM_EXIT_DEFAULT) ); } @@ -107,7 +104,7 @@ miscPanel.setBorder(createTitledBorder("optionsMisc")); systemExit = new JCheckBox(ACTION_FACTORY.createAction(false, "optionsSystemExit")); - systemExit.setSelected(prefs.getBoolean(PREFS_SYSTEM_EXIT, PREFS_SYSTEM_EXIT_DEFAULT)); + systemExit.setSelected(PREFS.getBoolean(PREFS_SYSTEM_EXIT, PREFS_SYSTEM_EXIT_DEFAULT)); miscPanel.add(systemExit); return miscPanel; } Modified: trunk/daimonin/src/daieditor/gui/prefs/GUIPrefs.java =================================================================== --- trunk/daimonin/src/daieditor/gui/prefs/GUIPrefs.java 2006-05-28 22:04:50 UTC (rev 64) +++ trunk/daimonin/src/daieditor/gui/prefs/GUIPrefs.java 2006-05-28 22:05:07 UTC (rev 65) @@ -55,9 +55,6 @@ */ public final class GUIPrefs extends AbstractPrefs { - /** Serial Version UID. */ - private static final long serialVersionUID = 1L; - /** Action Facotry. */ private static final ActionFactory ACTION_FACTORY = getFactory("daieditor"); @@ -78,9 +75,8 @@ /** * Create a GUIPrefs pane. - * @param mainControl The controller of this dialog. */ - public GUIPrefs(final CMainControl mainControl) { + public GUIPrefs() { setListLabelText(ACTION_FACTORY.getString("prefsGUI.title")); setListLabelIcon(ACTION_FACTORY.getIcon("prefsGUI.icon")); Modified: trunk/daimonin/src/daieditor/gui/prefs/MapValidatorPrefs.java =================================================================== --- trunk/daimonin/src/daieditor/gui/prefs/MapValidatorPrefs.java 2006-05-28 22:04:50 UTC (rev 64) +++ trunk/daimonin/src/daieditor/gui/prefs/MapValidatorPrefs.java 2006-05-28 22:05:07 UTC (rev 65) @@ -54,7 +54,7 @@ private static final ActionFactory ACTION_FACTORY = getFactory("daieditor"); /** Preferences. */ - private static final Preferences prefs = userNodeForPackage(CMainControl.class); + private static final Preferences PREFS = userNodeForPackage(CMainControl.class); /** The delegating validator that contains all the validators. */ private final DelegatingMapValidator validators; @@ -70,7 +70,7 @@ * @param mapValidators the delegating map validator that contains all the validators */ public MapValidatorPrefs(final DelegatingMapValidator mapValidators) { - this.validators = mapValidators; + validators = mapValidators; setListLabelText(ACTION_FACTORY.getString("prefsMapValidator.title")); setListLabelIcon(ACTION_FACTORY.getIcon("prefsMapValidator.icon")); @@ -93,7 +93,7 @@ for (final Map.Entry<Validator, JCheckBox> entry : checkBoxes.entrySet()) { entry.getKey().setEnabled(entry.getValue().isSelected()); } - prefs.putBoolean(PREFS_VALIDATOR_AUTO, autoValidate.isSelected()); + PREFS.putBoolean(PREFS_VALIDATOR_AUTO, autoValidate.isSelected()); } /** {@inheritDoc} */ @@ -101,7 +101,7 @@ for (final Map.Entry<Validator, JCheckBox> entry : checkBoxes.entrySet()) { entry.getValue().setSelected(entry.getKey().isEnabled()); } - autoValidate.setSelected(prefs.getBoolean(PREFS_VALIDATOR_AUTO, PREFS_VALIDATOR_AUTO_DEFAULT)); + autoValidate.setSelected(PREFS.getBoolean(PREFS_VALIDATOR_AUTO, PREFS_VALIDATOR_AUTO_DEFAULT)); } /** {@inheritDoc} */ @@ -119,7 +119,7 @@ return true; } } - return autoValidate.isSelected() != prefs.getBoolean(PREFS_VALIDATOR_AUTO, PREFS_VALIDATOR_AUTO_DEFAULT); + return autoValidate.isSelected() != PREFS.getBoolean(PREFS_VALIDATOR_AUTO, PREFS_VALIDATOR_AUTO_DEFAULT); } /** @@ -129,7 +129,7 @@ private Component createValidationPanel() { final Box panel = createVerticalBox(); panel.setBorder(createTitledBorder("optionsValidation")); - autoValidate = new JCheckBox(ACTION_FACTORY.getString("autoValidate.text"), prefs.getBoolean(PREFS_VALIDATOR_AUTO, PREFS_VALIDATOR_AUTO_DEFAULT)); + autoValidate = new JCheckBox(ACTION_FACTORY.getString("autoValidate.text"), PREFS.getBoolean(PREFS_VALIDATOR_AUTO, PREFS_VALIDATOR_AUTO_DEFAULT)); panel.add(autoValidate); return panel; } Modified: trunk/daimonin/src/daieditor/gui/prefs/MiscPrefs.java =================================================================== --- trunk/daimonin/src/daieditor/gui/prefs/MiscPrefs.java 2006-05-28 22:04:50 UTC (rev 64) +++ trunk/daimonin/src/daieditor/gui/prefs/MiscPrefs.java 2006-05-28 22:05:07 UTC (rev 65) @@ -48,14 +48,11 @@ */ public final class MiscPrefs extends AbstractPrefs { - /** Serial Version UID. */ - private static final long serialVersionUID = 1L; - /** Action Facotry. */ private static final ActionFactory ACTION_FACTORY = getFactory("daieditor"); /** Preferences. */ - private static final Preferences prefs = userNodeForPackage(CMainControl.class); + private static final Preferences PREFS = userNodeForPackage(CMainControl.class); /** TextField for user / artist name. */ private JTextField userField; @@ -84,13 +81,13 @@ /** {@inheritDoc} */ public void apply() { - prefs.put(PREFS_USERNAME, userField.getText()); + PREFS.put(PREFS_USERNAME, userField.getText()); MapFileFilter.setPerformingRealChecks(checkMaps.isSelected()); } /** {@inheritDoc} */ public void revert() { - userField.setText(prefs.get(PREFS_USERNAME, PREFS_USERNAME_DEFAULT)); + userField.setText(PREFS.get(PREFS_USERNAME, PREFS_USERNAME_DEFAULT)); checkMaps.setSelected(MapFileFilter.isPerformingRealChecks()); } @@ -103,7 +100,7 @@ /** {@inheritDoc} */ public boolean isChanged() { return !( - userField.getText().equals(prefs.get(PREFS_USERNAME, PREFS_USERNAME_DEFAULT)) + userField.getText().equals(PREFS.get(PREFS_USERNAME, PREFS_USERNAME_DEFAULT)) && checkMaps.isSelected() == MapFileFilter.isPerformingRealChecks() ); } @@ -115,7 +112,7 @@ private Component createUserPanel() { final Box userPanel = createVerticalBox(); userPanel.setBorder(createTitledBorder("optionsUser")); - userField = new JTextField(prefs.get(PREFS_USERNAME, PREFS_USERNAME_DEFAULT)); + userField = new JTextField(PREFS.get(PREFS_USERNAME, PREFS_USERNAME_DEFAULT)); userPanel.add(userField); return userPanel; } Modified: trunk/daimonin/src/daieditor/gui/prefs/NetPrefs.java =================================================================== --- trunk/daimonin/src/daieditor/gui/prefs/NetPrefs.java 2006-05-28 22:04:50 UTC (rev 64) +++ trunk/daimonin/src/daieditor/gui/prefs/NetPrefs.java 2006-05-28 22:05:07 UTC (rev 65) @@ -53,9 +53,6 @@ */ public class NetPrefs extends AbstractPrefs implements ItemListener { - /** Serial Version UID. */ - private static final long serialVersionUID = 1L; - /** The preferences key for the type. */ private static final String NET_PREFS_KEY_TYPE = "daieditor.proxy.type"; @@ -69,16 +66,16 @@ private static final ActionFactory ACTION_FACTORY = getFactory("daieditor"); /** Preferences. */ - private static final Preferences prefs = userNodeForPackage(CMainControl.class); + private static final Preferences PREFS = userNodeForPackage(CMainControl.class); /** JComboBox for selecting the proxy type. */ private JComboBox proxyType = createProxyType(); /** TextField for server executable. */ - private JTextField proxyHost = new JTextField(prefs.get(NET_PREFS_KEY_HOST, "")); + private JTextField proxyHost = new JTextField(PREFS.get(NET_PREFS_KEY_HOST, "")); /** TextField for client executable. */ - private JSpinner proxyPort = new JSpinner(new SpinnerNumberModel(prefs.getInt(NET_PREFS_KEY_PORT, 3128), 1, 65535, 1)); + private JSpinner proxyPort = new JSpinner(new SpinnerNumberModel(PREFS.getInt(NET_PREFS_KEY_PORT, 3128), 1, 65535, 1)); /** Create a NetPrefs pane. */ public NetPrefs() { @@ -103,37 +100,37 @@ /** {@inheritDoc} */ public boolean isChanged() { return !( - (Proxy.Type) proxyType.getSelectedItem() == Proxy.Type.valueOf(prefs.get(NET_PREFS_KEY_TYPE, "DIRECT")) - && prefs.get(NET_PREFS_KEY_HOST, "").equals(proxyHost.getText()) - && prefs.getInt(NET_PREFS_KEY_PORT, 3128) == (Integer) proxyPort.getValue() + (Proxy.Type) proxyType.getSelectedItem() == Proxy.Type.valueOf(PREFS.get(NET_PREFS_KEY_TYPE, "DIRECT")) + && PREFS.get(NET_PREFS_KEY_HOST, "").equals(proxyHost.getText()) + && PREFS.getInt(NET_PREFS_KEY_PORT, 3128) == (Integer) proxyPort.getValue() ); } /** {@inheritDoc} */ public void defaults() { - prefs.remove(NET_PREFS_KEY_TYPE); - prefs.remove(NET_PREFS_KEY_HOST); - prefs.remove(NET_PREFS_KEY_PORT); + PREFS.remove(NET_PREFS_KEY_TYPE); + PREFS.remove(NET_PREFS_KEY_HOST); + PREFS.remove(NET_PREFS_KEY_PORT); revert(); } /** {@inheritDoc} */ public void revert() { - final Proxy.Type proxyType = Proxy.Type.valueOf(prefs.get(NET_PREFS_KEY_TYPE, "DIRECT")); + final Proxy.Type proxyType = Proxy.Type.valueOf(PREFS.get(NET_PREFS_KEY_TYPE, "DIRECT")); this.proxyType.setSelectedIndex(proxyType.ordinal()); final boolean enableProxy = proxyType != DIRECT; proxyHost.setEnabled(enableProxy); proxyPort.setEnabled(enableProxy); - proxyHost.setText(prefs.get(NET_PREFS_KEY_HOST, "")); - proxyPort.setValue(prefs.getInt(NET_PREFS_KEY_PORT, 3128)); + proxyHost.setText(PREFS.get(NET_PREFS_KEY_HOST, "")); + proxyPort.setValue(PREFS.getInt(NET_PREFS_KEY_PORT, 3128)); } /** {@inheritDoc} */ public void apply() { - prefs.put(NET_PREFS_KEY_TYPE, ((Enum<Proxy.Type>) proxyType.getSelectedItem()).name()); - prefs.put(NET_PREFS_KEY_HOST, proxyHost.getText()); - prefs.putInt(NET_PREFS_KEY_PORT, (Integer) proxyPort.getValue()); + PREFS.put(NET_PREFS_KEY_TYPE, ((Enum<Proxy.Type>) proxyType.getSelectedItem()).name()); + PREFS.put(NET_PREFS_KEY_HOST, proxyHost.getText()); + PREFS.putInt(NET_PREFS_KEY_PORT, (Integer) proxyPort.getValue()); } /** @@ -153,7 +150,7 @@ * Create the JComboBox for selecting the proxy type. * @return JComboBox for selecting the proxy type */ - private JComboBox createProxyType() { + private static JComboBox createProxyType() { final JComboBox proxyType = new JComboBox(EnumSet.allOf(Proxy.Type.class).toArray()); return proxyType; } @@ -163,11 +160,11 @@ * @return currently preferred proxy */ public static Proxy getProxy() { - final Proxy.Type proxyType = Proxy.Type.valueOf(prefs.get(NET_PREFS_KEY_TYPE, "DIRECT")); + final Proxy.Type proxyType = Proxy.Type.valueOf(PREFS.get(NET_PREFS_KEY_TYPE, "DIRECT")); if (proxyType == DIRECT) { return NO_PROXY; } - return new Proxy(proxyType, new InetSocketAddress(prefs.get(NET_PREFS_KEY_HOST, "proxy"), prefs.getInt(NET_PREFS_KEY_PORT, 3128))); + return new Proxy(proxyType, new InetSocketAddress(PREFS.get(NET_PREFS_KEY_HOST, "proxy"), PREFS.getInt(NET_PREFS_KEY_PORT, 3128))); } /** {@inheritDoc} */ Modified: trunk/daimonin/src/daieditor/gui/prefs/ResPrefs.java =================================================================== --- trunk/daimonin/src/daieditor/gui/prefs/ResPrefs.java 2006-05-28 22:04:50 UTC (rev 64) +++ trunk/daimonin/src/daieditor/gui/prefs/ResPrefs.java 2006-05-28 22:05:07 UTC (rev 65) @@ -53,9 +53,6 @@ */ public final class ResPrefs extends AbstractPrefs { - /** Serial Version UID. */ - private static final long serialVersionUID = 1L; - /** Action Facotry. */ private static final ActionFactory ACTION_FACTORY = getFactory("daieditor"); Modified: trunk/daimonin/src/daieditor/gui/prefs/UpdatePrefs.java =================================================================== --- trunk/daimonin/src/daieditor/gui/prefs/UpdatePrefs.java 2006-05-28 22:04:50 UTC (rev 64) +++ trunk/daimonin/src/daieditor/gui/prefs/UpdatePrefs.java 2006-05-28 22:05:07 UTC (rev 65) @@ -46,14 +46,11 @@ */ public final class UpdatePrefs extends AbstractPrefs { - /** Serial Version UID. */ - private static final long serialVersionUID = 1L; - /** Action Facotry. */ private static final ActionFactory ACTION_FACTORY = getFactory("daieditor"); /** Preferences. */ - private static final Preferences prefs = userNodeForPackage(CMainControl.class); + private static final Preferences PREFS = userNodeForPackage(CMainControl.class); /** Checkbox whether to automatically check for updates on startup. */ private JCheckBox autoUpdate; @@ -81,14 +78,14 @@ /** {@inheritDoc} */ public void apply() { - prefs.putBoolean(Updater.AUTO_CHECK_KEY, autoUpdate.isSelected()); - prefs.putInt(Updater.INTERVAL_KEY, interval.getSelectedIndex()); + PREFS.putBoolean(Updater.AUTO_CHECK_KEY, autoUpdate.isSelected()); + PREFS.putInt(Updater.INTERVAL_KEY, interval.getSelectedIndex()); } /** {@inheritDoc} */ public void revert() { - autoUpdate.setSelected(prefs.getBoolean(Updater.AUTO_CHECK_KEY, Updater.AUTO_CHECK_DEFAULT)); - interval.setSelectedIndex(prefs.getInt(Updater.INTERVAL_KEY, Updater.INTERVAL_DEFAULT)); + autoUpdate.setSelected(PREFS.getBoolean(Updater.AUTO_CHECK_KEY, Updater.AUTO_CHECK_DEFAULT)); + interval.setSelectedIndex(PREFS.getInt(Updater.INTERVAL_KEY, Updater.INTERVAL_DEFAULT)); } /** {@inheritDoc} */ @@ -100,8 +97,8 @@ /** {@inheritDoc} */ public boolean isChanged() { return !( - autoUpdate.isSelected() == prefs.getBoolean(Updater.AUTO_CHECK_KEY, Updater.AUTO_CHECK_DEFAULT) - && interval.getSelectedIndex() == prefs.getInt(Updater.INTERVAL_KEY, Updater.INTERVAL_DEFAULT) + autoUpdate.isSelected() == PREFS.getBoolean(Updater.AUTO_CHECK_KEY, Updater.AUTO_CHECK_DEFAULT) + && interval.getSelectedIndex() == PREFS.getInt(Updater.INTERVAL_KEY, Updater.INTERVAL_DEFAULT) ); } @@ -113,7 +110,7 @@ final Box updatePanel = createVerticalBox(); updatePanel.setBorder(createTitledBorder("optionsUpdate")); autoUpdate = new JCheckBox(ACTION_FACTORY.createToggle(false, "autoUpdate", this)); - autoUpdate.setSelected(prefs.getBoolean(Updater.AUTO_CHECK_KEY, Updater.AUTO_CHECK_DEFAULT)); + autoUpdate.setSelected(PREFS.getBoolean(Updater.AUTO_CHECK_KEY, Updater.AUTO_CHECK_DEFAULT)); updatePanel.add(autoUpdate); updatePanel.add(createComboBox()); return updatePanel; @@ -148,8 +145,8 @@ }; interval = new JComboBox(items); interval.setEditable(false); - interval.setSelectedIndex(prefs.getInt(Updater.INTERVAL_KEY, Updater.INTERVAL_DEFAULT)); - interval.setEnabled(prefs.getBoolean(Updater.AUTO_CHECK_KEY, Updater.AUTO_CHECK_DEFAULT)); + interval.setSelectedIndex(PREFS.getInt(Updater.INTERVAL_KEY, Updater.INTERVAL_DEFAULT)); + interval.setEnabled(PREFS.getBoolean(Updater.AUTO_CHECK_KEY, Updater.AUTO_CHECK_DEFAULT)); return interval; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-05-28 22:05:05
|
Revision: 64 Author: akirschbaum Date: 2006-05-28 15:04:50 -0700 (Sun, 28 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=64&view=rev Log Message: ----------- Unified classes: whitespace changes, add final/static. Modified Paths: -------------- trunk/crossfire/src/cfeditor/textedit/textarea/TokenMarker.java trunk/daimonin/src/daieditor/textedit/textarea/TokenMarker.java Modified: trunk/crossfire/src/cfeditor/textedit/textarea/TokenMarker.java =================================================================== --- trunk/crossfire/src/cfeditor/textedit/textarea/TokenMarker.java 2006-05-28 21:56:20 UTC (rev 63) +++ trunk/crossfire/src/cfeditor/textedit/textarea/TokenMarker.java 2006-05-28 22:04:50 UTC (rev 64) @@ -31,24 +31,23 @@ * @param line the line * @param lineIndex the line number */ - public Token markTokens(Segment line, int lineIndex) { + public final Token markTokens(final Segment line, final int lineIndex) { if (lineIndex >= length) { throw new IllegalArgumentException("Tokenizing invalid line: " + lineIndex); } lastToken = null; - LineInfo info = lineInfo[lineIndex]; - LineInfo prev; + final LineInfo info = lineInfo[lineIndex]; + final LineInfo prev; if (lineIndex == 0) { prev = null; } else { prev = lineInfo[lineIndex - 1]; } - byte oldToken = info.token; - byte token = markTokensImpl(prev == null ? - Token.NULL : prev.token, line, lineIndex); + final byte oldToken = info.token; + final byte token = markTokensImpl(prev == null ? Token.NULL : prev.token, line, lineIndex); info.token = token; @@ -91,7 +90,7 @@ * duplicate it. */ if (!(lastLine == lineIndex && nextLineRequested)) { - nextLineRequested = (oldToken != token); + nextLineRequested = oldToken != token; } lastLine = lineIndex; @@ -115,8 +114,7 @@ * @param lineIndex the index of the line in the document, starting at 0 * @return the initial token type for the next line */ - protected abstract byte markTokensImpl(byte token, Segment line, - int lineIndex); + protected abstract byte markTokensImpl(byte token, Segment line, int lineIndex); /** * Returns if the token marker supports tokens that span multiple lines. If @@ -127,7 +125,7 @@ * The default implementation returns true; it should be overridden to * return false on simpler token markers for increased speed. */ - public boolean supportsMultilineTokens() { + public static final boolean supportsMultilineTokens() { return true; } @@ -137,14 +135,13 @@ * @param index the first line number * @param lines the number of lines */ - public void insertLines(int index, int lines) { + public final void insertLines(final int index, final int lines) { if (lines <= 0) { return; } - length += lines; ensureCapacity(length); - int len = index + lines; + final int len = index + lines; System.arraycopy(lineInfo, index, lineInfo, len, lineInfo.length - len); for (int i = index + lines - 1; i >= index; i--) { @@ -158,18 +155,17 @@ * @param index the first line number * @param lines the number of lines */ - public void deleteLines(int index, int lines) { + public final void deleteLines(final int index, final int lines) { if (lines <= 0) { return; } - - int len = index + lines; + final int len = index + lines; length -= lines; System.arraycopy(lineInfo, len, lineInfo, index, lineInfo.length - len); } /** Returns the number of lines in this token marker. */ - public int getLineCount() { + public final int getLineCount() { return length; } @@ -178,7 +174,7 @@ * after a line has been tokenized that starts a multiline token that * continues onto the next line. */ - public boolean isNextLineRequested() { + public final boolean isNextLineRequested() { return nextLineRequested; } @@ -233,11 +229,11 @@ * array automatically. * @param index the array index */ - protected void ensureCapacity(int index) { + protected final void ensureCapacity(final int index) { if (lineInfo == null) { lineInfo = new LineInfo[index + 1]; } else if (lineInfo.length <= index) { - LineInfo[] lineInfoN = new LineInfo[(index + 1) * 2]; + final LineInfo[] lineInfoN = new LineInfo[(index + 1) * 2]; System.arraycopy(lineInfo, 0, lineInfoN, 0, lineInfo.length); lineInfo = lineInfoN; } @@ -248,7 +244,7 @@ * @param length the length of the token * @param id the id of the token */ - protected void addToken(int length, byte id) { + protected final void addToken(final int length, final byte id) { if (id >= Token.INTERNAL_FIRST && id <= Token.INTERNAL_LAST) { throw new InternalError("Invalid id: " + id); } @@ -275,7 +271,7 @@ } /** Inner class for storing information about tokenized lines. */ - public class LineInfo { + public static final class LineInfo { /** * Creates a new LineInfo object with token = Token.NULL and obj = @@ -284,8 +280,10 @@ public LineInfo() { } - /** Creates a new LineInfo object with the specified parameters. */ - public LineInfo(byte token, Object obj) { + /** + * Creates a new LineInfo object with the specified parameters. + */ + public LineInfo(final byte token, final Object obj) { this.token = token; this.obj = obj; } @@ -299,5 +297,6 @@ * exist on a per-line basis. */ public Object obj; - } -} + } // class LineInfo + +} // class TokenMarker Modified: trunk/daimonin/src/daieditor/textedit/textarea/TokenMarker.java =================================================================== --- trunk/daimonin/src/daieditor/textedit/textarea/TokenMarker.java 2006-05-28 21:56:20 UTC (rev 63) +++ trunk/daimonin/src/daieditor/textedit/textarea/TokenMarker.java 2006-05-28 22:04:50 UTC (rev 64) @@ -12,25 +12,24 @@ import javax.swing.text.Segment; /** - * A token marker that splits lines of text into tokens. Each token carries - * a length field and an indentification tag that can be mapped to a color - * for painting that token.<p> + * A token marker that splits lines of text into tokens. Each token carries a + * length field and an indentification tag that can be mapped to a color for + * painting that token.<p> * <p/> - * For performance reasons, the linked list of tokens is reused after each - * line is tokenized. Therefore, the return value of <code>markTokens</code> - * should only be used for immediate painting. Notably, it cannot be - * cached. + * For performance reasons, the linked list of tokens is reused after each line + * is tokenized. Therefore, the return value of <code>markTokens</code> should + * only be used for immediate painting. Notably, it cannot be cached. * @author Slava Pestov * @version $Id: TokenMarker.java,v 1.8 2005/08/09 13:41:55 christianhujer Exp $ - * @see "org.gjt.sp.jedit.syntax.Token" + * @see Token */ public abstract class TokenMarker { /** - * A wrapper for the lower-level <code>markTokensImpl</code> method - * that is called to split a line up into tokens. - * @param line The line - * @param lineIndex The line number + * A wrapper for the lower-level <code>markTokensImpl</code> method that is + * called to split a line up into tokens. + * @param line the line + * @param lineIndex the line number */ public final Token markTokens(final Segment line, final int lineIndex) { if (lineIndex >= length) { @@ -102,42 +101,39 @@ } /** - * An abstract method that splits a line up into tokens. It - * should parse the line, and call <code>addToken()</code> to - * add syntax tokens to the token list. Then, it should return - * the initial token type for the next line.<p> + * An abstract method that splits a line up into tokens. It should parse + * the line, and call <code>addToken()</code> to add syntax tokens to the + * token list. Then, it should return the initial token type for the next + * line.<p> * <p/> - * For example if the current line contains the start of a - * multiline comment that doesn't end on that line, this method - * should return the comment token type so that it continues on - * the next line. - * @param token The initial token type for this line - * @param line The line to be tokenized - * @param lineIndex The index of the line in the document, - * starting at 0 - * @return The initial token type for the next line + * For example if the current line contains the start of a multiline + * comment that doesn't end on that line, this method should return the + * comment token type so that it continues on the next line. + * @param token the initial token type for this line + * @param line the line to be tokenized + * @param lineIndex the index of the line in the document, starting at 0 + * @return the initial token type for the next line */ protected abstract byte markTokensImpl(byte token, Segment line, int lineIndex); /** - * Returns if the token marker supports tokens that span multiple - * lines. If this is true, the object using this token marker is - * required to pass all lines in the document to the - * <code>markTokens()</code> method (in turn).<p> + * Returns if the token marker supports tokens that span multiple lines. If + * this is true, the object using this token marker is required to pass all + * lines in the document to the <code>markTokens()</code> method (in + * turn).<p> * <p/> - * The default implementation returns true; it should be overridden - * to return false on simpler token markers for increased speed. + * The default implementation returns true; it should be overridden to + * return false on simpler token markers for increased speed. */ public static final boolean supportsMultilineTokens() { return true; } /** - * Informs the token marker that lines have been inserted into - * the document. This inserts a gap in the <code>lineInfo</code> - * array. - * @param index The first line number - * @param lines The number of lines + * Informs the token marker that lines have been inserted into the + * document. This inserts a gap in the <code>lineInfo</code> array. + * @param index the first line number + * @param lines the number of lines */ public final void insertLines(final int index, final int lines) { if (lines <= 0) { @@ -154,11 +150,10 @@ } /** - * Informs the token marker that line have been deleted from - * the document. This removes the lines in question from the - * <code>lineInfo</code> array. - * @param index The first line number - * @param lines The number of lines + * Informs the token marker that line have been deleted from the document. + * This removes the lines in question from the <code>lineInfo</code> array. + * @param index the first line number + * @param lines the number of lines */ public final void deleteLines(final int index, final int lines) { if (lines <= 0) { @@ -175,9 +170,9 @@ } /** - * Returns true if the next line should be repainted. This - * will return true after a line has been tokenized that starts - * a multiline token that continues onto the next line. + * Returns true if the next line should be repainted. This will return true + * after a line has been tokenized that starts a multiline token that + * continues onto the next line. */ public final boolean isNextLineRequested() { return nextLineRequested; @@ -186,27 +181,27 @@ // protected members /** - * The first token in the list. This should be used as the return - * value from <code>markTokens()</code>. + * The first token in the list. This should be used as the return value + * from <code>markTokens()</code>. */ protected Token firstToken; /** - * The last token in the list. New tokens are added here. - * This should be set to null before a new line is to be tokenized. + * The last token in the list. New tokens are added here. This should be + * set to null before a new line is to be tokenized. */ protected Token lastToken; /** - * An array for storing information about lines. It is enlarged and - * shrunk automatically by the <code>insertLines()</code> and + * An array for storing information about lines. It is enlarged and shrunk + * automatically by the <code>insertLines()</code> and * <code>deleteLines()</code> methods. */ protected LineInfo[] lineInfo; /** - * The number of lines in the model being tokenized. This can be - * less than the length of the <code>lineInfo</code> array. + * The number of lines in the model being tokenized. This can be less than + * the length of the <code>lineInfo</code> array. */ protected int length; @@ -217,29 +212,28 @@ protected boolean nextLineRequested; /** - * Creates a new <code>TokenMarker</code>. This DOES NOT create - * a lineInfo array; an initial call to <code>insertLines()</code> - * does that. + * Creates a new <code>TokenMarker</code>. This DOES NOT create a lineInfo + * array; an initial call to <code>insertLines()</code> does that. */ protected TokenMarker() { lastLine = -1; } /** - * Ensures that the <code>lineInfo</code> array can contain the - * specified index. This enlarges it if necessary. No action is - * taken if the array is large enough already.<p> + * Ensures that the <code>lineInfo</code> array can contain the specified + * index. This enlarges it if necessary. No action is taken if the array is + * large enough already.<p> * <p/> - * It should be unnecessary to call this under normal - * circumstances; <code>insertLine()</code> should take care of - * enlarging the line info array automatically. - * @param index The array index + * It should be unnecessary to call this under normal circumstances; + * <code>insertLine()</code> should take care of enlarging the line info + * array automatically. + * @param index the array index */ protected final void ensureCapacity(final int index) { if (lineInfo == null) { lineInfo = new LineInfo[index + 1]; } else if (lineInfo.length <= index) { - final LineInfo[] lineInfoN = new LineInfo[index + 1 << 1]; + final LineInfo[] lineInfoN = new LineInfo[(index + 1) * 2]; System.arraycopy(lineInfo, 0, lineInfoN, 0, lineInfo.length); lineInfo = lineInfoN; } @@ -247,8 +241,8 @@ /** * Adds a token to the token list. - * @param length The length of the token - * @param id The id of the token + * @param length the length of the token + * @param id the id of the token */ protected final void addToken(final int length, final byte id) { if (id >= Token.INTERNAL_FIRST && id <= Token.INTERNAL_LAST) { @@ -280,15 +274,14 @@ public static final class LineInfo { /** - * Creates a new LineInfo object with token = Token.NULL - * and obj = null. + * Creates a new LineInfo object with token = Token.NULL and obj = + * null. */ public LineInfo() { } /** - * Creates a new LineInfo object with the specified - * parameters. + * Creates a new LineInfo object with the specified parameters. */ public LineInfo(final byte token, final Object obj) { this.setToken(token); @@ -299,10 +292,9 @@ private byte token; /** - * This is for use by the token marker implementations - * themselves. It can be used to store anything that - * is an object and that needs to exist on a per-line - * basis. + * This is for use by the token marker implementations themselves. It + * can be used to store anything that is an object and that needs to + * exist on a per-line basis. */ private Object obj; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-05-28 21:56:30
|
Revision: 63 Author: christianhujer Date: 2006-05-28 14:56:20 -0700 (Sun, 28 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=63&view=rev Log Message: ----------- Released new update version, committing next build number. Modified Paths: -------------- trunk/daimonin/nextBuildNumber.properties Modified: trunk/daimonin/nextBuildNumber.properties =================================================================== --- trunk/daimonin/nextBuildNumber.properties 2006-05-28 21:42:45 UTC (rev 62) +++ trunk/daimonin/nextBuildNumber.properties 2006-05-28 21:56:20 UTC (rev 63) @@ -1,3 +1,3 @@ #Build Number for ANT. Do not edit! -#Sun May 28 01:56:31 CEST 2006 -build.number=2918 +#Sun May 28 23:56:17 CEST 2006 +build.number=2919 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-05-28 21:43:03
|
Revision: 62 Author: christianhujer Date: 2006-05-28 14:42:45 -0700 (Sun, 28 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=62&view=rev Log Message: ----------- Fixed bug with paths for apps and resources. Modified Paths: -------------- trunk/daimonin/src/daieditor/arch/ArchObjectStack.java trunk/daimonin/src/daieditor/gui/prefs/AppPrefs.java trunk/daimonin/src/daieditor/gui/prefs/ResPrefs.java Added Paths: ----------- trunk/daimonin/src/test/daieditor/gui/prefs/ trunk/daimonin/src/test/daieditor/gui/prefs/AppPrefsTest.java trunk/daimonin/src/test/daieditor/gui/prefs/ResPrefsTest.java Modified: trunk/daimonin/src/daieditor/arch/ArchObjectStack.java =================================================================== --- trunk/daimonin/src/daieditor/arch/ArchObjectStack.java 2006-05-28 20:26:24 UTC (rev 61) +++ trunk/daimonin/src/daieditor/arch/ArchObjectStack.java 2006-05-28 21:42:45 UTC (rev 62) @@ -398,15 +398,25 @@ // mainControl.showMessage("LOAD FILE", "name: "+name+" index: "+index); } folderLevel++; - for (String entry : f.list()) { - loadArchFromFiles(new File(f, entry), index, false); + final String[] entries = f.list(); + if (entries != null) { + for (final String entry : f.list()) { + loadArchFromFiles(new File(f, entry), index, false); + } + } else { + System.err.println("NULL entries: " + f); } folderLevel--; } else { // We are in an intern folder, so no panel will be generated folderLevel++; - for (String entry : f.list()) { - loadArchFromFiles(new File(f, entry), index, true); + final String[] entries = f.list(); + if (entries != null) { + for (final String entry : f.list()) { + loadArchFromFiles(new File(f, entry), index, true); + } + } else { + System.err.println("NULL entries: " + f); } folderLevel--; } Modified: trunk/daimonin/src/daieditor/gui/prefs/AppPrefs.java =================================================================== --- trunk/daimonin/src/daieditor/gui/prefs/AppPrefs.java 2006-05-28 20:26:24 UTC (rev 61) +++ trunk/daimonin/src/daieditor/gui/prefs/AppPrefs.java 2006-05-28 21:42:45 UTC (rev 62) @@ -160,9 +160,9 @@ * @param str String to create path from * @return path */ - private static String path(final String str) { + public static String path(final String str) { final String path = str.replaceAll("\\\\", "/"); - return path.endsWith("/") ? path.substring(path.length() - 1) : path; + return path.endsWith("/") ? path.substring(0, path.length() - 1) : path; } } // class AppPrefs Modified: trunk/daimonin/src/daieditor/gui/prefs/ResPrefs.java =================================================================== --- trunk/daimonin/src/daieditor/gui/prefs/ResPrefs.java 2006-05-28 20:26:24 UTC (rev 61) +++ trunk/daimonin/src/daieditor/gui/prefs/ResPrefs.java 2006-05-28 21:42:45 UTC (rev 62) @@ -21,7 +21,6 @@ package daieditor.gui.prefs; -import static net.sf.japi.swing.ActionFactory.getFactory; import daieditor.CMainControl; import static daieditor.IGUIConstants.DIALOG_BORDER; import daieditor.ResourceFileManager; @@ -34,15 +33,16 @@ import static javax.swing.Box.createVerticalBox; import static javax.swing.Box.createVerticalGlue; import javax.swing.JCheckBox; +import javax.swing.JComponent; import static javax.swing.JFileChooser.DIRECTORIES_ONLY; import javax.swing.JLabel; import static javax.swing.JOptionPane.WARNING_MESSAGE; -import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.border.Border; import javax.swing.border.CompoundBorder; import javax.swing.border.TitledBorder; import net.sf.japi.swing.ActionFactory; +import static net.sf.japi.swing.ActionFactory.getFactory; import net.sf.japi.swing.JFileChooserButton; import net.sf.japi.swing.prefs.AbstractPrefs; @@ -60,22 +60,22 @@ private static final ActionFactory ACTION_FACTORY = getFactory("daieditor"); /** Preferences. */ - private static final Preferences prefs = userNodeForPackage(CMainControl.class); + private static final Preferences PREFS = userNodeForPackage(CMainControl.class); /** Main Control. */ private final CMainControl mainControl; /** TextField for arch directory path. */ - private JTextField archField; + private FileField archField; /** TextField for map directory path. */ - private JTextField mapField; + private FileField mapField; /** TextField for script directory path. */ - private JTextField scriptField; + private FileField scriptField; /** TextField for media directory path. */ - private JTextField mediaField; + private FileField mediaField; /** Checbox whether arches are to be loaded from collection. */ private JCheckBox loadArches; @@ -105,11 +105,11 @@ /** {@inheritDoc} */ public void apply() { - prefs.put(ResourceFileManager.ARCH_DIR_KEY, path(archField.getText())); - prefs.put(ResourceFileManager.MAP_DIR_KEY, path(mapField.getText())); - prefs.put(ResourceFileManager.SCRIPT_DIR_KEY, path(scriptField.getText())); - prefs.put(ResourceFileManager.MEDIA_DIR_KEY, path(mediaField.getText())); - prefs.putBoolean(CMainControl.LOAD_ARCH_COLL, loadArches.isSelected()); + PREFS.put(ResourceFileManager.ARCH_DIR_KEY, path(archField.getText())); + PREFS.put(ResourceFileManager.MAP_DIR_KEY, path(mapField.getText())); + PREFS.put(ResourceFileManager.SCRIPT_DIR_KEY, path(scriptField.getText())); + PREFS.put(ResourceFileManager.MEDIA_DIR_KEY, path(mediaField.getText())); + PREFS.putBoolean(CMainControl.LOAD_ARCH_COLL, loadArches.isSelected()); mainControl.initDirs(); ACTION_FACTORY.showOnetimeMessageDialog(this, WARNING_MESSAGE, "optionsRestart"); } @@ -138,7 +138,7 @@ && mapField.getText().equals(mainControl.getMapDefaultFolder()) && scriptField.getText().equals(mainControl.getScriptDefaultFolder()) && mediaField.getText().equals(mainControl.getMediaDefaultFolder()) - && loadArches.isSelected() == prefs.getBoolean(CMainControl.LOAD_ARCH_COLL, mainControl.isArchLoadedFromCollection()) + && loadArches.isSelected() == PREFS.getBoolean(CMainControl.LOAD_ARCH_COLL, mainControl.isArchLoadedFromCollection()) ); } @@ -199,18 +199,14 @@ * @param fileSelectionMode file selection mode * @return the created JTextField */ - private static JTextField createFileField(final Container panel, final String key, final String initial, final int fileSelectionMode) { - final JPanel subPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); + private static FileField createFileField(final Container panel, final String key, final String initial, final int fileSelectionMode) { + final FileField fileField = new FileField(ACTION_FACTORY.getString(key), initial, fileSelectionMode); final String tooltip = ACTION_FACTORY.getString(key + ".shortdescription"); if (tooltip != null) { - subPanel.setToolTipText(tooltip); + fileField.setToolTipText(tooltip); } - subPanel.add(new JLabel(ACTION_FACTORY.getString(key))); - final JTextField textField = new JTextField(initial, 16); - subPanel.add(textField); - subPanel.add(new JFileChooserButton(textField, fileSelectionMode)); - panel.add(subPanel); - return textField; + panel.add(fileField); + return fileField; } /** @@ -218,9 +214,65 @@ * @param str String to create path from * @return path */ - private static String path(final String str) { - final String path = str.replaceAll("\\\\", "/"); - return path.endsWith("/") ? path.substring(path.length() - 1) : path; + public static String path(final String str) { + String path = str.replaceAll("\\\\", "/"); + path = path.endsWith("/") ? path.substring(0, path.length() - 1) : path; + path = path.startsWith("file:") ? path.substring("file:".length()) : path; + return path; } + /** Class for selecting a file. */ + private static class FileField extends JComponent { + + /** The label. */ + private final JLabel label; + + /** The file field. */ + private final JTextField fileField; + + /** The button to start the JFileChooser. */ + private final JFileChooserButton chooserButton; + + /** + * Create a FileField. + * @param labelText the text for the label + * @param initial the initial path + * @param fileSelectionMode the mode for the file selection + */ + private FileField(final String labelText, final String initial, final int fileSelectionMode) { + setLayout(new FlowLayout(FlowLayout.RIGHT)); + fileField = new JTextField(initial, 16); + chooserButton = new JFileChooserButton(fileField, fileSelectionMode); + label = new JLabel(labelText); + add(label); + add(fileField); + add(chooserButton); + } + + /** {@inheritDoc} */ + @Override public void setEnabled(final boolean enabled) { + super.setEnabled(enabled); + fileField.setEnabled(enabled); + chooserButton.setEnabled(enabled); + label.setEnabled(enabled); + } + + /** + * Set the text, which is the filename. + * @param text filename + */ + public void setText(final String text) { + fileField.setText(text); + } + + /** + * Get the text, which is the filename. + * @return text (filename) + */ + public String getText() { + return fileField.getText(); + } + + } // class FileField + } // class ResPrefs Added: trunk/daimonin/src/test/daieditor/gui/prefs/AppPrefsTest.java =================================================================== --- trunk/daimonin/src/test/daieditor/gui/prefs/AppPrefsTest.java (rev 0) +++ trunk/daimonin/src/test/daieditor/gui/prefs/AppPrefsTest.java 2006-05-28 21:42:45 UTC (rev 62) @@ -0,0 +1,17 @@ +package test.daieditor.gui.prefs; + +import daieditor.gui.prefs.AppPrefs; +import junit.framework.TestCase; + +/** + * Test for {@link AppPrefs}. + * @author <a href="mailto:ch...@it...">Christian Hujer</a> + */ +public class AppPrefsTest extends TestCase { + + /** Test case for {@link AppPrefs#path(String)}. */ + public void testPath() { + assertEquals("Expecting trailing slash from directories being removed.", "/foo", AppPrefs.path("/foo/")); + } + +} // class AppPrefsTest \ No newline at end of file Property changes on: trunk/daimonin/src/test/daieditor/gui/prefs/AppPrefsTest.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Added: trunk/daimonin/src/test/daieditor/gui/prefs/ResPrefsTest.java =================================================================== --- trunk/daimonin/src/test/daieditor/gui/prefs/ResPrefsTest.java (rev 0) +++ trunk/daimonin/src/test/daieditor/gui/prefs/ResPrefsTest.java 2006-05-28 21:42:45 UTC (rev 62) @@ -0,0 +1,17 @@ +package test.daieditor.gui.prefs; + +import daieditor.gui.prefs.ResPrefs; +import junit.framework.TestCase; + +/** + * Test for {@link ResPrefs}. + * @author <a href="mailto:ch...@it...">Christian Hujer</a> + */ +public class ResPrefsTest extends TestCase { + + /** Test case for {@link ResPrefs#path(String)}. */ + public void testPath() { + assertEquals("Expecting trailing slash from directories being removed.", "/foo", ResPrefs.path("/foo/")); + } + +} // class ResPrefsTest \ No newline at end of file Property changes on: trunk/daimonin/src/test/daieditor/gui/prefs/ResPrefsTest.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2006-05-28 20:26:31
|
Revision: 61 Author: christianhujer Date: 2006-05-28 13:26:24 -0700 (Sun, 28 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=61&view=rev Log Message: ----------- Removed unused .cvsignore file. Removed Paths: ------------- trunk/crossfire/.cvsignore Deleted: trunk/crossfire/.cvsignore =================================================================== --- trunk/crossfire/.cvsignore 2006-05-28 20:07:33 UTC (rev 60) +++ trunk/crossfire/.cvsignore 2006-05-28 20:26:24 UTC (rev 61) @@ -1 +0,0 @@ -bin This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2006-05-28 20:07:38
|
Revision: 60 Author: akirschbaum Date: 2006-05-28 13:07:33 -0700 (Sun, 28 May 2006) ViewCVS: http://svn.sourceforge.net/gridarta/?rev=60&view=rev Log Message: ----------- Fix typo in error message. Modified Paths: -------------- trunk/daimonin/src/daieditor/arch/ArchObjectStack.java Modified: trunk/daimonin/src/daieditor/arch/ArchObjectStack.java =================================================================== --- trunk/daimonin/src/daieditor/arch/ArchObjectStack.java 2006-05-28 19:22:32 UTC (rev 59) +++ trunk/daimonin/src/daieditor/arch/ArchObjectStack.java 2006-05-28 20:07:33 UTC (rev 60) @@ -329,7 +329,7 @@ } } } catch (final FileNotFoundException e) { - System.err.println("Artifacts file '" + fname + "'could not be found"); + System.err.println("Artifacts file '" + fname + "' could not be found"); } catch (final IOException e) { System.err.println("IOException in reading Artifacts!"); } finally { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |