You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(103) |
Jun
(121) |
Jul
(16) |
Aug
(67) |
Sep
(126) |
Oct
(161) |
Nov
(164) |
Dec
(588) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(394) |
Feb
(181) |
Mar
(131) |
Apr
(180) |
May
(255) |
Jun
(11) |
Jul
(79) |
Aug
(70) |
Sep
(274) |
Oct
(138) |
Nov
(195) |
Dec
(8) |
2008 |
Jan
(3) |
Feb
(142) |
Mar
(162) |
Apr
(124) |
May
(148) |
Jun
(157) |
Jul
(425) |
Aug
(373) |
Sep
(264) |
Oct
(315) |
Nov
(225) |
Dec
(6) |
2009 |
Jan
(67) |
Feb
(78) |
Mar
(279) |
Apr
(294) |
May
(92) |
Jun
(65) |
Jul
(134) |
Aug
(41) |
Sep
(138) |
Oct
(125) |
Nov
(126) |
Dec
(122) |
2010 |
Jan
(15) |
Feb
(48) |
Mar
(9) |
Apr
(195) |
May
(373) |
Jun
(507) |
Jul
(42) |
Aug
(16) |
Sep
(38) |
Oct
(81) |
Nov
(64) |
Dec
(18) |
2011 |
Jan
(13) |
Feb
(12) |
Mar
(39) |
Apr
(1) |
May
(2) |
Jun
(27) |
Jul
(27) |
Aug
(31) |
Sep
(14) |
Oct
(102) |
Nov
(20) |
Dec
(37) |
2012 |
Jan
(22) |
Feb
(1) |
Mar
(1) |
Apr
(2) |
May
(2) |
Jun
(18) |
Jul
(6) |
Aug
(1) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2013 |
Jan
(1) |
Feb
(2) |
Mar
(1) |
Apr
(1) |
May
(47) |
Jun
(7) |
Jul
(107) |
Aug
|
Sep
|
Oct
(112) |
Nov
(31) |
Dec
(17) |
2014 |
Jan
(29) |
Feb
(111) |
Mar
(34) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(18) |
Dec
(10) |
From: <aki...@us...> - 2014-01-07 20:22:50
|
Revision: 9535 http://sourceforge.net/p/gridarta/code/9535 Author: akirschbaum Date: 2014-01-07 20:22:47 +0000 (Tue, 07 Jan 2014) Log Message: ----------- Update build instructions. Modified Paths: -------------- trunk/INSTALL trunk/README Modified: trunk/INSTALL =================================================================== --- trunk/INSTALL 2014-01-07 20:09:51 UTC (rev 9534) +++ trunk/INSTALL 2014-01-07 20:22:47 UTC (rev 9535) @@ -8,37 +8,53 @@ Build Requirements ------------------ -* Java Software Development Kit 5.0 or newer -* Ant 1.7.0 or newer, including the "optional" tasks - On Debian: install packages "ant" and "ant-optional". - On Mandriva: install "ant-nodeps". +* Java Software Development Kit 6.0 or newer Runtime Requirements -------------------- -* Java Runtime Environment 5.0 or newer +* Java Runtime Environment 6.0 or newer How to Build ------------ -Run "ant" to build the editor. This builds AtrinikEditor.jar, -CrossfireEditor.jar, and DaimoninEditor.jar. To find out options about building -Gridarta, run "ant -projecthelp". +Run "./gradlew" (or gradlew on Windows) to build the editors. This first +downloads Gradle (http://www.gradle.org), then builds all Gridarta variants. +If your Internet connection requires a proxy try one of the following: + + ./gradlew -DsocksProxyHost=... -DsocksProxyPort=... + ./gradlew -Dhttp.proxyHost=... -Dhttp.proxyPort=... + +You need the proxy only during the first build. Afterwards no further Internet +access is needed. + +If you have more than one Java version installed, you can select the right +version with + + JAVA_HOME=/.../jdk1.6.0_21 ./gradlew + +or + + SET JAVA_HOME=\...\jdk1.6.0_21 + gradlew + +on Windows. + To build Debian packages, run "debuild -uc -us". How to Run ---------- -java -jar AtrinikEditor.jar -java -jar CrossfireEditor.jar -java -jar DaimoninEditor.jar +java -jar src/atrinik/build/libs/AtrinikEditor.jar +java -jar src/daimonin/build/libs/DaimoninEditor.jar +java -jar src/crossfire/build/libs/CrossfireEditor.jar How to Generate Documentation (Javadoc) --------------------------------------- -Change to the main directory and run "ant javadoc". The documentation will be -placed in dest/doc/dev/api/. +Change to the main directory and run "./gradlew :javadoc". The documentation +will be placed in build/javadoc. How to Publish a Build @@ -46,11 +62,11 @@ Gridarta supports updating itself through the GUI (Help|Update...). Gridarta first checks whether an update is available, then downloads the update. + To check whether an update is available, Gridarta downloads a file specified in -"update.url=" in atrinik/src/app/net/sf/gridarta/var/atrinik/action.properties, -crossfire/src/app/net/sf/gridarta/var/crossfire/action.properties, or -daimonin/src/app/net/sf/gridarta/var/daimonin/action.properties. This file -contains the following entries: +"update.url=" in +src/{atrinik,crossfire,daimonin}/src/main/resources/net/sf/gridarta/var/{atrinik,crossfire,daimonin}/action.properties. +This file contains the following entries: - update.url=Download URL to AtrinikEditor.jar, CrossfireEditor.jar, or DaimoninEditor.jar. - update.number=the Gridarta version number corresponding to update.url @@ -61,9 +77,9 @@ update is available from update.url. The other entries are displayed to the user. -To provide a build, edit the value of "update.url" in -*/src/app/net/sf/gridarta/var/*/action.properties for the editor variant. Then -create or edit the file "developer.properties" in the project's root directory. +To provide a build, edit the value of "update.url" in the action.properties +file for the editor variant. Then create or edit the file +"developer.properties" in the project's root directory. Add the following entries: - build.developer=Name of the developer providing the build. - user.update.url.atrinik=Download URL to AtrinikEditor.jar. @@ -72,8 +88,9 @@ The definitions of user.update.url.* are optional for editor variants not provided. -Run "ant preparePublish". This compiles the editors and creates the file +Run "./gradlew preparePublish". This compiles the editors and creates the file "update.properties" for the editor variants to publish. The result is in -dist/atrinik, dist/crossfire, and dist/daimonin. +src/{atrinik,crossfire,daimonin}/build/libs. -Upload the contents of dist/atrinik, dist/crossfire, and dist/daimonin. +Upload the contents of src/{atrinik,crossfire,daimonin}/build/libs. The files +atrinik.jar, crossfire.jar, and daimonin.jar can be omitted. Modified: trunk/README =================================================================== --- trunk/README 2014-01-07 20:09:51 UTC (rev 9534) +++ trunk/README 2014-01-07 20:22:47 UTC (rev 9535) @@ -37,12 +37,13 @@ SYSTEM REQUIREMENTS ------------------- Java 6.0 or later - Previous versions of Java will not work. Gridarta uses Generics, - auto-boxing, static imports, foreach loops, assertions, covariant return - types and varargs quite a lot. + Previous versions of Java will not work. Gridarta uses Generics, + auto-boxing, foreach loops, assertions, covariant return types and varargs + quite a lot. -Ant 1.7.0 or later - Previous versions of Ant might work but are not tested. +Gradle 1.6 + Other versions of Gradle might work but are not tested. Alternatively, the + project can download Gradle automatically. See INSTALL for details. FILE STRUCTURE @@ -50,10 +51,6 @@ AUTHORS People that contributed code to Gridarta. See also CREDITS, MAINTAINERS. -build.xml - The build file to build the project with Ant. - See also INSTALL. - COPYING Gridarta license conditions. Note: applies to Gridarta only, not third party libraries. @@ -61,37 +58,37 @@ CREDITS List of project contributions. See also AUTHORS, MAINTAINERS. -atrinik/ - Directory containing the Atrinik Map Editor / Atrinik specific code. +INSTALL + Description of how to build and install Gridarta. -build/ (generated) -**/build/ (generated) - These directories contain generated files. +LICENSE + File with license information. -build.developer (optional) - Optional file for changing default settings of the Gradle build. You won't - need to tweak this file for normal building. But if you want to set or - override properties for build.gradle, this is the place to put them. +MAINTAINERS + List of current project maintainers. See also AUTHORS, CREDITS. -crossfire/ - Directory containing the Crossfire Map Editor / Crossfire specific code. +NEWS + Project News. -daimonin/ - Directory containing the Daimonin Map Editor / Daimonin specific code. +README + This file -dest/ (generated) - The directory containing generated files. +build.gradle + The build file to build the project with Gradle. + See also INSTALL. -developer.properties (optional) - Optional file for changing default settings of the Ant build. You won't - need to tweak this file for normal building. But if you want to set or - override properties for build.xml, this is the place to put them. +build.xml + The build file to build the project with Ant. This file may or may not work + anymore. The preferred way to build the project is now Gradle. -dist/ (generated) - Generated directory containing distribution archives. +build/ (generated) +**/build/ (generated) + These directories contain generated files. -INSTALL - Description of how to build and install Gridarta. +build.developer (optional) + Optional file for changing default settings of the Gradle build. You won't + need to tweak this file for normal building. But if you want to set or + override properties for build.gradle, this is the place to put them. lib/ Directory containing third part libraries used to build Gridarta. Please @@ -99,34 +96,22 @@ The licenses of the third party libraries are included in the lib/ directory. -LICENSE - File with license information. +src/ + Source files. -MAINTAINERS - List of current project maintainers. See also AUTHORS, CREDITS. +src/atrinik/ + Directory containing the Atrinik Map Editor / Atrinik specific code. -NEWS - Project News. +src/crossfire/ + Directory containing the Crossfire Map Editor / Crossfire specific code. -project.properties - File with automatically changed settings for Ant. +src/daimonin/ + Directory containing the Daimonin Map Editor / Daimonin specific code. -README - This file - -src/ - Source files. - -src/app/ +src/*/ Core Gridarta library sources. -src/doc/ - Documentation source files (website). -src/test/ - Unit test suite for automated unit testing of Gridarta. - - BUILD / INSTALLATION -------------------- See the file INSTALL. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-01-07 20:09:56
|
Revision: 9534 http://sourceforge.net/p/gridarta/code/9534 Author: akirschbaum Date: 2014-01-07 20:09:51 +0000 (Tue, 07 Jan 2014) Log Message: ----------- Add the Gradle Wrapper. Modified Paths: -------------- trunk/build.gradle Added Paths: ----------- trunk/gradle/ trunk/gradle/wrapper/ trunk/gradle/wrapper/gradle-wrapper.jar trunk/gradle/wrapper/gradle-wrapper.properties trunk/gradlew trunk/gradlew.bat Modified: trunk/build.gradle =================================================================== --- trunk/build.gradle 2014-01-07 19:11:24 UTC (rev 9533) +++ trunk/build.gradle 2014-01-07 20:09:51 UTC (rev 9534) @@ -164,3 +164,7 @@ } buildNumber }.memoize() + +task wrapper(type: Wrapper) { + gradleVersion = '1.6' +} Added: trunk/gradle/wrapper/gradle-wrapper.jar =================================================================== (Binary files differ) Index: trunk/gradle/wrapper/gradle-wrapper.jar =================================================================== --- trunk/gradle/wrapper/gradle-wrapper.jar 2014-01-07 19:11:24 UTC (rev 9533) +++ trunk/gradle/wrapper/gradle-wrapper.jar 2014-01-07 20:09:51 UTC (rev 9534) Property changes on: trunk/gradle/wrapper/gradle-wrapper.jar ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Added: trunk/gradle/wrapper/gradle-wrapper.properties =================================================================== --- trunk/gradle/wrapper/gradle-wrapper.properties (rev 0) +++ trunk/gradle/wrapper/gradle-wrapper.properties 2014-01-07 20:09:51 UTC (rev 9534) @@ -0,0 +1,6 @@ +#Tue Jan 07 20:12:55 CET 2014 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=http\://services.gradle.org/distributions/gradle-1.6-bin.zip Property changes on: trunk/gradle/wrapper/gradle-wrapper.properties ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: trunk/gradlew =================================================================== --- trunk/gradlew (rev 0) +++ trunk/gradlew 2014-01-07 20:09:51 UTC (rev 9534) @@ -0,0 +1,164 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# For Cygwin, ensure paths are in UNIX format before anything is touched. +if $cygwin ; then + [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` +fi + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >&- +APP_HOME="`pwd -P`" +cd "$SAVED" >&- + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" Property changes on: trunk/gradlew ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +LF \ No newline at end of property Added: trunk/gradlew.bat =================================================================== --- trunk/gradlew.bat (rev 0) +++ trunk/gradlew.bat 2014-01-07 20:09:51 UTC (rev 9534) @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega Property changes on: trunk/gradlew.bat ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +CRLF \ No newline at end of property This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-01-07 19:11:30
|
Revision: 9533 http://sourceforge.net/p/gridarta/code/9533 Author: akirschbaum Date: 2014-01-07 19:11:24 +0000 (Tue, 07 Jan 2014) Log Message: ----------- Remove unused type parameters. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/DefaultMainControl.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/DefaultMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/DefaultMainControl.java 2014-01-07 19:09:22 UTC (rev 9532) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/DefaultMainControl.java 2014-01-07 19:11:24 UTC (rev 9533) @@ -34,7 +34,7 @@ * structures / collections and global functions. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public class DefaultMainControl<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { +public class DefaultMainControl { /** * Private constructor to prevent instantiation. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-01-07 19:09:27
|
Revision: 9532 http://sourceforge.net/p/gridarta/code/9532 Author: akirschbaum Date: 2014-01-07 19:09:22 +0000 (Tue, 07 Jan 2014) Log Message: ----------- Add private constructor to utility class DefaultMainControl. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/DefaultMainControl.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/DefaultMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/DefaultMainControl.java 2014-01-07 19:08:25 UTC (rev 9531) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/DefaultMainControl.java 2014-01-07 19:09:22 UTC (rev 9532) @@ -36,6 +36,12 @@ */ public class DefaultMainControl<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { + /** + * Private constructor to prevent instantiation. + */ + private DefaultMainControl() { + } + @NotNull public static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> ScriptArchUtils loadScriptArchUtils(@NotNull final ErrorView errorView, final EditorFactory<G, A, R> editorFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet) { final ArchetypeTypeList eventTypeSetTmp = archetypeTypeSet.getList("event"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2014-01-07 19:08:31
|
Revision: 9531 http://sourceforge.net/p/gridarta/code/9531 Author: akirschbaum Date: 2014-01-07 19:08:25 +0000 (Tue, 07 Jan 2014) Log Message: ----------- Weaken type. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/scripts/ScriptArchEditor.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/scripts/ScriptArchEditor.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/scripts/ScriptArchEditor.java 2013-12-29 12:53:36 UTC (rev 9530) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/scripts/ScriptArchEditor.java 2014-01-07 19:08:25 UTC (rev 9531) @@ -292,7 +292,7 @@ newScriptFrame.setVisible(true); } - public void createNewEvent(@NotNull final JDialog frame, @NotNull final ScriptArchData<G, A, R> scriptArchData, @NotNull final G gameObject) { + public void createNewEvent(@NotNull final Component frame, @NotNull final ScriptArchData<G, A, R> scriptArchData, @NotNull final G gameObject) { final StringBuilder scriptPath = new StringBuilder(inputScriptPath.getText().trim().replace('\\', '/')); final String options = inputOptions.getText().trim(); final int eventType = scriptArchUtils.indexToEventType(eventTypeBox.getSelectedIndex()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ryo...@us...> - 2013-12-29 12:53:41
|
Revision: 9530 http://sourceforge.net/p/gridarta/code/9530 Author: ryo_saeba Date: 2013-12-29 12:53:36 +0000 (Sun, 29 Dec 2013) Log Message: ----------- Some translations. Modified Paths: -------------- trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_fr.properties Modified: trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_fr.properties =================================================================== --- trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_fr.properties 2013-12-10 22:23:56 UTC (rev 9529) +++ trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_fr.properties 2013-12-29 12:53:36 UTC (rev 9530) @@ -126,9 +126,9 @@ gridVisible.mnemonic=G #gridVisible.shortdescription= -#lightVisible.text= +lightVisible.text=Afficher la lumi\u00e8re lightVisible.mnemonic=H -#lightVisible.shortdescription= +lightVisible.shortdescription=Surligne les cases de la carte qui sont \u00e9clair\u00e9es. smoothing.text=Lissage smoothing.mnemonic=L @@ -141,7 +141,7 @@ mapCreateView.shortdescription=Ouvre une nouvelle vue sur la carte actuelle. #mapCreateView.longdescription= -mapProperties.text=Propri\u00e9t\u00e9s de la carte +mapProperties.text=Propri\u00e9t\u00e9s de la carte... mapProperties.mnemonic=R mapProperties.shortdescription=Ouvre le dialogue des propri\u00e9t\u00e9s de la carte actuelle. #mapProperties.longdescription= @@ -236,28 +236,28 @@ # Plugins -#plugins.text= +plugins.text=Greffons #plugins.shortdescription= #plugins.mnemonic= -#editPlugins.text= +editPlugins.text=\u00c9diter les greffons... #editPlugins.mnemonic= -#editPlugins.shortdescription= +editPlugins.shortdescription=Ouvre le dialogue de gestion des greffons. -#runPlugin.text= -#runPlugin.shortdescription= +runPlugin.text=Ex\u00e9cuter {0} +runPlugin.shortdescription=Ex\u00e9cuter le script du greffon. -#savePlugins.text= +savePlugins.text=Sauver les greffons #savePlugins.mnemonic= -#savePlugins.shortdescription= +savePlugins.shortdescription=Sauve tous les greffons modifi\u00e9s. -#importPlugin.text= +importPlugin.text=Importer un greffon... #importPlugin.mnemonic= -#importPlugin.shortdescription= +importPlugin.shortdescription=Importer un greffon depuis un fichier XML. # Resources -viewTreasurelists.text=Listes de tr\u00e9sors +viewTreasurelists.text=Listes de tr\u00e9sors... viewTreasurelists.mnemonic=T viewTreasurelists.shortdescription=Affiche toutes les listes de tr\u00e9sors. @@ -369,18 +369,18 @@ #openScriptNotFound.message= # New Map -#newMap.title= -#newPickmap.title= -#newPickmapFolder.title= -#newMapMapName= +newMap.title=Nouvelle carte +newPickmap.title=Nouvel assortiment +newPickmapFolder.title=Nouveau dossier d'assortiments +newMapMapName=Nom de la carte : #mapSizeDefault.text= -#newMapParameters= -#newMapPickmapName= -#newMapFolderPickmapName= -#newPickmapFolderInvalidName.title= -#newPickmapFolderInvalidName.message= -#newPickmapFolderExists.title= -#newPickmapFolderExists.message= +newMapParameters=Param\u00e8tres +newMapPickmapName=Nom de l'assortiment : +newMapPickmapFolderName=Nom du dossier : +newPickmapFolderInvalidName.title=Nom de dossier invalide +newPickmapFolderInvalidName.message=Le nom \u00ab {0} \u00bb est invalide pour un dossier d''assortiment.\nMerci de choisir un autre nom. +newPickmapFolderExists.title=Le dossier existe d\u00e9j\u00e0. +newPickmapFolderExists.message=Il existe d\u00e9j\u00e0 un dossier d''assortiments nomm\u00e9 \u00ab {0} \u00bb.\nMerci de choisir un autre nom. #deletePickmapFolderNotEmpty.title= #deletePickmapFolderNotEmpty.message= @@ -548,10 +548,10 @@ #mapTilePathMode.shortdescription= # Other Strings -#mapWidth= -#mapHeight= -#mapOkay.text= -#mapCancel.text= +mapWidth=Largeur : +mapHeight=Hauteur : +mapOkay.text=Cr\u00e9er +mapCancel.text=Annuler #find dialog findTitle=Rechercher dans la carte {0} @@ -659,7 +659,7 @@ saveMapAs.mnemonic=S saveMapAs.error.text=Erreur lors de l''enregistrement sous... -createImage.text=Cr\u00e9er image +createImage.text=Cr\u00e9er image... createImage.shortdescription=Cr\u00e9e une image \u00e0 partir de la carte et l'enregistre dans un fichier. createImage.mnemonic=I createImage.error.text=Erreur lors de la cr\u00e9ation d''une image. @@ -677,11 +677,11 @@ recent.shortdescription=Charge une carte r\u00e9cemment ouverte. recent.mnemonic=C -newMap.text=Nouveau +newMap.text=Nouveau... newMap.shortdescription=Cr\u00e9e une nouvelle carte. newMap.mnemonic=N -openFile.text=Ouvrir +openFile.text=Ouvrir... openFile.shortdescription=Ouvre une carte \u00e0 partir d'un fichier. openFile.mnemonic=O openFile.error.text=Erreur lors du chargement. @@ -760,7 +760,7 @@ findPrev.text=Chercher le pr\u00e9c\u00e9dent findPrev.shortdescription=R\u00e9p\u00e9ter la derni\u00e8re recherche. -replace.text=Remplacer +replace.text=Remplacer... replace.mnemonic=M replace.shortdescription=Ouvre le dialogue de remplacement. @@ -799,9 +799,9 @@ selectAll.mnemonic=T #selectAll.shortdescription= -#invertSelection.text= +invertSelection.text=Inverser la s\u00e9lection #invertSelection.mnemonic= -#invertSelection.shortdescription= +invertSelection.shortdescription=Inverse les cases s\u00e9lectionn\u00e9es. expandEmptySelection.text=\u00c9tendre la s\u00e9lection aux carr\u00e9s vides expandEmptySelection.shortdescription=\u00c9tend la s\u00e9lection aux carr\u00e9s vides adjacents \u00e0 un carr\u00e9 vide d\u00e9j\u00e0 s\u00e9lectionn\u00e9. @@ -851,17 +851,17 @@ editScript.mnemonic=E #editScript.shortdescription= -#validateMap.text= +validateMap.text=Valider la carte #validateMap.mnemonic= -#validateMap.shortdescription= +validateMap.shortdescription=Ex\u00e9cute le validateur de carte sur la carte actuelle. zoom.text=Zoom zoom.mnemonic=Z -#zoom.shortdescription= +zoom.shortdescription=Ouvre le visualisateur de cartes. -gc.text=Garbage Collection +gc.text=Nettoyer la m\u00e9moire gc.mnemonic=G -#gc.shortdescription= +gc.shortdescription=D\u00e9marre imm\u00e9diatement le nettoyage de la m\u00e9moire inutilis\u00e9e. #cleanCompletelyBlockedSquares.text= #cleanCompletelyBlockedSquares.mnemonic= @@ -877,7 +877,7 @@ addBookmark.mnemonic=A addBookmark.shortdescription=Ajoute un raccourci sur la carte courante. -manageBookmarks.text=G\u00e9rer les raccourcis +manageBookmarks.text=G\u00e9rer les raccourcis... manageBookmarks.mnemonic=G manageBookmarks.shortdescription=Permet de g\u00e9rer les raccourcis d\u00e9finis. @@ -960,7 +960,7 @@ #lockAllPickmaps.shortdescription= #lockAllPickmaps.longdescription= -addNewPickmap.text=Nouvel assortiment +addNewPickmap.text=Nouvel assortiment... addNewPickmap.mnemonic=N #addNewPickmap.shortdescription= @@ -980,7 +980,7 @@ revertPickmap.mnemonic=R #revertPickmap.shortdescription= -createPickmapFolder.text=Cr\u00e9er un dossier d'assortiments +createPickmapFolder.text=Cr\u00e9er un dossier d'assortiments... createPickmapFolder.shortdescription=Cr\u00e9\u00e9 un dossier d'assortiments. deletePickmapFolder.text=Supprimer le dossier d'assortiments @@ -997,9 +997,11 @@ view.text=Affichage view.mnemonic=I +show.text=Afficher {0} + resetView.text=Vue normale resetView.mnemonic=N -#resetView.shortdescription= +resetView.shortdescription=R\u00e9initialise les filtres de vue. #doubleFaces.text= #doubleFaces.mnemonic= @@ -1266,10 +1268,10 @@ displayIconsOnly.text=Afficher uniquement les ic\u00f4nes displayIconsOnly.shortdescription=Affiche uniquement les ic\u00f4nes dans la liste d'arch\u00e9types. -findArchetypes.text=Chercher un arch\u00e9type +findArchetypes.text=Chercher un arch\u00e9type... findArchetypes.shortdescription=Ouvre le dialogue de recherche d'arch\u00e9type. -browseArchetypes.text=Parcourir les arch\u00e9types +browseArchetypes.text=Parcourir les arch\u00e9types... browseArchetypes.shortdescription=Ouvre le dialogue de parcours des arch\u00e9types. @@ -1385,20 +1387,20 @@ #importSpellsFailed.message= -#controlServer.text= +controlServer.text=Contr\u00f4ler le serveur #controlServer.mnemonic= -#controlServer.name= -#controlServer.title= -#controlClient.text= +controlServer.name=Ouvrir le dialogue de contr\u00f4le du serveur. +controlServer.title=Console du serveur +controlClient.text=Contr\u00f4ler le client #controlClient.mnemonic= -#controlClient.name= -#controlClient.title= +controlClient.name=Ouvrir le dialogue de contr\u00f4le du client. +controlClient.title=Console du client #controlError.title= #controlError.message= #controlStart.text= #controlStop.text= #controlClear.text= -#controlCloseOkay= +controlCloseOkay=Vous pouvez fermer cette fen\u00eatre. #controlServerWarning.title= #controlServerWarning.message= @@ -1440,8 +1442,8 @@ tabButton.lockedItems.title1=Objets verrouill\u00e9s tabButton.lockedItems.title2={0} : Objets verrouill\u00e9s #tabButton.lockedItems.shortdescription= -#tabButton.textEditor.title1= -#tabButton.textEditor.title2= +tabButton.textEditor.title1=\u00c9diteur de texte +tabButton.textEditor.title2={0} : \u00c9diteur de texte #tabButton.textEditor.shortdescription= tabButton.warnings.title1=Alertes tabButton.warnings.title2={0} : Alertes This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ryo...@us...> - 2013-12-10 22:24:02
|
Revision: 9529 http://sourceforge.net/p/gridarta/code/9529 Author: ryo_saeba Date: 2013-12-10 22:23:56 +0000 (Tue, 10 Dec 2013) Log Message: ----------- Some French translations. Modified Paths: -------------- trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_fr.properties Modified: trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_fr.properties =================================================================== --- trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_fr.properties 2013-12-10 22:21:52 UTC (rev 9528) +++ trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_fr.properties 2013-12-10 22:23:56 UTC (rev 9529) @@ -554,42 +554,42 @@ #mapCancel.text= #find dialog -#findTitle= -#findFind= -#findFind.shortdescription= -#findWhere= -#findWhere.shortdescription= -#findWhereName= -#findWhereArch= -#findWhereMsg= -#findWhereFace= -#findWhereSlaying= -#findWhereOther= -#findOk.text= -#findCancel.text= +findTitle=Rechercher dans la carte {0} +findFind=Rechercher +findFind.shortdescription=Ouvre le dialogue de recherche. +findWhere=Dans : +findWhere.shortdescription=S\u00e9lectionnez les cat\u00e9gories dans lesquelles rechercher. +findWhereName=nom +findWhereArch=arch\u00e9type +findWhereMsg=message +findWhereFace=face +findWhereSlaying=slaying +findWhereOther=tout autre attribut +findOk.text=Chercher +findCancel.text=Fermer #replace replaceTitle=Remplacer replaceOn=Dans -#replaceOn.shortdescription= +replaceOn.shortdescription=<html>Choisir la zone \u00e0 remplacer dans :<br>- toute la carte : tous les objets sur la carte, sans tenir compte de la s\u00e9lection<br>- cases s\u00e9lectionn\u00e9es : le remplacement ne concerne que les cases s\u00e9lectionn\u00e9es replaceOnMap=toute la carte replaceOnSelection=les cases s\u00e9lectionn\u00e9es -replaceDelete=delete objects with -#replaceDelete.shortdescription= -#replaceArchetype= -#replaceName= +replaceDelete=supprimer les objets avec +replaceDelete.shortdescription=<html>Choisir les objets \u00e0 supprimer <br>- arch\u00e9type: par nom d'arch\u00e9type<br>- nom : par nom d'objet +replaceArchetype=arch\u00e9type +replaceName=nom #replaceInput1.shortdescription= -replaceBy=et remplace par -#replaceBy.shortdescription= +replaceBy=et remplacer par +replaceBy.shortdescription=<html>Choisir le remplacement :<br>- objet: l'objet actif dans le s\u00e9lecteur d'objets<br>- presse-papier: objets al\u00e9atoires parmi les derniers copi\u00e9s ou coup\u00e9s<br>- assortiment : objets al\u00e9atoires du s\u00e9lecteur d'objets<br>- rien : supprimer tous les objets concern\u00e9s. replaceByObject=objet -#replaceByCopyBuffer= -#replaceByPickmap= +replaceByCopyBuffer=presse-papier +replaceByPickmap=assortiment replaceByNothing=rien -#replaceDensity= -#replaceDensity.shortdescription= +replaceDensity=Densit\u00e9 : +replaceDensity.shortdescription=<html>Densit\u00e9 de remplacement, en pourcent (1 \u00e0 100).<br>100 : remplacer tous les objets concern\u00e9s<br>sinon : remplace al\u00e9atoirement une partie des objets affect\u00e9s. -#replaceInvalidDensity.title= -#replaceInvalidDensity.message= +replaceInvalidDensity.title=Valeur invalide +replaceInvalidDensity.message=Densit\u00e9 de remplacement invalide.\nLa valeur doit \u00eatre entre 1 et 100. #replaceMapNoSelection.title= replaceMapNoSelection.message=Vous avez choisi de remplacer les cases s\u00e9lectionn\u00e9es de la \ncarte \"{0}\", mais il n''y a pas de s\u00e9lection. @@ -600,7 +600,7 @@ #replacedMany.title= replacedMany.message={0} objets ont \u00e9t\u00e9 remplac\u00e9s. -#replaceOk.text= +replaceOk.text=Remplacer #replaceApply.text= #replaceCancel.text= @@ -664,10 +664,10 @@ createImage.mnemonic=I createImage.error.text=Erreur lors de la cr\u00e9ation d''une image. -#reloadMap.text=Restaurer -#reloadMap.shortdescription=Restaure la carte selon la derni\u00e8re version enregistr\u00e9e. -#reloadMap.mnemonic=R -#reloadMap.error.text=Erreur lors de la restauration de la carte. +reloadMap.text=Restaurer +reloadMap.shortdescription=Restaure la carte selon la derni\u00e8re version enregistr\u00e9e. +reloadMap.mnemonic=R +reloadMap.error.text=Erreur lors de la restauration de la carte. closeMap.text=Fermer closeMap.shortdescription=Ferme la carte active. @@ -712,19 +712,19 @@ cut.text=Couper cut.mnemonic=O -#cut.shortdescription= +cut.shortdescription=Couper les \u00e9l\u00e9ments vers le presse-papier. copy.text=Copier copy.mnemonic=C -#copy.shortdescription= +copy.shortdescription=Copier les \u00e9l\u00e9ments vers le presse-papier. paste.text=Coller paste.mnemonic=L -#paste.shortdescription= +paste.shortdescription=Coller les \u00e9l\u00e9ments depuis le presse-papier -#pasteTiled.text= -#pasteTiled.shortdescription= -#pasteTiled.longdescription= +pasteTiled.text=Coller cases +pasteTiled.shortdescription=Coller les \u00e9l\u00e9ments du presse-papier vers les cases s\u00e9lectionn\u00e9es. +pasteTiled.longdescription= shift.text=D\u00e9caler shift.mnemonic=D @@ -751,18 +751,18 @@ shiftNorthWest.text=D\u00e9caler vers le nord-ouest shiftNorthWest.shortdescription=D\u00e9cale la s\u00e9lection vers le nord-ouest. -#find.text= -#find.shortdescription= +find.text=Chercher... +find.shortdescription=Ouvre le dialogue de recherche. -#findNext.text= -#findNext.shortdescription= +findNext.text=Chercher le suivant +findNext.shortdescription=R\u00e9p\u00e9ter la derni\u00e8re recherche. -#findPrev.text=R -#findPrev.shortdescription= +findPrev.text=Chercher le pr\u00e9c\u00e9dent +findPrev.shortdescription=R\u00e9p\u00e9ter la derni\u00e8re recherche. replace.text=Remplacer replace.mnemonic=M -#replace.shortdescription= +replace.shortdescription=Ouvre le dialogue de remplacement. fillAuto.text=Remplir fillAuto.mnemonic=P @@ -1269,8 +1269,8 @@ findArchetypes.text=Chercher un arch\u00e9type findArchetypes.shortdescription=Ouvre le dialogue de recherche d'arch\u00e9type. -#browseArchetypes.text= -#browseArchetypes.shortdescription= +browseArchetypes.text=Parcourir les arch\u00e9types +browseArchetypes.shortdescription=Ouvre le dialogue de parcours des arch\u00e9types. ######### @@ -1572,8 +1572,8 @@ # Browse Archetypes Dialog -#browseArchetypesAddAttribute.text= -#browseArchetypesAddAttribute.shortdescription= -#browseArchetypes.title= -#browseArchetypes.table.archetype= -#browseArchetypes.table.name= +browseArchetypesAddAttribute.text=Ajouter +browseArchetypesAddAttribute.shortdescription=Ajouter un attribut \u00e0 l'affichage. +browseArchetypes.title=Parcourir les arch\u00e9types +browseArchetypes.table.archetype=Arch\u00e9type +browseArchetypes.table.name=Nom This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-12-10 22:21:56
|
Revision: 9528 http://sourceforge.net/p/gridarta/code/9528 Author: akirschbaum Date: 2013-12-10 22:21:52 +0000 (Tue, 10 Dec 2013) Log Message: ----------- Extract hard-coded strings as resources. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/BrowseArchetypesTableModel.java trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages.properties trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_de.properties trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_fr.properties trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_sv.properties Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/BrowseArchetypesTableModel.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/BrowseArchetypesTableModel.java 2013-12-10 20:36:58 UTC (rev 9527) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/BrowseArchetypesTableModel.java 2013-12-10 22:21:52 UTC (rev 9528) @@ -28,6 +28,9 @@ import net.sf.gridarta.model.archetypeset.ArchetypeSet; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.utils.ActionBuilderUtils; +import net.sf.japi.swing.action.ActionBuilder; +import net.sf.japi.swing.action.ActionBuilderFactory; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -44,6 +47,12 @@ private static final long serialVersionUID = 1L; /** + * The {@link ActionBuilder}. + */ + @NotNull + private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); + + /** * The {@link ArchetypeSet} from which archetypes are shown. */ @NotNull @@ -137,9 +146,9 @@ @Override public String getColumnName(final int column) { if (column == 0) { - return "Archetype"; + return ActionBuilderUtils.getString(ACTION_BUILDER, "browseArchetypes.table.archetype"); } else if (column == 1) { - return "Name"; + return ActionBuilderUtils.getString(ACTION_BUILDER, "browseArchetypes.table.name"); } else if (column >= 0 && column < 2 + attributes.size()) { return attributes.get(column - 2); } else { Modified: trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages.properties 2013-12-10 20:36:58 UTC (rev 9527) +++ trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages.properties 2013-12-10 22:21:52 UTC (rev 9528) @@ -1845,3 +1845,5 @@ browseArchetypesAddAttribute.text=Add Attribute browseArchetypesAddAttribute.shortdescription=Displays an attribute. browseArchetypes.title=Browse Archetypes +browseArchetypes.table.archetype=Archetype +browseArchetypes.table.name=Name Modified: trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_de.properties =================================================================== --- trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_de.properties 2013-12-10 20:36:58 UTC (rev 9527) +++ trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_de.properties 2013-12-10 22:21:52 UTC (rev 9528) @@ -1590,3 +1590,5 @@ browseArchetypesAddAttribute.text=Attribut anzeigen browseArchetypesAddAttribute.shortdescription=F\xFCgt das Attribut zur Tabelle hinzu. browseArchetypes.title=Archetypen anzeigen +browseArchetypes.table.archetype=Archetyp +browseArchetypes.table.name=Name Modified: trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_fr.properties =================================================================== --- trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_fr.properties 2013-12-10 20:36:58 UTC (rev 9527) +++ trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_fr.properties 2013-12-10 22:21:52 UTC (rev 9528) @@ -1575,3 +1575,5 @@ #browseArchetypesAddAttribute.text= #browseArchetypesAddAttribute.shortdescription= #browseArchetypes.title= +#browseArchetypes.table.archetype= +#browseArchetypes.table.name= Modified: trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_sv.properties =================================================================== --- trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_sv.properties 2013-12-10 20:36:58 UTC (rev 9527) +++ trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_sv.properties 2013-12-10 22:21:52 UTC (rev 9528) @@ -1576,3 +1576,5 @@ #browseArchetypesAddAttribute.text= #browseArchetypesAddAttribute.shortdescription= #browseArchetypes.title= +#browseArchetypes.table.archetype= +#browseArchetypes.table.name= This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-12-10 20:37:11
|
Revision: 9527 http://sourceforge.net/p/gridarta/code/9527 Author: akirschbaum Date: 2013-12-10 20:36:58 +0000 (Tue, 10 Dec 2013) Log Message: ----------- Add "Browse archetypes" to archetypes menu. Modified Paths: -------------- trunk/src/atrinik/ChangeLog trunk/src/atrinik/src/main/resources/net/sf/gridarta/var/atrinik/action.properties trunk/src/crossfire/ChangeLog trunk/src/crossfire/src/main/resources/net/sf/gridarta/var/crossfire/action.properties trunk/src/daimonin/ChangeLog trunk/src/daimonin/src/main/resources/net/sf/gridarta/var/daimonin/action.properties trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages.properties trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_de.properties trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_fr.properties trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_sv.properties trunk/src/model/src/main/java/net/sf/gridarta/model/archetype/Archetype.java trunk/src/model/src/main/java/net/sf/gridarta/model/baseobject/AbstractBaseObject.java trunk/src/model/src/main/java/net/sf/gridarta/model/baseobject/GameObjectText.java Added Paths: ----------- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/BrowseArchetypesAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/BrowseArchetypesDialog.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/BrowseArchetypesDialogManager.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/BrowseArchetypesTableModel.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/ClosingLabel.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/TableHeaderCellRenderer.java Modified: trunk/src/atrinik/ChangeLog =================================================================== --- trunk/src/atrinik/ChangeLog 2013-12-10 19:57:47 UTC (rev 9526) +++ trunk/src/atrinik/ChangeLog 2013-12-10 20:36:58 UTC (rev 9527) @@ -1,3 +1,8 @@ +2013-12-10 Andreas Kirschbaum + + * Add "Browse archetypes" to archetypes menu. It shows a dialog to + browse attribute values of archetypes. + 2013-12-04 Andreas Kirschbaum * Switch to adjacent map if the map cursor attempts to move off Modified: trunk/src/atrinik/src/main/resources/net/sf/gridarta/var/atrinik/action.properties =================================================================== --- trunk/src/atrinik/src/main/resources/net/sf/gridarta/var/atrinik/action.properties 2013-12-10 19:57:47 UTC (rev 9526) +++ trunk/src/atrinik/src/main/resources/net/sf/gridarta/var/atrinik/action.properties 2013-12-10 20:36:58 UTC (rev 9527) @@ -28,7 +28,7 @@ file.menu=newMap openFile goMap recent closeMap - saveMap saveMapAs saveAllMaps - closeAllMaps reloadMap createImage - options shortcuts - exit edit.menu=undo redo - clear cut copy paste pasteTiled - shift - find findNext findPrev replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll invertSelection expandEmptySelection growSelection shrinkSelection map.menu=autoJoin - enterExit nextExit prevExit enterNorthMap enterEastMap enterSouthMap enterWestMap enterNorthEastMap enterSouthEastMap enterSouthWestMap enterNorthWestMap - mapCreateView mapProperties shrinkMapSize deleteUnknownObjects - gameObjectTextEditor -archetypes.menu=displayGameObjectNames displayArchetypeNames displayIconsOnly - findArchetypes +archetypes.menu=displayGameObjectNames displayArchetypeNames displayIconsOnly - findArchetypes browseArchetypes #pickmaps.menu: See gridarta resources.menu=collectArches collectSpells - reloadFaces - viewTreasurelists tools.menu=newScript editScript - controlServer controlClient - validateMap cleanCompletelyBlockedSquares - zoom gc Modified: trunk/src/crossfire/ChangeLog =================================================================== --- trunk/src/crossfire/ChangeLog 2013-12-10 19:57:47 UTC (rev 9526) +++ trunk/src/crossfire/ChangeLog 2013-12-10 20:36:58 UTC (rev 9527) @@ -1,3 +1,8 @@ +2013-12-10 Andreas Kirschbaum + + * Add "Browse archetypes" to archetypes menu. It shows a dialog to + browse attribute values of archetypes. + 2013-12-04 Andreas Kirschbaum * Switch to adjacent map if the map cursor attempts to move off Modified: trunk/src/crossfire/src/main/resources/net/sf/gridarta/var/crossfire/action.properties =================================================================== --- trunk/src/crossfire/src/main/resources/net/sf/gridarta/var/crossfire/action.properties 2013-12-10 19:57:47 UTC (rev 9526) +++ trunk/src/crossfire/src/main/resources/net/sf/gridarta/var/crossfire/action.properties 2013-12-10 20:36:58 UTC (rev 9527) @@ -28,7 +28,7 @@ file.menu=newMap openFile goMap recent closeMap - saveMap saveMapAs saveAllMaps - closeAllMaps reloadMap createImage - options shortcuts - exit edit.menu=undo redo - clear cut copy paste pasteTiled - shift - find findNext findPrev replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll invertSelection expandEmptySelection growSelection shrinkSelection map.menu=autoJoin - enterExit nextExit prevExit enterNorthMap enterEastMap enterSouthMap enterWestMap tileShow - mapCreateView mapProperties shrinkMapSize deleteUnknownObjects - gameObjectTextEditor -archetypes.menu=displayGameObjectNames displayArchetypeNames displayIconsOnly - findArchetypes +archetypes.menu=displayGameObjectNames displayArchetypeNames displayIconsOnly - findArchetypes browseArchetypes #pickmaps.menu: See gridarta resources.menu=collectArches - reloadFaces - viewTreasurelists tools.menu=newScript editScript - controlServer controlClient - validateMap - zoom gc Modified: trunk/src/daimonin/ChangeLog =================================================================== --- trunk/src/daimonin/ChangeLog 2013-12-10 19:57:47 UTC (rev 9526) +++ trunk/src/daimonin/ChangeLog 2013-12-10 20:36:58 UTC (rev 9527) @@ -1,3 +1,8 @@ +2013-12-10 Andreas Kirschbaum + + * Add "Browse archetypes" to archetypes menu. It shows a dialog to + browse attribute values of archetypes. + 2013-12-04 Andreas Kirschbaum * Switch to adjacent map if the map cursor attempts to move off Modified: trunk/src/daimonin/src/main/resources/net/sf/gridarta/var/daimonin/action.properties =================================================================== --- trunk/src/daimonin/src/main/resources/net/sf/gridarta/var/daimonin/action.properties 2013-12-10 19:57:47 UTC (rev 9526) +++ trunk/src/daimonin/src/main/resources/net/sf/gridarta/var/daimonin/action.properties 2013-12-10 20:36:58 UTC (rev 9527) @@ -28,7 +28,7 @@ file.menu=newMap openFile goMap recent closeMap - saveMap saveMapAs saveAllMaps - closeAllMaps reloadMap createImage - options shortcuts - exit edit.menu=undo redo - clear cut copy paste pasteTiled - shift - find findNext findPrev replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll invertSelection expandEmptySelection growSelection shrinkSelection map.menu=autoJoin - enterExit nextExit prevExit enterNorthMap enterEastMap enterSouthMap enterWestMap enterNorthEastMap enterSouthEastMap enterSouthWestMap enterNorthWestMap - mapCreateView mapProperties shrinkMapSize deleteUnknownObjects - gameObjectTextEditor -archetypes.menu=displayGameObjectNames displayArchetypeNames displayIconsOnly - findArchetypes +archetypes.menu=displayGameObjectNames displayArchetypeNames displayIconsOnly - findArchetypes browseArchetypes #pickmaps.menu: See gridarta resources.menu=collectArches collectSpells - reloadFaces - viewTreasurelists tools.menu=newScript editScript - controlServer controlClient - validateMap cleanCompletelyBlockedSquares - zoom gc Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/BrowseArchetypesAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/BrowseArchetypesAction.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/BrowseArchetypesAction.java 2013-12-10 20:36:58 UTC (rev 9527) @@ -0,0 +1,78 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.action; + +import java.awt.Component; +import javax.swing.Action; +import javax.swing.ImageIcon; +import net.sf.gridarta.gui.dialog.browsearchetypes.BrowseArchetypesDialogManager; +import net.sf.gridarta.gui.panel.archetypechooser.ArchetypeChooserControl; +import net.sf.gridarta.gui.panel.objectchooser.ObjectChooser; +import net.sf.gridarta.gui.utils.AbstractDialogManager; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.archetypeset.ArchetypeSet; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.utils.EditorAction; +import net.sf.japi.swing.action.ActionMethod; +import org.jetbrains.annotations.NotNull; + +/** + * An {@link EditorAction} that displays the browse archetypes dialog. + * @author Andreas Kirschbaum + */ +public class BrowseArchetypesAction<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements EditorAction { + + /** + * The browse archetypes dialog manager. + */ + @NotNull + private final AbstractDialogManager dialogManager; + + /** + * Creates a new instance. + * @param parent the parent component for the dialog + * @param archetypeChooserControl the archetype chooser control to search + * @param objectChooser the object chooser to use when selecting search + * results + * @param archetypeSet the archetype set for looking up archetypes + * @param closingIcon the icon to display in the closing buttons of the + * archetype browser + */ + public BrowseArchetypesAction(@NotNull final Component parent, @NotNull final ArchetypeChooserControl<G, A, R> archetypeChooserControl, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final ImageIcon closingIcon) { + dialogManager = new BrowseArchetypesDialogManager<G, A, R>(parent, archetypeChooserControl, objectChooser, archetypeSet, closingIcon); + } + + /** + * Shows the browse archetypes dialog. + */ + @ActionMethod + public void browseArchetypes() { + dialogManager.showDialog(); + } + + /** + * {@inheritDoc} + */ + @Override + public void setAction(@NotNull final Action action, @NotNull final String name) { + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/BrowseArchetypesAction.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/BrowseArchetypesDialog.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/BrowseArchetypesDialog.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/BrowseArchetypesDialog.java 2013-12-10 20:36:58 UTC (rev 9527) @@ -0,0 +1,361 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gui.dialog.browsearchetypes; + +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.util.Collection; +import java.util.TreeSet; +import javax.swing.BoxLayout; +import javax.swing.DefaultComboBoxModel; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JDialog; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.ListSelectionModel; +import javax.swing.ScrollPaneConstants; +import javax.swing.SwingUtilities; +import javax.swing.WindowConstants; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import javax.swing.table.JTableHeader; +import javax.swing.table.TableColumnModel; +import net.sf.gridarta.gui.panel.archetypechooser.ArchetypeChooserControl; +import net.sf.gridarta.gui.panel.objectchooser.ObjectChooser; +import net.sf.gridarta.gui.utils.GUIConstants; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.archetypeset.ArchetypeSet; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.utils.ActionBuilderUtils; +import net.sf.japi.swing.action.ActionBuilder; +import net.sf.japi.swing.action.ActionBuilderFactory; +import net.sf.japi.swing.action.ActionMethod; +import org.jetbrains.annotations.NotNull; + +/** + * A dialog that displays archetypes. + * @author Andreas Kirschbaum + */ +public class BrowseArchetypesDialog<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends JOptionPane { + + /** + * The serial Version UID. + */ + private static final long serialVersionUID = 1L; + + /** + * The {@link ActionBuilder}. + */ + @NotNull + private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); + + /** + * The archetype set to search. + */ + @NotNull + private final ArchetypeChooserControl<G, A, R> archetypeChooserControl; + + /** + * The insertion object chooser to use when selecting search results. + */ + @NotNull + private final ObjectChooser<G, A, R> objectChooser; + + /** + * The attribute names currently not shown. + */ + @NotNull + private final Collection<String> availableAttributes = new TreeSet<String>(); + + /** + * The model of {@link #archetypesTable}. + */ + @NotNull + private final BrowseArchetypesTableModel<G, A, R> archetypesTableModel; + + /** + * The model of {@link #addAttributeComboBox}. + */ + @NotNull + private final DefaultComboBoxModel addAttributeComboBoxModel = new DefaultComboBoxModel(); + + /** + * The {@link JTable} showing the selected archetypes. + * @serial + */ + @NotNull + private final JTable archetypesTable; + + /** + * The dialog. + * @serial + */ + @NotNull + private final JDialog dialog; + + /** + * The button for adding the {@link #addAttributeComboBox selected + * attribute} to {@link #archetypesTable}. + */ + @NotNull + private final JButton addAttributeButton; + + /** + * The attribute to add to {@link #archetypesTable} if {@link + * #addAttributeButton} is selected. + */ + @NotNull + private final JComboBox addAttributeComboBox; + + /** + * Creates a new instance. + * @param parentComponent the parent component for the dialog + * @param archetypeChooserControl the archetype chooser control to to + * search + * @param objectChooser the object chooser to use when selecting search + * results + * @param archetypeSet the archetype set to show + * @param closingIcon the icon to display in the closing buttons of the + * table + */ + public BrowseArchetypesDialog(@NotNull final Component parentComponent, @NotNull final ArchetypeChooserControl<G, A, R> archetypeChooserControl, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final ImageIcon closingIcon) { + this.archetypeChooserControl = archetypeChooserControl; + this.objectChooser = objectChooser; + archetypesTableModel = new BrowseArchetypesTableModel<G, A, R>(archetypeSet); + archetypesTable = new JTable(archetypesTableModel); + + for (final Archetype<?, ?, ?> archetype : archetypeSet.getArchetypes()) { + for (final String attribute : archetype.getAttributeKeys()) { + availableAttributes.add(attribute); + } + } + if (availableAttributes.remove("value")) { + archetypesTableModel.addAttribute("value"); + } + + archetypesTable.setFillsViewportHeight(true); + archetypesTable.setAutoCreateRowSorter(true); + archetypesTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + archetypesTable.setRowSelectionAllowed(true); + archetypesTable.setColumnSelectionAllowed(false); + final ListSelectionListener listSelectionListener = new ListSelectionListener() { + + @Override + public void valueChanged(@NotNull final ListSelectionEvent e) { + highlightSelectedEntry(); + } + + }; + archetypesTable.getSelectionModel().addListSelectionListener(listSelectionListener); + final JTableHeader tableHeader = archetypesTable.getTableHeader(); + tableHeader.setReorderingAllowed(true); + final TableHeaderCellRenderer renderer = new TableHeaderCellRenderer(closingIcon, tableHeader.getDefaultRenderer()); + tableHeader.setDefaultRenderer(renderer); + final MouseListener mouseListener = new MouseListener() { + + /** + * Whether the mouse button is currently pressed. + */ + private boolean pressed; + + @Override + public void mouseClicked(@NotNull final MouseEvent e) { + if (pressed) { + pressed = false; + if (SwingUtilities.isLeftMouseButton(e)) { + final TableColumnModel columnModel = archetypesTable.getColumnModel(); + final int viewColumn = columnModel.getColumnIndexAtX(e.getX()); + final int columnIndex = archetypesTable.convertColumnIndexToModel(viewColumn); + final int offsetX = renderer.getX(columnIndex); + int cx = 0; + for (int i = 0; i < columnIndex; i++) { + cx += columnModel.getColumn(i).getWidth(); + } + final int ex = e.getX(); + if (offsetX >= 0 && ex - cx >= offsetX) { + final String attribute = archetypesTableModel.removeAttribute(columnIndex); + if (attribute != null) { + availableAttributes.add(attribute); + updateComboBox(); + addAttributeComboBoxModel.setSelectedItem(attribute); + } + } + } + } + } + + @Override + public void mousePressed(@NotNull final MouseEvent e) { + pressed = true; + } + + @Override + public void mouseReleased(@NotNull final MouseEvent e) { + } + + @Override + public void mouseEntered(@NotNull final MouseEvent e) { + } + + @Override + public void mouseExited(@NotNull final MouseEvent e) { + } + + }; + tableHeader.addMouseListener(mouseListener); + addAttributeButton = new JButton(ACTION_BUILDER.createAction(false, "browseArchetypesAddAttribute", this)); + addAttributeComboBox = new JComboBox(addAttributeComboBoxModel); + final ItemListener itemListener = new ItemListener() { + + @Override + public void itemStateChanged(@NotNull final ItemEvent e) { + updateActions(); + } + + }; + addAttributeComboBox.addItemListener(itemListener); + setMessage(createPanel()); + + final JPanel addAttributePanel = new JPanel(); + addAttributePanel.setLayout(new BoxLayout(addAttributePanel, BoxLayout.LINE_AXIS)); + addAttributePanel.add(addAttributeButton); + addAttributePanel.add(addAttributeComboBox); + setOptions(new Object[] { addAttributePanel }); + + updateComboBox(); + addAttributeComboBox.setSelectedIndex(Math.min(0, addAttributeComboBoxModel.getSize() - 1)); + + dialog = createDialog(parentComponent, ActionBuilderUtils.getString(ACTION_BUILDER, "browseArchetypes.title")); + dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); + dialog.setModal(false); + dialog.setResizable(true); + dialog.pack(); + dialog.setMinimumSize(new Dimension(200, 200)); + dialog.setSize(new Dimension(800, 600)); + dialog.setLocationRelativeTo(parentComponent); + setInitialValue(archetypesTable); + updateActions(); + } + + /** + * Opens the dialog. Returns immediately. + */ + public void showDialog() { + dialog.setVisible(true); + dialog.toFront(); + } + + /** + * Creates the GUI. + * @return the panel containing the GUI + */ + @NotNull + private JPanel createPanel() { + final JPanel mainPanel = new JPanel(new BorderLayout()); + + mainPanel.setBorder(GUIConstants.DIALOG_BORDER); + + final JScrollPane scrollPane = new JScrollPane(archetypesTable); + scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); + scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); + + mainPanel.add(scrollPane, BorderLayout.CENTER); + return mainPanel; + } + + /** + * Action method for "add attribute". + */ + @ActionMethod + public void browseArchetypesAddAttribute() { + doAddAttribute(true); + } + + /** + * Adds an attribute to the table. + * @param performAction whether the action should be performed + * @return whether the action can or was performed + */ + private boolean doAddAttribute(final boolean performAction) { + final String attributeName = (String) addAttributeComboBox.getSelectedItem(); + if (attributeName == null) { + return false; + } + + if (performAction) { + if (availableAttributes.remove(attributeName)) { + archetypesTableModel.addAttribute(attributeName); + final int selectedIndex = Math.max(addAttributeComboBox.getSelectedIndex(), 0); + updateComboBox(); + addAttributeComboBox.setSelectedIndex(Math.min(selectedIndex, addAttributeComboBoxModel.getSize() - 1)); + } + updateActions(); + } else if (!availableAttributes.contains(attributeName)) { + return false; + } + + return true; + } + + /** + * Updates the actions' states to reflect the current selection. + */ + private void updateActions() { + addAttributeButton.setEnabled(doAddAttribute(false)); + addAttributeComboBox.setEnabled(!availableAttributes.isEmpty()); + } + + /** + * Updates the contents of {@link #addAttributeComboBoxModel}. The current + * selection is lost. + */ + private void updateComboBox() { + addAttributeComboBoxModel.removeAllElements(); + for (final String attribute : availableAttributes) { + addAttributeComboBoxModel.addElement(attribute); + } + } + + /** + * Highlights the selected row from {@link #archetypesTable} in the + * insertion object chooser. + */ + private void highlightSelectedEntry() { + final int index = archetypesTable.getSelectedRow(); + if (index == -1) { + return; + } + + final R archetype = archetypesTableModel.get(archetypesTable.getRowSorter().convertRowIndexToModel(index)); + objectChooser.moveArchetypeChooserToFront(); + archetypeChooserControl.selectArchetype(archetype); + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/BrowseArchetypesDialog.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/BrowseArchetypesDialogManager.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/BrowseArchetypesDialogManager.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/BrowseArchetypesDialogManager.java 2013-12-10 20:36:58 UTC (rev 9527) @@ -0,0 +1,117 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gui.dialog.browsearchetypes; + +import java.awt.Component; +import javax.swing.ImageIcon; +import net.sf.gridarta.gui.panel.archetypechooser.ArchetypeChooserControl; +import net.sf.gridarta.gui.panel.objectchooser.ObjectChooser; +import net.sf.gridarta.gui.utils.AbstractDialogManager; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.archetypeset.ArchetypeSet; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * A dialog manager for the browse archetypes dialog. + * @author Andreas Kirschbaum + */ +public class BrowseArchetypesDialogManager<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractDialogManager { + + /** + * The synchronization object for accessing {@link #browseArchetypesDialog}. + */ + @NotNull + private final Object sync = new Object(); + + /** + * The {@link BrowseArchetypesDialog} instance or <code>null</code> if the + * dialog isn't built yet. + */ + @Nullable + private BrowseArchetypesDialog<G, A, R> browseArchetypesDialog; + + /** + * The parent {@link Component} for the dialog. + */ + @NotNull + private final Component parent; + + /** + * The {@link ArchetypeChooserControl} to search. + */ + @NotNull + private final ArchetypeChooserControl<G, A, R> archetypeChooserControl; + + /** + * The {@link ObjectChooser} to use when selecting search results. + */ + @NotNull + private final ObjectChooser<G, A, R> objectChooser; + + /** + * The {@link ArchetypeSet} for looking up archetypes. + */ + @NotNull + private final ArchetypeSet<G, A, R> archetypeSet; + + /** + * The icon to display in the closing buttons of the archetype browser. + */ + @NotNull + private final ImageIcon closingIcon; + + /** + * Creates a new instance. + * @param parent the parent component for the dialog + * @param archetypeChooserControl the archetype chooser control to search + * @param objectChooser the object chooser to use when selecting search + * results + * @param archetypeSet the archetype set for looking up archetypes + * @param closingIcon the icon to display in the closing buttons of the + * archetype browser + */ + public BrowseArchetypesDialogManager(@NotNull final Component parent, @NotNull final ArchetypeChooserControl<G, A, R> archetypeChooserControl, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final ImageIcon closingIcon) { + this.parent = parent; + this.archetypeChooserControl = archetypeChooserControl; + this.objectChooser = objectChooser; + this.archetypeSet = archetypeSet; + this.closingIcon = closingIcon; + } + + /** + * {@inheritDoc} + */ + @Override + public void showDialog() { + BrowseArchetypesDialog<G, A, R> dialog; + synchronized (sync) { + dialog = browseArchetypesDialog; + if (dialog == null) { + dialog = new BrowseArchetypesDialog<G, A, R>(parent, archetypeChooserControl, objectChooser, archetypeSet, closingIcon); + browseArchetypesDialog = dialog; + } + } + dialog.showDialog(); + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/BrowseArchetypesDialogManager.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/BrowseArchetypesTableModel.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/BrowseArchetypesTableModel.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/BrowseArchetypesTableModel.java 2013-12-10 20:36:58 UTC (rev 9527) @@ -0,0 +1,250 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gui.dialog.browsearchetypes; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.WeakHashMap; +import javax.swing.table.AbstractTableModel; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.archetypeset.ArchetypeSet; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * A {@link javax.swing.table.TableModel} that displays a selected set of + * attributes within a list of archetypes. + * @author Andreas Kirschbaum + */ +public class BrowseArchetypesTableModel<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractTableModel { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** + * The {@link ArchetypeSet} from which archetypes are shown. + */ + @NotNull + private final ArchetypeSet<G, A, R> archetypeSet; + + /** + * The shown archetypes. + */ + @NotNull + private final List<R> archetypes = new ArrayList<R>(); + + /** + * The shown attributes. + */ + @NotNull + private final List<String> attributes = new ArrayList<String>(); + + /** + * The classes corresponding to {@link #attributes}. + */ + @NotNull + private final List<Class<?>> classes = new ArrayList<Class<?>>(); + + /** + * Caches mapping of attribute name to table column class. + */ + @NotNull + private final Map<String, Class<?>> classMap = new WeakHashMap<String, Class<?>>(); + + /** + * Creates a new instance. + * @param archetypeSet the archetype set from which archetypes are shown + */ + public BrowseArchetypesTableModel(@NotNull final ArchetypeSet<G, A, R> archetypeSet) { + this.archetypeSet = archetypeSet; + update(); + } + + /** + * {@inheritDoc} + */ + @Override + public int getRowCount() { + return archetypes.size(); + } + + /** + * {@inheritDoc} + */ + @Override + public int getColumnCount() { + return 2 + attributes.size(); + } + + /** + * {@inheritDoc} + */ + @Nullable + @Override + public Object getValueAt(final int rowIndex, final int columnIndex) { + if (rowIndex < 0 || rowIndex >= archetypes.size()) { + return null; + } + final Archetype<?, ?, ?> archetype = archetypes.get(rowIndex); + if (columnIndex == 0) { + return archetype.getArchetypeName(); + } else if (columnIndex == 1) { + return archetype.getBestName(); + } else if (columnIndex >= 0 && columnIndex < 2 + attributes.size()) { + final String attribute = attributes.get(columnIndex - 2); + final String value = archetype.getAttributeString(attribute); + final Class<?> attributeClass = classes.get(columnIndex - 2); + if (attributeClass == Long.class) { + if (value.isEmpty()) { + return null; + } + try { + return Long.valueOf(value); + } catch (final NumberFormatException ignored) { + } + } + return value; + } else { + return null; + } + } + + /** + * {@inheritDoc} + */ + @Override + public String getColumnName(final int column) { + if (column == 0) { + return "Archetype"; + } else if (column == 1) { + return "Name"; + } else if (column >= 0 && column < 2 + attributes.size()) { + return attributes.get(column - 2); + } else { + return super.getColumnName(column); + } + } + + @Override + public Class<?> getColumnClass(final int columnIndex) { + if (columnIndex < 2) { + return String.class; + } else if (columnIndex >= 0 && columnIndex < 2 + attributes.size()) { + return classes.get(columnIndex - 2); + } else { + return super.getColumnClass(columnIndex); + } + } + + /** + * Updates {@link #archetypes} to include all archetypes from {@link + * #archetypeSet} that define at least one show attribute. + */ + private void update() { + archetypes.clear(); + for (final R archetype : archetypeSet.getArchetypes()) { + boolean include = false; + for (final String attribute : attributes) { + if (!archetype.getAttributeString(attribute).isEmpty()) { + include = true; + break; + } + } + if (include) { + archetypes.add(archetype); + } + } + fireTableStructureChanged(); + } + + /** + * Adds a column for an attribute to the table. + * @param attribute the attribute + */ + public void addAttribute(@NotNull final String attribute) { + classes.add(getAttributeClass(attribute)); + attributes.add(attribute); + update(); + } + + /** + * Returns the class for rendering attribute values. + * @param attribute the attribute + * @return the class + */ + @NotNull + private Class<?> getAttributeClass(@NotNull final String attribute) { + final Class<?> existingClass = classMap.get(attribute); + if (existingClass != null) { + return existingClass; + } + + for (final Archetype<?, ?, ?> archetype : archetypeSet.getArchetypes()) { + final String value = archetype.getAttributeString(attribute); + if (value.isEmpty()) { + // skip empty values + continue; + } + try { + Long.parseLong(value); + } catch (final NumberFormatException ignored) { + classMap.put(attribute, String.class); + return String.class; + } + } + classMap.put(attribute, Long.class); + return Long.class; + } + + /** + * Removes an attribute from the table. + * @param index the index of the column + * @return the attribute or {@code null} if the index is invalid + */ + @Nullable + public String removeAttribute(final int index) { + final String attribute; + try { + attribute = attributes.remove(index - 2); + classes.remove(index - 2); + } catch (final IndexOutOfBoundsException ignored) { + return null; + } + update(); + return attribute; + } + + /** + * Return one archetype. + * @param index the table row index + * @return the row content + */ + @NotNull + @SuppressWarnings("TypeMayBeWeakened") + public R get(final int index) { + return archetypes.get(index); + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/BrowseArchetypesTableModel.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/ClosingLabel.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/ClosingLabel.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/ClosingLabel.java 2013-12-10 20:36:58 UTC (rev 9527) @@ -0,0 +1,63 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gui.dialog.browsearchetypes; + +import java.awt.Graphics; +import javax.swing.Icon; +import javax.swing.JLabel; +import org.jetbrains.annotations.NotNull; + +/** + * A {@link JLabel} that tracks the x coordinate at which it was painted last. + * @author Andreas Kirschbaum + */ +public class ClosingLabel extends JLabel { + + /** + * The remembered x coordinate. + */ + private int paintX; + + /** + * Creates a new instance. + * @param icon the icon to display + */ + public ClosingLabel(@NotNull final Icon icon) { + super(icon); + } + + /** + * {@inheritDoc} + */ + @Override + protected void paintComponent(@NotNull final Graphics g) { + paintX = getX(); + super.paintComponent(g); + } + + /** + * Returns the x coordinate at which this label was painted last. + * @return the x coordinate + */ + public int getPaintX() { + return paintX; + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/ClosingLabel.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/TableHeaderCellRenderer.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/TableHeaderCellRenderer.java (rev 0) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/TableHeaderCellRenderer.java 2013-12-10 20:36:58 UTC (rev 9527) @@ -0,0 +1,118 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2011 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gui.dialog.browsearchetypes; + +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Container; +import java.util.ArrayList; +import java.util.List; +import javax.swing.ImageIcon; +import javax.swing.JPanel; +import javax.swing.JTable; +import javax.swing.table.TableCellRenderer; +import org.jetbrains.annotations.NotNull; + +/** + * A {@link TableCellRenderer} that adds a closing icon. + * @author Andreas Kirschbaum + */ +public class TableHeaderCellRenderer implements TableCellRenderer { + + /** + * The icon. + */ + @NotNull + private final ImageIcon closingIcon; + + /** + * The default {@link TableCellRenderer} of the associated table. + */ + @NotNull + private final TableCellRenderer tableCellRenderer; + + /** + * The panel that renders the cell. It contains both the original contents + * of the cell and a closing icon. + */ + @NotNull + private final Container panel = new JPanel(new BorderLayout()); + + /** + * The closing icons. A separate instance is created for each table column + * as each column may have a different width and thus a different x position + * of the closing label. + */ + @NotNull + private final List<ClosingLabel> labels = new ArrayList<ClosingLabel>(); + + /** + * Creates a new instance. + * @param closingIcon the icon to display as the closing buttons + * @param tableCellRenderer the default table cell renderer of the + * associated table + */ + public TableHeaderCellRenderer(@NotNull final ImageIcon closingIcon, @NotNull final TableCellRenderer tableCellRenderer) { + this.closingIcon = closingIcon; + this.tableCellRenderer = tableCellRenderer; + } + + /** + * {@inheritDoc} + */ + @Override + public Component getTableCellRendererComponent(@NotNull final JTable table, @NotNull final Object value, final boolean isSelected, final boolean hasFocus, final int row, final int column) { + panel.removeAll(); + final Component x = tableCellRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); + panel.add(x, BorderLayout.CENTER); + if (column >= 2) { + ClosingLabel label; + try { + label = labels.get(column); + } catch (final IndexOutOfBoundsException ignored) { + while (labels.size() < column) { + labels.add(new ClosingLabel(closingIcon)); + } + label = new ClosingLabel(closingIcon); + assert labels.size() == column; + labels.add(label); + } + panel.add(label, BorderLayout.EAST); + } + return panel; + } + + /** + * Returns the x coordinate of a closing icon. + * @param index the index of the closing icon + * @return the x coordinate or {@code -1} if the index is invalid + */ + public int getX(final int index) { + final ClosingLabel label; + try { + label = labels.get(index); + } catch (final ArrayIndexOutOfBoundsException ignored) { + return -1; + } + + return label.getPaintX(); + } + +} Property changes on: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/browsearchetypes/TableHeaderCellRenderer.java ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-12-10 19:57:47 UTC (rev 9526) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-12-10 20:36:58 UTC (rev 9527) @@ -36,6 +36,7 @@ import net.sf.gridarta.action.AddBookmarkAction; import net.sf.gridarta.action.AddToSelectionAction; import net.sf.gridarta.action.ArchAttributesAction; +import net.sf.gridarta.action.BrowseArchetypesAction; import net.sf.gridarta.action.CleanCompletelyBlockedSquaresAction; import net.sf.gridarta.action.CloseAllMapsAction; import net.sf.gridarta.action.CollectArchesAction; @@ -409,6 +410,7 @@ final Action moveSquareInvAction = createAction("moveSquareInv", "Selected Square View", new MoveSquareInvAction<G, A, R>(selectedSquareModel, projectModel.getMapManager())); final Action moveSquareTopAction = createAction("moveSquareTop", "Selected Square View", new MoveSquareTopAction<G, A, R>(selectedSquareModel, projectModel.getMapManager())); createAction("findArchetypes", "Archetypes", new FindArchetypesAction<G, A, R>(parent, archetypeChooserControl, objectChooser, projectModel.getArchetypeTypeSet())); + createAction("browseArchetypes", "Archetypes", new BrowseArchetypesAction<G, A, R>(parent, archetypeChooserControl, objectChooser, projectModel.getArchetypeSet(), resourceIcons.getResourceIcon(ResourceIcons.CLOSE_TAB_SMALL_ICON))); createAction("moveSquarePrev", "Selected Square View", new MoveSquarePrevAction<G, A, R>(selectedSquareModel, projectModel.getMapManager())); createAction("moveSquareNext", "Selected Square View", new MoveSquareNextAction<G, A, R>(selectedSquareModel, projectModel.getMapManager())); createAction("prevWindow", "Map,Window", mapDesktop); Modified: trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages.properties 2013-12-10 19:57:47 UTC (rev 9526) +++ trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages.properties 2013-12-10 20:36:58 UTC (rev 9527) @@ -1511,7 +1511,10 @@ findArchetypes.shortdescription=Opens the find archetypes dialog. findArchetypes.accel=ctrl alt pressed A +browseArchetypes.text=Browse archetypes +browseArchetypes.shortdescription=Opens the browse archetypes dialog. + ######### # Window @@ -1836,3 +1839,9 @@ pluginViewNoScripts=no scripts available pluginViewConsoleTitle=Beanshell scripts I/O Console pluginViewProvideParameters=Please provide runtime parameters for {0}. + + +# Browse Archetypes Dialog +browseArchetypesAddAttribute.text=Add Attribute +browseArchetypesAddAttribute.shortdescription=Displays an attribute. +browseArchetypes.title=Browse Archetypes Modified: trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_de.properties =================================================================== --- trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_de.properties 2013-12-10 19:57:47 UTC (rev 9526) +++ trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_de.properties 2013-12-10 20:36:58 UTC (rev 9527) @@ -1279,7 +1279,10 @@ findArchetypes.text=Archetypen finden findArchetypes.shortdescription=\u00d6ffnet den Dialog zum Suchen von Archetypen. +browseArchetypes.text=Archetypen anzeigen +browseArchetypes.shortdescription=\u00d6ffnet den Dialog zum Anzeigen von Archetypen. + ######### # Window @@ -1581,3 +1584,9 @@ pluginViewNoScripts=Keine Editor-Scripte vorhanden pluginViewConsoleTitle=Editor-Script-Konsole pluginViewProvideParameters=Bitte Laufzeitparameter f\xFCr {0} eingeben. + + +# Browse Archetypes Dialog +browseArchetypesAddAttribute.text=Attribut anzeigen +browseArchetypesAddAttribute.shortdescription=F\xFCgt das Attribut zur Tabelle hinzu. +browseArchetypes.title=Archetypen anzeigen Modified: trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_fr.properties =================================================================== --- trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_fr.properties 2013-12-10 19:57:47 UTC (rev 9526) +++ trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_fr.properties 2013-12-10 20:36:58 UTC (rev 9527) @@ -1269,7 +1269,10 @@ findArchetypes.text=Chercher un arch\u00e9type findArchetypes.shortdescription=Ouvre le dialogue de recherche d'arch\u00e9type. +#browseArchetypes.text= +#browseArchetypes.shortdescription= + ######### # Window @@ -1566,3 +1569,9 @@ #pluginViewNoScripts= #pluginViewConsoleTitle= #pluginViewProvideParameters= + + +# Browse Archetypes Dialog +#browseArchetypesAddAttribute.text= +#browseArchetypesAddAttribute.shortdescription= +#browseArchetypes.title= Modified: trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_sv.properties =================================================================== --- trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_sv.properties 2013-12-10 19:57:47 UTC (rev 9526) +++ trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_sv.properties 2013-12-10 20:36:58 UTC (rev 9527) @@ -1271,7 +1271,10 @@ #findArchetypes.text= +#browseArchetypes.text= +#browseArchetypes.shortdescription= + ######### # Window @@ -1567,3 +1570,9 @@ #pluginViewNoScripts= #pluginViewConsoleTitle= #pluginViewProvideParameters= + + +# Browse Archetypes Dialog +#browseArchetypesAddAttribute.text= +#browseArchetypesAddAttribute.shortdescription= +#browseArchetypes.title= Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/archetype/Archetype.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/archetype/Archetype.java 2013-12-10 19:57:47 UTC (rev 9526) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/archetype/Archetype.java 2013-12-10 20:36:58 UTC (rev 9527) @@ -19,6 +19,7 @@ package net.sf.gridarta.model.archetype; +import java.util.Collection; import java.util.Iterator; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.gameobject.GameObject; @@ -178,4 +179,11 @@ */ void setArtifact(); + /** + * Returns all attribute keys of this archetype. + * @return the attribute keys + */ + @NotNull + Collection<String> getAttributeKeys(); + } Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/baseobject/AbstractBaseObject.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2013-12-10 19:57:47 UTC (rev 9526) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2013-12-10 20:36:58 UTC (rev 9527) @@ -20,6 +20,7 @@ package net.sf.gridarta.model.baseobject; import java.awt.Point; +import java.util.Collection; import javax.swing.ImageIcon; import net.sf.gridarta.model.anim.AnimationObject; import net.sf.gridarta.model.anim.AnimationObjects; @@ -910,7 +911,6 @@ return faceObjSource; } - /** * Sets object animation <code>animation <var>animName</var></code>. * @param animName object animation <code>animation <var>animName</var></code> @@ -1183,4 +1183,13 @@ } } + /** + * Returns all attribute keys of this object. + * @return the attribute keys + */ + @NotNull + public Collection<String> getAttributeKeys() { + return gameObjectText.getAttributeKeys(); + } + } Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/baseobject/GameObjectText.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/baseobject/GameObjectText.java 2013-12-10 19:57:47 UTC (rev 9526) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/baseobject/GameObjectText.java 2013-12-10 20:36:58 UTC (rev 9527) @@ -20,7 +20,9 @@ package net.sf.gridarta.model.baseobject; import java.io.Serializable; +import java.util.Collection; import java.util.HashMap; +import java.util.HashSet; import java.util.Map; import net.sf.gridarta.utils.StringUtils; import org.jetbrains.annotations.NotNull; @@ -243,4 +245,20 @@ return setObjectText(result.toString()); } + /** + * Returns all attribute keys of this object. + * @return the attribute keys + */ + @NotNull + public Collection<String> getAttributeKeys() { + final Collection<String> keys = new HashSet<String>(); + for (final String line : StringUtils.PATTERN_END_OF_LINE.split(objectText.toString(), 0)) { + final int index = line.indexOf(' '); + if (index != -1) { + keys.add(line.substring(0, index)); + } + } + return keys; + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-12-10 19:57:52
|
Revision: 9526 http://sourceforge.net/p/gridarta/code/9526 Author: akirschbaum Date: 2013-12-10 19:57:47 +0000 (Tue, 10 Dec 2013) Log Message: ----------- Fix comment. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/findarchetypes/FindArchetypesDialogManager.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/findarchetypes/FindArchetypesDialogManager.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/findarchetypes/FindArchetypesDialogManager.java 2013-12-05 09:43:22 UTC (rev 9525) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/findarchetypes/FindArchetypesDialogManager.java 2013-12-10 19:57:47 UTC (rev 9526) @@ -43,8 +43,8 @@ private final Object sync = new Object(); /** - * The {@link FindArchetypesDialogManager} instance or <code>null</code> if - * the dialog isn't built yet. + * The {@link FindArchetypesDialog} instance or <code>null</code> if the + * dialog isn't built yet. */ @Nullable private FindArchetypesDialog<G, A, R> findArchetypesDialog; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-12-05 09:43:25
|
Revision: 9525 http://sourceforge.net/p/gridarta/code/9525 Author: akirschbaum Date: 2013-12-05 09:43:22 +0000 (Thu, 05 Dec 2013) Log Message: ----------- Disallow null values. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/CloseableTabbedPane.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/ClosingIcon.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/CloseableTabbedPane.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/CloseableTabbedPane.java 2013-12-05 09:41:41 UTC (rev 9524) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/CloseableTabbedPane.java 2013-12-05 09:43:22 UTC (rev 9525) @@ -50,23 +50,22 @@ import javax.swing.ImageIcon; import javax.swing.JTabbedPane; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; public class CloseableTabbedPane extends JTabbedPane { /** - * The icon or <code>null</code>. + * The icon. */ - @Nullable + @NotNull private final ImageIcon closingIcon; private static final long serialVersionUID = 1L; /** * Creates a new instance. - * @param closingIcon the icons or <code>null</code> + * @param closingIcon the icons */ - public CloseableTabbedPane(@Nullable final ImageIcon closingIcon) { + public CloseableTabbedPane(@NotNull final ImageIcon closingIcon) { this.closingIcon = closingIcon; addMouseListener(new ClosingListener(this)); Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/ClosingIcon.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/ClosingIcon.java 2013-12-05 09:41:41 UTC (rev 9524) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/ClosingIcon.java 2013-12-05 09:43:22 UTC (rev 9525) @@ -23,7 +23,6 @@ import java.awt.Graphics; import javax.swing.Icon; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; /** * the idea for this class stems from limewire's CancelSearchIconProxy class, @@ -31,7 +30,7 @@ */ public class ClosingIcon implements Icon { - @Nullable + @NotNull private final Icon icon; private int x; @@ -42,10 +41,10 @@ private final int width; - public ClosingIcon(@Nullable final Icon icon) { + public ClosingIcon(@NotNull final Icon icon) { this.icon = icon; - height = icon == null ? 10 : icon.getIconHeight(); - width = icon == null ? 10 : icon.getIconWidth(); + height = icon.getIconHeight(); + width = icon.getIconWidth(); } @Override @@ -66,12 +65,7 @@ public void paintIcon(@NotNull final Component c, @NotNull final Graphics g, final int x, final int y) { this.x = x; this.y = y; - - if (icon != null) { - icon.paintIcon(c, g, x, y + 1); - } else { - g.drawRect(x, y + 1, width, height); - } + icon.paintIcon(c, g, x, y + 1); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-12-05 09:41:47
|
Revision: 9524 http://sourceforge.net/p/gridarta/code/9524 Author: akirschbaum Date: 2013-12-05 09:41:41 +0000 (Thu, 05 Dec 2013) Log Message: ----------- Remove useless comments. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/ClosingIcon.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/ClosingIcon.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/ClosingIcon.java 2013-12-05 09:41:15 UTC (rev 9523) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/ClosingIcon.java 2013-12-05 09:41:41 UTC (rev 9524) @@ -31,8 +31,6 @@ */ public class ClosingIcon implements Icon { - //--- Data field(s) --- - @Nullable private final Icon icon; @@ -44,16 +42,12 @@ private final int width; - //--- Constructor(s) --- - public ClosingIcon(@Nullable final Icon icon) { this.icon = icon; height = icon == null ? 10 : icon.getIconHeight(); width = icon == null ? 10 : icon.getIconWidth(); } - //--- Method(s) --- - @Override public int getIconHeight() { return height; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-12-05 09:41:21
|
Revision: 9523 http://sourceforge.net/p/gridarta/code/9523 Author: akirschbaum Date: 2013-12-05 09:41:15 +0000 (Thu, 05 Dec 2013) Log Message: ----------- Make fields final. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/ClosingIcon.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/ClosingIcon.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/ClosingIcon.java 2013-12-04 22:04:45 UTC (rev 9522) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/ClosingIcon.java 2013-12-05 09:41:15 UTC (rev 9523) @@ -40,19 +40,16 @@ private int y; - private int height = 10; + private final int height; - private int width = 10; + private final int width; //--- Constructor(s) --- public ClosingIcon(@Nullable final Icon icon) { this.icon = icon; - - if (icon != null) { - height = icon.getIconHeight(); - width = icon.getIconWidth(); - } + height = icon == null ? 10 : icon.getIconHeight(); + width = icon == null ? 10 : icon.getIconWidth(); } //--- Method(s) --- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-12-04 22:04:52
|
Revision: 9522 http://sourceforge.net/p/gridarta/code/9522 Author: akirschbaum Date: 2013-12-04 22:04:45 +0000 (Wed, 04 Dec 2013) Log Message: ----------- Remove unneeded code. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ArchAttributesAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/objectchooser/DefaultObjectChooser.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ArchAttributesAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ArchAttributesAction.java 2013-12-04 22:01:04 UTC (rev 9521) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ArchAttributesAction.java 2013-12-04 22:04:45 UTC (rev 9522) @@ -100,7 +100,7 @@ @Override public void mapCursorChangedMode() { - updateActions(); + // ignore } @Override Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java 2013-12-04 22:01:04 UTC (rev 9521) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java 2013-12-04 22:04:45 UTC (rev 9522) @@ -116,7 +116,7 @@ @Override public void mapCursorChangedMode() { - refreshActions(); + // ignore } @Override Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/objectchooser/DefaultObjectChooser.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/objectchooser/DefaultObjectChooser.java 2013-12-04 22:01:04 UTC (rev 9521) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/objectchooser/DefaultObjectChooser.java 2013-12-04 22:04:45 UTC (rev 9522) @@ -139,7 +139,7 @@ @Override public void mapCursorChangedMode() { - updatePickmapInfo(activePickmapView == null ? null : activePickmapView.getMapCursor()); + // ignore } @Override This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-12-04 22:01:10
|
Revision: 9521 http://sourceforge.net/p/gridarta/code/9521 Author: akirschbaum Date: 2013-12-04 22:01:04 +0000 (Wed, 04 Dec 2013) Log Message: ----------- Remove unneeded code. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/exitconnector/ExitConnectorController.java trunk/src/gridarta/src/main/java/net/sf/gridarta/mainactions/MainActions.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/exitconnector/ExitConnectorController.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/exitconnector/ExitConnectorController.java 2013-12-04 20:51:14 UTC (rev 9520) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/exitconnector/ExitConnectorController.java 2013-12-04 22:01:04 UTC (rev 9521) @@ -31,8 +31,6 @@ import net.sf.gridarta.model.exitconnector.ExitLocation; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; -import net.sf.gridarta.model.mapcursor.MapCursorListener; -import net.sf.gridarta.model.mapmodel.MapSquare; import net.sf.gridarta.utils.EditorAction; import net.sf.japi.swing.action.ActionMethod; import org.jetbrains.annotations.NotNull; @@ -126,35 +124,6 @@ }; /** - * The {@link MapCursorListener} used to track cursor state changes in - * {@link #currentMapView}. - */ - @NotNull - private final MapCursorListener<G, A, R> mapCursorListener = new MapCursorListener<G, A, R>() { - - @Override - public void mapCursorChangedPos(@NotNull final Point location) { - // ignore - } - - @Override - public void mapCursorChangedMode() { - refreshActions(); - } - - @Override - public void mapCursorChangedGameObject(@Nullable final MapSquare<G, A, R> mapSquare, @Nullable final G gameObject) { - //ignore - } - - @Override - public void mapCursorChangedSize() { - // ignore - } - - }; - - /** * Creates a new instance. * @param exitConnectorActions the exit connector actions to use * @param exitConnectorModel the model for this controller @@ -197,13 +166,7 @@ * @param currentMapView the new current map view */ private void setCurrentMapView(@Nullable final MapView<G, A, R> currentMapView) { - if (this.currentMapView != null) { - this.currentMapView.getMapCursor().removeMapCursorListener(mapCursorListener); - } this.currentMapView = currentMapView; - if (this.currentMapView != null) { - this.currentMapView.getMapCursor().addMapCursorListener(mapCursorListener); - } refreshActions(); } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/mainactions/MainActions.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/mainactions/MainActions.java 2013-12-04 20:51:14 UTC (rev 9520) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/mainactions/MainActions.java 2013-12-04 22:01:04 UTC (rev 9521) @@ -44,7 +44,6 @@ import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.mapcontrol.MapControl; -import net.sf.gridarta.model.mapcursor.MapCursorListener; import net.sf.gridarta.model.mapgrid.MapGrid; import net.sf.gridarta.model.mapgrid.MapGridEvent; import net.sf.gridarta.model.mapgrid.MapGridListener; @@ -312,34 +311,6 @@ }; /** - * The map cursor listener used to detect map cursor changes. - */ - @NotNull - private final MapCursorListener<G, A, R> mapCursorListener = new MapCursorListener<G, A, R>() { - - @Override - public void mapCursorChangedPos(@NotNull final Point location) { - // ignore - } - - @Override - public void mapCursorChangedMode() { - refreshMenus(); // cursor may have been activated or deactivated - } - - @Override - public void mapCursorChangedGameObject(@Nullable final MapSquare<G, A, R> mapSquare, @Nullable final G gameObject) { - // ignore - } - - @Override - public void mapCursorChangedSize() { - // ignore - } - - }; - - /** * Create a new instance. * @param findDialogManager the find dialog manager to use * @param replaceDialogManager the replace dialog manager to use @@ -423,12 +394,10 @@ @Override public void mapViewCreated(@NotNull final MapView<G, A, R> mapView) { mapView.getMapGrid().addMapGridListener(mapGridListener); - mapView.getMapCursor().addMapCursorListener(mapCursorListener); } @Override public void mapViewClosing(@NotNull final MapView<G, A, R> mapView) { - mapView.getMapCursor().removeMapCursorListener(mapCursorListener); mapView.getMapGrid().removeMapGridListener(mapGridListener); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-12-04 20:51:20
|
Revision: 9520 http://sourceforge.net/p/gridarta/code/9520 Author: akirschbaum Date: 2013-12-04 20:51:14 +0000 (Wed, 04 Dec 2013) Log Message: ----------- Switch to adjacent map if the map cursor attempts to move off map on a tiled map set. Modified Paths: -------------- trunk/src/atrinik/ChangeLog trunk/src/crossfire/ChangeLog trunk/src/daimonin/ChangeLog trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/MapActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java Modified: trunk/src/atrinik/ChangeLog =================================================================== --- trunk/src/atrinik/ChangeLog 2013-12-04 18:00:21 UTC (rev 9519) +++ trunk/src/atrinik/ChangeLog 2013-12-04 20:51:14 UTC (rev 9520) @@ -1,3 +1,8 @@ +2013-12-04 Andreas Kirschbaum + + * Switch to adjacent map if the map cursor attempts to move off + map on a tiled map set. + 2013-12-03 Andreas Kirschbaum * Always show the map cursor. For newly opened maps place the map Modified: trunk/src/crossfire/ChangeLog =================================================================== --- trunk/src/crossfire/ChangeLog 2013-12-04 18:00:21 UTC (rev 9519) +++ trunk/src/crossfire/ChangeLog 2013-12-04 20:51:14 UTC (rev 9520) @@ -1,3 +1,8 @@ +2013-12-04 Andreas Kirschbaum + + * Switch to adjacent map if the map cursor attempts to move off + map on a tiled map set. + 2013-12-03 Andreas Kirschbaum * Always show the map cursor. For newly opened maps place the map Modified: trunk/src/daimonin/ChangeLog =================================================================== --- trunk/src/daimonin/ChangeLog 2013-12-04 18:00:21 UTC (rev 9519) +++ trunk/src/daimonin/ChangeLog 2013-12-04 20:51:14 UTC (rev 9520) @@ -1,3 +1,8 @@ +2013-12-04 Andreas Kirschbaum + + * Switch to adjacent map if the map cursor attempts to move off + map on a tiled map set. + 2013-12-03 Andreas Kirschbaum * Always show the map cursor. For newly opened maps place the map Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/MapActions.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/MapActions.java 2013-12-04 18:00:21 UTC (rev 9519) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/MapActions.java 2013-12-04 20:51:14 UTC (rev 9520) @@ -944,7 +944,7 @@ * @param direction the direction to enter * @return whether the action was or can be performed */ - private boolean doEnterMap(final boolean performAction, @NotNull final Direction direction) { + public boolean doEnterMap(final boolean performAction, @NotNull final Direction direction) { final MapView<G, A, R> mapView = currentMapView; if (mapView == null) { return false; Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java 2013-12-04 18:00:21 UTC (rev 9519) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java 2013-12-04 20:51:14 UTC (rev 9520) @@ -23,6 +23,7 @@ import java.io.File; import java.util.Set; import javax.swing.Action; +import net.sf.gridarta.gui.map.mapactions.MapActions; import net.sf.gridarta.gui.map.mapview.MapView; import net.sf.gridarta.gui.map.mapview.MapViewManager; import net.sf.gridarta.gui.map.mapview.MapViewManagerListener; @@ -60,6 +61,9 @@ @NotNull private static final Direction[] directions = Direction.values(); + @NotNull + private final MapActions<G, A, R> mapActions; + /** * Actions for "move cursor". */ @@ -170,7 +174,8 @@ * Create a new instance. * @param mapViewManager the map view manager */ - public MapCursorActions(@NotNull final MapViewManager<G, A, R> mapViewManager) { + public MapCursorActions(@NotNull final MapViewManager<G, A, R> mapViewManager, @NotNull final MapActions<G, A, R> mapActions) { + this.mapActions = mapActions; aMoveCursor = new Action[directions.length]; mapViewManager.addMapViewManagerListener(mapViewManagerListener); currentMapView = mapViewManager.getActiveMapView(); @@ -267,10 +272,10 @@ final MapCursor<G, A, R> mapCursor = mapView.getMapCursor(); if (!mapCursor.goTo(performAction, direction)) { - return false; - } - - if (performAction) { + if (!mapActions.doEnterMap(performAction, direction)) { + return false; + } + } else if (performAction) { final MapRenderer renderer = mapView.getRenderer(); final Point location = mapCursor.getLocation(); location.translate(BORDER * direction.getDx(), BORDER * direction.getDy()); Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-12-04 18:00:21 UTC (rev 9519) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/maincontrol/GUIMainControl.java 2013-12-04 20:51:14 UTC (rev 9520) @@ -383,7 +383,7 @@ newMapDialogFactory.setObjectChooser(objectChooser); final MapDesktop<G, A, R> mapDesktop = new MapDesktop<G, A, R>(mapViewManager, projectModel.getMapManager(), mapImageCache, mapViewsManager); final EnterMap<G, A, R> enterMap = new EnterMap<G, A, R>(parent, editorFactory.getDirectionMap(), mapPathNormalizer, fileControl, mapViewsManager); - final EditorAction mapActions = new MapActions<G, A, R>(parent, projectModel.getMapManager(), mapViewManager, exitMatcher, GuiFileFilters.mapFileFilter, selectedSquareModel, editorFactory.isAllowRandomMapParameters(), mapPropertiesDialogFactory, mapViewSettings, mapViewsManager, enterMap); + final MapActions<G, A, R> mapActions = new MapActions<G, A, R>(parent, projectModel.getMapManager(), mapViewManager, exitMatcher, GuiFileFilters.mapFileFilter, selectedSquareModel, editorFactory.isAllowRandomMapParameters(), mapPropertiesDialogFactory, mapViewSettings, mapViewsManager, enterMap); final MapFolderTreeActions<G, A, R> mapFolderTreeActions = new MapFolderTreeActions<G, A, R>(mapFolderTree, pickmapSettings, newMapDialogFactory, "createPickmapFolder", "deletePickmapFolder", "confirmDeletePickmapFolder", "deletePickmapFolderNotEmpty"); final ViewActions<G, A, R> viewActions = new ViewActions<G, A, R>(mapViewSettings, projectModel.getMapManager()); final EditorAction mapFileActions = new MapFileActions<G, A, R>(imageCreator2, projectModel.getMapManager(), mapViewsManager, mapViewManager, fileControl, parent); @@ -401,7 +401,7 @@ pluginParameters.addPluginParameter("rendererFactory", rendererFactory); final PluginController<G, A, R> pluginControl = new PluginController<G, A, R>(filterControl, projectModel.getPluginModel(), pluginParameters, parent, pluginParameterViewFactory, scriptsFile, resourceIcons); final EditorAction mainActions = new MainActions<G, A, R>(findDialogManager, replaceDialogManager, mainViewFrame, mapViewSettings, projectModel.getArchetypeSet(), copyBuffer, objectChooser, projectModel.getMapManager(), mapViewManager, insertionModeSet); - final EditorAction mapCursorActions = new MapCursorActions<G, A, R>(mapViewManager); + final EditorAction mapCursorActions = new MapCursorActions<G, A, R>(mapViewManager, mapActions); final Action moveSquareDownAction = createAction("moveSquareDown", "Selected Square View", new MoveSquareDownAction<G, A, R>(selectedSquareModel, projectModel.getMapManager())); final Action moveSquareUpAction = createAction("moveSquareUp", "Selected Square View", new MoveSquareUpAction<G, A, R>(selectedSquareModel, projectModel.getMapManager())); final Action moveSquareBottomAction = createAction("moveSquareBottom", "Selected Square View", new MoveSquareBottomAction<G, A, R>(selectedSquareModel, projectModel.getMapManager())); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-12-04 18:00:30
|
Revision: 9519 http://sourceforge.net/p/gridarta/code/9519 Author: akirschbaum Date: 2013-12-04 18:00:21 +0000 (Wed, 04 Dec 2013) Log Message: ----------- Add nullable annotation. Modified Paths: -------------- trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/DefaultMapModel.java Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/DefaultMapModel.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/DefaultMapModel.java 2013-12-03 11:03:27 UTC (rev 9518) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/DefaultMapModel.java 2013-12-04 18:00:21 UTC (rev 9519) @@ -205,6 +205,7 @@ * The {@link MapArchObjectListener} used to detect changes in {@link * #mapArchObject} and set the {@link #modified} flag accordingly. */ + @NotNull private final transient MapArchObjectListener mapArchObjectListener = new MapArchObjectListener() { @Override This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-12-03 11:03:34
|
Revision: 9518 http://sourceforge.net/p/gridarta/code/9518 Author: akirschbaum Date: 2013-12-03 11:03:27 +0000 (Tue, 03 Dec 2013) Log Message: ----------- Always show the map cursor. Modified Paths: -------------- trunk/src/atrinik/ChangeLog trunk/src/crossfire/ChangeLog trunk/src/daimonin/ChangeLog trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AbstractMapCursorAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ArchAttributesAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/AbstractServerActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/golocation/GoLocationDialog.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/exitconnector/ExitConnectorController.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/EnterMap.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/MapActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapview/AbstractMapView.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapview/MapCursorTracker.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapview/MapView.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/StatusBar.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/objectchooser/DefaultObjectChooser.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/selectedsquare/SelectedSquareView.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/tools/DeletionTool.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/tools/SelectionTool.java trunk/src/gridarta/src/main/java/net/sf/gridarta/mainactions/MainActions.java trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages.properties trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_de.properties trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_fr.properties trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_sv.properties trunk/src/model/src/main/java/net/sf/gridarta/model/exitconnector/ExitMatcher.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapcursor/MapCursor.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapcursor/MapCursorListener.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/TopLevelGameObjectIterator.java trunk/src/model/src/test/java/net/sf/gridarta/model/mapcursor/MapCursorTest.java Modified: trunk/src/atrinik/ChangeLog =================================================================== --- trunk/src/atrinik/ChangeLog 2013-12-03 00:32:13 UTC (rev 9517) +++ trunk/src/atrinik/ChangeLog 2013-12-03 11:03:27 UTC (rev 9518) @@ -1,5 +1,8 @@ 2013-12-03 Andreas Kirschbaum + * Always show the map cursor. For newly opened maps place the map + cursor at the map's default enter position. + * Properly enable or disable "Move Cursor" actions if the map size changes. Modified: trunk/src/crossfire/ChangeLog =================================================================== --- trunk/src/crossfire/ChangeLog 2013-12-03 00:32:13 UTC (rev 9517) +++ trunk/src/crossfire/ChangeLog 2013-12-03 11:03:27 UTC (rev 9518) @@ -1,5 +1,8 @@ 2013-12-03 Andreas Kirschbaum + * Always show the map cursor. For newly opened maps place the map + cursor at the map's default enter position. + * Properly enable or disable "Move Cursor" actions if the map size changes. Modified: trunk/src/daimonin/ChangeLog =================================================================== --- trunk/src/daimonin/ChangeLog 2013-12-03 00:32:13 UTC (rev 9517) +++ trunk/src/daimonin/ChangeLog 2013-12-03 11:03:27 UTC (rev 9518) @@ -1,5 +1,8 @@ 2013-12-03 Andreas Kirschbaum + * Always show the map cursor. For newly opened maps place the map + cursor at the map's default enter position. + * Properly enable or disable "Move Cursor" actions if the map size changes. Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AbstractMapCursorAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AbstractMapCursorAction.java 2013-12-03 00:32:13 UTC (rev 9517) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AbstractMapCursorAction.java 2013-12-03 11:03:27 UTC (rev 9518) @@ -76,7 +76,7 @@ private final MapCursorListener<G, A, R> mapCursorListener = new MapCursorListener<G, A, R>() { @Override - public void mapCursorChangedPos(@Nullable final Point location) { + public void mapCursorChangedPos(@NotNull final Point location) { updateAction(); } @@ -114,7 +114,7 @@ @Nullable protected MapCursor<G, A, R> getActiveMapCursor() { final MapView<G, A, R> mapView = currentMapView; - return mapView == null ? null : getActiveMapCursor(mapView); + return mapView == null ? null : mapView.getMapCursor(); } /** @@ -127,18 +127,6 @@ } /** - * Return the map cursor of a map view if it is active. - * @param mapView the map view - * @return the map cursor, or <code>null</code> if the cursor is not active, - * or if no map view exists - */ - @Nullable - private MapCursor<G, A, R> getActiveMapCursor(@NotNull final MapView<G, A, R> mapView) { - final MapCursor<G, A, R> mapCursor = mapView.getMapCursor(); - return mapCursor.isActive() ? mapCursor : null; - } - - /** * Called whenever the current map cursor has changed. */ protected abstract void updateAction(); Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ArchAttributesAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ArchAttributesAction.java 2013-12-03 00:32:13 UTC (rev 9517) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ArchAttributesAction.java 2013-12-03 11:03:27 UTC (rev 9518) @@ -94,7 +94,7 @@ private final MapCursorListener<G, A, R> mapCursorListener = new MapCursorListener<G, A, R>() { @Override - public void mapCursorChangedPos(@Nullable final Point location) { + public void mapCursorChangedPos(@NotNull final Point location) { updateActions(); } @@ -164,11 +164,7 @@ return false; } - final MapCursor<G, A, R> mapCursor = getActiveMapCursor(currentMapView); - if (mapCursor == null) { - return false; - } - + final MapCursor<G, A, R> mapCursor = currentMapView.getMapCursor(); final G gameObject = mapCursor.getGameObject(); if (gameObject == null) { return false; @@ -181,16 +177,4 @@ return true; } - /** - * Return the map cursor of a map view if it is active. - * @param mapView the map view - * @return the map cursor, or <code>null</code> if the cursor is not active, - * or if no map view exists - */ - @Nullable - private MapCursor<G, A, R> getActiveMapCursor(@NotNull final MapView<G, A, R> mapView) { - final MapCursor<G, A, R> mapCursor = mapView.getMapCursor(); - return mapCursor.isActive() ? mapCursor : null; - } - } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/AbstractServerActions.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/AbstractServerActions.java 2013-12-03 00:32:13 UTC (rev 9517) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/actions/AbstractServerActions.java 2013-12-03 11:03:27 UTC (rev 9518) @@ -165,16 +165,8 @@ } final Point cursor = mapView.getMapCursor().getLocation(); - final int mapX; - final int mapY; - if (cursor == null) { - final A mapArchObject = mapModel.getMapArchObject(); - mapX = mapArchObject.getEnterX(); - mapY = mapArchObject.getEnterY(); - } else { - mapX = cursor.x; - mapY = cursor.y; - } + final int mapX = cursor.x; + final int mapY = cursor.y; try { teleportCharacterToMap(mapPath, mapX, mapY); } catch (final IOException ex) { Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/golocation/GoLocationDialog.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/golocation/GoLocationDialog.java 2013-12-03 00:32:13 UTC (rev 9517) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/golocation/GoLocationDialog.java 2013-12-03 11:03:27 UTC (rev 9518) @@ -166,12 +166,12 @@ final Point point = mapView.getMapCursor().getLocation(); coordinatesPanel.add(ActionBuilderUtils.newLabel(ACTION_BUILDER, "goLocationX"), gbcLabel); - xCoordinateField.setText(point == null ? "0" : Integer.toString(point.x)); + xCoordinateField.setText(Integer.toString(point.x)); xCoordinateField.setColumns(3); coordinatesPanel.add(xCoordinateField, gbcField); coordinatesPanel.add(ActionBuilderUtils.newLabel(ACTION_BUILDER, "goLocationY"), gbcLabel); - yCoordinateField.setText(point == null ? "0" : Integer.toString(point.y)); + yCoordinateField.setText(Integer.toString(point.y)); yCoordinateField.setColumns(3); coordinatesPanel.add(yCoordinateField, gbcField); Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/exitconnector/ExitConnectorController.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/exitconnector/ExitConnectorController.java 2013-12-03 00:32:13 UTC (rev 9517) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/exitconnector/ExitConnectorController.java 2013-12-03 11:03:27 UTC (rev 9518) @@ -133,7 +133,7 @@ private final MapCursorListener<G, A, R> mapCursorListener = new MapCursorListener<G, A, R>() { @Override - public void mapCursorChangedPos(@Nullable final Point location) { + public void mapCursorChangedPos(@NotNull final Point location) { // ignore } @@ -238,8 +238,7 @@ } final Point location = mapView.getMapCursor().getLocation(); - // no active cursor ==> no location to remember - return location != null && exitConnectorActions.doExitCopy(performAction, mapView.getMapControl(), location); + return exitConnectorActions.doExitCopy(performAction, mapView.getMapControl(), location); } /** @@ -254,7 +253,7 @@ } final Point targetLocation = mapView.getMapCursor().getLocation(); - return targetLocation != null && exitConnectorActions.doExitPaste(performAction, mapView.getMapControl(), targetLocation); + return exitConnectorActions.doExitPaste(performAction, mapView.getMapControl(), targetLocation); } /** @@ -269,7 +268,7 @@ } final Point targetLocation = mapView.getMapCursor().getLocation(); - return targetLocation != null && exitConnectorActions.doExitConnect(performAction, mapView.getMapControl(), targetLocation); + return exitConnectorActions.doExitConnect(performAction, mapView.getMapControl(), targetLocation); } /** Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/EnterMap.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/EnterMap.java 2013-12-03 00:32:13 UTC (rev 9517) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/EnterMap.java 2013-12-03 11:03:27 UTC (rev 9518) @@ -288,10 +288,6 @@ return null; } final Point oldCursorLocation = oldMapView.getMapCursor().getLocation(); - if (oldCursorLocation == null) { - return null; - } - final Size2D mapSize = newMapView.getMapControl().getMapModel().getMapArchObject().getMapSize(); switch (direction) { case SOUTH: Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/MapActions.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/MapActions.java 2013-12-03 00:32:13 UTC (rev 9517) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/MapActions.java 2013-12-03 11:03:27 UTC (rev 9518) @@ -326,7 +326,7 @@ private final MapCursorListener<G, A, R> mapCursorListener = new MapCursorListener<G, A, R>() { @Override - public void mapCursorChangedPos(@Nullable final Point location) { + public void mapCursorChangedPos(@NotNull final Point location) { updateActions(); } @@ -567,8 +567,6 @@ final MapSquare<G, A, R> mapSquare = exit.getMapSquare(); assert mapSquare != null; mapView.setCursorLocation(mapSquare.getMapLocation()); - } else { - mapView.setCursorLocation(null); } } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapview/AbstractMapView.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapview/AbstractMapView.java 2013-12-03 00:32:13 UTC (rev 9517) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapview/AbstractMapView.java 2013-12-03 11:03:27 UTC (rev 9518) @@ -144,20 +144,18 @@ * {@inheritDoc} */ @Override - public void setCursorLocation(@Nullable final Point point) { - if (point != null) { - final Size2D mapSize = getMapControl().getMapModel().getMapArchObject().getMapSize(); - if (point.x >= mapSize.getWidth()) { - point.x = mapSize.getWidth() - 1; - } else if (point.x < 0) { - point.x = 0; - } - if (point.y >= mapSize.getHeight()) { - point.y = mapSize.getHeight() - 1; - } else if (point.y < 0) { - point.y = 0; - } + public void setCursorLocation(@NotNull final Point point) { + final Size2D mapSize = getMapControl().getMapModel().getMapArchObject().getMapSize(); + if (point.x >= mapSize.getWidth()) { + point.x = mapSize.getWidth() - 1; + } else if (point.x < 0) { + point.x = 0; } + if (point.y >= mapSize.getHeight()) { + point.y = mapSize.getHeight() - 1; + } else if (point.y < 0) { + point.y = 0; + } mapCursor.setLocation(point); } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapview/MapCursorTracker.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapview/MapCursorTracker.java 2013-12-03 00:32:13 UTC (rev 9517) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapview/MapCursorTracker.java 2013-12-03 11:03:27 UTC (rev 9518) @@ -67,7 +67,7 @@ private final MapCursorListener<G, A, R> mapCursorListener = new MapCursorListener<G, A, R>() { @Override - public void mapCursorChangedPos(@Nullable final Point location) { + public void mapCursorChangedPos(@NotNull final Point location) { ensureVisibleMapCursor(); } @@ -133,9 +133,7 @@ */ private void ensureVisibleMapCursor() { final Point cursorLocation = mapCursor.getLocation(); - if (cursorLocation != null) { - renderer.scrollRectToVisible(renderer.getSquareBounds(cursorLocation)); - } + renderer.scrollRectToVisible(renderer.getSquareBounds(cursorLocation)); } /** Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapview/MapView.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapview/MapView.java 2013-12-03 00:32:13 UTC (rev 9517) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapview/MapView.java 2013-12-03 11:03:27 UTC (rev 9518) @@ -137,9 +137,9 @@ /** * Sets the cursor location. If the map location is not within map bounds * the cursor is set to the nearest valid location. - * @param point the new location or <code>null</code> to remove the cursor; + * @param point the new location * will be modified to the actually set cursor location */ - void setCursorLocation(@Nullable Point point); + void setCursorLocation(@NotNull Point point); } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java 2013-12-03 00:32:13 UTC (rev 9517) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java 2013-12-03 11:03:27 UTC (rev 9518) @@ -20,6 +20,8 @@ package net.sf.gridarta.gui.mapcursor; import java.awt.Point; +import java.io.File; +import java.util.Set; import javax.swing.Action; import net.sf.gridarta.gui.map.mapview.MapView; import net.sf.gridarta.gui.map.mapview.MapViewManager; @@ -31,8 +33,11 @@ import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.mapcursor.MapCursor; import net.sf.gridarta.model.mapcursor.MapCursorListener; +import net.sf.gridarta.model.mapmodel.MapModelListener; import net.sf.gridarta.model.mapmodel.MapSquare; +import net.sf.gridarta.model.validation.ErrorCollector; import net.sf.gridarta.utils.EditorAction; +import net.sf.gridarta.utils.Size2D; import net.sf.japi.swing.action.ActionMethod; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -82,11 +87,13 @@ @Override public void mapViewCreated(@NotNull final MapView<G, A, R> mapView) { mapView.getMapCursor().addMapCursorListener(mapCursorListener); + mapView.getMapControl().getMapModel().addMapModelListener(mapModelListener); } @Override public void mapViewClosing(@NotNull final MapView<G, A, R> mapView) { mapView.getMapCursor().removeMapCursorListener(mapCursorListener); + mapView.getMapControl().getMapModel().removeMapModelListener(mapModelListener); } }; @@ -99,7 +106,7 @@ private final MapCursorListener<G, A, R> mapCursorListener = new MapCursorListener<G, A, R>() { @Override - public void mapCursorChangedPos(@Nullable final Point location) { + public void mapCursorChangedPos(@NotNull final Point location) { refreshActions(); } @@ -121,6 +128,45 @@ }; /** + * The map model listener used to detect map size changes in {@link + * #currentMapView}. + */ + @NotNull + private final MapModelListener<G, A, R> mapModelListener = new MapModelListener<G, A, R>() { + + @Override + public void mapSizeChanged(@NotNull final Size2D newSize) { + refreshActions(); + } + + @Override + public void mapSquaresChanged(@NotNull final Set<MapSquare<G, A, R>> mapSquares) { + // ignore + } + + @Override + public void mapObjectsChanged(@NotNull final Set<G> gameObjects, @NotNull final Set<G> transientGameObjects) { + // ignore + } + + @Override + public void errorsChanged(@NotNull final ErrorCollector<G, A, R> errors) { + // ignore + } + + @Override + public void mapFileChanged(@Nullable final File oldMapFile) { + // ignore + } + + @Override + public void modifiedChanged() { + // ignore + } + + }; + + /** * Create a new instance. * @param mapViewManager the map view manager */ @@ -196,18 +242,6 @@ } /** - * Return the map cursor of a map view if it is active. - * @param mapView the map view - * @return the map cursor, or <code>null</code> if the cursor is not active, - * or if no map view exists - */ - @Nullable - private MapCursor<G, A, R> getActiveMapCursor(@NotNull final MapView<G, A, R> mapView) { - final MapCursor<G, A, R> mapCursor = mapView.getMapCursor(); - return mapCursor.isActive() ? mapCursor : null; - } - - /** * Enable/disable menu entries based on the current cursor state. */ private void refreshActions() { @@ -231,11 +265,7 @@ return false; } - final MapCursor<G, A, R> mapCursor = getActiveMapCursor(mapView); - if (mapCursor == null) { - return false; - } - + final MapCursor<G, A, R> mapCursor = mapView.getMapCursor(); if (!mapCursor.goTo(performAction, direction)) { return false; } @@ -243,10 +273,8 @@ if (performAction) { final MapRenderer renderer = mapView.getRenderer(); final Point location = mapCursor.getLocation(); - if (location != null) { - location.translate(BORDER * direction.getDx(), BORDER * direction.getDy()); - renderer.scrollRectToVisible(renderer.getSquareBounds(location)); - } + location.translate(BORDER * direction.getDx(), BORDER * direction.getDy()); + renderer.scrollRectToVisible(renderer.getSquareBounds(location)); } return true; Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/StatusBar.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/StatusBar.java 2013-12-03 00:32:13 UTC (rev 9517) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/StatusBar.java 2013-12-03 11:03:27 UTC (rev 9518) @@ -133,7 +133,7 @@ private final MapCursorListener<G, A, R> mapCursorListener = new MapCursorListener<G, A, R>() { @Override - public void mapCursorChangedPos(@Nullable final Point location) { + public void mapCursorChangedPos(@NotNull final Point location) { mapCursorChanged(mapView == null ? null : mapView.getMapCursor()); } @@ -355,20 +355,16 @@ formatCursor = ""; } else { final Point pos = mapCursor.getLocation(); - if (pos == null) { - formatCursor = ACTION_BUILDER.format("statusCursorInactive"); + final int cursorX = pos.x; + final int cursorY = pos.y; + if (mapCursor.isDragging()) { + final Dimension offset = mapCursor.getDragOffset(); + assert offset != null; + final int offsetX = Math.abs(offset.width) + 1; + final int offsetY = Math.abs(offset.height) + 1; + formatCursor = ACTION_BUILDER.format("statusCursorDragging", cursorX, cursorY, offsetX, offsetY); } else { - final int cursorX = pos.x; - final int cursorY = pos.y; - if (mapCursor.isDragging()) { - final Dimension offset = mapCursor.getDragOffset(); - assert offset != null; - final int offsetX = Math.abs(offset.width) + 1; - final int offsetY = Math.abs(offset.height) + 1; - formatCursor = ACTION_BUILDER.format("statusCursorDragging", cursorX, cursorY, offsetX, offsetY); - } else { - formatCursor = ACTION_BUILDER.format("statusCursorActive", cursorX, cursorY); - } + formatCursor = ACTION_BUILDER.format("statusCursorActive", cursorX, cursorY); } } cursor.setText(formatCursor); Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/objectchooser/DefaultObjectChooser.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/objectchooser/DefaultObjectChooser.java 2013-12-03 00:32:13 UTC (rev 9517) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/objectchooser/DefaultObjectChooser.java 2013-12-03 11:03:27 UTC (rev 9518) @@ -133,7 +133,7 @@ private final MapCursorListener<G, A, R> mapCursorListener = new MapCursorListener<G, A, R>() { @Override - public void mapCursorChangedPos(@Nullable final Point location) { + public void mapCursorChangedPos(@NotNull final Point location) { updatePickmapInfo(activePickmapView == null ? null : activePickmapView.getMapCursor()); } @@ -410,10 +410,8 @@ gameObject = null; } else { final Point location = mapCursor.getLocation(); - if (location == null) { + if (activeMapFile == null) { gameObject = null; - } else if (activeMapFile == null) { - gameObject = null; } else { final MapControl<G, A, R> pickmap = activeMapFile.getPickmap(); if (pickmap == null) { Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/selectedsquare/SelectedSquareView.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/selectedsquare/SelectedSquareView.java 2013-12-03 00:32:13 UTC (rev 9517) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/selectedsquare/SelectedSquareView.java 2013-12-03 11:03:27 UTC (rev 9518) @@ -255,7 +255,7 @@ private final MapCursorListener<G, A, R> mapCursorListener = new MapCursorListener<G, A, R>() { @Override - public void mapCursorChangedPos(@Nullable final Point location) { + public void mapCursorChangedPos(@NotNull final Point location) { // ignore } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/tools/DeletionTool.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/tools/DeletionTool.java 2013-12-03 00:32:13 UTC (rev 9517) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/tools/DeletionTool.java 2013-12-03 11:03:27 UTC (rev 9518) @@ -211,7 +211,7 @@ final MapCursor<G, A, R> mapCursor = e.getMapCursor(); final MapControl<G, A, R> mapControl = e.getMapControl(); mapCursor.setLocationSafe(mapLoc); - if (mapLoc != null && mapCursor.isActive()) { + if (mapLoc != null) { // delete the topmost arch (matching the view settings) on that square and redraw the map deleteArch(mapLoc, mapControl); } Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/tools/SelectionTool.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/tools/SelectionTool.java 2013-12-03 00:32:13 UTC (rev 9517) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/tools/SelectionTool.java 2013-12-03 11:03:27 UTC (rev 9518) @@ -129,6 +129,9 @@ @Override public void pressed(final MouseOpEvent<G, A, R> e) { final Point mapLoc = e.getMapLocation(); + if (mapLoc == null) { + return; + } final int mod = e.getModifiers(); final MapCursor<G, A, R> mapCursor = e.getMapCursor(); mapCursor.beginTransaction(); Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/mainactions/MainActions.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/mainactions/MainActions.java 2013-12-03 00:32:13 UTC (rev 9517) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/mainactions/MainActions.java 2013-12-03 11:03:27 UTC (rev 9518) @@ -318,7 +318,7 @@ private final MapCursorListener<G, A, R> mapCursorListener = new MapCursorListener<G, A, R>() { @Override - public void mapCursorChangedPos(@Nullable final Point location) { + public void mapCursorChangedPos(@NotNull final Point location) { // ignore } @@ -975,10 +975,6 @@ } final Point startLocation = mapView.getMapCursor().getLocation(); - if (startLocation == null) { - return false; - } - if (copyBuffer.isEmpty()) { return false; } @@ -1002,10 +998,6 @@ } final Point startLocation = mapView.getMapCursor().getLocation(); - if (startLocation == null) { - return false; - } - if (copyBuffer.isEmpty()) { return false; } @@ -1023,8 +1015,7 @@ if (performAction) { final Point cursorLocation = mapView.getMapCursor().getLocation(); - final Point origin = cursorLocation == null ? selectedRec.getLocation() : cursorLocation; - copyBuffer.pasteTiled(mapView, selectedSquares, origin); + copyBuffer.pasteTiled(mapView, selectedSquares, cursorLocation); } return true; @@ -1179,10 +1170,6 @@ } final Point mapCursorLocation = mapView.getMapCursor().getLocation(); - if (mapCursorLocation == null) { - return false; - } - if (performAction) { FillUtils.floodFill(mapView.getMapControl().getMapModel(), mapCursorLocation, objectChooser.getSelections(), insertionModeSet); } Modified: trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages.properties 2013-12-03 00:32:13 UTC (rev 9517) +++ trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages.properties 2013-12-03 11:03:27 UTC (rev 9518) @@ -658,7 +658,6 @@ statusMouseOn=Mouse {0,number,integer}/{1,number,integer} statusCursorDragging=Cursor {0,number,integer}/{1,number,integer} [{2,number,integer}/{3,number,integer}] statusCursorActive=Cursor {0,number,integer}/{1,number,integer} -statusCursorInactive=Cursor off map ####################### # Various Log Messages Modified: trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_de.properties =================================================================== --- trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_de.properties 2013-12-03 00:32:13 UTC (rev 9517) +++ trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_de.properties 2013-12-03 11:03:27 UTC (rev 9518) @@ -636,7 +636,6 @@ statusMouseOn=Maus {0,number,integer}/{1,number,integer} statusCursorDragging=Cursor {0,number,integer}/{1,number,integer} [{2,number,integer}/{3,number,integer}] statusCursorActive=Cursor {0,number,integer}/{1,number,integer} -statusCursorInactive=Cursor nicht auf Karte # Edit undo.text=R\u00fcckg\u00e4ngig Modified: trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_fr.properties =================================================================== --- trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_fr.properties 2013-12-03 00:32:13 UTC (rev 9517) +++ trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_fr.properties 2013-12-03 11:03:27 UTC (rev 9518) @@ -630,7 +630,6 @@ #statusMouseOn= statusCursorDragging=Souris {0,number,integer}/{1,number,integer} [{2,number,integer}/{3,number,integer}] statusCursorActive=Souris {0,number,integer}/{1,number,integer} -#statusCursorInactive= # Edit undo.text=Annuler Modified: trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_sv.properties =================================================================== --- trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_sv.properties 2013-12-03 00:32:13 UTC (rev 9517) +++ trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_sv.properties 2013-12-03 11:03:27 UTC (rev 9518) @@ -630,7 +630,6 @@ statusMouseOn=Mus {0,number,integer}/{1,number,integer} statusCursorDragging=Mark\u00f6r {0,number,integer}/{1,number,integer} [{2,number,integer}x{3,number,integer}] statusCursorActive=Mark\u00f6r {0,number,integer}/{1,number,integer} -statusCursorInactive=Mark\u00f6r utanf\u00f6r karta # Edit undo.text=\u00c5ngra Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/exitconnector/ExitMatcher.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/exitconnector/ExitMatcher.java 2013-12-03 00:32:13 UTC (rev 9517) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/exitconnector/ExitMatcher.java 2013-12-03 11:03:27 UTC (rev 9518) @@ -59,12 +59,11 @@ * information. * @param mapModel the map model to check * @param point the map square to check - * @return the head of the exit game object or <code>null</code> if none was - * found + * @return the head of the exit game object */ @Nullable - public G getValidExit(@NotNull final MapModel<G, A, R> mapModel, @Nullable final Point point) { - if (point == null || !mapModel.getMapArchObject().isPointValid(point)) { + public G getValidExit(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Point point) { + if (!mapModel.getMapArchObject().isPointValid(point)) { return null; } for (final GameObject<G, A, R> part : mapModel.getMapSquare(point)) { Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/mapcursor/MapCursor.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/mapcursor/MapCursor.java 2013-12-03 00:32:13 UTC (rev 9517) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/mapcursor/MapCursor.java 2013-12-03 11:03:27 UTC (rev 9518) @@ -54,7 +54,7 @@ * MapGrid. */ @NotNull - private final Point pos = new Point(); + private final Point pos; /** * Position where dragging has started. @@ -69,11 +69,6 @@ private final Dimension dragOffset = new Dimension(); /** - * Whether the cursor is currently on map. - */ - private boolean onMap; - - /** * Gets set to <code>true</code> when in drag mode. */ private boolean dragging; @@ -129,12 +124,6 @@ private final Point transactionPos = new Point(); /** - * The value of {@link #onMap} at the start of the outermost map cursor - * transaction. - */ - private boolean transactionOnMap; - - /** * The value of {@link #dragging} at the start of the outermost map cursor * transaction. */ @@ -178,6 +167,8 @@ this.mapModel = mapModel; final Size2D gridSize = mapGrid.getGridSize(); mapRec = new Rectangle(0, 0, gridSize.getWidth(), gridSize.getHeight()); + final A mapArchObject = mapModel.getMapArchObject(); + pos = fixPoint(new Point(mapArchObject.getEnterX(), mapArchObject.getEnterY())); final MapGridListener mapGridListener = new MapGridListener() { @Override @@ -199,7 +190,7 @@ dragStart.y = Math.min(dragStart.y, mapRec.height - 1); } // Test if cursor position is outside map -> move inside - if (onMap && !mapRec.contains(pos)) { + if (!mapRec.contains(pos)) { pos.x = Math.min(pos.x, mapRec.width - 1); pos.y = Math.min(pos.y, mapRec.height - 1); selectMapSquare(); @@ -211,39 +202,36 @@ }; mapGrid.addMapGridListener(mapGridListener); + mapGrid.setCursor(pos); + beginTransaction(); + try { + selectMapSquare(); + } finally { + endTransaction(); + } } /** * Get position of cursor. - * @return coordinates of cursor or <code>null</code> if cursor is not - * active + * @return coordinates of cursor */ - @Nullable + @NotNull public Point getLocation() { - return onMap ? new Point(pos) : null; + return new Point(pos); } /** - * Move cursor to a new location. If new location is not on map, cursor gets - * disabled. - * @param p New location. If <code>p == null</code> cursor gets disabled + * Move cursor to a new location. If new location is not on map, the nearest + * valid location is chosen. + * @param p the new location */ - public void setLocation(@Nullable final Point p) { + public void setLocation(@NotNull final Point p) { beginTransaction(); try { - if (p != null && mapRec.contains(p)) { - if (onMap) { - if (!pos.equals(p)) { - pos.setLocation(p); - selectMapSquare(); - } - } else { - pos.setLocation(p); - selectMapSquare(); - onMap = true; - } - } else { - onMap = false; + final Point effectivePoint = fixPoint(p); + if (!pos.equals(effectivePoint)) { + pos.setLocation(effectivePoint); + selectMapSquare(); } } finally { endTransaction(); @@ -261,18 +249,11 @@ final boolean hasChanged; try { if (p != null && mapRec.contains(p)) { - if (onMap) { - if (pos.equals(p)) { - hasChanged = false; - } else { - pos.setLocation(p); - selectMapSquare(); - hasChanged = true; - } + if (pos.equals(p)) { + hasChanged = false; } else { pos.setLocation(p); selectMapSquare(); - onMap = true; hasChanged = true; } } else { @@ -288,7 +269,7 @@ * Set cursor to drag mode when it is active. */ public void dragStart() { - if (onMap && !dragging) { + if (!dragging) { beginTransaction(); try { dragStart.setLocation(pos); @@ -362,7 +343,7 @@ public final void deactivate() { beginTransaction(); try { - onMap = false; + dragging = false; mapGrid.unSelect(); } finally { endTransaction(); @@ -370,14 +351,6 @@ } /** - * Get cursor state. - * @return <code>true</code> if cursor is on the map - */ - public boolean isActive() { - return onMap; - } - - /** * Get offset from start position of dragging. * @return offset or <code>null</code> when not in drag mode * @noinspection NullableProblems @@ -403,21 +376,18 @@ * @return <code>true</code> if cursor really moved */ public boolean goTo(final boolean performAction, @NotNull final Direction dir) { - if (onMap) { - tmpPoint.setLocation(pos.x + dir.getDx(), pos.y + dir.getDy()); - if (!mapRec.contains(tmpPoint)) { - return false; + tmpPoint.setLocation(pos.x + dir.getDx(), pos.y + dir.getDy()); + if (!mapRec.contains(tmpPoint)) { + return false; + } + if (performAction) { + if (dragging) { + dragTo(tmpPoint); + } else { + setLocationSafe(tmpPoint); } - if (performAction) { - if (dragging) { - dragTo(tmpPoint); - } else { - setLocationSafe(tmpPoint); - } - } - return true; } - return false; + return true; } /** @@ -457,9 +427,8 @@ /** * Sets the selected {@link GameObject}. If the game object is not on a map - * or not on the map this cursor is attached to, the cursor is deactivated. - * @param gameObject the selected game object or <code>null</code> to - * deactivate the cursor + * or not on the map this cursor is attached to, the cursor is unchanged. + * @param gameObject the selected game object */ public void setGameObject(@Nullable final G gameObject) { beginTransaction(); @@ -468,10 +437,7 @@ this.gameObject = null; } else { final MapSquare<G, A, R> mapSquare = gameObject.getMapSquare(); - if (mapSquare == null || mapSquare.getMapModel() != mapModel) { - onMap = false; - } else { - onMap = true; + if (mapSquare != null && mapSquare.getMapModel() == mapModel) { pos.setLocation(mapSquare.getMapX(), mapSquare.getMapY()); this.mapSquare = mapSquare; this.gameObject = gameObject; @@ -484,17 +450,13 @@ /** * Sets the selected {@link MapSquare}. If the map square does not belong to - * the map this cursor is attached to, the cursor is deactivated. - * @param mapSquare the selected map square or <code>null</code> to - * deactivate the cursor + * the map this cursor is attached to, the cursor is unchanged. + * @param mapSquare the selected map square */ public void setMapSquare(@Nullable final MapSquare<G, A, R> mapSquare) { beginTransaction(); try { - if (mapSquare == null || mapSquare.getMapModel() != mapModel) { - onMap = false; - } else { - onMap = true; + if (mapSquare != null && mapSquare.getMapModel() == mapModel) { pos.setLocation(mapSquare.getMapX(), mapSquare.getMapY()); this.mapSquare = mapSquare; selectTopmostGameObject(); @@ -510,10 +472,9 @@ * come before the view is really required to update. Each invocation of * this function requires its own invocation of {@link #endTransaction()}. */ - public void beginTransaction() { + public final void beginTransaction() { if (transactionDepth == 0) { transactionPos.setLocation(pos); - transactionOnMap = onMap; transactionDragging = dragging; transactionMapSquare = mapSquare; transactionGameObject = gameObject; @@ -527,28 +488,17 @@ * End a transaction. Invoking this method will reduce the transaction depth * by 1. <p/> If the last transaction is ended, the changes are committed. */ - public void endTransaction() { + public final void endTransaction() { assert transactionDepth > 0; transactionDepth--; - if (!onMap) { - dragging = false; - mapSquare = null; - gameObject = null; - } - if (transactionDepth == 0) { final boolean changedPos = !pos.equals(transactionPos) || mapSquare != transactionMapSquare; - final boolean changedMode = onMap != transactionOnMap || dragging != transactionDragging; + final boolean changedMode = dragging != transactionDragging; final boolean changedGameObject = gameObject != transactionGameObject; final boolean changedSize = !mapRec.equals(transactionMapRec); - if (!onMap) { - mapGrid.unSelect(); - } - if (transactionOnMap && (!onMap || !pos.equals(transactionPos))) { + if (!pos.equals(transactionPos)) { mapGrid.unSetCursor(transactionPos); - } - if (onMap && (!transactionOnMap || !pos.equals(transactionPos))) { mapGrid.setCursor(pos); } if (changedMode) { @@ -664,10 +614,6 @@ * @return whether the action was or can be performed */ public boolean insertGameObject(final boolean performAction, @NotNull final BaseObject<G, A, R, ?> gameObject, final boolean insertAtEnd, final boolean join) { - if (!onMap) { - return false; - } - if (performAction) { mapModel.beginTransaction("Insert"); // TODO; I18N/L10N try { @@ -695,10 +641,6 @@ * @return whether the action was or can be performed */ public boolean deleteSelectedGameObject(final boolean performAction, final boolean autoJoin) { - if (!onMap) { - return false; - } - final G gameObject = this.gameObject; if (gameObject == null) { return false; @@ -740,4 +682,18 @@ return true; } + /** + * Returns a valid location that is on the map. + * @param p the preferred location + * @return the valid location + */ + @NotNull + private Point fixPoint(@NotNull final Point p) { + if (mapRec.contains(p)) { + return p; + } + + return new Point(Math.max(Math.min(p.x, mapRec.width - 1), 0), Math.max(Math.min(p.y, mapRec.height - 1), 0)); + } + } Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/mapcursor/MapCursorListener.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/mapcursor/MapCursorListener.java 2013-12-03 00:32:13 UTC (rev 9517) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/mapcursor/MapCursorListener.java 2013-12-03 11:03:27 UTC (rev 9518) @@ -25,6 +25,7 @@ import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.mapmodel.MapSquare; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** @@ -35,12 +36,10 @@ public interface MapCursorListener<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends EventListener { /** - * This event handler is called when {@link MapCursor} has moved, appeared - * or disappeared. - * @param location the new location or <code>null</code> if the cursor - * disappeared + * This event handler is called when {@link MapCursor} has moved. + * @param location the new location */ - void mapCursorChangedPos(@Nullable Point location); + void mapCursorChangedPos(@NotNull Point location); /** * This event handler is called when {@link MapCursor} changes mode (drag, Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/TopLevelGameObjectIterator.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/TopLevelGameObjectIterator.java 2013-12-03 00:32:13 UTC (rev 9517) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/mapmodel/TopLevelGameObjectIterator.java 2013-12-03 11:03:27 UTC (rev 9518) @@ -58,13 +58,13 @@ /** * Creates a new instance. * @param mapModel the map model to iterate over - * @param start the starting point or <code>null</code> for default + * @param start the starting point * @param direction the direction to iterate: <code>+1</code> for forward, * <code>-1</code> for backward * @param skipFirst whether to skip the first map square and return it at * the end */ - public TopLevelGameObjectIterator(@NotNull final MapModel<G, A, R> mapModel, @Nullable final Point start, final int direction, final boolean skipFirst) { + public TopLevelGameObjectIterator(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Point start, final int direction, final boolean skipFirst) { mapSquareIterator = new MapSquareIterator<G, A, R>(mapModel, start, direction, skipFirst); findNext(); } Modified: trunk/src/model/src/test/java/net/sf/gridarta/model/mapcursor/MapCursorTest.java =================================================================== --- trunk/src/model/src/test/java/net/sf/gridarta/model/mapcursor/MapCursorTest.java 2013-12-03 00:32:13 UTC (rev 9517) +++ trunk/src/model/src/test/java/net/sf/gridarta/model/mapcursor/MapCursorTest.java 2013-12-03 11:03:27 UTC (rev 9518) @@ -28,6 +28,7 @@ import net.sf.gridarta.model.maparchobject.TestMapArchObject; import net.sf.gridarta.model.mapgrid.MapGrid; import net.sf.gridarta.model.mapgrid.SelectionMode; +import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.mapmodel.MapSquare; import net.sf.gridarta.model.mapmodel.TestMapModelCreator; import net.sf.gridarta.utils.Size2D; @@ -45,6 +46,16 @@ public class MapCursorTest { /** + * The enter x coordinate of newly created maps. + */ + private static final int ENTER_X = 1; + + /** + * The enter y coordinate of newly created maps. + */ + private static final int ENTER_Y = 2; + + /** * The size of the map grid for the tested cursor. */ @NotNull @@ -66,9 +77,11 @@ private static MapCursor<TestGameObject, TestMapArchObject, TestArchetype> createCursor(@NotNull final MapGrid grid) { final TestMapModelCreator mapModelCreator = new TestMapModelCreator(false); final Size2D gridSize = grid.getSize(); - final MapCursor<TestGameObject, TestMapArchObject, TestArchetype> cursor = new MapCursor<TestGameObject, TestMapArchObject, TestArchetype>(grid, mapModelCreator.newMapModel(gridSize.getWidth(), gridSize.getHeight())); + final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = mapModelCreator.newMapModel(gridSize.getWidth(), gridSize.getHeight()); + mapModel.getMapArchObject().setEnterX(ENTER_X); + mapModel.getMapArchObject().setEnterY(ENTER_Y); + final MapCursor<TestGameObject, TestMapArchObject, TestArchetype> cursor = new MapCursor<TestGameObject, TestMapArchObject, TestArchetype>(grid, mapModel); cursor.addMapCursorListener(listener); - Assert.assertFalse("MapCursor has to be disabled when created.", cursor.isActive()); listener.changedPosCounter = 0; listener.changedModeCounter = 0; return cursor; @@ -82,37 +95,31 @@ final MapGrid grid = new MapGrid(gridSize); final MapCursor<TestGameObject, TestMapArchObject, TestArchetype> cursor = createCursor(grid); final Point p = new Point(); - for (int i = -2; i < gridSize.getWidth() + 2; i++) { + final int width = gridSize.getWidth(); + final int height = gridSize.getHeight(); + for (int i = -2; i < width + 2; i++) { p.setLocation(i, -1); cursor.setLocation(p); + testEvents(1, 0); + Assert.assertEquals(new Point(Math.max(0, Math.min(width - 1, i)), 0), cursor.getLocation()); testEvents(0, 0); - Assert.assertFalse("MapCursor should be disabled after setLocation(" + p + ")", cursor.isActive()); - testEvents(0, 0); - Assert.assertNull("getLocation() should return null after setLocation(" + p + ")", cursor.getLocation()); - testEvents(0, 0); - p.setLocation(i, gridSize.getHeight()); + p.setLocation(i, height); cursor.setLocation(p); + testEvents(1, 0); + Assert.assertEquals(new Point(Math.max(0, Math.min(width - 1, i)), height - 1), cursor.getLocation()); testEvents(0, 0); - Assert.assertFalse("MapCursor should be disabled after setLocation(" + p + ")", cursor.isActive()); - testEvents(0, 0); - Assert.assertNull("getLocation() should return null after setLocation(" + p + ")", cursor.getLocation()); - testEvents(0, 0); } - for (int i = -2; i < gridSize.getHeight() + 2; i++) { + for (int i = -2; i < height + 2; i++) { p.setLocation(-1, i); cursor.setLocation(p); + testEvents(1, 0); + Assert.assertEquals(new Point(0, Math.max(0, Math.min(height - 1, i))), cursor.getLocation()); testEvents(0, 0); - Assert.assertFalse("MapCursor should be disabled after setLocation(" + p + ")", cursor.isActive()); - testEvents(0, 0); - Assert.assertNull("getLocation() should return null after setLocation(" + p + ")", cursor.getLocation()); - testEvents(0, 0); - p.setLocation(gridSize.getWidth(), i); + p.setLocation(width, i); cursor.setLocation(p); + testEvents(1, 0); + Assert.assertEquals(new Point(width - 1, Math.max(0, Math.min(height - 1, i))), cursor.getLocation()); testEvents(0, 0); - Assert.assertFalse("MapCursor should be disabled after setLocation(" + p + ")", cursor.isActive()); - testEvents(0, 0); - Assert.assertNull("getLocation() should return null after setLocation(" + p + ")", cursor.getLocation()); - testEvents(0, 0); } } @@ -123,21 +130,12 @@ public void setInside() { final MapGrid grid = new MapGrid(gridSize); final MapCursor<TestGameObject, TestMapArchObject, TestArchetype> cursor = createCursor(grid); - boolean first = true; final Point p = new Point(); for (int j = 0; j < gridSize.getHeight(); j++) { for (int i = 0; i < gridSize.getWidth(); i++) { p.setLocation(i, j); cursor.setLocation(p); - if (first) { - // Only the first after activation should fire a change mode event - testEvents(1, 1); - first = false; - } else { - testEvents(1, 0); - } - Assert.assertTrue("MapCursor should be active after setLocation(" + p + ")", cursor.isActive()); - testEvents(0, 0); + testEvents(1, 0); final Point res = cursor.getLocation(); testEvents(0, 0); Assert.assertEquals("getLocation()", p, res); @@ -153,29 +151,20 @@ public void setSameLocation() { final MapGrid grid = new MapGrid(gridSize); final MapCursor<TestGameObject, TestMapArchObject, TestArchetype> cursor = createCursor(grid); - final Point p = new Point(-1, -1); - cursor.setLocation(null); + cursor.setLocation(new Point(3, 4)); + testEvents(1, 0); + cursor.setLocation(new Point(3, 4)); testEvents(0, 0); - Assert.assertFalse("MapCursor should be deactivated", cursor.isActive()); + cursor.setLocation(new Point(1, 0)); + testEvents(1, 0); + cursor.setLocation(new Point(1, -1)); testEvents(0, 0); - cursor.setLocation(p); + cursor.setLocation(new Point(-3, -2)); + testEvents(1, 0); + cursor.setLocation(new Point(-2, -1)); testEvents(0, 0); - Assert.assertFalse("MapCursor should be deactivated", cursor.isActive()); + cursor.setLocation(new Point(0, 0)); testEvents(0, 0); - p.setLocation(3, 4); - cursor.setLocation(p); - testEvents(1, 1); - Assert.assertTrue("MapCursor should be active", cursor.isActive()); - testEvents(0, 0); - cursor.setLocation(p); - testEvents(0, 0); - Assert.assertTrue("MapCursor should be active", cursor.isActive()); - testEvents(0, 0); - p.setLocation(-1, -1); - cursor.setLocation(p); - testEvents(1, 1); - Assert.assertFalse("MapCursor should be deactivated", cursor.isActive()); - testEvents(0, 0); } /** @@ -188,30 +177,18 @@ final Point p = new Point(-1, -1); Assert.assertFalse("setLocationSafe(null) should return false", cursor.setLocationSafe(null)); testEvents(0, 0); - Assert.assertFalse("MapCursor should be deactivated", cursor.isActive()); - testEvents(0, 0); Assert.assertFalse("setLocationSafe(" + p + ") should return false", cursor.setLocationSafe(p)); testEvents(0, 0); - Assert.assertFalse("MapCursor should be deactivated", cursor.isActive()); - testEvents(0, 0); p.setLocation(3, 4); Assert.assertTrue("setLocationSafe(" + p + ") should return true", cursor.setLocationSafe(p)); - testEvents(1, 1); - Assert.assertTrue("MapCursor should be active", cursor.isActive()); - testEvents(0, 0); + testEvents(1, 0); Assert.assertFalse("setLocationSafe(" + p + ") should return false", cursor.setLocationSafe(p)); testEvents(0, 0); - Assert.assertTrue("MapCursor should be active", cursor.isActive()); - testEvents(0, 0); p.setLocation(-1, -1); Assert.assertFalse("setLocationSafe(" + p + ") should return false", cursor.setLocationSafe(p)); testEvents(0, 0); - Assert.assertTrue("MapCursor should be active", cursor.isActive()); - testEvents(0, 0); Assert.assertFalse("setLocationSafe(null) should return false", cursor.setLocationSafe(null)); testEvents(0, 0); - Assert.assertTrue("MapCursor should be active", cursor.isActive()); - testEvents(0, 0); } /** @@ -242,14 +219,10 @@ public void testGoTo() { final MapGrid grid = new MapGrid(gridSize); final MapCursor<TestGameObject, TestMapArchObject, TestArchetype> cursor = createCursor(grid); - for (final Direction dir : Direction.values()) { - Assert.assertFalse("go(" + dir + ") should return false.", cursor.goTo(true, dir)); - testEvents(0, 0); - } final Point pStart = new Point(2, 3); final Point p = new Point(pStart); cursor.setLocation(p); - testEvents(1, 1); + testEvents(1, 0); for (final Direction dir : Direction.values()) { Assert.assertTrue("go(" + dir + ") should return true. (Maybe the grid was too small.)", cursor.goTo(true, dir)); testEvents(1, 0); @@ -269,24 +242,23 @@ final MapCursor<TestGameObject, TestMapArchObject, TestArchetype> cursor = createCursor(grid); Assert.assertFalse("MapCursor should not drag while deactivated.", cursor.isDragging()); cursor.dragStart(); - testEvents(0, 0); - Assert.assertFalse("MapCursor should not drag while deactivated.", cursor.isDragging()); - Assert.assertNull("Drag offset should be null", cursor.getDragOffset()); + testEvents(0, 1); + Assert.assertEquals(new Dimension(0, 0), cursor.getDragOffset()); final Point dragStart = new Point(3, 4); final Point p = new Point(dragStart); final Dimension offset = new Dimension(0, 0); cursor.setLocation(dragStart); - testEvents(1, 1); + testEvents(1, 0); cursor.dragStart(); - testEvents(0, 1); + testEvents(0, 0); Assert.assertTrue("MapCursor should be in drag mode.", cursor.isDragging()); Assert.assertEquals("Wrong offset", offset, cursor.getDragOffset()); cursor.deactivate(); - testEvents(1, 1); + testEvents(0, 1); Assert.assertFalse("MapCursor should not drag while deactivated.", cursor.isDragging()); Assert.assertNull("Drag offset should be null", cursor.getDragOffset()); cursor.setLocation(dragStart); - testEvents(1, 1); + testEvents(0, 0); cursor.dragStart(); testEvents(0, 1); Assert.assertEquals("Wrong offset", offset, cursor.getDragOffset()); @@ -386,7 +358,7 @@ cursor.dragRelease(); testEvents(0, 0); cursor.setLocation(start); - testEvents(1, 1); + testEvents(1, 0); cursor.dragStart(); te... [truncated message content] |
From: <aki...@us...> - 2013-12-03 00:32:20
|
Revision: 9517 http://sourceforge.net/p/gridarta/code/9517 Author: akirschbaum Date: 2013-12-03 00:32:13 +0000 (Tue, 03 Dec 2013) Log Message: ----------- Properly enable or disable "Move Cursor" actions if the map size changes. Modified Paths: -------------- trunk/src/atrinik/ChangeLog trunk/src/crossfire/ChangeLog trunk/src/daimonin/ChangeLog trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AbstractMapCursorAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ArchAttributesAction.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/exitconnector/ExitConnectorController.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/MapActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapview/MapCursorTracker.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/StatusBar.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/objectchooser/DefaultObjectChooser.java trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/selectedsquare/SelectedSquareView.java trunk/src/gridarta/src/main/java/net/sf/gridarta/mainactions/MainActions.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapcursor/MapCursor.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapcursor/MapCursorListener.java trunk/src/model/src/test/java/net/sf/gridarta/model/mapcursor/MapCursorTest.java Modified: trunk/src/atrinik/ChangeLog =================================================================== --- trunk/src/atrinik/ChangeLog 2013-12-03 00:13:05 UTC (rev 9516) +++ trunk/src/atrinik/ChangeLog 2013-12-03 00:32:13 UTC (rev 9517) @@ -1,3 +1,8 @@ +2013-12-03 Andreas Kirschbaum + + * Properly enable or disable "Move Cursor" actions if the map size + changes. + 2013-11-24 Andreas Kirschbaum * Fix plugin script parameter editor. Modified: trunk/src/crossfire/ChangeLog =================================================================== --- trunk/src/crossfire/ChangeLog 2013-12-03 00:13:05 UTC (rev 9516) +++ trunk/src/crossfire/ChangeLog 2013-12-03 00:32:13 UTC (rev 9517) @@ -1,3 +1,8 @@ +2013-12-03 Andreas Kirschbaum + + * Properly enable or disable "Move Cursor" actions if the map size + changes. + 2013-11-24 Andreas Kirschbaum * Fix plugin script parameter editor. Modified: trunk/src/daimonin/ChangeLog =================================================================== --- trunk/src/daimonin/ChangeLog 2013-12-03 00:13:05 UTC (rev 9516) +++ trunk/src/daimonin/ChangeLog 2013-12-03 00:32:13 UTC (rev 9517) @@ -1,3 +1,8 @@ +2013-12-03 Andreas Kirschbaum + + * Properly enable or disable "Move Cursor" actions if the map size + changes. + 2013-11-24 Andreas Kirschbaum * Fix plugin script parameter editor. Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AbstractMapCursorAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AbstractMapCursorAction.java 2013-12-03 00:13:05 UTC (rev 9516) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/AbstractMapCursorAction.java 2013-12-03 00:32:13 UTC (rev 9517) @@ -90,6 +90,11 @@ // ignore } + @Override + public void mapCursorChangedSize() { + // ignore + } + }; /** Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ArchAttributesAction.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ArchAttributesAction.java 2013-12-03 00:13:05 UTC (rev 9516) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/action/ArchAttributesAction.java 2013-12-03 00:32:13 UTC (rev 9517) @@ -108,6 +108,11 @@ // ignore } + @Override + public void mapCursorChangedSize() { + // ignore + } + }; /** Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/exitconnector/ExitConnectorController.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/exitconnector/ExitConnectorController.java 2013-12-03 00:13:05 UTC (rev 9516) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/exitconnector/ExitConnectorController.java 2013-12-03 00:32:13 UTC (rev 9517) @@ -147,6 +147,11 @@ //ignore } + @Override + public void mapCursorChangedSize() { + // ignore + } + }; /** Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/MapActions.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/MapActions.java 2013-12-03 00:13:05 UTC (rev 9516) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapactions/MapActions.java 2013-12-03 00:32:13 UTC (rev 9517) @@ -340,6 +340,11 @@ // ignore } + @Override + public void mapCursorChangedSize() { + // ignore + } + }; /** Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapview/MapCursorTracker.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapview/MapCursorTracker.java 2013-12-03 00:13:05 UTC (rev 9516) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/map/mapview/MapCursorTracker.java 2013-12-03 00:32:13 UTC (rev 9517) @@ -81,6 +81,11 @@ // ignore } + @Override + public void mapCursorChangedSize() { + // ignore + } + }; /** Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java 2013-12-03 00:13:05 UTC (rev 9516) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/mapcursor/MapCursorActions.java 2013-12-03 00:32:13 UTC (rev 9517) @@ -113,6 +113,11 @@ // ignore } + @Override + public void mapCursorChangedSize() { + refreshActions(); + } + }; /** Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/StatusBar.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/StatusBar.java 2013-12-03 00:13:05 UTC (rev 9516) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/misc/StatusBar.java 2013-12-03 00:32:13 UTC (rev 9517) @@ -147,6 +147,11 @@ // ignore } + @Override + public void mapCursorChangedSize() { + // ignore + } + }; /** Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/objectchooser/DefaultObjectChooser.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/objectchooser/DefaultObjectChooser.java 2013-12-03 00:13:05 UTC (rev 9516) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/objectchooser/DefaultObjectChooser.java 2013-12-03 00:32:13 UTC (rev 9517) @@ -147,6 +147,11 @@ // ignore } + @Override + public void mapCursorChangedSize() { + // ignore + } + }; /** Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/selectedsquare/SelectedSquareView.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/selectedsquare/SelectedSquareView.java 2013-12-03 00:13:05 UTC (rev 9516) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/panel/selectedsquare/SelectedSquareView.java 2013-12-03 00:32:13 UTC (rev 9517) @@ -271,6 +271,11 @@ } } + @Override + public void mapCursorChangedSize() { + // ignore + } + }; /** Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/mainactions/MainActions.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/mainactions/MainActions.java 2013-12-03 00:13:05 UTC (rev 9516) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/mainactions/MainActions.java 2013-12-03 00:32:13 UTC (rev 9517) @@ -332,6 +332,11 @@ // ignore } + @Override + public void mapCursorChangedSize() { + // ignore + } + }; /** Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/mapcursor/MapCursor.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/mapcursor/MapCursor.java 2013-12-03 00:13:05 UTC (rev 9516) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/mapcursor/MapCursor.java 2013-12-03 00:32:13 UTC (rev 9517) @@ -155,6 +155,13 @@ private G transactionGameObject; /** + * The value of {@link #mapRec} at the start of the outermost map cursor + * transaction. + */ + @NotNull + private final Rectangle transactionMapRec = new Rectangle(); + + /** * The MapCursorListeners to inform of changes. */ @NotNull @@ -181,22 +188,24 @@ @Override public void mapGridResized(@NotNull final MapGridEvent e) { final Size2D newSize = mapGrid.getGridSize(); - mapRec.setSize(newSize.getWidth(), newSize.getHeight()); - // Test if drag start point is outside map -> move inside - if (dragging && !mapRec.contains(dragStart)) { - dragStart.x = Math.min(dragStart.x, mapRec.width - 1); - dragStart.y = Math.min(dragStart.y, mapRec.height - 1); - } - // Test if cursor position is outside map -> move inside - if (onMap && !mapRec.contains(pos)) { - beginTransaction(); - try { + final int newWidth = newSize.getWidth(); + final int newHeight = newSize.getHeight(); + beginTransaction(); + try { + mapRec.setSize(newWidth, newHeight); + // Test if drag start point is outside map -> move inside + if (dragging && !mapRec.contains(dragStart)) { + dragStart.x = Math.min(dragStart.x, mapRec.width - 1); + dragStart.y = Math.min(dragStart.y, mapRec.height - 1); + } + // Test if cursor position is outside map -> move inside + if (onMap && !mapRec.contains(pos)) { pos.x = Math.min(pos.x, mapRec.width - 1); pos.y = Math.min(pos.y, mapRec.height - 1); selectMapSquare(); - } finally { - endTransaction(); } + } finally { + endTransaction(); } } @@ -508,6 +517,7 @@ transactionDragging = dragging; transactionMapSquare = mapSquare; transactionGameObject = gameObject; + transactionMapRec.setRect(mapRec); } transactionDepth++; mapGrid.beginTransaction(); @@ -531,6 +541,7 @@ final boolean changedPos = !pos.equals(transactionPos) || mapSquare != transactionMapSquare; final boolean changedMode = onMap != transactionOnMap || dragging != transactionDragging; final boolean changedGameObject = gameObject != transactionGameObject; + final boolean changedSize = !mapRec.equals(transactionMapRec); if (!onMap) { mapGrid.unSelect(); } @@ -555,6 +566,11 @@ listener.mapCursorChangedGameObject(mapSquare, gameObject); } } + if (changedSize) { + for (final MapCursorListener<G, A, R> listener : listenerList.getListeners()) { + listener.mapCursorChangedSize(); + } + } } mapGrid.endTransaction(); Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/mapcursor/MapCursorListener.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/mapcursor/MapCursorListener.java 2013-12-03 00:13:05 UTC (rev 9516) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/mapcursor/MapCursorListener.java 2013-12-03 00:32:13 UTC (rev 9517) @@ -59,4 +59,9 @@ */ void mapCursorChangedGameObject(@Nullable MapSquare<G, A, R> mapSquare, @Nullable G gameObject); + /** + * Called whenever the map cursor's map grid size has changed. + */ + void mapCursorChangedSize(); + } Modified: trunk/src/model/src/test/java/net/sf/gridarta/model/mapcursor/MapCursorTest.java =================================================================== --- trunk/src/model/src/test/java/net/sf/gridarta/model/mapcursor/MapCursorTest.java 2013-12-03 00:13:05 UTC (rev 9516) +++ trunk/src/model/src/test/java/net/sf/gridarta/model/mapcursor/MapCursorTest.java 2013-12-03 00:32:13 UTC (rev 9517) @@ -505,6 +505,11 @@ // ignore } + @Override + public void mapCursorChangedSize() { + // ignore + } + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-12-03 00:13:11
|
Revision: 9516 http://sourceforge.net/p/gridarta/code/9516 Author: akirschbaum Date: 2013-12-03 00:13:05 +0000 (Tue, 03 Dec 2013) Log Message: ----------- Properly update map cursor's idea of the size of its map grid. Modified Paths: -------------- trunk/src/model/src/main/java/net/sf/gridarta/model/mapcursor/MapCursor.java trunk/src/model/src/main/java/net/sf/gridarta/model/mapgrid/MapGrid.java Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/mapcursor/MapCursor.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/mapcursor/MapCursor.java 2013-12-02 23:59:46 UTC (rev 9515) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/mapcursor/MapCursor.java 2013-12-03 00:13:05 UTC (rev 9516) @@ -34,6 +34,7 @@ import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.mapmodel.MapSquare; import net.sf.gridarta.utils.EventListenerList2; +import net.sf.gridarta.utils.Size2D; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -168,7 +169,8 @@ public MapCursor(@NotNull final MapGrid mapGrid, @NotNull final MapModel<G, A, R> mapModel) { this.mapGrid = mapGrid; this.mapModel = mapModel; - mapRec = mapGrid.getMapRec(); + final Size2D gridSize = mapGrid.getGridSize(); + mapRec = new Rectangle(0, 0, gridSize.getWidth(), gridSize.getHeight()); final MapGridListener mapGridListener = new MapGridListener() { @Override @@ -178,6 +180,8 @@ @Override public void mapGridResized(@NotNull final MapGridEvent e) { + final Size2D newSize = mapGrid.getGridSize(); + mapRec.setSize(newSize.getWidth(), newSize.getHeight()); // Test if drag start point is outside map -> move inside if (dragging && !mapRec.contains(dragStart)) { dragStart.x = Math.min(dragStart.x, mapRec.width - 1); Modified: trunk/src/model/src/main/java/net/sf/gridarta/model/mapgrid/MapGrid.java =================================================================== --- trunk/src/model/src/main/java/net/sf/gridarta/model/mapgrid/MapGrid.java 2013-12-02 23:59:46 UTC (rev 9515) +++ trunk/src/model/src/main/java/net/sf/gridarta/model/mapgrid/MapGrid.java 2013-12-03 00:13:05 UTC (rev 9516) @@ -153,12 +153,6 @@ private final EventListenerList2<MapGridListener> listenerList = new EventListenerList2<MapGridListener>(MapGridListener.class); /** - * Set to size of grid size. Used to test if coordinates are on the map. - */ - @NotNull - private final Rectangle mapRec = new Rectangle(); - - /** * The transaction depth. A value of 0 means there's no transaction going * on. A value > 0 means there's a transaction going on and denotes the * nesting level. @@ -178,7 +172,6 @@ * @param gridSize the size of the grid */ public MapGrid(@NotNull final Size2D gridSize) { - mapRec.setBounds(0, 0, gridSize.getWidth(), gridSize.getHeight()); this.gridSize = gridSize; gridFlags = new int[gridSize.getWidth()][gridSize.getHeight()]; } @@ -200,12 +193,12 @@ } /** - * Returns a {@link Rectangle} with position and dimension of this grid. - * @return a rectangle with position and dimension of this grid + * Returns a {@link Size2D} with the dimension of this grid. + * @return a size 2D with the dimension of this grid */ @NotNull - public Rectangle getMapRec() { - return mapRec; + public Size2D getGridSize() { + return gridSize; } /** @@ -234,7 +227,6 @@ gridFlags = newGridFlags; gridSize = newSize; cachedSelectedRecValid = false; - mapRec.setSize(newSize.getWidth(), newSize.getHeight()); fireMapGridResizeEvent(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-12-02 23:59:50
|
Revision: 9515 http://sourceforge.net/p/gridarta/code/9515 Author: akirschbaum Date: 2013-12-02 23:59:46 +0000 (Mon, 02 Dec 2013) Log Message: ----------- Copy save location when cloning plugins. Modified Paths: -------------- trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/Plugin.java Modified: trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/Plugin.java =================================================================== --- trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/Plugin.java 2013-12-02 23:15:00 UTC (rev 9514) +++ trunk/src/plugin/src/main/java/net/sf/gridarta/plugin/Plugin.java 2013-12-02 23:59:46 UTC (rev 9515) @@ -266,6 +266,7 @@ model.autoBoot = autoBoot; model.filter = filter; model.script = script; + model.file = file; model.modified = modified; for (final PluginParameter<G, A, R, ?> parameter : parameters) { final Element paramXml = codec.toXML(parameter); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-12-02 23:15:04
|
Revision: 9514 http://sourceforge.net/p/gridarta/code/9514 Author: akirschbaum Date: 2013-12-02 23:15:00 +0000 (Mon, 02 Dec 2013) Log Message: ----------- Fix Ant build script. Modified Paths: -------------- trunk/build.xml Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2013-11-25 09:07:01 UTC (rev 9513) +++ trunk/build.xml 2013-12-02 23:15:00 UTC (rev 9514) @@ -568,6 +568,7 @@ <mkdir dir="${build.dir}/plugin/test"/> <javac srcdir="src/plugin/src/test/java" destdir="${build.dir}/plugin/test" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="yes"> <classpath> + <path refid="path.class.model.app"/> <path refid="path.class.model.test"/> <path refid="path.class.plugin.app"/> <path refid="path.class.utils.app"/> @@ -1176,7 +1177,14 @@ <mkdir dir="${docs.dir}/test"/> <junit printsummary="no" haltonfailure="yes"> <classpath> + <path refid="path.class.model.app"/> + <path refid="path.class.model.test"/> <path refid="path.class.plugin.test"/> + <path refid="path.class.utils.app"/> + <path refid="path.lib.japi-swing-action"/> + <path refid="path.lib.jdom"/> + <path refid="path.lib.junit"/> + <path refid="path.lib.log4j"/> </classpath> <formatter type="plain"/> <formatter type="xml"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-11-25 09:07:09
|
Revision: 9513 http://sourceforge.net/p/gridarta/code/9513 Author: akirschbaum Date: 2013-11-25 09:07:01 +0000 (Mon, 25 Nov 2013) Log Message: ----------- Fix Ant build script. Modified Paths: -------------- trunk/build.xml Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2013-11-24 14:03:50 UTC (rev 9512) +++ trunk/build.xml 2013-11-25 09:07:01 UTC (rev 9513) @@ -568,7 +568,12 @@ <mkdir dir="${build.dir}/plugin/test"/> <javac srcdir="src/plugin/src/test/java" destdir="${build.dir}/plugin/test" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="yes"> <classpath> + <path refid="path.class.model.test"/> <path refid="path.class.plugin.app"/> + <path refid="path.class.utils.app"/> + <path refid="path.lib.annotations"/> + <path refid="path.lib.jdom"/> + <path refid="path.lib.junit"/> </classpath> <compilerarg line="${javac.args}"/> </javac> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-11-24 14:03:56
|
Revision: 9512 http://sourceforge.net/p/gridarta/code/9512 Author: akirschbaum Date: 2013-11-24 14:03:50 +0000 (Sun, 24 Nov 2013) Log Message: ----------- Remove useless debug output. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginView.java Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginView.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginView.java 2013-11-24 14:03:16 UTC (rev 9511) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginView.java 2013-11-24 14:03:50 UTC (rev 9512) @@ -49,8 +49,6 @@ import net.sf.gridarta.utils.ResourceIcons; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; -import org.apache.log4j.Category; -import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -61,12 +59,6 @@ public class PluginView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { /** - * The Logger for printing log messages. - */ - @NotNull - private static final Category log = Logger.getLogger(PluginView.class); - - /** * The {@link ActionBuilder} instance. */ @NotNull @@ -232,7 +224,6 @@ dialog.getContentPane().removeAll(); int i = 0; for (final PluginParameter<G, A, R, ?> parameter : plugin) { - log.debug("adding parameter"); final Component name = new JLabel(parameter.getName()); final PluginParameterView<G, A, R> view = pluginParameterViewFactory.getView(panel, parameter); final JComponent val = view.getValueComponent(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2013-11-24 14:03:23
|
Revision: 9511 http://sourceforge.net/p/gridarta/code/9511 Author: akirschbaum Date: 2013-11-24 14:03:16 +0000 (Sun, 24 Nov 2013) Log Message: ----------- Make plugin view resources translatable. Modified Paths: -------------- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginView.java trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages.properties trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_de.properties trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_fr.properties trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_sv.properties Modified: trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginView.java =================================================================== --- trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginView.java 2013-11-24 09:32:18 UTC (rev 9510) +++ trunk/src/gridarta/src/main/java/net/sf/gridarta/gui/dialog/plugin/PluginView.java 2013-11-24 14:03:16 UTC (rev 9511) @@ -45,7 +45,10 @@ import net.sf.gridarta.plugin.PluginModel; import net.sf.gridarta.plugin.PluginModelListener; import net.sf.gridarta.plugin.parameter.PluginParameter; +import net.sf.gridarta.utils.ActionBuilderUtils; import net.sf.gridarta.utils.ResourceIcons; +import net.sf.japi.swing.action.ActionBuilder; +import net.sf.japi.swing.action.ActionBuilderFactory; import org.apache.log4j.Category; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; @@ -63,7 +66,13 @@ @NotNull private static final Category log = Logger.getLogger(PluginView.class); + /** + * The {@link ActionBuilder} instance. + */ @NotNull + private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); + + @NotNull private final PluginController<G, A, R> pluginController; /** @@ -180,7 +189,7 @@ tmpMenuScripts.add(item, index++); } if (index == 0) { - final Component def = new JMenuItem("no scripts available"); + final Component def = new JMenuItem(ActionBuilderUtils.getString(ACTION_BUILDER, "pluginViewNoScripts")); def.setEnabled(false); tmpMenuScripts.add(def, 0); } @@ -190,7 +199,7 @@ private void showConsoleFrame() { synchronized (sync) { if (console == null) { - console = new JFrame("Beanshell scripts I/O Console"); + console = new JFrame(ActionBuilderUtils.getString(ACTION_BUILDER, "pluginViewConsoleTitle")); console.setSize(400, 200); consolePane = new CloseableTabbedPane(resourceIcons.getResourceIcon(ResourceIcons.CLOSE_TAB_SMALL_ICON)); console.getContentPane().add(consolePane); @@ -215,7 +224,7 @@ final JOptionPane p = new PluginViewPane(); p.setOptionType(JOptionPane.OK_CANCEL_OPTION); p.setMessageType(JOptionPane.QUESTION_MESSAGE); - p.setMessage("Please provide runtime parameters for " + plugin.getName()); + p.setMessage(ActionBuilderUtils.format(ACTION_BUILDER, "pluginViewProvideParameters", plugin.getName())); final GridBagLayout layout = new GridBagLayout(); final JComponent panel = new JPanel(layout); final JDialog dialog = p.createDialog(parent, plugin.getName()); Modified: trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages.properties 2013-11-24 09:32:18 UTC (rev 9510) +++ trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages.properties 2013-11-24 14:03:16 UTC (rev 9511) @@ -1831,3 +1831,9 @@ pluginEditorRunScript.text=Run plugin script... pluginEditorRunScript.shortdescription=Executes the plugin script. + + +# Plugin View +pluginViewNoScripts=no scripts available +pluginViewConsoleTitle=Beanshell scripts I/O Console +pluginViewProvideParameters=Please provide runtime parameters for {0}. Modified: trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_de.properties =================================================================== --- trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_de.properties 2013-11-24 09:32:18 UTC (rev 9510) +++ trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_de.properties 2013-11-24 14:03:16 UTC (rev 9511) @@ -1576,3 +1576,9 @@ pluginEditorRunScript.text=Editor-Script starten pluginEditorRunScript.shortdescription=F\xFChrt das Editor-Script aus. + + +# Plugin View +pluginViewNoScripts=Keine Editor-Scripte vorhanden +pluginViewConsoleTitle=Editor-Script-Konsole +pluginViewProvideParameters=Bitte Laufzeitparameter f\xFCr {0} eingeben. Modified: trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_fr.properties =================================================================== --- trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_fr.properties 2013-11-24 09:32:18 UTC (rev 9510) +++ trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_fr.properties 2013-11-24 14:03:16 UTC (rev 9511) @@ -1561,3 +1561,9 @@ #pluginEditorRunScript.text= #pluginEditorRunScript.shortdescription= + + +# Plugin View +#pluginViewNoScripts= +#pluginViewConsoleTitle= +#pluginViewProvideParameters= Modified: trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_sv.properties =================================================================== --- trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_sv.properties 2013-11-24 09:32:18 UTC (rev 9510) +++ trunk/src/gridarta/src/main/resources/net/sf/gridarta/messages_sv.properties 2013-11-24 14:03:16 UTC (rev 9511) @@ -1562,3 +1562,9 @@ #pluginEditorRunScript.text= #pluginEditorRunScript.shortdescription= + + +# Plugin View +#pluginViewNoScripts= +#pluginViewConsoleTitle= +#pluginViewProvideParameters= This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |