カルネージハートエクサのチームデータ編集ツール JAVAベース
Import initial version
| @@ -0,0 +1,73 @@ | ||
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!-- You may freely edit this file. See commented blocks below for --> | |
| 3 | +<!-- some examples of how to customize the build. --> | |
| 4 | +<!-- (If you delete it and reopen the project it will be recreated.) --> | |
| 5 | +<!-- By default, only the Clean and Build commands use this build script. --> | |
| 6 | +<!-- Commands such as Run, Debug, and Test only use this build script if --> | |
| 7 | +<!-- the Compile on Save feature is turned off for the project. --> | |
| 8 | +<!-- You can turn off the Compile on Save (or Deploy on Save) setting --> | |
| 9 | +<!-- in the project's Project Properties dialog box.--> | |
| 10 | +<project name="chexaFormation" default="default" basedir="."> | |
| 11 | + <description>Builds, tests, and runs the project chexaFormation.</description> | |
| 12 | + <import file="nbproject/build-impl.xml"/> | |
| 13 | + <!-- | |
| 14 | + | |
| 15 | + There exist several targets which are by default empty and which can be | |
| 16 | + used for execution of your tasks. These targets are usually executed | |
| 17 | + before and after some main targets. They are: | |
| 18 | + | |
| 19 | + -pre-init: called before initialization of project properties | |
| 20 | + -post-init: called after initialization of project properties | |
| 21 | + -pre-compile: called before javac compilation | |
| 22 | + -post-compile: called after javac compilation | |
| 23 | + -pre-compile-single: called before javac compilation of single file | |
| 24 | + -post-compile-single: called after javac compilation of single file | |
| 25 | + -pre-compile-test: called before javac compilation of JUnit tests | |
| 26 | + -post-compile-test: called after javac compilation of JUnit tests | |
| 27 | + -pre-compile-test-single: called before javac compilation of single JUnit test | |
| 28 | + -post-compile-test-single: called after javac compilation of single JUunit test | |
| 29 | + -pre-jar: called before JAR building | |
| 30 | + -post-jar: called after JAR building | |
| 31 | + -post-clean: called after cleaning build products | |
| 32 | + | |
| 33 | + (Targets beginning with '-' are not intended to be called on their own.) | |
| 34 | + | |
| 35 | + Example of inserting an obfuscator after compilation could look like this: | |
| 36 | + | |
| 37 | + <target name="-post-compile"> | |
| 38 | + <obfuscate> | |
| 39 | + <fileset dir="${build.classes.dir}"/> | |
| 40 | + </obfuscate> | |
| 41 | + </target> | |
| 42 | + | |
| 43 | + For list of available properties check the imported | |
| 44 | + nbproject/build-impl.xml file. | |
| 45 | + | |
| 46 | + | |
| 47 | + Another way to customize the build is by overriding existing main targets. | |
| 48 | + The targets of interest are: | |
| 49 | + | |
| 50 | + -init-macrodef-javac: defines macro for javac compilation | |
| 51 | + -init-macrodef-junit: defines macro for junit execution | |
| 52 | + -init-macrodef-debug: defines macro for class debugging | |
| 53 | + -init-macrodef-java: defines macro for class execution | |
| 54 | + -do-jar: JAR building | |
| 55 | + run: execution of project | |
| 56 | + -javadoc-build: Javadoc generation | |
| 57 | + test-report: JUnit report generation | |
| 58 | + | |
| 59 | + An example of overriding the target for project execution could look like this: | |
| 60 | + | |
| 61 | + <target name="run" depends="chexaFormation-impl.jar"> | |
| 62 | + <exec dir="bin" executable="launcher.exe"> | |
| 63 | + <arg file="${dist.jar}"/> | |
| 64 | + </exec> | |
| 65 | + </target> | |
| 66 | + | |
| 67 | + Notice that the overridden target depends on the jar target and not only on | |
| 68 | + the compile target as the regular run target does. Again, for a list of available | |
| 69 | + properties which you can use, check the target you are overriding in the | |
| 70 | + nbproject/build-impl.xml file. | |
| 71 | + | |
| 72 | + --> | |
| 73 | +</project> |
| @@ -0,0 +1,1413 @@ | ||
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!-- | |
| 3 | +*** GENERATED FROM project.xml - DO NOT EDIT *** | |
| 4 | +*** EDIT ../build.xml INSTEAD *** | |
| 5 | + | |
| 6 | +For the purpose of easier reading the script | |
| 7 | +is divided into following sections: | |
| 8 | + | |
| 9 | + - initialization | |
| 10 | + - compilation | |
| 11 | + - jar | |
| 12 | + - execution | |
| 13 | + - debugging | |
| 14 | + - javadoc | |
| 15 | + - test compilation | |
| 16 | + - test execution | |
| 17 | + - test debugging | |
| 18 | + - applet | |
| 19 | + - cleanup | |
| 20 | + | |
| 21 | + --> | |
| 22 | +<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="chexaFormation-impl"> | |
| 23 | + <fail message="Please build using Ant 1.8.0 or higher."> | |
| 24 | + <condition> | |
| 25 | + <not> | |
| 26 | + <antversion atleast="1.8.0"/> | |
| 27 | + </not> | |
| 28 | + </condition> | |
| 29 | + </fail> | |
| 30 | + <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/> | |
| 31 | + <!-- | |
| 32 | + ====================== | |
| 33 | + INITIALIZATION SECTION | |
| 34 | + ====================== | |
| 35 | + --> | |
| 36 | + <target name="-pre-init"> | |
| 37 | + <!-- Empty placeholder for easier customization. --> | |
| 38 | + <!-- You can override this target in the ../build.xml file. --> | |
| 39 | + </target> | |
| 40 | + <target depends="-pre-init" name="-init-private"> | |
| 41 | + <property file="nbproject/private/config.properties"/> | |
| 42 | + <property file="nbproject/private/configs/${config}.properties"/> | |
| 43 | + <property file="nbproject/private/private.properties"/> | |
| 44 | + </target> | |
| 45 | + <target depends="-pre-init,-init-private" name="-init-user"> | |
| 46 | + <property file="${user.properties.file}"/> | |
| 47 | + <!-- The two properties below are usually overridden --> | |
| 48 | + <!-- by the active platform. Just a fallback. --> | |
| 49 | + <property name="default.javac.source" value="1.4"/> | |
| 50 | + <property name="default.javac.target" value="1.4"/> | |
| 51 | + </target> | |
| 52 | + <target depends="-pre-init,-init-private,-init-user" name="-init-project"> | |
| 53 | + <property file="nbproject/configs/${config}.properties"/> | |
| 54 | + <property file="nbproject/project.properties"/> | |
| 55 | + </target> | |
| 56 | + <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init"> | |
| 57 | + <property name="platform.java" value="${java.home}/bin/java"/> | |
| 58 | + <available file="${manifest.file}" property="manifest.available"/> | |
| 59 | + <condition property="splashscreen.available"> | |
| 60 | + <and> | |
| 61 | + <not> | |
| 62 | + <equals arg1="${application.splash}" arg2="" trim="true"/> | |
| 63 | + </not> | |
| 64 | + <available file="${application.splash}"/> | |
| 65 | + </and> | |
| 66 | + </condition> | |
| 67 | + <condition property="main.class.available"> | |
| 68 | + <and> | |
| 69 | + <isset property="main.class"/> | |
| 70 | + <not> | |
| 71 | + <equals arg1="${main.class}" arg2="" trim="true"/> | |
| 72 | + </not> | |
| 73 | + </and> | |
| 74 | + </condition> | |
| 75 | + <condition property="profile.available"> | |
| 76 | + <and> | |
| 77 | + <isset property="javac.profile"/> | |
| 78 | + <length length="0" string="${javac.profile}" when="greater"/> | |
| 79 | + <matches pattern="1\.[89](\..*)?" string="${javac.source}"/> | |
| 80 | + </and> | |
| 81 | + </condition> | |
| 82 | + <condition property="do.archive"> | |
| 83 | + <or> | |
| 84 | + <not> | |
| 85 | + <istrue value="${jar.archive.disabled}"/> | |
| 86 | + </not> | |
| 87 | + <istrue value="${not.archive.disabled}"/> | |
| 88 | + </or> | |
| 89 | + </condition> | |
| 90 | + <condition property="do.mkdist"> | |
| 91 | + <and> | |
| 92 | + <isset property="do.archive"/> | |
| 93 | + <isset property="libs.CopyLibs.classpath"/> | |
| 94 | + <not> | |
| 95 | + <istrue value="${mkdist.disabled}"/> | |
| 96 | + </not> | |
| 97 | + </and> | |
| 98 | + </condition> | |
| 99 | + <condition property="do.archive+manifest.available"> | |
| 100 | + <and> | |
| 101 | + <isset property="manifest.available"/> | |
| 102 | + <istrue value="${do.archive}"/> | |
| 103 | + </and> | |
| 104 | + </condition> | |
| 105 | + <condition property="do.archive+main.class.available"> | |
| 106 | + <and> | |
| 107 | + <isset property="main.class.available"/> | |
| 108 | + <istrue value="${do.archive}"/> | |
| 109 | + </and> | |
| 110 | + </condition> | |
| 111 | + <condition property="do.archive+splashscreen.available"> | |
| 112 | + <and> | |
| 113 | + <isset property="splashscreen.available"/> | |
| 114 | + <istrue value="${do.archive}"/> | |
| 115 | + </and> | |
| 116 | + </condition> | |
| 117 | + <condition property="do.archive+profile.available"> | |
| 118 | + <and> | |
| 119 | + <isset property="profile.available"/> | |
| 120 | + <istrue value="${do.archive}"/> | |
| 121 | + </and> | |
| 122 | + </condition> | |
| 123 | + <condition property="have.tests"> | |
| 124 | + <or> | |
| 125 | + <available file="${test.src.dir}"/> | |
| 126 | + </or> | |
| 127 | + </condition> | |
| 128 | + <condition property="have.sources"> | |
| 129 | + <or> | |
| 130 | + <available file="${src.dir}"/> | |
| 131 | + </or> | |
| 132 | + </condition> | |
| 133 | + <condition property="netbeans.home+have.tests"> | |
| 134 | + <and> | |
| 135 | + <isset property="netbeans.home"/> | |
| 136 | + <isset property="have.tests"/> | |
| 137 | + </and> | |
| 138 | + </condition> | |
| 139 | + <condition property="no.javadoc.preview"> | |
| 140 | + <and> | |
| 141 | + <isset property="javadoc.preview"/> | |
| 142 | + <isfalse value="${javadoc.preview}"/> | |
| 143 | + </and> | |
| 144 | + </condition> | |
| 145 | + <property name="run.jvmargs" value=""/> | |
| 146 | + <property name="run.jvmargs.ide" value=""/> | |
| 147 | + <property name="javac.compilerargs" value=""/> | |
| 148 | + <property name="work.dir" value="${basedir}"/> | |
| 149 | + <condition property="no.deps"> | |
| 150 | + <and> | |
| 151 | + <istrue value="${no.dependencies}"/> | |
| 152 | + </and> | |
| 153 | + </condition> | |
| 154 | + <property name="javac.debug" value="true"/> | |
| 155 | + <property name="javadoc.preview" value="true"/> | |
| 156 | + <property name="application.args" value=""/> | |
| 157 | + <property name="source.encoding" value="${file.encoding}"/> | |
| 158 | + <property name="runtime.encoding" value="${source.encoding}"/> | |
| 159 | + <condition property="javadoc.encoding.used" value="${javadoc.encoding}"> | |
| 160 | + <and> | |
| 161 | + <isset property="javadoc.encoding"/> | |
| 162 | + <not> | |
| 163 | + <equals arg1="${javadoc.encoding}" arg2=""/> | |
| 164 | + </not> | |
| 165 | + </and> | |
| 166 | + </condition> | |
| 167 | + <property name="javadoc.encoding.used" value="${source.encoding}"/> | |
| 168 | + <property name="includes" value="**"/> | |
| 169 | + <property name="excludes" value=""/> | |
| 170 | + <property name="do.depend" value="false"/> | |
| 171 | + <condition property="do.depend.true"> | |
| 172 | + <istrue value="${do.depend}"/> | |
| 173 | + </condition> | |
| 174 | + <path id="endorsed.classpath.path" path="${endorsed.classpath}"/> | |
| 175 | + <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'"> | |
| 176 | + <and> | |
| 177 | + <isset property="endorsed.classpath"/> | |
| 178 | + <not> | |
| 179 | + <equals arg1="${endorsed.classpath}" arg2="" trim="true"/> | |
| 180 | + </not> | |
| 181 | + </and> | |
| 182 | + </condition> | |
| 183 | + <condition else="" property="javac.profile.cmd.line.arg" value="-profile ${javac.profile}"> | |
| 184 | + <isset property="profile.available"/> | |
| 185 | + </condition> | |
| 186 | + <condition else="false" property="jdkBug6558476"> | |
| 187 | + <and> | |
| 188 | + <matches pattern="1\.[56]" string="${java.specification.version}"/> | |
| 189 | + <not> | |
| 190 | + <os family="unix"/> | |
| 191 | + </not> | |
| 192 | + </and> | |
| 193 | + </condition> | |
| 194 | + <property name="javac.fork" value="${jdkBug6558476}"/> | |
| 195 | + <property name="jar.index" value="false"/> | |
| 196 | + <property name="jar.index.metainf" value="${jar.index}"/> | |
| 197 | + <property name="copylibs.rebase" value="true"/> | |
| 198 | + <available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/> | |
| 199 | + <condition property="junit.available"> | |
| 200 | + <or> | |
| 201 | + <available classname="org.junit.Test" classpath="${run.test.classpath}"/> | |
| 202 | + <available classname="junit.framework.Test" classpath="${run.test.classpath}"/> | |
| 203 | + </or> | |
| 204 | + </condition> | |
| 205 | + <condition property="testng.available"> | |
| 206 | + <available classname="org.testng.annotations.Test" classpath="${run.test.classpath}"/> | |
| 207 | + </condition> | |
| 208 | + <condition property="junit+testng.available"> | |
| 209 | + <and> | |
| 210 | + <istrue value="${junit.available}"/> | |
| 211 | + <istrue value="${testng.available}"/> | |
| 212 | + </and> | |
| 213 | + </condition> | |
| 214 | + <condition else="testng" property="testng.mode" value="mixed"> | |
| 215 | + <istrue value="${junit+testng.available}"/> | |
| 216 | + </condition> | |
| 217 | + <condition else="" property="testng.debug.mode" value="-mixed"> | |
| 218 | + <istrue value="${junit+testng.available}"/> | |
| 219 | + </condition> | |
| 220 | + </target> | |
| 221 | + <target name="-post-init"> | |
| 222 | + <!-- Empty placeholder for easier customization. --> | |
| 223 | + <!-- You can override this target in the ../build.xml file. --> | |
| 224 | + </target> | |
| 225 | + <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check"> | |
| 226 | + <fail unless="src.dir">Must set src.dir</fail> | |
| 227 | + <fail unless="test.src.dir">Must set test.src.dir</fail> | |
| 228 | + <fail unless="build.dir">Must set build.dir</fail> | |
| 229 | + <fail unless="dist.dir">Must set dist.dir</fail> | |
| 230 | + <fail unless="build.classes.dir">Must set build.classes.dir</fail> | |
| 231 | + <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail> | |
| 232 | + <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail> | |
| 233 | + <fail unless="build.test.results.dir">Must set build.test.results.dir</fail> | |
| 234 | + <fail unless="build.classes.excludes">Must set build.classes.excludes</fail> | |
| 235 | + <fail unless="dist.jar">Must set dist.jar</fail> | |
| 236 | + </target> | |
| 237 | + <target name="-init-macrodef-property"> | |
| 238 | + <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1"> | |
| 239 | + <attribute name="name"/> | |
| 240 | + <attribute name="value"/> | |
| 241 | + <sequential> | |
| 242 | + <property name="@{name}" value="${@{value}}"/> | |
| 243 | + </sequential> | |
| 244 | + </macrodef> | |
| 245 | + </target> | |
| 246 | + <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors"> | |
| 247 | + <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 248 | + <attribute default="${src.dir}" name="srcdir"/> | |
| 249 | + <attribute default="${build.classes.dir}" name="destdir"/> | |
| 250 | + <attribute default="${javac.classpath}" name="classpath"/> | |
| 251 | + <attribute default="${javac.processorpath}" name="processorpath"/> | |
| 252 | + <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/> | |
| 253 | + <attribute default="${includes}" name="includes"/> | |
| 254 | + <attribute default="${excludes}" name="excludes"/> | |
| 255 | + <attribute default="${javac.debug}" name="debug"/> | |
| 256 | + <attribute default="${empty.dir}" name="sourcepath"/> | |
| 257 | + <attribute default="${empty.dir}" name="gensrcdir"/> | |
| 258 | + <element name="customize" optional="true"/> | |
| 259 | + <sequential> | |
| 260 | + <property location="${build.dir}/empty" name="empty.dir"/> | |
| 261 | + <mkdir dir="${empty.dir}"/> | |
| 262 | + <mkdir dir="@{apgeneratedsrcdir}"/> | |
| 263 | + <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}"> | |
| 264 | + <src> | |
| 265 | + <dirset dir="@{gensrcdir}" erroronmissingdir="false"> | |
| 266 | + <include name="*"/> | |
| 267 | + </dirset> | |
| 268 | + </src> | |
| 269 | + <classpath> | |
| 270 | + <path path="@{classpath}"/> | |
| 271 | + </classpath> | |
| 272 | + <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> | |
| 273 | + <compilerarg line="${javac.profile.cmd.line.arg}"/> | |
| 274 | + <compilerarg line="${javac.compilerargs}"/> | |
| 275 | + <compilerarg value="-processorpath"/> | |
| 276 | + <compilerarg path="@{processorpath}:${empty.dir}"/> | |
| 277 | + <compilerarg line="${ap.processors.internal}"/> | |
| 278 | + <compilerarg line="${annotation.processing.processor.options}"/> | |
| 279 | + <compilerarg value="-s"/> | |
| 280 | + <compilerarg path="@{apgeneratedsrcdir}"/> | |
| 281 | + <compilerarg line="${ap.proc.none.internal}"/> | |
| 282 | + <customize/> | |
| 283 | + </javac> | |
| 284 | + </sequential> | |
| 285 | + </macrodef> | |
| 286 | + </target> | |
| 287 | + <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal"> | |
| 288 | + <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 289 | + <attribute default="${src.dir}" name="srcdir"/> | |
| 290 | + <attribute default="${build.classes.dir}" name="destdir"/> | |
| 291 | + <attribute default="${javac.classpath}" name="classpath"/> | |
| 292 | + <attribute default="${javac.processorpath}" name="processorpath"/> | |
| 293 | + <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/> | |
| 294 | + <attribute default="${includes}" name="includes"/> | |
| 295 | + <attribute default="${excludes}" name="excludes"/> | |
| 296 | + <attribute default="${javac.debug}" name="debug"/> | |
| 297 | + <attribute default="${empty.dir}" name="sourcepath"/> | |
| 298 | + <attribute default="${empty.dir}" name="gensrcdir"/> | |
| 299 | + <element name="customize" optional="true"/> | |
| 300 | + <sequential> | |
| 301 | + <property location="${build.dir}/empty" name="empty.dir"/> | |
| 302 | + <mkdir dir="${empty.dir}"/> | |
| 303 | + <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}"> | |
| 304 | + <src> | |
| 305 | + <dirset dir="@{gensrcdir}" erroronmissingdir="false"> | |
| 306 | + <include name="*"/> | |
| 307 | + </dirset> | |
| 308 | + </src> | |
| 309 | + <classpath> | |
| 310 | + <path path="@{classpath}"/> | |
| 311 | + </classpath> | |
| 312 | + <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> | |
| 313 | + <compilerarg line="${javac.profile.cmd.line.arg}"/> | |
| 314 | + <compilerarg line="${javac.compilerargs}"/> | |
| 315 | + <customize/> | |
| 316 | + </javac> | |
| 317 | + </sequential> | |
| 318 | + </macrodef> | |
| 319 | + </target> | |
| 320 | + <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac"> | |
| 321 | + <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 322 | + <attribute default="${src.dir}" name="srcdir"/> | |
| 323 | + <attribute default="${build.classes.dir}" name="destdir"/> | |
| 324 | + <attribute default="${javac.classpath}" name="classpath"/> | |
| 325 | + <sequential> | |
| 326 | + <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}"> | |
| 327 | + <classpath> | |
| 328 | + <path path="@{classpath}"/> | |
| 329 | + </classpath> | |
| 330 | + </depend> | |
| 331 | + </sequential> | |
| 332 | + </macrodef> | |
| 333 | + <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 334 | + <attribute default="${build.classes.dir}" name="destdir"/> | |
| 335 | + <sequential> | |
| 336 | + <fail unless="javac.includes">Must set javac.includes</fail> | |
| 337 | + <pathconvert pathsep="${line.separator}" property="javac.includes.binary"> | |
| 338 | + <path> | |
| 339 | + <filelist dir="@{destdir}" files="${javac.includes}"/> | |
| 340 | + </path> | |
| 341 | + <globmapper from="*.java" to="*.class"/> | |
| 342 | + </pathconvert> | |
| 343 | + <tempfile deleteonexit="true" property="javac.includesfile.binary"/> | |
| 344 | + <echo file="${javac.includesfile.binary}" message="${javac.includes.binary}"/> | |
| 345 | + <delete> | |
| 346 | + <files includesfile="${javac.includesfile.binary}"/> | |
| 347 | + </delete> | |
| 348 | + <delete> | |
| 349 | + <fileset file="${javac.includesfile.binary}"/> | |
| 350 | + </delete> | |
| 351 | + </sequential> | |
| 352 | + </macrodef> | |
| 353 | + </target> | |
| 354 | + <target if="${junit.available}" name="-init-macrodef-junit-init"> | |
| 355 | + <condition else="false" property="nb.junit.batch" value="true"> | |
| 356 | + <and> | |
| 357 | + <istrue value="${junit.available}"/> | |
| 358 | + <not> | |
| 359 | + <isset property="test.method"/> | |
| 360 | + </not> | |
| 361 | + </and> | |
| 362 | + </condition> | |
| 363 | + <condition else="false" property="nb.junit.single" value="true"> | |
| 364 | + <and> | |
| 365 | + <istrue value="${junit.available}"/> | |
| 366 | + <isset property="test.method"/> | |
| 367 | + </and> | |
| 368 | + </condition> | |
| 369 | + </target> | |
| 370 | + <target name="-init-test-properties"> | |
| 371 | + <property name="test.binaryincludes" value="<nothing>"/> | |
| 372 | + <property name="test.binarytestincludes" value=""/> | |
| 373 | + <property name="test.binaryexcludes" value=""/> | |
| 374 | + </target> | |
| 375 | + <target if="${nb.junit.single}" name="-init-macrodef-junit-single" unless="${nb.junit.batch}"> | |
| 376 | + <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 377 | + <attribute default="${includes}" name="includes"/> | |
| 378 | + <attribute default="${excludes}" name="excludes"/> | |
| 379 | + <attribute default="**" name="testincludes"/> | |
| 380 | + <attribute default="" name="testmethods"/> | |
| 381 | + <element name="customize" optional="true"/> | |
| 382 | + <sequential> | |
| 383 | + <property name="junit.forkmode" value="perTest"/> | |
| 384 | + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> | |
| 385 | + <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/> | |
| 386 | + <syspropertyset> | |
| 387 | + <propertyref prefix="test-sys-prop."/> | |
| 388 | + <mapper from="test-sys-prop.*" to="*" type="glob"/> | |
| 389 | + </syspropertyset> | |
| 390 | + <formatter type="brief" usefile="false"/> | |
| 391 | + <formatter type="xml"/> | |
| 392 | + <jvmarg value="-ea"/> | |
| 393 | + <customize/> | |
| 394 | + </junit> | |
| 395 | + </sequential> | |
| 396 | + </macrodef> | |
| 397 | + </target> | |
| 398 | + <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}"> | |
| 399 | + <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 400 | + <attribute default="${includes}" name="includes"/> | |
| 401 | + <attribute default="${excludes}" name="excludes"/> | |
| 402 | + <attribute default="**" name="testincludes"/> | |
| 403 | + <attribute default="" name="testmethods"/> | |
| 404 | + <element name="customize" optional="true"/> | |
| 405 | + <sequential> | |
| 406 | + <property name="junit.forkmode" value="perTest"/> | |
| 407 | + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> | |
| 408 | + <batchtest todir="${build.test.results.dir}"> | |
| 409 | + <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}"> | |
| 410 | + <filename name="@{testincludes}"/> | |
| 411 | + </fileset> | |
| 412 | + <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}"> | |
| 413 | + <filename name="${test.binarytestincludes}"/> | |
| 414 | + </fileset> | |
| 415 | + </batchtest> | |
| 416 | + <syspropertyset> | |
| 417 | + <propertyref prefix="test-sys-prop."/> | |
| 418 | + <mapper from="test-sys-prop.*" to="*" type="glob"/> | |
| 419 | + </syspropertyset> | |
| 420 | + <formatter type="brief" usefile="false"/> | |
| 421 | + <formatter type="xml"/> | |
| 422 | + <jvmarg value="-ea"/> | |
| 423 | + <customize/> | |
| 424 | + </junit> | |
| 425 | + </sequential> | |
| 426 | + </macrodef> | |
| 427 | + </target> | |
| 428 | + <target depends="-init-macrodef-junit-init,-init-macrodef-junit-single, -init-macrodef-junit-batch" if="${junit.available}" name="-init-macrodef-junit"/> | |
| 429 | + <target if="${testng.available}" name="-init-macrodef-testng"> | |
| 430 | + <macrodef name="testng" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 431 | + <attribute default="${includes}" name="includes"/> | |
| 432 | + <attribute default="${excludes}" name="excludes"/> | |
| 433 | + <attribute default="**" name="testincludes"/> | |
| 434 | + <attribute default="" name="testmethods"/> | |
| 435 | + <element name="customize" optional="true"/> | |
| 436 | + <sequential> | |
| 437 | + <condition else="" property="testng.methods.arg" value="@{testincludes}.@{testmethods}"> | |
| 438 | + <isset property="test.method"/> | |
| 439 | + </condition> | |
| 440 | + <union id="test.set"> | |
| 441 | + <fileset dir="${test.src.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}"> | |
| 442 | + <filename name="@{testincludes}"/> | |
| 443 | + </fileset> | |
| 444 | + </union> | |
| 445 | + <taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/> | |
| 446 | + <testng classfilesetref="test.set" failureProperty="tests.failed" listeners="org.testng.reporters.VerboseReporter" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="chexaFormation" testname="TestNG tests" workingDir="${work.dir}"> | |
| 447 | + <xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/> | |
| 448 | + <propertyset> | |
| 449 | + <propertyref prefix="test-sys-prop."/> | |
| 450 | + <mapper from="test-sys-prop.*" to="*" type="glob"/> | |
| 451 | + </propertyset> | |
| 452 | + <customize/> | |
| 453 | + </testng> | |
| 454 | + </sequential> | |
| 455 | + </macrodef> | |
| 456 | + </target> | |
| 457 | + <target name="-init-macrodef-test-impl"> | |
| 458 | + <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 459 | + <attribute default="${includes}" name="includes"/> | |
| 460 | + <attribute default="${excludes}" name="excludes"/> | |
| 461 | + <attribute default="**" name="testincludes"/> | |
| 462 | + <attribute default="" name="testmethods"/> | |
| 463 | + <element implicit="true" name="customize" optional="true"/> | |
| 464 | + <sequential> | |
| 465 | + <echo>No tests executed.</echo> | |
| 466 | + </sequential> | |
| 467 | + </macrodef> | |
| 468 | + </target> | |
| 469 | + <target depends="-init-macrodef-junit" if="${junit.available}" name="-init-macrodef-junit-impl"> | |
| 470 | + <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 471 | + <attribute default="${includes}" name="includes"/> | |
| 472 | + <attribute default="${excludes}" name="excludes"/> | |
| 473 | + <attribute default="**" name="testincludes"/> | |
| 474 | + <attribute default="" name="testmethods"/> | |
| 475 | + <element implicit="true" name="customize" optional="true"/> | |
| 476 | + <sequential> | |
| 477 | + <j2seproject3:junit excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> | |
| 478 | + <customize/> | |
| 479 | + </j2seproject3:junit> | |
| 480 | + </sequential> | |
| 481 | + </macrodef> | |
| 482 | + </target> | |
| 483 | + <target depends="-init-macrodef-testng" if="${testng.available}" name="-init-macrodef-testng-impl"> | |
| 484 | + <macrodef name="test-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 485 | + <attribute default="${includes}" name="includes"/> | |
| 486 | + <attribute default="${excludes}" name="excludes"/> | |
| 487 | + <attribute default="**" name="testincludes"/> | |
| 488 | + <attribute default="" name="testmethods"/> | |
| 489 | + <element implicit="true" name="customize" optional="true"/> | |
| 490 | + <sequential> | |
| 491 | + <j2seproject3:testng excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> | |
| 492 | + <customize/> | |
| 493 | + </j2seproject3:testng> | |
| 494 | + </sequential> | |
| 495 | + </macrodef> | |
| 496 | + </target> | |
| 497 | + <target depends="-init-macrodef-test-impl,-init-macrodef-junit-impl,-init-macrodef-testng-impl" name="-init-macrodef-test"> | |
| 498 | + <macrodef name="test" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 499 | + <attribute default="${includes}" name="includes"/> | |
| 500 | + <attribute default="${excludes}" name="excludes"/> | |
| 501 | + <attribute default="**" name="testincludes"/> | |
| 502 | + <attribute default="" name="testmethods"/> | |
| 503 | + <sequential> | |
| 504 | + <j2seproject3:test-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> | |
| 505 | + <customize> | |
| 506 | + <classpath> | |
| 507 | + <path path="${run.test.classpath}"/> | |
| 508 | + </classpath> | |
| 509 | + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> | |
| 510 | + <jvmarg line="${run.jvmargs}"/> | |
| 511 | + <jvmarg line="${run.jvmargs.ide}"/> | |
| 512 | + </customize> | |
| 513 | + </j2seproject3:test-impl> | |
| 514 | + </sequential> | |
| 515 | + </macrodef> | |
| 516 | + </target> | |
| 517 | + <target if="${junit.available}" name="-init-macrodef-junit-debug" unless="${nb.junit.batch}"> | |
| 518 | + <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 519 | + <attribute default="${includes}" name="includes"/> | |
| 520 | + <attribute default="${excludes}" name="excludes"/> | |
| 521 | + <attribute default="**" name="testincludes"/> | |
| 522 | + <attribute default="" name="testmethods"/> | |
| 523 | + <element name="customize" optional="true"/> | |
| 524 | + <sequential> | |
| 525 | + <property name="junit.forkmode" value="perTest"/> | |
| 526 | + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> | |
| 527 | + <test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/> | |
| 528 | + <syspropertyset> | |
| 529 | + <propertyref prefix="test-sys-prop."/> | |
| 530 | + <mapper from="test-sys-prop.*" to="*" type="glob"/> | |
| 531 | + </syspropertyset> | |
| 532 | + <formatter type="brief" usefile="false"/> | |
| 533 | + <formatter type="xml"/> | |
| 534 | + <jvmarg value="-ea"/> | |
| 535 | + <jvmarg line="${debug-args-line}"/> | |
| 536 | + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> | |
| 537 | + <customize/> | |
| 538 | + </junit> | |
| 539 | + </sequential> | |
| 540 | + </macrodef> | |
| 541 | + </target> | |
| 542 | + <target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-debug-batch"> | |
| 543 | + <macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 544 | + <attribute default="${includes}" name="includes"/> | |
| 545 | + <attribute default="${excludes}" name="excludes"/> | |
| 546 | + <attribute default="**" name="testincludes"/> | |
| 547 | + <attribute default="" name="testmethods"/> | |
| 548 | + <element name="customize" optional="true"/> | |
| 549 | + <sequential> | |
| 550 | + <property name="junit.forkmode" value="perTest"/> | |
| 551 | + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> | |
| 552 | + <batchtest todir="${build.test.results.dir}"> | |
| 553 | + <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}"> | |
| 554 | + <filename name="@{testincludes}"/> | |
| 555 | + </fileset> | |
| 556 | + <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}"> | |
| 557 | + <filename name="${test.binarytestincludes}"/> | |
| 558 | + </fileset> | |
| 559 | + </batchtest> | |
| 560 | + <syspropertyset> | |
| 561 | + <propertyref prefix="test-sys-prop."/> | |
| 562 | + <mapper from="test-sys-prop.*" to="*" type="glob"/> | |
| 563 | + </syspropertyset> | |
| 564 | + <formatter type="brief" usefile="false"/> | |
| 565 | + <formatter type="xml"/> | |
| 566 | + <jvmarg value="-ea"/> | |
| 567 | + <jvmarg line="${debug-args-line}"/> | |
| 568 | + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> | |
| 569 | + <customize/> | |
| 570 | + </junit> | |
| 571 | + </sequential> | |
| 572 | + </macrodef> | |
| 573 | + </target> | |
| 574 | + <target depends="-init-macrodef-junit-debug,-init-macrodef-junit-debug-batch" if="${junit.available}" name="-init-macrodef-junit-debug-impl"> | |
| 575 | + <macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 576 | + <attribute default="${includes}" name="includes"/> | |
| 577 | + <attribute default="${excludes}" name="excludes"/> | |
| 578 | + <attribute default="**" name="testincludes"/> | |
| 579 | + <attribute default="" name="testmethods"/> | |
| 580 | + <element implicit="true" name="customize" optional="true"/> | |
| 581 | + <sequential> | |
| 582 | + <j2seproject3:junit-debug excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> | |
| 583 | + <customize/> | |
| 584 | + </j2seproject3:junit-debug> | |
| 585 | + </sequential> | |
| 586 | + </macrodef> | |
| 587 | + </target> | |
| 588 | + <target if="${testng.available}" name="-init-macrodef-testng-debug"> | |
| 589 | + <macrodef name="testng-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 590 | + <attribute default="${main.class}" name="testClass"/> | |
| 591 | + <attribute default="" name="testMethod"/> | |
| 592 | + <element name="customize2" optional="true"/> | |
| 593 | + <sequential> | |
| 594 | + <condition else="-testclass @{testClass}" property="test.class.or.method" value="-methods @{testClass}.@{testMethod}"> | |
| 595 | + <isset property="test.method"/> | |
| 596 | + </condition> | |
| 597 | + <condition else="-suitename chexaFormation -testname @{testClass} ${test.class.or.method}" property="testng.cmd.args" value="@{testClass}"> | |
| 598 | + <matches pattern=".*\.xml" string="@{testClass}"/> | |
| 599 | + </condition> | |
| 600 | + <delete dir="${build.test.results.dir}" quiet="true"/> | |
| 601 | + <mkdir dir="${build.test.results.dir}"/> | |
| 602 | + <j2seproject3:debug classname="org.testng.TestNG" classpath="${debug.test.classpath}"> | |
| 603 | + <customize> | |
| 604 | + <customize2/> | |
| 605 | + <jvmarg value="-ea"/> | |
| 606 | + <arg line="${testng.debug.mode}"/> | |
| 607 | + <arg line="-d ${build.test.results.dir}"/> | |
| 608 | + <arg line="-listener org.testng.reporters.VerboseReporter"/> | |
| 609 | + <arg line="${testng.cmd.args}"/> | |
| 610 | + </customize> | |
| 611 | + </j2seproject3:debug> | |
| 612 | + </sequential> | |
| 613 | + </macrodef> | |
| 614 | + </target> | |
| 615 | + <target depends="-init-macrodef-testng-debug" if="${testng.available}" name="-init-macrodef-testng-debug-impl"> | |
| 616 | + <macrodef name="testng-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 617 | + <attribute default="${main.class}" name="testClass"/> | |
| 618 | + <attribute default="" name="testMethod"/> | |
| 619 | + <element implicit="true" name="customize2" optional="true"/> | |
| 620 | + <sequential> | |
| 621 | + <j2seproject3:testng-debug testClass="@{testClass}" testMethod="@{testMethod}"> | |
| 622 | + <customize2/> | |
| 623 | + </j2seproject3:testng-debug> | |
| 624 | + </sequential> | |
| 625 | + </macrodef> | |
| 626 | + </target> | |
| 627 | + <target depends="-init-macrodef-junit-debug-impl" if="${junit.available}" name="-init-macrodef-test-debug-junit"> | |
| 628 | + <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 629 | + <attribute default="${includes}" name="includes"/> | |
| 630 | + <attribute default="${excludes}" name="excludes"/> | |
| 631 | + <attribute default="**" name="testincludes"/> | |
| 632 | + <attribute default="" name="testmethods"/> | |
| 633 | + <attribute default="${main.class}" name="testClass"/> | |
| 634 | + <attribute default="" name="testMethod"/> | |
| 635 | + <sequential> | |
| 636 | + <j2seproject3:test-debug-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}"> | |
| 637 | + <customize> | |
| 638 | + <classpath> | |
| 639 | + <path path="${run.test.classpath}"/> | |
| 640 | + </classpath> | |
| 641 | + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> | |
| 642 | + <jvmarg line="${run.jvmargs}"/> | |
| 643 | + <jvmarg line="${run.jvmargs.ide}"/> | |
| 644 | + </customize> | |
| 645 | + </j2seproject3:test-debug-impl> | |
| 646 | + </sequential> | |
| 647 | + </macrodef> | |
| 648 | + </target> | |
| 649 | + <target depends="-init-macrodef-testng-debug-impl" if="${testng.available}" name="-init-macrodef-test-debug-testng"> | |
| 650 | + <macrodef name="test-debug" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 651 | + <attribute default="${includes}" name="includes"/> | |
| 652 | + <attribute default="${excludes}" name="excludes"/> | |
| 653 | + <attribute default="**" name="testincludes"/> | |
| 654 | + <attribute default="" name="testmethods"/> | |
| 655 | + <attribute default="${main.class}" name="testClass"/> | |
| 656 | + <attribute default="" name="testMethod"/> | |
| 657 | + <sequential> | |
| 658 | + <j2seproject3:testng-debug-impl testClass="@{testClass}" testMethod="@{testMethod}"> | |
| 659 | + <customize2> | |
| 660 | + <syspropertyset> | |
| 661 | + <propertyref prefix="test-sys-prop."/> | |
| 662 | + <mapper from="test-sys-prop.*" to="*" type="glob"/> | |
| 663 | + </syspropertyset> | |
| 664 | + </customize2> | |
| 665 | + </j2seproject3:testng-debug-impl> | |
| 666 | + </sequential> | |
| 667 | + </macrodef> | |
| 668 | + </target> | |
| 669 | + <target depends="-init-macrodef-test-debug-junit,-init-macrodef-test-debug-testng" name="-init-macrodef-test-debug"/> | |
| 670 | + <!-- | |
| 671 | + pre NB7.2 profiling section; consider it deprecated | |
| 672 | + --> | |
| 673 | + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" if="profiler.info.jvmargs.agent" name="profile-init"/> | |
| 674 | + <target if="profiler.info.jvmargs.agent" name="-profile-pre-init"> | |
| 675 | + <!-- Empty placeholder for easier customization. --> | |
| 676 | + <!-- You can override this target in the ../build.xml file. --> | |
| 677 | + </target> | |
| 678 | + <target if="profiler.info.jvmargs.agent" name="-profile-post-init"> | |
| 679 | + <!-- Empty placeholder for easier customization. --> | |
| 680 | + <!-- You can override this target in the ../build.xml file. --> | |
| 681 | + </target> | |
| 682 | + <target if="profiler.info.jvmargs.agent" name="-profile-init-macrodef-profile"> | |
| 683 | + <macrodef name="resolve"> | |
| 684 | + <attribute name="name"/> | |
| 685 | + <attribute name="value"/> | |
| 686 | + <sequential> | |
| 687 | + <property name="@{name}" value="${env.@{value}}"/> | |
| 688 | + </sequential> | |
| 689 | + </macrodef> | |
| 690 | + <macrodef name="profile"> | |
| 691 | + <attribute default="${main.class}" name="classname"/> | |
| 692 | + <element name="customize" optional="true"/> | |
| 693 | + <sequential> | |
| 694 | + <property environment="env"/> | |
| 695 | + <resolve name="profiler.current.path" value="${profiler.info.pathvar}"/> | |
| 696 | + <java classname="@{classname}" dir="${profiler.info.dir}" fork="true" jvm="${profiler.info.jvm}"> | |
| 697 | + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> | |
| 698 | + <jvmarg value="${profiler.info.jvmargs.agent}"/> | |
| 699 | + <jvmarg line="${profiler.info.jvmargs}"/> | |
| 700 | + <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/> | |
| 701 | + <arg line="${application.args}"/> | |
| 702 | + <classpath> | |
| 703 | + <path path="${run.classpath}"/> | |
| 704 | + </classpath> | |
| 705 | + <syspropertyset> | |
| 706 | + <propertyref prefix="run-sys-prop."/> | |
| 707 | + <mapper from="run-sys-prop.*" to="*" type="glob"/> | |
| 708 | + </syspropertyset> | |
| 709 | + <customize/> | |
| 710 | + </java> | |
| 711 | + </sequential> | |
| 712 | + </macrodef> | |
| 713 | + </target> | |
| 714 | + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" if="profiler.info.jvmargs.agent" name="-profile-init-check"> | |
| 715 | + <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail> | |
| 716 | + <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail> | |
| 717 | + </target> | |
| 718 | + <!-- | |
| 719 | + end of pre NB7.2 profiling section | |
| 720 | + --> | |
| 721 | + <target depends="-init-debug-args" name="-init-macrodef-nbjpda"> | |
| 722 | + <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1"> | |
| 723 | + <attribute default="${main.class}" name="name"/> | |
| 724 | + <attribute default="${debug.classpath}" name="classpath"/> | |
| 725 | + <attribute default="" name="stopclassname"/> | |
| 726 | + <sequential> | |
| 727 | + <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}"> | |
| 728 | + <classpath> | |
| 729 | + <path path="@{classpath}"/> | |
| 730 | + </classpath> | |
| 731 | + </nbjpdastart> | |
| 732 | + </sequential> | |
| 733 | + </macrodef> | |
| 734 | + <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1"> | |
| 735 | + <attribute default="${build.classes.dir}" name="dir"/> | |
| 736 | + <sequential> | |
| 737 | + <nbjpdareload> | |
| 738 | + <fileset dir="@{dir}" includes="${fix.classes}"> | |
| 739 | + <include name="${fix.includes}*.class"/> | |
| 740 | + </fileset> | |
| 741 | + </nbjpdareload> | |
| 742 | + </sequential> | |
| 743 | + </macrodef> | |
| 744 | + </target> | |
| 745 | + <target name="-init-debug-args"> | |
| 746 | + <property name="version-output" value="java version "${ant.java.version}"/> | |
| 747 | + <condition property="have-jdk-older-than-1.4"> | |
| 748 | + <or> | |
| 749 | + <contains string="${version-output}" substring="java version "1.0"/> | |
| 750 | + <contains string="${version-output}" substring="java version "1.1"/> | |
| 751 | + <contains string="${version-output}" substring="java version "1.2"/> | |
| 752 | + <contains string="${version-output}" substring="java version "1.3"/> | |
| 753 | + </or> | |
| 754 | + </condition> | |
| 755 | + <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none"> | |
| 756 | + <istrue value="${have-jdk-older-than-1.4}"/> | |
| 757 | + </condition> | |
| 758 | + <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem"> | |
| 759 | + <os family="windows"/> | |
| 760 | + </condition> | |
| 761 | + <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}"> | |
| 762 | + <isset property="debug.transport"/> | |
| 763 | + </condition> | |
| 764 | + </target> | |
| 765 | + <target depends="-init-debug-args" name="-init-macrodef-debug"> | |
| 766 | + <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 767 | + <attribute default="${main.class}" name="classname"/> | |
| 768 | + <attribute default="${debug.classpath}" name="classpath"/> | |
| 769 | + <element name="customize" optional="true"/> | |
| 770 | + <sequential> | |
| 771 | + <java classname="@{classname}" dir="${work.dir}" fork="true"> | |
| 772 | + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> | |
| 773 | + <jvmarg line="${debug-args-line}"/> | |
| 774 | + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> | |
| 775 | + <jvmarg value="-Dfile.encoding=${runtime.encoding}"/> | |
| 776 | + <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/> | |
| 777 | + <jvmarg line="${run.jvmargs}"/> | |
| 778 | + <jvmarg line="${run.jvmargs.ide}"/> | |
| 779 | + <classpath> | |
| 780 | + <path path="@{classpath}"/> | |
| 781 | + </classpath> | |
| 782 | + <syspropertyset> | |
| 783 | + <propertyref prefix="run-sys-prop."/> | |
| 784 | + <mapper from="run-sys-prop.*" to="*" type="glob"/> | |
| 785 | + </syspropertyset> | |
| 786 | + <customize/> | |
| 787 | + </java> | |
| 788 | + </sequential> | |
| 789 | + </macrodef> | |
| 790 | + </target> | |
| 791 | + <target name="-init-macrodef-java"> | |
| 792 | + <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1"> | |
| 793 | + <attribute default="${main.class}" name="classname"/> | |
| 794 | + <attribute default="${run.classpath}" name="classpath"/> | |
| 795 | + <attribute default="jvm" name="jvm"/> | |
| 796 | + <element name="customize" optional="true"/> | |
| 797 | + <sequential> | |
| 798 | + <java classname="@{classname}" dir="${work.dir}" fork="true"> | |
| 799 | + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> | |
| 800 | + <jvmarg value="-Dfile.encoding=${runtime.encoding}"/> | |
| 801 | + <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/> | |
| 802 | + <jvmarg line="${run.jvmargs}"/> | |
| 803 | + <jvmarg line="${run.jvmargs.ide}"/> | |
| 804 | + <classpath> | |
| 805 | + <path path="@{classpath}"/> | |
| 806 | + </classpath> | |
| 807 | + <syspropertyset> | |
| 808 | + <propertyref prefix="run-sys-prop."/> | |
| 809 | + <mapper from="run-sys-prop.*" to="*" type="glob"/> | |
| 810 | + </syspropertyset> | |
| 811 | + <customize/> | |
| 812 | + </java> | |
| 813 | + </sequential> | |
| 814 | + </macrodef> | |
| 815 | + </target> | |
| 816 | + <target name="-init-macrodef-copylibs"> | |
| 817 | + <macrodef name="copylibs" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
| 818 | + <attribute default="${manifest.file}" name="manifest"/> | |
| 819 | + <element name="customize" optional="true"/> | |
| 820 | + <sequential> | |
| 821 | + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/> | |
| 822 | + <pathconvert property="run.classpath.without.build.classes.dir"> | |
| 823 | + <path path="${run.classpath}"/> | |
| 824 | + <map from="${build.classes.dir.resolved}" to=""/> | |
| 825 | + </pathconvert> | |
| 826 | + <pathconvert pathsep=" " property="jar.classpath"> | |
| 827 | + <path path="${run.classpath.without.build.classes.dir}"/> | |
| 828 | + <chainedmapper> | |
| 829 | + <flattenmapper/> | |
| 830 | + <filtermapper> | |
| 831 | + <replacestring from=" " to="%20"/> | |
| 832 | + </filtermapper> | |
| 833 | + <globmapper from="*" to="lib/*"/> | |
| 834 | + </chainedmapper> | |
| 835 | + </pathconvert> | |
| 836 | + <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/> | |
| 837 | + <copylibs compress="${jar.compress}" excludeFromCopy="${copylibs.excludes}" index="${jar.index}" indexMetaInf="${jar.index.metainf}" jarfile="${dist.jar}" manifest="@{manifest}" rebase="${copylibs.rebase}" runtimeclasspath="${run.classpath.without.build.classes.dir}"> | |
| 838 | + <fileset dir="${build.classes.dir}" excludes="${dist.archive.excludes}"/> | |
| 839 | + <manifest> | |
| 840 | + <attribute name="Class-Path" value="${jar.classpath}"/> | |
| 841 | + <customize/> | |
| 842 | + </manifest> | |
| 843 | + </copylibs> | |
| 844 | + </sequential> | |
| 845 | + </macrodef> | |
| 846 | + </target> | |
| 847 | + <target name="-init-presetdef-jar"> | |
| 848 | + <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1"> | |
| 849 | + <jar compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}"> | |
| 850 | + <j2seproject1:fileset dir="${build.classes.dir}" excludes="${dist.archive.excludes}"/> | |
| 851 | + </jar> | |
| 852 | + </presetdef> | |
| 853 | + </target> | |
| 854 | + <target name="-init-ap-cmdline-properties"> | |
| 855 | + <property name="annotation.processing.enabled" value="true"/> | |
| 856 | + <property name="annotation.processing.processors.list" value=""/> | |
| 857 | + <property name="annotation.processing.processor.options" value=""/> | |
| 858 | + <property name="annotation.processing.run.all.processors" value="true"/> | |
| 859 | + <property name="javac.processorpath" value="${javac.classpath}"/> | |
| 860 | + <property name="javac.test.processorpath" value="${javac.test.classpath}"/> | |
| 861 | + <condition property="ap.supported.internal" value="true"> | |
| 862 | + <not> | |
| 863 | + <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/> | |
| 864 | + </not> | |
| 865 | + </condition> | |
| 866 | + </target> | |
| 867 | + <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported"> | |
| 868 | + <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}"> | |
| 869 | + <isfalse value="${annotation.processing.run.all.processors}"/> | |
| 870 | + </condition> | |
| 871 | + <condition else="" property="ap.proc.none.internal" value="-proc:none"> | |
| 872 | + <isfalse value="${annotation.processing.enabled}"/> | |
| 873 | + </condition> | |
| 874 | + </target> | |
| 875 | + <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline"> | |
| 876 | + <property name="ap.cmd.line.internal" value=""/> | |
| 877 | + </target> | |
| 878 | + <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-test,-init-macrodef-test-debug,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/> | |
| 879 | + <!-- | |
| 880 | + =================== | |
| 881 | + COMPILATION SECTION | |
| 882 | + =================== | |
| 883 | + --> | |
| 884 | + <target name="-deps-jar-init" unless="built-jar.properties"> | |
| 885 | + <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/> | |
| 886 | + <delete file="${built-jar.properties}" quiet="true"/> | |
| 887 | + </target> | |
| 888 | + <target if="already.built.jar.${basedir}" name="-warn-already-built-jar"> | |
| 889 | + <echo level="warn" message="Cycle detected: chexaFormation was already built"/> | |
| 890 | + </target> | |
| 891 | + <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps"> | |
| 892 | + <mkdir dir="${build.dir}"/> | |
| 893 | + <touch file="${built-jar.properties}" verbose="false"/> | |
| 894 | + <property file="${built-jar.properties}" prefix="already.built.jar."/> | |
| 895 | + <antcall target="-warn-already-built-jar"/> | |
| 896 | + <propertyfile file="${built-jar.properties}"> | |
| 897 | + <entry key="${basedir}" value=""/> | |
| 898 | + </propertyfile> | |
| 899 | + </target> | |
| 900 | + <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/> | |
| 901 | + <target depends="init" name="-check-automatic-build"> | |
| 902 | + <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/> | |
| 903 | + </target> | |
| 904 | + <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build"> | |
| 905 | + <antcall target="clean"/> | |
| 906 | + </target> | |
| 907 | + <target depends="init,deps-jar" name="-pre-pre-compile"> | |
| 908 | + <mkdir dir="${build.classes.dir}"/> | |
| 909 | + </target> | |
| 910 | + <target name="-pre-compile"> | |
| 911 | + <!-- Empty placeholder for easier customization. --> | |
| 912 | + <!-- You can override this target in the ../build.xml file. --> | |
| 913 | + </target> | |
| 914 | + <target if="do.depend.true" name="-compile-depend"> | |
| 915 | + <pathconvert property="build.generated.subdirs"> | |
| 916 | + <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false"> | |
| 917 | + <include name="*"/> | |
| 918 | + </dirset> | |
| 919 | + </pathconvert> | |
| 920 | + <j2seproject3:depend srcdir="${src.dir}:${build.generated.subdirs}"/> | |
| 921 | + </target> | |
| 922 | + <target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile"> | |
| 923 | + <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/> | |
| 924 | + <copy todir="${build.classes.dir}"> | |
| 925 | + <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> | |
| 926 | + </copy> | |
| 927 | + </target> | |
| 928 | + <target if="has.persistence.xml" name="-copy-persistence-xml"> | |
| 929 | + <mkdir dir="${build.classes.dir}/META-INF"/> | |
| 930 | + <copy todir="${build.classes.dir}/META-INF"> | |
| 931 | + <fileset dir="${meta.inf.dir}" includes="persistence.xml orm.xml"/> | |
| 932 | + </copy> | |
| 933 | + </target> | |
| 934 | + <target name="-post-compile"> | |
| 935 | + <!-- Empty placeholder for easier customization. --> | |
| 936 | + <!-- You can override this target in the ../build.xml file. --> | |
| 937 | + </target> | |
| 938 | + <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/> | |
| 939 | + <target name="-pre-compile-single"> | |
| 940 | + <!-- Empty placeholder for easier customization. --> | |
| 941 | + <!-- You can override this target in the ../build.xml file. --> | |
| 942 | + </target> | |
| 943 | + <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single"> | |
| 944 | + <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail> | |
| 945 | + <j2seproject3:force-recompile/> | |
| 946 | + <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}"/> | |
| 947 | + </target> | |
| 948 | + <target name="-post-compile-single"> | |
| 949 | + <!-- Empty placeholder for easier customization. --> | |
| 950 | + <!-- You can override this target in the ../build.xml file. --> | |
| 951 | + </target> | |
| 952 | + <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/> | |
| 953 | + <!-- | |
| 954 | + ==================== | |
| 955 | + JAR BUILDING SECTION | |
| 956 | + ==================== | |
| 957 | + --> | |
| 958 | + <target depends="init" name="-pre-pre-jar"> | |
| 959 | + <dirname file="${dist.jar}" property="dist.jar.dir"/> | |
| 960 | + <mkdir dir="${dist.jar.dir}"/> | |
| 961 | + </target> | |
| 962 | + <target name="-pre-jar"> | |
| 963 | + <!-- Empty placeholder for easier customization. --> | |
| 964 | + <!-- You can override this target in the ../build.xml file. --> | |
| 965 | + </target> | |
| 966 | + <target depends="init" if="do.archive" name="-do-jar-create-manifest" unless="manifest.available"> | |
| 967 | + <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/> | |
| 968 | + <touch file="${tmp.manifest.file}" verbose="false"/> | |
| 969 | + </target> | |
| 970 | + <target depends="init" if="do.archive+manifest.available" name="-do-jar-copy-manifest"> | |
| 971 | + <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/> | |
| 972 | + <copy file="${manifest.file}" tofile="${tmp.manifest.file}"/> | |
| 973 | + </target> | |
| 974 | + <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+main.class.available" name="-do-jar-set-mainclass"> | |
| 975 | + <manifest file="${tmp.manifest.file}" mode="update"> | |
| 976 | + <attribute name="Main-Class" value="${main.class}"/> | |
| 977 | + </manifest> | |
| 978 | + </target> | |
| 979 | + <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+profile.available" name="-do-jar-set-profile"> | |
| 980 | + <manifest file="${tmp.manifest.file}" mode="update"> | |
| 981 | + <attribute name="Profile" value="${javac.profile}"/> | |
| 982 | + </manifest> | |
| 983 | + </target> | |
| 984 | + <target depends="init,-do-jar-create-manifest,-do-jar-copy-manifest" if="do.archive+splashscreen.available" name="-do-jar-set-splashscreen"> | |
| 985 | + <basename file="${application.splash}" property="splashscreen.basename"/> | |
| 986 | + <mkdir dir="${build.classes.dir}/META-INF"/> | |
| 987 | + <copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/> | |
| 988 | + <manifest file="${tmp.manifest.file}" mode="update"> | |
| 989 | + <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/> | |
| 990 | + </manifest> | |
| 991 | + </target> | |
| 992 | + <target depends="init,-init-macrodef-copylibs,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen" if="do.mkdist" name="-do-jar-copylibs"> | |
| 993 | + <j2seproject3:copylibs manifest="${tmp.manifest.file}"/> | |
| 994 | + <echo level="info">To run this application from the command line without Ant, try:</echo> | |
| 995 | + <property location="${dist.jar}" name="dist.jar.resolved"/> | |
| 996 | + <echo level="info">java -jar "${dist.jar.resolved}"</echo> | |
| 997 | + </target> | |
| 998 | + <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen" if="do.archive" name="-do-jar-jar" unless="do.mkdist"> | |
| 999 | + <j2seproject1:jar manifest="${tmp.manifest.file}"/> | |
| 1000 | + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/> | |
| 1001 | + <property location="${dist.jar}" name="dist.jar.resolved"/> | |
| 1002 | + <pathconvert property="run.classpath.with.dist.jar"> | |
| 1003 | + <path path="${run.classpath}"/> | |
| 1004 | + <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/> | |
| 1005 | + </pathconvert> | |
| 1006 | + <condition else="" property="jar.usage.message" value="To run this application from the command line without Ant, try:${line.separator}${platform.java} -cp ${run.classpath.with.dist.jar} ${main.class}"> | |
| 1007 | + <isset property="main.class.available"/> | |
| 1008 | + </condition> | |
| 1009 | + <condition else="debug" property="jar.usage.level" value="info"> | |
| 1010 | + <isset property="main.class.available"/> | |
| 1011 | + </condition> | |
| 1012 | + <echo level="${jar.usage.level}" message="${jar.usage.message}"/> | |
| 1013 | + </target> | |
| 1014 | + <target depends="-do-jar-copylibs" if="do.archive" name="-do-jar-delete-manifest"> | |
| 1015 | + <delete> | |
| 1016 | + <fileset file="${tmp.manifest.file}"/> | |
| 1017 | + </delete> | |
| 1018 | + </target> | |
| 1019 | + <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-do-jar-jar,-do-jar-delete-manifest" name="-do-jar-without-libraries"/> | |
| 1020 | + <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-create-manifest,-do-jar-copy-manifest,-do-jar-set-mainclass,-do-jar-set-profile,-do-jar-set-splashscreen,-do-jar-copylibs,-do-jar-delete-manifest" name="-do-jar-with-libraries"/> | |
| 1021 | + <target name="-post-jar"> | |
| 1022 | + <!-- Empty placeholder for easier customization. --> | |
| 1023 | + <!-- You can override this target in the ../build.xml file. --> | |
| 1024 | + </target> | |
| 1025 | + <target depends="init,compile,-pre-jar,-do-jar-without-libraries,-do-jar-with-libraries,-post-jar" name="-do-jar"/> | |
| 1026 | + <target depends="init,compile,-pre-jar,-do-jar,-post-jar" description="Build JAR." name="jar"/> | |
| 1027 | + <!-- | |
| 1028 | + ================= | |
| 1029 | + EXECUTION SECTION | |
| 1030 | + ================= | |
| 1031 | + --> | |
| 1032 | + <target depends="init,compile" description="Run a main class." name="run"> | |
| 1033 | + <j2seproject1:java> | |
| 1034 | + <customize> | |
| 1035 | + <arg line="${application.args}"/> | |
| 1036 | + </customize> | |
| 1037 | + </j2seproject1:java> | |
| 1038 | + </target> | |
| 1039 | + <target name="-do-not-recompile"> | |
| 1040 | + <property name="javac.includes.binary" value=""/> | |
| 1041 | + </target> | |
| 1042 | + <target depends="init,compile-single" name="run-single"> | |
| 1043 | + <fail unless="run.class">Must select one file in the IDE or set run.class</fail> | |
| 1044 | + <j2seproject1:java classname="${run.class}"/> | |
| 1045 | + </target> | |
| 1046 | + <target depends="init,compile-test-single" name="run-test-with-main"> | |
| 1047 | + <fail unless="run.class">Must select one file in the IDE or set run.class</fail> | |
| 1048 | + <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/> | |
| 1049 | + </target> | |
| 1050 | + <!-- | |
| 1051 | + ================= | |
| 1052 | + DEBUGGING SECTION | |
| 1053 | + ================= | |
| 1054 | + --> | |
| 1055 | + <target depends="init" if="netbeans.home" name="-debug-start-debugger"> | |
| 1056 | + <j2seproject1:nbjpdastart name="${debug.class}"/> | |
| 1057 | + </target> | |
| 1058 | + <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test"> | |
| 1059 | + <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/> | |
| 1060 | + </target> | |
| 1061 | + <target depends="init,compile" name="-debug-start-debuggee"> | |
| 1062 | + <j2seproject3:debug> | |
| 1063 | + <customize> | |
| 1064 | + <arg line="${application.args}"/> | |
| 1065 | + </customize> | |
| 1066 | + </j2seproject3:debug> | |
| 1067 | + </target> | |
| 1068 | + <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/> | |
| 1069 | + <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto"> | |
| 1070 | + <j2seproject1:nbjpdastart stopclassname="${main.class}"/> | |
| 1071 | + </target> | |
| 1072 | + <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/> | |
| 1073 | + <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single"> | |
| 1074 | + <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail> | |
| 1075 | + <j2seproject3:debug classname="${debug.class}"/> | |
| 1076 | + </target> | |
| 1077 | + <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/> | |
| 1078 | + <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test"> | |
| 1079 | + <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail> | |
| 1080 | + <j2seproject3:debug classname="${debug.class}" classpath="${debug.test.classpath}"/> | |
| 1081 | + </target> | |
| 1082 | + <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/> | |
| 1083 | + <target depends="init" name="-pre-debug-fix"> | |
| 1084 | + <fail unless="fix.includes">Must set fix.includes</fail> | |
| 1085 | + <property name="javac.includes" value="${fix.includes}.java"/> | |
| 1086 | + </target> | |
| 1087 | + <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix"> | |
| 1088 | + <j2seproject1:nbjpdareload/> | |
| 1089 | + </target> | |
| 1090 | + <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/> | |
| 1091 | + <!-- | |
| 1092 | + ================= | |
| 1093 | + PROFILING SECTION | |
| 1094 | + ================= | |
| 1095 | + --> | |
| 1096 | + <!-- | |
| 1097 | + pre NB7.2 profiler integration | |
| 1098 | + --> | |
| 1099 | + <target depends="profile-init,compile" description="Profile a project in the IDE." if="profiler.info.jvmargs.agent" name="-profile-pre72"> | |
| 1100 | + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> | |
| 1101 | + <nbprofiledirect> | |
| 1102 | + <classpath> | |
| 1103 | + <path path="${run.classpath}"/> | |
| 1104 | + </classpath> | |
| 1105 | + </nbprofiledirect> | |
| 1106 | + <profile/> | |
| 1107 | + </target> | |
| 1108 | + <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="profiler.info.jvmargs.agent" name="-profile-single-pre72"> | |
| 1109 | + <fail unless="profile.class">Must select one file in the IDE or set profile.class</fail> | |
| 1110 | + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> | |
| 1111 | + <nbprofiledirect> | |
| 1112 | + <classpath> | |
| 1113 | + <path path="${run.classpath}"/> | |
| 1114 | + </classpath> | |
| 1115 | + </nbprofiledirect> | |
| 1116 | + <profile classname="${profile.class}"/> | |
| 1117 | + </target> | |
| 1118 | + <target depends="profile-init,compile-single" if="profiler.info.jvmargs.agent" name="-profile-applet-pre72"> | |
| 1119 | + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> | |
| 1120 | + <nbprofiledirect> | |
| 1121 | + <classpath> | |
| 1122 | + <path path="${run.classpath}"/> | |
| 1123 | + </classpath> | |
| 1124 | + </nbprofiledirect> | |
| 1125 | + <profile classname="sun.applet.AppletViewer"> | |
| 1126 | + <customize> | |
| 1127 | + <arg value="${applet.url}"/> | |
| 1128 | + </customize> | |
| 1129 | + </profile> | |
| 1130 | + </target> | |
| 1131 | + <target depends="profile-init,compile-test-single" if="profiler.info.jvmargs.agent" name="-profile-test-single-pre72"> | |
| 1132 | + <fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail> | |
| 1133 | + <nbprofiledirect> | |
| 1134 | + <classpath> | |
| 1135 | + <path path="${run.test.classpath}"/> | |
| 1136 | + </classpath> | |
| 1137 | + </nbprofiledirect> | |
| 1138 | + <junit dir="${profiler.info.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" jvm="${profiler.info.jvm}" showoutput="true"> | |
| 1139 | + <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/> | |
| 1140 | + <jvmarg value="${profiler.info.jvmargs.agent}"/> | |
| 1141 | + <jvmarg line="${profiler.info.jvmargs}"/> | |
| 1142 | + <test name="${profile.class}"/> | |
| 1143 | + <classpath> | |
| 1144 | + <path path="${run.test.classpath}"/> | |
| 1145 | + </classpath> | |
| 1146 | + <syspropertyset> | |
| 1147 | + <propertyref prefix="test-sys-prop."/> | |
| 1148 | + <mapper from="test-sys-prop.*" to="*" type="glob"/> | |
| 1149 | + </syspropertyset> | |
| 1150 | + <formatter type="brief" usefile="false"/> | |
| 1151 | + <formatter type="xml"/> | |
| 1152 | + </junit> | |
| 1153 | + </target> | |
| 1154 | + <!-- | |
| 1155 | + end of pre NB72 profiling section | |
| 1156 | + --> | |
| 1157 | + <target if="netbeans.home" name="-profile-check"> | |
| 1158 | + <condition property="profiler.configured"> | |
| 1159 | + <or> | |
| 1160 | + <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-agentpath:"/> | |
| 1161 | + <contains casesensitive="true" string="${run.jvmargs.ide}" substring="-javaagent:"/> | |
| 1162 | + </or> | |
| 1163 | + </condition> | |
| 1164 | + </target> | |
| 1165 | + <target depends="-profile-check,-profile-pre72" description="Profile a project in the IDE." if="profiler.configured" name="profile" unless="profiler.info.jvmargs.agent"> | |
| 1166 | + <startprofiler/> | |
| 1167 | + <antcall target="run"/> | |
| 1168 | + </target> | |
| 1169 | + <target depends="-profile-check,-profile-single-pre72" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-single" unless="profiler.info.jvmargs.agent"> | |
| 1170 | + <fail unless="run.class">Must select one file in the IDE or set run.class</fail> | |
| 1171 | + <startprofiler/> | |
| 1172 | + <antcall target="run-single"/> | |
| 1173 | + </target> | |
| 1174 | + <target depends="-profile-test-single-pre72" description="Profile a selected test in the IDE." name="profile-test-single"/> | |
| 1175 | + <target depends="-profile-check" description="Profile a selected test in the IDE." if="profiler.configured" name="profile-test" unless="profiler.info.jvmargs"> | |
| 1176 | + <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail> | |
| 1177 | + <startprofiler/> | |
| 1178 | + <antcall target="test-single"/> | |
| 1179 | + </target> | |
| 1180 | + <target depends="-profile-check" description="Profile a selected class in the IDE." if="profiler.configured" name="profile-test-with-main"> | |
| 1181 | + <fail unless="run.class">Must select one file in the IDE or set run.class</fail> | |
| 1182 | + <startprofiler/> | |
| 1183 | + <antcal target="run-test-with-main"/> | |
| 1184 | + </target> | |
| 1185 | + <target depends="-profile-check,-profile-applet-pre72" if="profiler.configured" name="profile-applet" unless="profiler.info.jvmargs.agent"> | |
| 1186 | + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail> | |
| 1187 | + <startprofiler/> | |
| 1188 | + <antcall target="run-applet"/> | |
| 1189 | + </target> | |
| 1190 | + <!-- | |
| 1191 | + =============== | |
| 1192 | + JAVADOC SECTION | |
| 1193 | + =============== | |
| 1194 | + --> | |
| 1195 | + <target depends="init" if="have.sources" name="-javadoc-build"> | |
| 1196 | + <mkdir dir="${dist.javadoc.dir}"/> | |
| 1197 | + <condition else="" property="javadoc.endorsed.classpath.cmd.line.arg" value="-J${endorsed.classpath.cmd.line.arg}"> | |
| 1198 | + <and> | |
| 1199 | + <isset property="endorsed.classpath.cmd.line.arg"/> | |
| 1200 | + <not> | |
| 1201 | + <equals arg1="${endorsed.classpath.cmd.line.arg}" arg2=""/> | |
| 1202 | + </not> | |
| 1203 | + </and> | |
| 1204 | + </condition> | |
| 1205 | + <condition else="" property="bug5101868workaround" value="*.java"> | |
| 1206 | + <matches pattern="1\.[56](\..*)?" string="${java.version}"/> | |
| 1207 | + </condition> | |
| 1208 | + <javadoc additionalparam="-J-Dfile.encoding=${file.encoding} ${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}"> | |
| 1209 | + <classpath> | |
| 1210 | + <path path="${javac.classpath}"/> | |
| 1211 | + </classpath> | |
| 1212 | + <fileset dir="${src.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}"> | |
| 1213 | + <filename name="**/*.java"/> | |
| 1214 | + </fileset> | |
| 1215 | + <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false"> | |
| 1216 | + <include name="**/*.java"/> | |
| 1217 | + <exclude name="*.java"/> | |
| 1218 | + </fileset> | |
| 1219 | + <arg line="${javadoc.endorsed.classpath.cmd.line.arg}"/> | |
| 1220 | + </javadoc> | |
| 1221 | + <copy todir="${dist.javadoc.dir}"> | |
| 1222 | + <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}"> | |
| 1223 | + <filename name="**/doc-files/**"/> | |
| 1224 | + </fileset> | |
| 1225 | + <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false"> | |
| 1226 | + <include name="**/doc-files/**"/> | |
| 1227 | + </fileset> | |
| 1228 | + </copy> | |
| 1229 | + </target> | |
| 1230 | + <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview"> | |
| 1231 | + <nbbrowse file="${dist.javadoc.dir}/index.html"/> | |
| 1232 | + </target> | |
| 1233 | + <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/> | |
| 1234 | + <!-- | |
| 1235 | + ========================= | |
| 1236 | + TEST COMPILATION SECTION | |
| 1237 | + ========================= | |
| 1238 | + --> | |
| 1239 | + <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test"> | |
| 1240 | + <mkdir dir="${build.test.classes.dir}"/> | |
| 1241 | + </target> | |
| 1242 | + <target name="-pre-compile-test"> | |
| 1243 | + <!-- Empty placeholder for easier customization. --> | |
| 1244 | + <!-- You can override this target in the ../build.xml file. --> | |
| 1245 | + </target> | |
| 1246 | + <target if="do.depend.true" name="-compile-test-depend"> | |
| 1247 | + <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/> | |
| 1248 | + </target> | |
| 1249 | + <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test"> | |
| 1250 | + <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" processorpath="${javac.test.processorpath}" srcdir="${test.src.dir}"/> | |
| 1251 | + <copy todir="${build.test.classes.dir}"> | |
| 1252 | + <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> | |
| 1253 | + </copy> | |
| 1254 | + </target> | |
| 1255 | + <target name="-post-compile-test"> | |
| 1256 | + <!-- Empty placeholder for easier customization. --> | |
| 1257 | + <!-- You can override this target in the ../build.xml file. --> | |
| 1258 | + </target> | |
| 1259 | + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/> | |
| 1260 | + <target name="-pre-compile-test-single"> | |
| 1261 | + <!-- Empty placeholder for easier customization. --> | |
| 1262 | + <!-- You can override this target in the ../build.xml file. --> | |
| 1263 | + </target> | |
| 1264 | + <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single"> | |
| 1265 | + <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail> | |
| 1266 | + <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/> | |
| 1267 | + <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" processorpath="${javac.test.processorpath}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/> | |
| 1268 | + <copy todir="${build.test.classes.dir}"> | |
| 1269 | + <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> | |
| 1270 | + </copy> | |
| 1271 | + </target> | |
| 1272 | + <target name="-post-compile-test-single"> | |
| 1273 | + <!-- Empty placeholder for easier customization. --> | |
| 1274 | + <!-- You can override this target in the ../build.xml file. --> | |
| 1275 | + </target> | |
| 1276 | + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/> | |
| 1277 | + <!-- | |
| 1278 | + ======================= | |
| 1279 | + TEST EXECUTION SECTION | |
| 1280 | + ======================= | |
| 1281 | + --> | |
| 1282 | + <target depends="init" if="have.tests" name="-pre-test-run"> | |
| 1283 | + <mkdir dir="${build.test.results.dir}"/> | |
| 1284 | + </target> | |
| 1285 | + <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run"> | |
| 1286 | + <j2seproject3:test includes="${includes}" testincludes="**/*Test.java"/> | |
| 1287 | + </target> | |
| 1288 | + <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run"> | |
| 1289 | + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> | |
| 1290 | + </target> | |
| 1291 | + <target depends="init" if="have.tests" name="test-report"/> | |
| 1292 | + <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/> | |
| 1293 | + <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/> | |
| 1294 | + <target depends="init" if="have.tests" name="-pre-test-run-single"> | |
| 1295 | + <mkdir dir="${build.test.results.dir}"/> | |
| 1296 | + </target> | |
| 1297 | + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single"> | |
| 1298 | + <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail> | |
| 1299 | + <j2seproject3:test excludes="" includes="${test.includes}" testincludes="${test.includes}"/> | |
| 1300 | + </target> | |
| 1301 | + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single"> | |
| 1302 | + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> | |
| 1303 | + </target> | |
| 1304 | + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/> | |
| 1305 | + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single-method"> | |
| 1306 | + <fail unless="test.class">Must select some files in the IDE or set test.class</fail> | |
| 1307 | + <fail unless="test.method">Must select some method in the IDE or set test.method</fail> | |
| 1308 | + <j2seproject3:test excludes="" includes="${javac.includes}" testincludes="${test.class}" testmethods="${test.method}"/> | |
| 1309 | + </target> | |
| 1310 | + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method" if="have.tests" name="-post-test-run-single-method"> | |
| 1311 | + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> | |
| 1312 | + </target> | |
| 1313 | + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method,-post-test-run-single-method" description="Run single unit test." name="test-single-method"/> | |
| 1314 | + <!-- | |
| 1315 | + ======================= | |
| 1316 | + TEST DEBUGGING SECTION | |
| 1317 | + ======================= | |
| 1318 | + --> | |
| 1319 | + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test"> | |
| 1320 | + <fail unless="test.class">Must select one file in the IDE or set test.class</fail> | |
| 1321 | + <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testincludes="${javac.includes}"/> | |
| 1322 | + </target> | |
| 1323 | + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-debug-start-debuggee-test-method"> | |
| 1324 | + <fail unless="test.class">Must select one file in the IDE or set test.class</fail> | |
| 1325 | + <fail unless="test.method">Must select some method in the IDE or set test.method</fail> | |
| 1326 | + <j2seproject3:test-debug excludes="" includes="${javac.includes}" testClass="${test.class}" testMethod="${test.method}" testincludes="${test.class}" testmethods="${test.method}"/> | |
| 1327 | + </target> | |
| 1328 | + <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test"> | |
| 1329 | + <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/> | |
| 1330 | + </target> | |
| 1331 | + <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/> | |
| 1332 | + <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test-method" name="debug-test-method"/> | |
| 1333 | + <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test"> | |
| 1334 | + <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/> | |
| 1335 | + </target> | |
| 1336 | + <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/> | |
| 1337 | + <!-- | |
| 1338 | + ========================= | |
| 1339 | + APPLET EXECUTION SECTION | |
| 1340 | + ========================= | |
| 1341 | + --> | |
| 1342 | + <target depends="init,compile-single" name="run-applet"> | |
| 1343 | + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail> | |
| 1344 | + <j2seproject1:java classname="sun.applet.AppletViewer"> | |
| 1345 | + <customize> | |
| 1346 | + <arg value="${applet.url}"/> | |
| 1347 | + </customize> | |
| 1348 | + </j2seproject1:java> | |
| 1349 | + </target> | |
| 1350 | + <!-- | |
| 1351 | + ========================= | |
| 1352 | + APPLET DEBUGGING SECTION | |
| 1353 | + ========================= | |
| 1354 | + --> | |
| 1355 | + <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet"> | |
| 1356 | + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail> | |
| 1357 | + <j2seproject3:debug classname="sun.applet.AppletViewer"> | |
| 1358 | + <customize> | |
| 1359 | + <arg value="${applet.url}"/> | |
| 1360 | + </customize> | |
| 1361 | + </j2seproject3:debug> | |
| 1362 | + </target> | |
| 1363 | + <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/> | |
| 1364 | + <!-- | |
| 1365 | + =============== | |
| 1366 | + CLEANUP SECTION | |
| 1367 | + =============== | |
| 1368 | + --> | |
| 1369 | + <target name="-deps-clean-init" unless="built-clean.properties"> | |
| 1370 | + <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/> | |
| 1371 | + <delete file="${built-clean.properties}" quiet="true"/> | |
| 1372 | + </target> | |
| 1373 | + <target if="already.built.clean.${basedir}" name="-warn-already-built-clean"> | |
| 1374 | + <echo level="warn" message="Cycle detected: chexaFormation was already built"/> | |
| 1375 | + </target> | |
| 1376 | + <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps"> | |
| 1377 | + <mkdir dir="${build.dir}"/> | |
| 1378 | + <touch file="${built-clean.properties}" verbose="false"/> | |
| 1379 | + <property file="${built-clean.properties}" prefix="already.built.clean."/> | |
| 1380 | + <antcall target="-warn-already-built-clean"/> | |
| 1381 | + <propertyfile file="${built-clean.properties}"> | |
| 1382 | + <entry key="${basedir}" value=""/> | |
| 1383 | + </propertyfile> | |
| 1384 | + </target> | |
| 1385 | + <target depends="init" name="-do-clean"> | |
| 1386 | + <delete dir="${build.dir}"/> | |
| 1387 | + <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/> | |
| 1388 | + </target> | |
| 1389 | + <target name="-post-clean"> | |
| 1390 | + <!-- Empty placeholder for easier customization. --> | |
| 1391 | + <!-- You can override this target in the ../build.xml file. --> | |
| 1392 | + </target> | |
| 1393 | + <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/> | |
| 1394 | + <target name="-check-call-dep"> | |
| 1395 | + <property file="${call.built.properties}" prefix="already.built."/> | |
| 1396 | + <condition property="should.call.dep"> | |
| 1397 | + <and> | |
| 1398 | + <not> | |
| 1399 | + <isset property="already.built.${call.subproject}"/> | |
| 1400 | + </not> | |
| 1401 | + <available file="${call.script}"/> | |
| 1402 | + </and> | |
| 1403 | + </condition> | |
| 1404 | + </target> | |
| 1405 | + <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep"> | |
| 1406 | + <ant antfile="${call.script}" inheritall="false" target="${call.target}"> | |
| 1407 | + <propertyset> | |
| 1408 | + <propertyref prefix="transfer."/> | |
| 1409 | + <mapper from="transfer.*" to="*" type="glob"/> | |
| 1410 | + </propertyset> | |
| 1411 | + </ant> | |
| 1412 | + </target> | |
| 1413 | +</project> |
| @@ -0,0 +1,15 @@ | ||
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<project xmlns="http://www.netbeans.org/ns/project/1"> | |
| 3 | + <type>org.netbeans.modules.java.j2seproject</type> | |
| 4 | + <configuration> | |
| 5 | + <data xmlns="http://www.netbeans.org/ns/j2se-project/3"> | |
| 6 | + <name>chexaFormation</name> | |
| 7 | + <source-roots> | |
| 8 | + <root id="src.dir"/> | |
| 9 | + </source-roots> | |
| 10 | + <test-roots> | |
| 11 | + <root id="test.src.dir"/> | |
| 12 | + </test-roots> | |
| 13 | + </data> | |
| 14 | + </configuration> | |
| 15 | +</project> |
| @@ -0,0 +1,3 @@ | ||
| 1 | +Manifest-Version: 1.0 | |
| 2 | +X-COMMENT: Main-Class will be added automatically by build | |
| 3 | + |
| @@ -0,0 +1,111 @@ | ||
| 1 | +package chexaformation; | |
| 2 | + | |
| 3 | +import java.awt.datatransfer.DataFlavor; | |
| 4 | +import java.awt.datatransfer.Transferable; | |
| 5 | +import java.awt.datatransfer.UnsupportedFlavorException; | |
| 6 | +import java.io.IOException; | |
| 7 | +import java.util.logging.Level; | |
| 8 | +import java.util.logging.Logger; | |
| 9 | +import javax.swing.Icon; | |
| 10 | +import javax.swing.JComponent; | |
| 11 | +import javax.swing.JList; | |
| 12 | +import javax.swing.TransferHandler; | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * | |
| 16 | + * @author fukui | |
| 17 | + */ | |
| 18 | +public class transDestHandler2 extends TransferHandler { | |
| 19 | + | |
| 20 | + /** | |
| 21 | + * コンストラクタ | |
| 22 | + */ | |
| 23 | + public transDestHandler2() { | |
| 24 | + super(); | |
| 25 | + } | |
| 26 | + | |
| 27 | + @Override | |
| 28 | + public boolean canImport(JComponent comp, DataFlavor[] transferFlavors) { | |
| 29 | + int i; | |
| 30 | + DataFlavor df1 = new DataFlavor(cheTeamData.class, null); | |
| 31 | + for (i = 0; i < transferFlavors.length; i++) { | |
| 32 | + if (df1.equals(transferFlavors[i]) == true) { | |
| 33 | + return true; | |
| 34 | + } | |
| 35 | + } | |
| 36 | + return false; | |
| 37 | + } | |
| 38 | + | |
| 39 | + @Override | |
| 40 | + public int getSourceActions(JComponent c) { | |
| 41 | + return COPY; | |
| 42 | + } | |
| 43 | + | |
| 44 | + @Override | |
| 45 | + protected Transferable createTransferable(JComponent c) { | |
| 46 | + MatchDataPanel p; | |
| 47 | + try { | |
| 48 | + p = (MatchDataPanel) (c.getParent().getParent().getParent()); | |
| 49 | + } catch (Exception e) { | |
| 50 | + Logger.getLogger(transDestHandler2.class.getName()).log(Level.SEVERE, | |
| 51 | + null, e); | |
| 52 | + return null; | |
| 53 | + } | |
| 54 | + cheTeamData team = p.get_current_team(); | |
| 55 | + if (team == null || team.is_enable() == false) { | |
| 56 | + return null; | |
| 57 | + } | |
| 58 | + return new transData(team, p.get_current_index()); | |
| 59 | + } | |
| 60 | + | |
| 61 | + @Override | |
| 62 | + @SuppressWarnings("null") | |
| 63 | + public boolean importData(JComponent comp, Transferable t) { | |
| 64 | + MatchDataPanel p = null; | |
| 65 | + try { | |
| 66 | + p = (MatchDataPanel) (comp.getParent().getParent().getParent()); | |
| 67 | + } catch (Exception e) { | |
| 68 | + Logger.getLogger(transDestHandler2.class.getName()).log(Level.SEVERE, | |
| 69 | + null, e); | |
| 70 | + } | |
| 71 | + try { | |
| 72 | + cheTeamData team = (cheTeamData) t.getTransferData(new DataFlavor( | |
| 73 | + cheTeamData.class, null)); | |
| 74 | + if (team != null) { | |
| 75 | + JList list = (JList) comp; | |
| 76 | + int nsel = list.getDropLocation().getIndex(); | |
| 77 | + int src_idx = (Integer) t.getTransferData(new DataFlavor( | |
| 78 | + Integer.class, null)); | |
| 79 | + if (src_idx == -1 || nsel == -1) { | |
| 80 | + p.load_team(team, nsel); | |
| 81 | + } else { | |
| 82 | + p.move_team(src_idx, nsel); | |
| 83 | + } | |
| 84 | + return true; | |
| 85 | + } | |
| 86 | + } catch (UnsupportedFlavorException ex) { | |
| 87 | + Logger.getLogger(transDestHandler2.class.getName()).log(Level.SEVERE, | |
| 88 | + null, ex); | |
| 89 | + } catch (IOException ex) { | |
| 90 | + Logger.getLogger(transDestHandler2.class.getName()).log(Level.SEVERE, | |
| 91 | + null, ex); | |
| 92 | + } | |
| 93 | + return false; | |
| 94 | + } | |
| 95 | + | |
| 96 | + @Override | |
| 97 | + public Icon getVisualRepresentation(Transferable t) { | |
| 98 | + try { | |
| 99 | + cheTeamData team = (cheTeamData) t.getTransferData(new DataFlavor( | |
| 100 | + cheTeamData.class, null)); | |
| 101 | + return team.get_emblem().getImgicon(); | |
| 102 | + } catch (UnsupportedFlavorException ex) { | |
| 103 | + Logger.getLogger(transDestHandler2.class.getName()).log(Level.SEVERE, | |
| 104 | + null, ex); | |
| 105 | + } catch (IOException ex) { | |
| 106 | + Logger.getLogger(transDestHandler2.class.getName()).log(Level.SEVERE, | |
| 107 | + null, ex); | |
| 108 | + } | |
| 109 | + return null; | |
| 110 | + } | |
| 111 | +} |
| @@ -0,0 +1,227 @@ | ||
| 1 | +package chexaformation; | |
| 2 | + | |
| 3 | +import java.io.FileNotFoundException; | |
| 4 | +import java.io.FileOutputStream; | |
| 5 | +import java.io.IOException; | |
| 6 | +import java.io.UnsupportedEncodingException; | |
| 7 | +import java.util.ArrayList; | |
| 8 | +import java.util.Arrays; | |
| 9 | +import java.util.NoSuchElementException; | |
| 10 | +import java.util.Scanner; | |
| 11 | +import java.util.logging.Level; | |
| 12 | +import java.util.logging.Logger; | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * OKEデータ | |
| 16 | + * | |
| 17 | + * @author fukui | |
| 18 | + */ | |
| 19 | +public class cheOkeData { | |
| 20 | + | |
| 21 | + static public final int datasize = 7872; | |
| 22 | + static final ArrayList<String> bodylist; | |
| 23 | + int okeno; | |
| 24 | + byte realData[]; | |
| 25 | + cheEmblem emblem; | |
| 26 | + | |
| 27 | + /** | |
| 28 | + * 初期化 | |
| 29 | + */ | |
| 30 | + static { | |
| 31 | + int nbody; | |
| 32 | + nbody = 0; | |
| 33 | + bodylist = new ArrayList<String>(); | |
| 34 | + try { | |
| 35 | + String bodys; | |
| 36 | + Scanner data; | |
| 37 | + bodys = java.util.ResourceBundle. | |
| 38 | + getBundle("chexaformation/resource"). | |
| 39 | + getString("okeBodyList"); | |
| 40 | + data = new Scanner(bodys).useDelimiter(","); | |
| 41 | + while (data.hasNext() == true) { | |
| 42 | + bodylist.add(data.next()); | |
| 43 | + nbody++; | |
| 44 | + } | |
| 45 | + data.close(); | |
| 46 | + } catch (NoSuchElementException ex) { | |
| 47 | + //途中で定義データがなくなったので残りを補充 | |
| 48 | + for (; nbody < 38; nbody++) { | |
| 49 | + bodylist.add(String.format("%02x", nbody)); | |
| 50 | + } | |
| 51 | + } catch (Exception ex) { | |
| 52 | + //なぜかエラーが発生したのでリストを初期化 | |
| 53 | + bodylist.clear(); | |
| 54 | + for (nbody = 0; nbody < 38; nbody++) { | |
| 55 | + bodylist.add(String.format("%02x", nbody)); | |
| 56 | + } | |
| 57 | + //一応ログっておく | |
| 58 | + Logger.getLogger(cheOkeData.class.getName()).log(Level.SEVERE, | |
| 59 | + null, ex); | |
| 60 | + } | |
| 61 | + } | |
| 62 | + | |
| 63 | + /** | |
| 64 | + * コンストラクタ | |
| 65 | + * | |
| 66 | + * @param n OKEインデックス | |
| 67 | + */ | |
| 68 | + public cheOkeData(int n) { | |
| 69 | + okeno = n; | |
| 70 | + realData = new byte[datasize]; | |
| 71 | + } | |
| 72 | + | |
| 73 | + @Override | |
| 74 | + public boolean equals(Object obj) { | |
| 75 | + if (obj.getClass().getName().equals(this.getClass().getName())) { | |
| 76 | + return Arrays.equals(((cheOkeData) obj).realData, realData); | |
| 77 | + } else { | |
| 78 | + return super.equals(obj); | |
| 79 | + } | |
| 80 | + } | |
| 81 | + | |
| 82 | + @Override | |
| 83 | + public int hashCode() { | |
| 84 | + int hash = 3; | |
| 85 | + hash = 79 * hash + Arrays.hashCode(this.realData); | |
| 86 | + return hash; | |
| 87 | + } | |
| 88 | + | |
| 89 | + /** | |
| 90 | + * OKEデータをコピーする | |
| 91 | + * | |
| 92 | + * @param p コピー先OKEデータ | |
| 93 | + */ | |
| 94 | + public void copy(cheOkeData p) { | |
| 95 | + System.arraycopy(realData, 0, p.realData, 0, datasize); | |
| 96 | + p.emblem = emblem; | |
| 97 | + } | |
| 98 | + | |
| 99 | + /** | |
| 100 | + * OKEデータを読み込み | |
| 101 | + * | |
| 102 | + * @param s 読み込み元データポインタ | |
| 103 | + * @param nofs 読み込み元オフセット | |
| 104 | + * @return 正常に読み込めたときにtrue | |
| 105 | + */ | |
| 106 | + public boolean load(byte s[], int nofs) { | |
| 107 | + int i; | |
| 108 | + if (nofs + datasize > s.length) { | |
| 109 | + return false; | |
| 110 | + } | |
| 111 | + for (i = 0; i < datasize; i++) { | |
| 112 | + realData[i] = s[i + nofs]; | |
| 113 | + } | |
| 114 | + emblem = new cheEmblem(realData, 48); | |
| 115 | + return true; | |
| 116 | + } | |
| 117 | + | |
| 118 | + /** | |
| 119 | + * OKEデータの保存 | |
| 120 | + * | |
| 121 | + * @param s 保存先データポインタ | |
| 122 | + * @param nofs 保存先オフセット | |
| 123 | + * @return 正常に保存できたときにtrue | |
| 124 | + */ | |
| 125 | + public boolean save(byte s[], int nofs) { | |
| 126 | + int i; | |
| 127 | + if (nofs + datasize > s.length) { | |
| 128 | + return false; | |
| 129 | + } | |
| 130 | + for (i = 0; i < datasize; i++) { | |
| 131 | + s[i + nofs] = realData[i]; | |
| 132 | + } | |
| 133 | + return true; | |
| 134 | + } | |
| 135 | + | |
| 136 | + /** | |
| 137 | + * OKE有効フラグの取得 | |
| 138 | + * | |
| 139 | + * @return OKE有効フラグ | |
| 140 | + */ | |
| 141 | + public int get_flag() { | |
| 142 | + int n; | |
| 143 | + n = (int) realData[0] & 255; | |
| 144 | + n |= ((int) realData[1] & 255) << 8; | |
| 145 | + n |= ((int) realData[2] & 255) << 16; | |
| 146 | + n |= ((int) realData[3] & 255) << 24; | |
| 147 | + return n; | |
| 148 | + } | |
| 149 | + | |
| 150 | + /** | |
| 151 | + * OKE名称の取得 | |
| 152 | + * | |
| 153 | + * @return 名称 | |
| 154 | + */ | |
| 155 | + public String get_name() { | |
| 156 | + byte work[] = new byte[28]; | |
| 157 | + int nlen; | |
| 158 | + for (nlen = 0; nlen < 28; nlen++) { | |
| 159 | + work[nlen] = realData[4 + nlen]; | |
| 160 | + if (work[nlen] == 0) { | |
| 161 | + break; | |
| 162 | + } | |
| 163 | + } | |
| 164 | + try { | |
| 165 | + return new String(work, 0, nlen, "SJIS"); | |
| 166 | + } catch (UnsupportedEncodingException ex) { | |
| 167 | + Logger.getLogger(cheOkeData.class.getName()).log(Level.SEVERE, | |
| 168 | + null, ex); | |
| 169 | + return new String(); | |
| 170 | + } | |
| 171 | + } | |
| 172 | + | |
| 173 | + /** | |
| 174 | + * エンブレムデータの取得 | |
| 175 | + * | |
| 176 | + * @return エンブレムデータ | |
| 177 | + */ | |
| 178 | + public cheEmblem get_emblem() { | |
| 179 | + return emblem; | |
| 180 | + } | |
| 181 | + | |
| 182 | + /** | |
| 183 | + * OKEインデックスの取得 | |
| 184 | + * | |
| 185 | + * @return インデックス | |
| 186 | + */ | |
| 187 | + public int get_no() { | |
| 188 | + return okeno; | |
| 189 | + } | |
| 190 | + | |
| 191 | + @Override | |
| 192 | + public String toString() { | |
| 193 | + String retstr = get_name(); | |
| 194 | + int i = retstr.length(); | |
| 195 | + for (; i < 14; i++) { | |
| 196 | + retstr += " "; | |
| 197 | + } | |
| 198 | + retstr += "("; | |
| 199 | + try { | |
| 200 | + retstr += bodylist.get(realData[0x270]); | |
| 201 | + } catch (IndexOutOfBoundsException e) { | |
| 202 | + retstr += "?"; | |
| 203 | + } | |
| 204 | + retstr += ")"; | |
| 205 | + return retstr; | |
| 206 | + } | |
| 207 | + | |
| 208 | + /** | |
| 209 | + * OKEデータをダンプ | |
| 210 | + * @param basename ファイル名の基本名 | |
| 211 | + */ | |
| 212 | + public void dump(String basename) { | |
| 213 | + String filename; | |
| 214 | + filename = basename + "-" + okeno + ".bin"; | |
| 215 | + try { | |
| 216 | + FileOutputStream fos = new FileOutputStream(filename); | |
| 217 | + fos.write(realData); | |
| 218 | + fos.close(); | |
| 219 | + } catch (FileNotFoundException ex) { | |
| 220 | + Logger.getLogger(cheOkeData.class.getName()). | |
| 221 | + log(Level.SEVERE, null, ex); | |
| 222 | + } catch (IOException ex) { | |
| 223 | + Logger.getLogger(cheOkeData.class.getName()). | |
| 224 | + log(Level.SEVERE, null, ex); | |
| 225 | + } | |
| 226 | + } | |
| 227 | +} |
| @@ -0,0 +1,71 @@ | ||
| 1 | +package chexaformation; | |
| 2 | + | |
| 3 | +import java.awt.datatransfer.DataFlavor; | |
| 4 | +import java.awt.datatransfer.Transferable; | |
| 5 | +import java.awt.datatransfer.UnsupportedFlavorException; | |
| 6 | +import java.io.IOException; | |
| 7 | +import java.util.logging.Level; | |
| 8 | +import java.util.logging.Logger; | |
| 9 | +import javax.swing.Icon; | |
| 10 | +import javax.swing.JComponent; | |
| 11 | +import javax.swing.TransferHandler; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * | |
| 15 | + * @author fukui | |
| 16 | + */ | |
| 17 | +public class transTeamHandler extends TransferHandler { | |
| 18 | + | |
| 19 | + /** | |
| 20 | + * コンストラクタ | |
| 21 | + */ | |
| 22 | + public transTeamHandler() { | |
| 23 | + super(); | |
| 24 | + } | |
| 25 | + | |
| 26 | + @Override | |
| 27 | + public boolean canImport(JComponent comp, DataFlavor[] transferFlavors) { | |
| 28 | + int i; | |
| 29 | + DataFlavor df = new DataFlavor(cheTeamData.class, null); | |
| 30 | + for (i = 0; i < transferFlavors.length; i++) { | |
| 31 | + if (df.equals(transferFlavors[i]) == true) { | |
| 32 | + return true; | |
| 33 | + } | |
| 34 | + } | |
| 35 | + return false; | |
| 36 | + } | |
| 37 | + | |
| 38 | + @Override | |
| 39 | + public int getSourceActions(JComponent c) { | |
| 40 | + return COPY; | |
| 41 | + } | |
| 42 | + | |
| 43 | + @Override | |
| 44 | + public Icon getVisualRepresentation(Transferable t) { | |
| 45 | + cheTeamData team; | |
| 46 | + try { | |
| 47 | + team = (cheTeamData) t.getTransferData(new DataFlavor( | |
| 48 | + cheTeamData.class, null)); | |
| 49 | + if (team != null) { | |
| 50 | + return team.get_emblem().getImgicon(); | |
| 51 | + } | |
| 52 | + } catch (UnsupportedFlavorException ex) { | |
| 53 | + Logger.getLogger(transTeamHandler.class.getName()).log(Level.SEVERE, | |
| 54 | + null, ex); | |
| 55 | + } catch (IOException ex) { | |
| 56 | + Logger.getLogger(transTeamHandler.class.getName()).log(Level.SEVERE, | |
| 57 | + null, ex); | |
| 58 | + } | |
| 59 | + return null; | |
| 60 | + } | |
| 61 | + | |
| 62 | + @Override | |
| 63 | + protected Transferable createTransferable(JComponent c) { | |
| 64 | + mainForm mform = (mainForm) (c.getRootPane().getParent()); | |
| 65 | + cheTeamData team = mform.get_teamlist().get_current_team(); | |
| 66 | + if (team == null) { | |
| 67 | + return null; | |
| 68 | + } | |
| 69 | + return new transData(team); | |
| 70 | + } | |
| 71 | +} |
| @@ -0,0 +1,573 @@ | ||
| 1 | +package chexaformation; | |
| 2 | + | |
| 3 | +import java.io.FileInputStream; | |
| 4 | +import java.io.FileNotFoundException; | |
| 5 | +import java.io.FileOutputStream; | |
| 6 | +import java.io.IOException; | |
| 7 | +import java.io.UnsupportedEncodingException; | |
| 8 | +import java.util.Arrays; | |
| 9 | +import java.util.HashMap; | |
| 10 | +import java.util.logging.Level; | |
| 11 | +import java.util.logging.Logger; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * CHEファイルデータ | |
| 15 | + * @author fukui | |
| 16 | + */ | |
| 17 | +public class cheFile { | |
| 18 | + | |
| 19 | + static final int teamfile_size = 24512; | |
| 20 | + static final int matchfile_size = 266232; | |
| 21 | + static final int buffer_size = 327680; | |
| 22 | + static final byte teamfile_head[] = { | |
| 23 | + 0x43, 0x45, 0x54, 0x44, 0x1c, 0x00, 0x00, 0x00 | |
| 24 | + }; | |
| 25 | + static final byte matchfile_head[] = { | |
| 26 | + 0x43, 0x45, 0x4d, 0x44, 0x48, 0x01, 0x00, 0x00 | |
| 27 | + }; | |
| 28 | + static final byte file_version[] = { | |
| 29 | + 0x30, 0x2e, 0x30, 0x2e, 0x34, 0x34, 0x00, 0x00 | |
| 30 | + }; | |
| 31 | + static HashMap<String, cheFile> filelist; | |
| 32 | + String fname; | |
| 33 | + cheTeamData team[]; | |
| 34 | + cheOkeData oke[]; | |
| 35 | + boolean bteamfile; | |
| 36 | + int team_max; | |
| 37 | + int oke_max; | |
| 38 | + byte match_data[]; | |
| 39 | + | |
| 40 | + static { | |
| 41 | + filelist = new HashMap<String, cheFile>(); | |
| 42 | + } | |
| 43 | + | |
| 44 | + /** | |
| 45 | + * ファイルからデータを読み出し | |
| 46 | + * @return 正常にCHEファイルを読み出せたときにtrue | |
| 47 | + */ | |
| 48 | + private boolean inner_load() { | |
| 49 | + int i; | |
| 50 | + int nofs; | |
| 51 | + int read_size; | |
| 52 | + byte wk_buffer[] = new byte[buffer_size]; | |
| 53 | + try { | |
| 54 | + FileInputStream fin = new FileInputStream(fname); | |
| 55 | + read_size = fin.read(wk_buffer); | |
| 56 | + fin.close(); | |
| 57 | + } catch (FileNotFoundException ex) { | |
| 58 | + Logger.getLogger(cheFile.class.getName()).log(Level.SEVERE, null, | |
| 59 | + ex); | |
| 60 | + return false; | |
| 61 | + } catch (IOException ex) { | |
| 62 | + Logger.getLogger(cheFile.class.getName()).log(Level.SEVERE, null, | |
| 63 | + ex); | |
| 64 | + return false; | |
| 65 | + } | |
| 66 | + if (read_size == teamfile_size) { | |
| 67 | + for (i = 0; i < teamfile_head.length; i++) { | |
| 68 | + if (wk_buffer[i] != teamfile_head[i]) { | |
| 69 | + return false; | |
| 70 | + } | |
| 71 | + } | |
| 72 | + bteamfile = true; | |
| 73 | + team_max = 1; | |
| 74 | + oke_max = 3; | |
| 75 | + } else if (read_size == matchfile_size) { | |
| 76 | + for (i = 0; i < matchfile_head.length; i++) { | |
| 77 | + if (wk_buffer[i] != matchfile_head[i]) { | |
| 78 | + return false; | |
| 79 | + } | |
| 80 | + } | |
| 81 | + bteamfile = false; | |
| 82 | + team_max = 16; | |
| 83 | + oke_max = 32; | |
| 84 | + match_data = new byte[336]; | |
| 85 | + System.arraycopy(wk_buffer, 0x00000018, match_data, 0, 336); | |
| 86 | + } else { | |
| 87 | + return false; | |
| 88 | + } | |
| 89 | + team = new cheTeamData[team_max]; | |
| 90 | + oke = new cheOkeData[oke_max]; | |
| 91 | + nofs = (bteamfile == true) ? 0x00000370 : 0x0000368c; | |
| 92 | + for (i = 0; i < oke_max; i++, nofs += cheOkeData.datasize) { | |
| 93 | + oke[i] = new cheOkeData(i); | |
| 94 | + if (oke[i].load(wk_buffer, nofs) == false | |
| 95 | + || oke[i].get_flag() == 0) { | |
| 96 | + oke[i] = null; | |
| 97 | + } | |
| 98 | + } | |
| 99 | + nofs = (bteamfile == true) ? 0x00000030 : 0x0000028c; | |
| 100 | + for (i = 0; i < team_max; i++, nofs += cheTeamData.datasize) { | |
| 101 | + team[i] = new cheTeamData(wk_buffer, nofs, this); | |
| 102 | + if (team[i].is_enable() == false) { | |
| 103 | + team[i] = null; | |
| 104 | + } | |
| 105 | + } | |
| 106 | + return true; | |
| 107 | + } | |
| 108 | + | |
| 109 | + /** | |
| 110 | + * コンストラクタ | |
| 111 | + * @param s CHEファイル名 | |
| 112 | + */ | |
| 113 | + public cheFile(String s) { | |
| 114 | + fname = s; | |
| 115 | + bteamfile = true; | |
| 116 | + team_max = 0; | |
| 117 | + oke_max = 0; | |
| 118 | + } | |
| 119 | + | |
| 120 | + /** | |
| 121 | + * コンストラクタ | |
| 122 | + */ | |
| 123 | + public cheFile() { | |
| 124 | + fname = "NEWDATA.CHE"; | |
| 125 | + team_max = 1; | |
| 126 | + oke_max = 3; | |
| 127 | + bteamfile = true; | |
| 128 | + team = new cheTeamData[team_max]; | |
| 129 | + oke = new cheOkeData[oke_max]; | |
| 130 | + } | |
| 131 | + | |
| 132 | + /** | |
| 133 | + * ファイルからデータを読みだす | |
| 134 | + * @return 正常に読み込めたときにtrue | |
| 135 | + */ | |
| 136 | + public boolean load() { | |
| 137 | + bteamfile = true; | |
| 138 | + team_max = 0; | |
| 139 | + oke_max = 0; | |
| 140 | + if (inner_load() == true) { | |
| 141 | + filelist.put(fname, this); | |
| 142 | + return true; | |
| 143 | + } else { | |
| 144 | + return false; | |
| 145 | + } | |
| 146 | + } | |
| 147 | + | |
| 148 | + /** | |
| 149 | + * ファイルへデータを保存 | |
| 150 | + * @return 正常に保存できたときにtrue | |
| 151 | + */ | |
| 152 | + public boolean save() { | |
| 153 | + int i; | |
| 154 | + int real_team_count; | |
| 155 | + int real_oke_count; | |
| 156 | + int nofs; | |
| 157 | + int write_size; | |
| 158 | + byte[] wk_buffer; | |
| 159 | + if (team_max == 0) { | |
| 160 | + return false; | |
| 161 | + } | |
| 162 | + write_size = (bteamfile == true) ? teamfile_size : matchfile_size; | |
| 163 | + wk_buffer = new byte[write_size]; | |
| 164 | + if (bteamfile == true) { | |
| 165 | + System.arraycopy(teamfile_head, 0, wk_buffer, 0, | |
| 166 | + teamfile_head.length); | |
| 167 | + System.arraycopy(file_version, 0, wk_buffer, 0x00005fb0, | |
| 168 | + file_version.length); | |
| 169 | + } else { | |
| 170 | + System.arraycopy(matchfile_head, 0, wk_buffer, 0, | |
| 171 | + matchfile_head.length); | |
| 172 | + System.arraycopy(file_version, 0, wk_buffer, 0x00000008, | |
| 173 | + file_version.length); | |
| 174 | + } | |
| 175 | + real_oke_count = 0; | |
| 176 | + nofs = (bteamfile == true) ? 0x00000370 : 0x0000368c; | |
| 177 | + for (i = 0; i < oke_max; i++, nofs += cheOkeData.datasize) { | |
| 178 | + if (oke[i] != null && oke[i].get_flag() != 0) { | |
| 179 | + if (oke[i].save(wk_buffer, nofs) == true) { | |
| 180 | + real_oke_count++; | |
| 181 | + } | |
| 182 | + } | |
| 183 | + } | |
| 184 | + real_team_count = 0; | |
| 185 | + nofs = (bteamfile == true) ? 0x00000030 : 0x0000028c; | |
| 186 | + for (i = 0; i < team_max; i++, nofs += cheTeamData.datasize) { | |
| 187 | + if (team[i] != null && team[i].is_enable() == true) { | |
| 188 | + if (team[i].save(wk_buffer, nofs) == true) { | |
| 189 | + real_team_count++; | |
| 190 | + } | |
| 191 | + } | |
| 192 | + } | |
| 193 | + if (bteamfile == true) { | |
| 194 | + long checksum = 0; | |
| 195 | + for (nofs = 0; nofs < 0x00005fb8; nofs++) { | |
| 196 | + checksum += wk_buffer[nofs]; | |
| 197 | + } | |
| 198 | + wk_buffer[nofs++] = (byte) (checksum & 0xff); | |
| 199 | + wk_buffer[nofs++] = (byte) (checksum >> 8); | |
| 200 | + wk_buffer[nofs++] = (byte) (checksum >> 16); | |
| 201 | + wk_buffer[nofs++] = (byte) (checksum >> 24); | |
| 202 | + } else { | |
| 203 | + System.arraycopy(match_data, 0, wk_buffer, 0x00000018, 336); | |
| 204 | + nofs = 0x00000034; | |
| 205 | + wk_buffer[nofs++] = (byte) (real_team_count & 0xff); | |
| 206 | + wk_buffer[nofs++] = (byte) (real_team_count >> 8); | |
| 207 | + wk_buffer[nofs++] = (byte) (real_team_count >> 16); | |
| 208 | + wk_buffer[nofs++] = (byte) (real_team_count >> 24); | |
| 209 | + wk_buffer[nofs++] = (byte) (real_oke_count & 0xff); | |
| 210 | + wk_buffer[nofs++] = (byte) (real_oke_count >> 8); | |
| 211 | + wk_buffer[nofs++] = (byte) (real_oke_count >> 16); | |
| 212 | + wk_buffer[nofs++] = (byte) (real_oke_count >> 24); | |
| 213 | + nofs = 0x00000184; | |
| 214 | + wk_buffer[nofs++] = (byte) (real_team_count & 0xff); | |
| 215 | + wk_buffer[nofs++] = (byte) (real_team_count >> 8); | |
| 216 | + wk_buffer[nofs++] = (byte) (real_team_count >> 16); | |
| 217 | + wk_buffer[nofs++] = (byte) (real_team_count >> 24); | |
| 218 | + wk_buffer[nofs++] = (byte) (real_oke_count & 0xff); | |
| 219 | + wk_buffer[nofs++] = (byte) (real_oke_count >> 8); | |
| 220 | + wk_buffer[nofs++] = (byte) (real_oke_count >> 16); | |
| 221 | + wk_buffer[nofs++] = (byte) (real_oke_count >> 24); | |
| 222 | + } | |
| 223 | + try { | |
| 224 | + FileOutputStream fout = new FileOutputStream(fname); | |
| 225 | + fout.write(wk_buffer); | |
| 226 | + fout.close(); | |
| 227 | + } catch (FileNotFoundException ex) { | |
| 228 | + Logger.getLogger(cheFile.class.getName()).log(Level.SEVERE, null, | |
| 229 | + ex); | |
| 230 | + } catch (IOException ex) { | |
| 231 | + Logger.getLogger(cheFile.class.getName()).log(Level.SEVERE, null, | |
| 232 | + ex); | |
| 233 | + } | |
| 234 | + return true; | |
| 235 | + } | |
| 236 | + | |
| 237 | + /** | |
| 238 | + * チーム数を取得 | |
| 239 | + * @return チーム数 | |
| 240 | + */ | |
| 241 | + public int get_team_max() { | |
| 242 | + return team_max; | |
| 243 | + } | |
| 244 | + | |
| 245 | + /** | |
| 246 | + * OKE数を取得 | |
| 247 | + * @return OKE数 | |
| 248 | + */ | |
| 249 | + public int get_oke_max() { | |
| 250 | + return oke_max; | |
| 251 | + } | |
| 252 | + | |
| 253 | + /** | |
| 254 | + * ファイル名の取得 | |
| 255 | + * @return ファイル名 | |
| 256 | + */ | |
| 257 | + public String get_fname() { | |
| 258 | + return fname; | |
| 259 | + } | |
| 260 | + | |
| 261 | + /** | |
| 262 | + * ファイル名の設定 | |
| 263 | + * @param s ファイル名 | |
| 264 | + */ | |
| 265 | + public void set_fname(String s) { | |
| 266 | + fname = s; | |
| 267 | + } | |
| 268 | + | |
| 269 | + /** | |
| 270 | + * チームデータの取得 | |
| 271 | + * @param nidx インデックス | |
| 272 | + * @return チームデータ | |
| 273 | + */ | |
| 274 | + public cheTeamData get_team(int nidx) { | |
| 275 | + if (nidx < 0 || nidx >= team_max) { | |
| 276 | + return null; | |
| 277 | + } | |
| 278 | + return team[nidx]; | |
| 279 | + } | |
| 280 | + | |
| 281 | + /** | |
| 282 | + * チームデータの設定 | |
| 283 | + * @param nidx インデックス | |
| 284 | + * @param p チームデータ | |
| 285 | + * @return 正常に設定できたときにtrue | |
| 286 | + */ | |
| 287 | + public boolean set_team(int nidx, cheTeamData p) { | |
| 288 | + int i; | |
| 289 | + cheOkeData ulist[]; | |
| 290 | + if (nidx < 0 || nidx >= team_max) { | |
| 291 | + return false; | |
| 292 | + } | |
| 293 | + if (team[nidx] != null) { | |
| 294 | + //既存チームの消去 | |
| 295 | + team[nidx] = null; | |
| 296 | + gc_oke(); | |
| 297 | + } | |
| 298 | + team[nidx] = new cheTeamData(); | |
| 299 | + p.copy(team[nidx]); | |
| 300 | + ulist = p.get_unique_member(); | |
| 301 | + for (i = 0; i < 3; i++) { | |
| 302 | + if (ulist[i] != null) { | |
| 303 | + if (add_oke(ulist[i]) == null) { | |
| 304 | + team[nidx] = null; | |
| 305 | + gc_oke(); | |
| 306 | + return false; | |
| 307 | + } | |
| 308 | + } | |
| 309 | + } | |
| 310 | + for (i = 0; i < 3; i++) { | |
| 311 | + cheOkeData wk_oke = p.get_member(i); | |
| 312 | + if (wk_oke != null) { | |
| 313 | + int j = search_oke(wk_oke); | |
| 314 | + if (j != -1) { | |
| 315 | + team[nidx].set_member(i, oke[j]); | |
| 316 | + } else { | |
| 317 | + team[nidx].set_member(i, null); | |
| 318 | + } | |
| 319 | + } | |
| 320 | + } | |
| 321 | + return true; | |
| 322 | + } | |
| 323 | + | |
| 324 | + /** | |
| 325 | + * チームデータの削除 | |
| 326 | + * @param nidx インデックス | |
| 327 | + */ | |
| 328 | + public void remove_team(int nidx) { | |
| 329 | + if (nidx < 0 || nidx >= team_max) { | |
| 330 | + return; | |
| 331 | + } | |
| 332 | + team[nidx] = null; | |
| 333 | + gc_oke(); | |
| 334 | + } | |
| 335 | + | |
| 336 | + /** | |
| 337 | + * チームデータの移動 | |
| 338 | + * 移動先が空ではない時には挿入 | |
| 339 | + * @param src 移動元インデックス | |
| 340 | + * @param dest 移動先インデックス | |
| 341 | + */ | |
| 342 | + public void move_team(int src, int dest) { | |
| 343 | + if (src < 0 || src >= team_max || dest < 0 || dest >= team_max | |
| 344 | + || src == dest) { | |
| 345 | + return; | |
| 346 | + } | |
| 347 | + if (team[dest] == null) { | |
| 348 | + team[dest] = team[src]; | |
| 349 | + team[src] = null; | |
| 350 | + } else { | |
| 351 | + int i; | |
| 352 | + cheTeamData wkteam = team[src]; | |
| 353 | + for (i = src; i < team_max - 2; i++) { | |
| 354 | + team[i] = team[i + 1]; | |
| 355 | + } | |
| 356 | + team[i] = null; | |
| 357 | + for (i = team_max - 1; i > dest; i--) { | |
| 358 | + team[i] = team[i - 1]; | |
| 359 | + } | |
| 360 | + team[dest] = wkteam; | |
| 361 | + } | |
| 362 | + gc_oke(); | |
| 363 | + } | |
| 364 | + | |
| 365 | + /** | |
| 366 | + * OKEの取得 | |
| 367 | + * @param nidx インデックス | |
| 368 | + * @return OKEデータ | |
| 369 | + */ | |
| 370 | + public cheOkeData get_oke(int nidx) { | |
| 371 | + if (nidx < 0 || nidx >= oke_max) { | |
| 372 | + return null; | |
| 373 | + } | |
| 374 | + return oke[nidx]; | |
| 375 | + } | |
| 376 | + | |
| 377 | + /** | |
| 378 | + * OKEデータの設定 | |
| 379 | + * @param nidx インデックス | |
| 380 | + * @param p OKEデータ | |
| 381 | + */ | |
| 382 | + public void set_oke(int nidx, cheOkeData p) { | |
| 383 | + if (nidx < 0 || nidx >= oke_max) { | |
| 384 | + return; | |
| 385 | + } | |
| 386 | + oke[nidx] = p; | |
| 387 | + } | |
| 388 | + | |
| 389 | + /** | |
| 390 | + * 指定したOKEデータと同じ内容の登録済みデータを検索 | |
| 391 | + * @param p OKEデータ | |
| 392 | + * @return 発見したインデックス。見つからない場合-1 | |
| 393 | + */ | |
| 394 | + public int search_oke(cheOkeData p) { | |
| 395 | + int i; | |
| 396 | + for (i = 0; i < oke_max; i++) { | |
| 397 | + if (oke[i] != null && oke[i].equals(p) == true) { | |
| 398 | + return i; | |
| 399 | + } | |
| 400 | + } | |
| 401 | + return -1; | |
| 402 | + } | |
| 403 | + | |
| 404 | + /** | |
| 405 | + * OKEデータを追加 | |
| 406 | + * @param p OKEデータ | |
| 407 | + * @return 正常に追加できたときにOKEデータ。 | |
| 408 | + * 失敗したときにはnull | |
| 409 | + */ | |
| 410 | + public cheOkeData add_oke(cheOkeData p) { | |
| 411 | + int i; | |
| 412 | + i = search_oke(p); | |
| 413 | + if (i != -1) { | |
| 414 | + return oke[i]; | |
| 415 | + } | |
| 416 | + for (i = 0; i < oke_max; i++) { | |
| 417 | + if (oke[i] == null) { | |
| 418 | + oke[i] = new cheOkeData(i); | |
| 419 | + p.copy(oke[i]); | |
| 420 | + return oke[i]; | |
| 421 | + } | |
| 422 | + } | |
| 423 | + return null; | |
| 424 | + } | |
| 425 | + | |
| 426 | + /** | |
| 427 | + * マッチデータ名称を取得 | |
| 428 | + * @return マッチデータ名。マッチデータではない場合null | |
| 429 | + */ | |
| 430 | + public String get_match_name() { | |
| 431 | + if (match_data != null) { | |
| 432 | + byte work[] = new byte[28]; | |
| 433 | + int nlen; | |
| 434 | + for (nlen = 0; nlen < 28; nlen++) { | |
| 435 | + work[nlen] = match_data[nlen]; | |
| 436 | + if (work[nlen] == 0) { | |
| 437 | + break; | |
| 438 | + } | |
| 439 | + } | |
| 440 | + try { | |
| 441 | + return new String(work, 0, nlen, "SJIS"); | |
| 442 | + } catch (UnsupportedEncodingException ex) { | |
| 443 | + Logger.getLogger(cheFile.class.getName()).log(Level.SEVERE, | |
| 444 | + null, ex); | |
| 445 | + return new String(); | |
| 446 | + } | |
| 447 | + } | |
| 448 | + return null; | |
| 449 | + } | |
| 450 | + | |
| 451 | + /** | |
| 452 | + * マッチデータ名称を設定 | |
| 453 | + * @param s マッチデータ名 | |
| 454 | + */ | |
| 455 | + public void set_match_name(String s) { | |
| 456 | + if (match_data != null) { | |
| 457 | + byte work[]; | |
| 458 | + int ncpy; | |
| 459 | + try { | |
| 460 | + work = s.getBytes("SJIS"); | |
| 461 | + ncpy = work.length; | |
| 462 | + if (ncpy > 28) { | |
| 463 | + ncpy = 28; | |
| 464 | + } | |
| 465 | + Arrays.fill(match_data, 0, 27, (byte) 0); | |
| 466 | + System.arraycopy(work, 0, match_data, 0, ncpy); | |
| 467 | + System.arraycopy(work, 0, match_data, 0x00000168, ncpy); | |
| 468 | + } catch (UnsupportedEncodingException ex) { | |
| 469 | + Logger.getLogger(cheFile.class.getName()).log(Level.SEVERE, | |
| 470 | + null, ex); | |
| 471 | + } | |
| 472 | + } | |
| 473 | + } | |
| 474 | + | |
| 475 | + /** | |
| 476 | + * マッチ設定データを取得 | |
| 477 | + * @return マッチ設定(336byte)。マッチデータではない場合null | |
| 478 | + */ | |
| 479 | + public byte[] get_match_data() { | |
| 480 | + if (match_data != null) { | |
| 481 | + byte p[] = new byte[336]; | |
| 482 | + System.arraycopy(match_data, 0, p, 0, 336); | |
| 483 | + return p; | |
| 484 | + } | |
| 485 | + return null; | |
| 486 | + } | |
| 487 | + | |
| 488 | + /** | |
| 489 | + * マッチ設定データを設定 | |
| 490 | + * @param p マッチ設定(336byte) | |
| 491 | + * @return 正常に設定できたときtrue | |
| 492 | + */ | |
| 493 | + public boolean set_match_data(byte p[]) { | |
| 494 | + if (match_data != null) { | |
| 495 | + if (p.length >= 336) { | |
| 496 | + System.arraycopy(p, 0, match_data, 0, 336); | |
| 497 | + return true; | |
| 498 | + } else { | |
| 499 | + return false; | |
| 500 | + } | |
| 501 | + } | |
| 502 | + return false; | |
| 503 | + } | |
| 504 | + | |
| 505 | + /** | |
| 506 | + * チームに登録されていないOKEデータを消去 | |
| 507 | + */ | |
| 508 | + public void gc_oke() { | |
| 509 | + if (oke_max > 0) { | |
| 510 | + int i; | |
| 511 | + boolean bflag[] = new boolean[oke_max]; | |
| 512 | + Arrays.fill(bflag, false); | |
| 513 | + for (i = 0; i < team_max; i++) { | |
| 514 | + if (team[i] != null) { | |
| 515 | + int j; | |
| 516 | + cheOkeData ulist[] = team[i].get_unique_member(); | |
| 517 | + for (j = 0; j < 3; j++) { | |
| 518 | + if (ulist[j] != null) { | |
| 519 | + int idx = search_oke(ulist[j]); | |
| 520 | + if (idx != -1) { | |
| 521 | + bflag[idx] = true; | |
| 522 | + } | |
| 523 | + } | |
| 524 | + } | |
| 525 | + } | |
| 526 | + } | |
| 527 | + for (i = 0; i < oke_max; i++) { | |
| 528 | + if (oke[i] != null && bflag[i] == false) { | |
| 529 | + oke[i] = null; | |
| 530 | + } | |
| 531 | + } | |
| 532 | + } | |
| 533 | + } | |
| 534 | + | |
| 535 | + /** | |
| 536 | + * OKEデータを消去(同時にチームデータも消去) | |
| 537 | + */ | |
| 538 | + public void clear_oke() { | |
| 539 | + clear_team(); | |
| 540 | + Arrays.fill(oke, null); | |
| 541 | + } | |
| 542 | + | |
| 543 | + /** | |
| 544 | + * チームデータを消去 | |
| 545 | + */ | |
| 546 | + public void clear_team() { | |
| 547 | + Arrays.fill(team, null); | |
| 548 | + } | |
| 549 | + | |
| 550 | + /** | |
| 551 | + * チームデータかどうかを取得 | |
| 552 | + * @return チームデータの時にtrue | |
| 553 | + */ | |
| 554 | + public boolean is_teamfile() { | |
| 555 | + return bteamfile; | |
| 556 | + } | |
| 557 | + | |
| 558 | + /** | |
| 559 | + * ファイル名に対応するCHEファイルデータを取得 | |
| 560 | + * @param s ファイル名 | |
| 561 | + * @return CHEファイルデータ。見つからない場合にnull | |
| 562 | + */ | |
| 563 | + static public cheFile get_che(String s) { | |
| 564 | + return filelist.get(s); | |
| 565 | + } | |
| 566 | + | |
| 567 | + /** | |
| 568 | + * 登録済みCHEファイルデータを消去 | |
| 569 | + */ | |
| 570 | + static public void clear_che() { | |
| 571 | + filelist.clear(); | |
| 572 | + } | |
| 573 | +} |
| @@ -0,0 +1,35 @@ | ||
| 1 | +package chexaformation; | |
| 2 | + | |
| 3 | +import javax.swing.text.AttributeSet; | |
| 4 | +import javax.swing.text.BadLocationException; | |
| 5 | +import javax.swing.text.PlainDocument; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * 名称データ | |
| 9 | + * @author fukui | |
| 10 | + */ | |
| 11 | +public class cheNameDocument extends PlainDocument { | |
| 12 | + | |
| 13 | + /** | |
| 14 | + * コンストラクタ | |
| 15 | + */ | |
| 16 | + public cheNameDocument() { | |
| 17 | + } | |
| 18 | + | |
| 19 | + @Override | |
| 20 | + public void insertString(int offs, String str, AttributeSet a) | |
| 21 | + throws BadLocationException { | |
| 22 | + if (str == null) { | |
| 23 | + return; | |
| 24 | + } | |
| 25 | + int i; | |
| 26 | + char[] wkbuffer = str.toCharArray(); | |
| 27 | + for (i = 0; i < wkbuffer.length; i++) { | |
| 28 | + if ((wkbuffer[i] & 0xff) == wkbuffer[i]) { | |
| 29 | + //SJISにするとシングルバイトになるかも | |
| 30 | + wkbuffer[i] = ' '; | |
| 31 | + } | |
| 32 | + } | |
| 33 | + super.insertString(offs, new String(wkbuffer), a); | |
| 34 | + } | |
| 35 | +} |
| @@ -0,0 +1,580 @@ | ||
| 1 | +package chexaformation; | |
| 2 | + | |
| 3 | +import java.io.File; | |
| 4 | +import java.io.UnsupportedEncodingException; | |
| 5 | +import java.util.Calendar; | |
| 6 | +import java.util.logging.Level; | |
| 7 | +import java.util.logging.Logger; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * チームデータ | |
| 11 | + * @author fukui | |
| 12 | + */ | |
| 13 | +public class cheTeamData { | |
| 14 | + | |
| 15 | + static public final int datasize = 832; | |
| 16 | + File data_name; | |
| 17 | + cheOkeData oke[]; | |
| 18 | + int position[]; | |
| 19 | + cheEmblem emblem; | |
| 20 | + String team_name; | |
| 21 | + String owner_name; | |
| 22 | + int year; | |
| 23 | + int month; | |
| 24 | + int day; | |
| 25 | + int rating; | |
| 26 | + boolean benable; | |
| 27 | + | |
| 28 | + /** | |
| 29 | + * データの読み込み | |
| 30 | + * @param s 読み込み元データポインタ | |
| 31 | + * @param nofs 読み込み元オフセット | |
| 32 | + * @param che CHEファイルデータ | |
| 33 | + * @return | |
| 34 | + */ | |
| 35 | + private boolean inner_load(byte s[], int nofs, cheFile che) { | |
| 36 | + byte[] work = new byte[39]; | |
| 37 | + int nlen; | |
| 38 | + int i; | |
| 39 | + if (nofs + datasize > s.length) { | |
| 40 | + return false; | |
| 41 | + } | |
| 42 | + data_name = new File(che.get_fname()); | |
| 43 | + if (s[nofs] == 0 && s[nofs + 1] == 0 | |
| 44 | + && s[nofs + 2] == 0 && s[nofs + 3] == 0) { | |
| 45 | + return true; | |
| 46 | + } | |
| 47 | + try { | |
| 48 | + for (nlen = 0; nlen < 25; nlen++) { | |
| 49 | + work[nlen] = s[nofs + 592 + nlen]; | |
| 50 | + if (work[nlen] == 0) { | |
| 51 | + break; | |
| 52 | + } | |
| 53 | + } | |
| 54 | + team_name = new String(work, 0, nlen, "SJIS"); | |
| 55 | + for (nlen = 0; nlen < 39; nlen++) { | |
| 56 | + work[nlen] = s[nofs + 617 + nlen]; | |
| 57 | + if (work[nlen] == 0) { | |
| 58 | + break; | |
| 59 | + } | |
| 60 | + } | |
| 61 | + owner_name = new String(work, 0, nlen, "SJIS"); | |
| 62 | + } catch (UnsupportedEncodingException ex) { | |
| 63 | + Logger.getLogger(cheTeamData.class.getName()).log(Level.SEVERE, | |
| 64 | + null, ex); | |
| 65 | + } | |
| 66 | + emblem.load(s, nofs + 16); | |
| 67 | + year = ((int) s[nofs + 800] & 255) | |
| 68 | + | (((int) s[nofs + 801] & 255) << 8); | |
| 69 | + month = ((int) s[nofs + 802] & 255) | |
| 70 | + | (((int) s[nofs + 803] & 255) << 8); | |
| 71 | + day = ((int) s[nofs + 804] & 255) | |
| 72 | + | (((int) s[nofs + 805] & 255) << 8); | |
| 73 | + rating = (int) s[nofs + 824] & 255; | |
| 74 | + rating += ((int) s[nofs + 825] & 255) << 8; | |
| 75 | + rating += ((int) s[nofs + 826] & 255) << 16; | |
| 76 | + rating += ((int) s[nofs + 827] & 255) << 24; | |
| 77 | + for (i = 0; i < 3; i++) { | |
| 78 | + int okeno; | |
| 79 | + okeno = (int) s[nofs + 688 + i * 48] & 255; | |
| 80 | + if (okeno >= 0 && okeno < che.get_oke_max()) { | |
| 81 | + oke[i] = che.get_oke(okeno); | |
| 82 | + position[i] = (int) s[nofs + 692 + i * 48] & 255; | |
| 83 | + } else { | |
| 84 | + oke[i] = null; | |
| 85 | + position[i] = -1; | |
| 86 | + } | |
| 87 | + } | |
| 88 | + benable = true; | |
| 89 | + return true; | |
| 90 | + } | |
| 91 | + | |
| 92 | + /** | |
| 93 | + * コンストラクタ | |
| 94 | + */ | |
| 95 | + public cheTeamData() { | |
| 96 | + Calendar nowDate = Calendar.getInstance(); | |
| 97 | + oke = new cheOkeData[3]; | |
| 98 | + position = new int[3]; | |
| 99 | + position[0] = -1; | |
| 100 | + position[1] = -1; | |
| 101 | + position[2] = -1; | |
| 102 | + team_name = "チーム"; | |
| 103 | + owner_name = "プレイヤー"; | |
| 104 | + emblem = new cheEmblem(); | |
| 105 | + year = nowDate.get(Calendar.YEAR); | |
| 106 | + month = nowDate.get(Calendar.MONTH); | |
| 107 | + day = nowDate.get(Calendar.DAY_OF_MONTH); | |
| 108 | + rating = 1000; | |
| 109 | + benable = true; | |
| 110 | + } | |
| 111 | + | |
| 112 | + /** | |
| 113 | + * コンストラクタ | |
| 114 | + * @param s 読み込み元データポインタ | |
| 115 | + * @param nofs 読み込み元オフセット | |
| 116 | + * @param che CHEデータ | |
| 117 | + */ | |
| 118 | + public cheTeamData(byte s[], int nofs, cheFile che) { | |
| 119 | + oke = new cheOkeData[3]; | |
| 120 | + position = new int[3]; | |
| 121 | + benable = false; | |
| 122 | + emblem = new cheEmblem(); | |
| 123 | + inner_load(s, nofs, che); | |
| 124 | + } | |
| 125 | + | |
| 126 | + /** | |
| 127 | + * チームデータのコピー | |
| 128 | + * @param p コピー先チームデータ | |
| 129 | + */ | |
| 130 | + public void copy(cheTeamData p) { | |
| 131 | + p.team_name = team_name; | |
| 132 | + p.owner_name = owner_name; | |
| 133 | + p.emblem = emblem; | |
| 134 | + p.year = year; | |
| 135 | + p.month = month; | |
| 136 | + p.day = day; | |
| 137 | + p.rating = rating; | |
| 138 | + System.arraycopy(position, 0, p.position, 0, 3); | |
| 139 | + System.arraycopy(oke, 0, p.oke, 0, 3); | |
| 140 | + p.benable = benable; | |
| 141 | + p.data_name = data_name; | |
| 142 | + } | |
| 143 | + | |
| 144 | + /** | |
| 145 | + * チームデータの読み込み | |
| 146 | + * @param s 読み込み元データポインタ | |
| 147 | + * @param nofs 読み込み元オフセット | |
| 148 | + * @param che CHEデータ | |
| 149 | + * @return | |
| 150 | + */ | |
| 151 | + public boolean load(byte s[], int nofs, cheFile che) { | |
| 152 | + return inner_load(s, nofs, che); | |
| 153 | + } | |
| 154 | + | |
| 155 | + /** | |
| 156 | + * チームデータの保存 | |
| 157 | + * @param s 保存先データポインタ | |
| 158 | + * @param nofs 保存先オフセット | |
| 159 | + * @return 正常に保存できたときにtrue | |
| 160 | + */ | |
| 161 | + public boolean save(byte s[], int nofs) { | |
| 162 | + byte work[]; | |
| 163 | + int i; | |
| 164 | + if (nofs + datasize > s.length) { | |
| 165 | + return false; | |
| 166 | + } | |
| 167 | + for (i = 0; i < datasize; i++) { | |
| 168 | + s[nofs + i] = 0; | |
| 169 | + } | |
| 170 | + s[nofs] = 2; | |
| 171 | + try { | |
| 172 | + int ncpy; | |
| 173 | + work = team_name.getBytes("SJIS"); | |
| 174 | + ncpy = work.length; | |
| 175 | + if (ncpy > 24) { | |
| 176 | + ncpy = 24; | |
| 177 | + } | |
| 178 | + System.arraycopy(work, 0, s, nofs + 592, ncpy); | |
| 179 | + work = owner_name.getBytes("SJIS"); | |
| 180 | + ncpy = work.length; | |
| 181 | + if (ncpy > 38) { | |
| 182 | + ncpy = 38; | |
| 183 | + } | |
| 184 | + System.arraycopy(work, 0, s, nofs + 617, ncpy); | |
| 185 | + } catch (UnsupportedEncodingException ex) { | |
| 186 | + Logger.getLogger(cheTeamData.class.getName()).log(Level.SEVERE, | |
| 187 | + null, ex); | |
| 188 | + } | |
| 189 | + emblem.save(s, nofs + 16); | |
| 190 | + s[nofs + 800] = (byte) (year & 0xff); | |
| 191 | + s[nofs + 801] = (byte) (year >> 8); | |
| 192 | + s[nofs + 802] = (byte) (month & 0xff); | |
| 193 | + s[nofs + 803] = (byte) (month >> 8); | |
| 194 | + s[nofs + 804] = (byte) (day & 0xff); | |
| 195 | + s[nofs + 805] = (byte) (day >> 8); | |
| 196 | + s[nofs + 824] = (byte) (rating & 0xff); | |
| 197 | + s[nofs + 825] = (byte) (rating >> 8); | |
| 198 | + s[nofs + 826] = (byte) (rating >> 16); | |
| 199 | + s[nofs + 827] = (byte) (rating >> 24); | |
| 200 | + for (i = 0; i < 3; i++) { | |
| 201 | + if (oke[i] != null && position[i] != -1) { | |
| 202 | + int noke = oke[i].get_no(); | |
| 203 | + s[nofs + 688 + i * 48] = (byte) (noke & 0xff); | |
| 204 | + s[nofs + 689 + i * 48] = (byte) (noke >> 8); | |
| 205 | + s[nofs + 690 + i * 48] = (byte) (noke >> 16); | |
| 206 | + s[nofs + 691 + i * 48] = (byte) (noke >> 24); | |
| 207 | + s[nofs + 692 + i * 48] = (byte) (position[i] & 0xff); | |
| 208 | + s[nofs + 693 + i * 48] = (byte) (position[i] >> 8); | |
| 209 | + s[nofs + 694 + i * 48] = (byte) (position[i] >> 16); | |
| 210 | + s[nofs + 695 + i * 48] = (byte) (position[i] >> 24); | |
| 211 | + } else { | |
| 212 | + s[nofs + 688 + i * 48] = (byte) 0xff; | |
| 213 | + s[nofs + 689 + i * 48] = (byte) 0xff; | |
| 214 | + s[nofs + 690 + i * 48] = (byte) 0xff; | |
| 215 | + s[nofs + 691 + i * 48] = (byte) 0xff; | |
| 216 | + s[nofs + 692 + i * 48] = (byte) 0xff; | |
| 217 | + s[nofs + 693 + i * 48] = (byte) 0xff; | |
| 218 | + s[nofs + 694 + i * 48] = (byte) 0xff; | |
| 219 | + s[nofs + 695 + i * 48] = (byte) 0xff; | |
| 220 | + } | |
| 221 | + } | |
| 222 | + return true; | |
| 223 | + } | |
| 224 | + | |
| 225 | + /** | |
| 226 | + * 指定された位置が利用可能かどうかをチェック | |
| 227 | + * @param nidx チェック元OKE番号 | |
| 228 | + * @param npos 配置場所ID | |
| 229 | + * @return 配置できるときにtrue | |
| 230 | + */ | |
| 231 | + public boolean check_position(int nidx, int npos) { | |
| 232 | + int i; | |
| 233 | + for (i = 0; i < 3; i++) { | |
| 234 | + if (nidx == i) { | |
| 235 | + continue; | |
| 236 | + } | |
| 237 | + if (position[i] == npos) { | |
| 238 | + return false; | |
| 239 | + } | |
| 240 | + } | |
| 241 | + return true; | |
| 242 | + } | |
| 243 | + | |
| 244 | + /** | |
| 245 | + * OKEデータを追加する | |
| 246 | + * @param nidx 追加位置 | |
| 247 | + * @param p OKEデータ | |
| 248 | + * @param npos 配置場所ID | |
| 249 | + * @return 正常に追加できたときにtrue | |
| 250 | + */ | |
| 251 | + public boolean add_member(int nidx, cheOkeData p, int npos) { | |
| 252 | + if (nidx < 0 || nidx > 2) { | |
| 253 | + return false; | |
| 254 | + } | |
| 255 | + if (npos != -1 && check_position(nidx, npos) == false) { | |
| 256 | + //reposition OKE | |
| 257 | + int i; | |
| 258 | + for (i = 0; i < 2; i++) { | |
| 259 | + npos += 3; | |
| 260 | + npos %= 9; | |
| 261 | + if (check_position(nidx, npos) == true) { | |
| 262 | + break; | |
| 263 | + } | |
| 264 | + } | |
| 265 | + } | |
| 266 | + oke[nidx] = p; | |
| 267 | + if (npos < 0 || npos > 8) { | |
| 268 | + position[nidx] = -1; | |
| 269 | + } else { | |
| 270 | + position[nidx] = npos; | |
| 271 | + } | |
| 272 | + return true; | |
| 273 | + } | |
| 274 | + | |
| 275 | + /** | |
| 276 | + * OKEデータの削除 | |
| 277 | + * @param nidx OKE番号 | |
| 278 | + * @return | |
| 279 | + */ | |
| 280 | + public boolean del_member(int nidx) { | |
| 281 | + if (nidx < 0 || nidx > 2) { | |
| 282 | + return false; | |
| 283 | + } | |
| 284 | + oke[nidx] = null; | |
| 285 | + position[nidx] = -1; | |
| 286 | + return true; | |
| 287 | + } | |
| 288 | + | |
| 289 | + /** | |
| 290 | + * OKEデータの取得 | |
| 291 | + * @param nidx OKE番号 | |
| 292 | + * @return OKEデータ。範囲外もしくは存在しないときにnull | |
| 293 | + */ | |
| 294 | + public cheOkeData get_member(int nidx) { | |
| 295 | + if (nidx < 0 || nidx > 2) { | |
| 296 | + return null; | |
| 297 | + } | |
| 298 | + return oke[nidx]; | |
| 299 | + } | |
| 300 | + | |
| 301 | + /** | |
| 302 | + * OKEデータの設定 | |
| 303 | + * @param nidx OKE番号 | |
| 304 | + * @param p OKEデータ | |
| 305 | + */ | |
| 306 | + public void set_member(int nidx, cheOkeData p) { | |
| 307 | + if (nidx < 0 || nidx > 2) { | |
| 308 | + return; | |
| 309 | + } | |
| 310 | + oke[nidx] = p; | |
| 311 | + } | |
| 312 | + | |
| 313 | + /** | |
| 314 | + * ユニークなOKEデータ一覧を取得 | |
| 315 | + * @return OKEデータ配列 | |
| 316 | + */ | |
| 317 | + public cheOkeData[] get_unique_member() { | |
| 318 | + int i; | |
| 319 | + cheOkeData[] unique_list = new cheOkeData[3]; | |
| 320 | + i = 0; | |
| 321 | + unique_list[i++] = oke[0]; | |
| 322 | + if (oke[1] != null) { | |
| 323 | + if (oke[0] != oke[1]) { | |
| 324 | + unique_list[i++] = oke[1]; | |
| 325 | + } | |
| 326 | + } | |
| 327 | + if (oke[2] != null) { | |
| 328 | + if (oke[0] != oke[2] && oke[1] != oke[2]) { | |
| 329 | + unique_list[i++] = oke[2]; | |
| 330 | + } | |
| 331 | + } | |
| 332 | + return unique_list; | |
| 333 | + } | |
| 334 | + | |
| 335 | + /** | |
| 336 | + * 指定したOKEの配置場所を取得 | |
| 337 | + * @param nidx OKE番号 | |
| 338 | + * @return 配置場所ID | |
| 339 | + */ | |
| 340 | + public int get_position(int nidx) { | |
| 341 | + if (nidx < 0 || nidx > 2) { | |
| 342 | + return -1; | |
| 343 | + } | |
| 344 | + return position[nidx]; | |
| 345 | + } | |
| 346 | + | |
| 347 | + /** | |
| 348 | + * 指定したOKEの配置場所を設定 | |
| 349 | + * @param nidx OKE番号 | |
| 350 | + * @param n 配置場所ID | |
| 351 | + */ | |
| 352 | + public void set_position(int nidx, int n) { | |
| 353 | + if (nidx < 0 || nidx > 2) { | |
| 354 | + return; | |
| 355 | + } | |
| 356 | + if (n != -1 && oke[nidx] != null | |
| 357 | + && check_position(nidx, n) == false) { | |
| 358 | + return; | |
| 359 | + } | |
| 360 | + position[nidx] = n; | |
| 361 | + } | |
| 362 | + | |
| 363 | + /** | |
| 364 | + * チーム名称の取得 | |
| 365 | + * @return 名称 | |
| 366 | + */ | |
| 367 | + public String get_team_name() { | |
| 368 | + return team_name; | |
| 369 | + } | |
| 370 | + | |
| 371 | + /** | |
| 372 | + * オーナー名の取得 | |
| 373 | + * @return オーナー名 | |
| 374 | + */ | |
| 375 | + public String get_owner_name() { | |
| 376 | + return owner_name; | |
| 377 | + } | |
| 378 | + | |
| 379 | + /** | |
| 380 | + * 年の取得 | |
| 381 | + * @return 年 | |
| 382 | + */ | |
| 383 | + public int get_year() { | |
| 384 | + return year; | |
| 385 | + } | |
| 386 | + | |
| 387 | + /** | |
| 388 | + * 月の取得 | |
| 389 | + * @return 月 | |
| 390 | + */ | |
| 391 | + public int get_month() { | |
| 392 | + return month; | |
| 393 | + } | |
| 394 | + | |
| 395 | + /** | |
| 396 | + * 日の取得 | |
| 397 | + * @return 日 | |
| 398 | + */ | |
| 399 | + public int get_day() { | |
| 400 | + return day; | |
| 401 | + } | |
| 402 | + | |
| 403 | + /** | |
| 404 | + * レーティング値の取得 | |
| 405 | + * @return レーティング値 | |
| 406 | + */ | |
| 407 | + public int get_rating() { | |
| 408 | + return rating; | |
| 409 | + } | |
| 410 | + | |
| 411 | + /** | |
| 412 | + * チーム名称の設定 | |
| 413 | + * @param s 名称 | |
| 414 | + */ | |
| 415 | + public void set_team_name(String s) { | |
| 416 | + team_name = s; | |
| 417 | + } | |
| 418 | + | |
| 419 | + /** | |
| 420 | + * オーナー名の設定 | |
| 421 | + * @param s オーナー名 | |
| 422 | + */ | |
| 423 | + public void set_owner_name(String s) { | |
| 424 | + owner_name = s; | |
| 425 | + } | |
| 426 | + | |
| 427 | + /** | |
| 428 | + * 作成日付の設定 | |
| 429 | + * @param y 年 | |
| 430 | + * @param m 月 | |
| 431 | + * @param d 日 | |
| 432 | + */ | |
| 433 | + public void set_date(int y, int m, int d) { | |
| 434 | + year = y; | |
| 435 | + month = m; | |
| 436 | + day = d; | |
| 437 | + } | |
| 438 | + | |
| 439 | + /** | |
| 440 | + * レーティング値の設定 | |
| 441 | + * @param n レーティング値 | |
| 442 | + */ | |
| 443 | + public void set_rating(int n) { | |
| 444 | + rating = n; | |
| 445 | + } | |
| 446 | + | |
| 447 | + /** | |
| 448 | + * エンブレムの設定 | |
| 449 | + * @param emb エンブレムデータ | |
| 450 | + */ | |
| 451 | + public void set_emblem(cheEmblem emb) { | |
| 452 | + emb.copy(emblem); | |
| 453 | + } | |
| 454 | + | |
| 455 | + /** | |
| 456 | + * エンブレムの設定 | |
| 457 | + * @param oke OKEデータ | |
| 458 | + */ | |
| 459 | + public void set_emblem(cheOkeData oke) { | |
| 460 | + oke.get_emblem().copy(emblem); | |
| 461 | + } | |
| 462 | + | |
| 463 | + /** | |
| 464 | + * エンブレムの取得 | |
| 465 | + * @return エンブレムデータ | |
| 466 | + */ | |
| 467 | + public cheEmblem get_emblem() { | |
| 468 | + return emblem; | |
| 469 | + } | |
| 470 | + | |
| 471 | + /** | |
| 472 | + * 有効フラグの取得 | |
| 473 | + * @return 有効フラグ | |
| 474 | + */ | |
| 475 | + public boolean is_enable() { | |
| 476 | + return benable; | |
| 477 | + } | |
| 478 | + | |
| 479 | + /** | |
| 480 | + * 有効フラグの設定 | |
| 481 | + * @param b 有効フラグ | |
| 482 | + */ | |
| 483 | + public void set_enable(boolean b) { | |
| 484 | + benable = b; | |
| 485 | + } | |
| 486 | + | |
| 487 | + /** | |
| 488 | + * データファイル名称の取得 | |
| 489 | + * @return ファイル名 | |
| 490 | + */ | |
| 491 | + public String get_data_name() { | |
| 492 | + return data_name.getName(); | |
| 493 | + } | |
| 494 | + | |
| 495 | + /** | |
| 496 | + * 指定されたOKの配置場所名称を取得 | |
| 497 | + * @param nidx OKE番号 | |
| 498 | + * @return 配置場所名称 | |
| 499 | + */ | |
| 500 | + public String member_pos(int nidx) { | |
| 501 | + if (nidx < 0 || nidx > 2) { | |
| 502 | + return java.util.ResourceBundle.getBundle( | |
| 503 | + "chexaformation/resource").getString("unknownOkePos"); | |
| 504 | + } | |
| 505 | + switch (position[nidx]) { | |
| 506 | + case 0: | |
| 507 | + return java.util.ResourceBundle.getBundle( | |
| 508 | + "chexaformation/resource"). | |
| 509 | + getString("okePosLeftForward"); | |
| 510 | + case 1: | |
| 511 | + return java.util.ResourceBundle.getBundle( | |
| 512 | + "chexaformation/resource"). | |
| 513 | + getString("okePosForward"); | |
| 514 | + case 2: | |
| 515 | + return java.util.ResourceBundle.getBundle( | |
| 516 | + "chexaformation/resource"). | |
| 517 | + getString("okePosRightForward"); | |
| 518 | + case 3: | |
| 519 | + return java.util.ResourceBundle.getBundle( | |
| 520 | + "chexaformation/resource"). | |
| 521 | + getString("okePosLeft"); | |
| 522 | + case 4: | |
| 523 | + return java.util.ResourceBundle.getBundle( | |
| 524 | + "chexaformation/resource"). | |
| 525 | + getString("okePosCenter"); | |
| 526 | + case 5: | |
| 527 | + return java.util.ResourceBundle.getBundle( | |
| 528 | + "chexaformation/resource"). | |
| 529 | + getString("okePosRight"); | |
| 530 | + case 6: | |
| 531 | + return java.util.ResourceBundle.getBundle( | |
| 532 | + "chexaformation/resource"). | |
| 533 | + getString("okePosLeftBackward"); | |
| 534 | + case 7: | |
| 535 | + return java.util.ResourceBundle.getBundle( | |
| 536 | + "chexaformation/resource"). | |
| 537 | + getString("okePosBackward"); | |
| 538 | + case 8: | |
| 539 | + return java.util.ResourceBundle.getBundle( | |
| 540 | + "chexaformation/resource"). | |
| 541 | + getString("okePosRightBackward"); | |
| 542 | + default: | |
| 543 | + return java.util.ResourceBundle.getBundle( | |
| 544 | + "chexaformation/resource"). | |
| 545 | + getString("unknownOkePos"); | |
| 546 | + } | |
| 547 | + } | |
| 548 | + | |
| 549 | + /** | |
| 550 | + * メンバーリスト文字列の作成 | |
| 551 | + * @return メンバーリスト文字列 | |
| 552 | + */ | |
| 553 | + public String[] make_member_list() { | |
| 554 | + String member[] = new String[3]; | |
| 555 | + int i; | |
| 556 | + for (i = 0; i < 3; i++) { | |
| 557 | + member[i] = Integer.toString(i + 1) + ":"; | |
| 558 | + if (oke[i] != null) { | |
| 559 | + member[i] += oke[i].toString() + "[" + member_pos(i) + "]"; | |
| 560 | + } else { | |
| 561 | + member[i] += "-nothing-"; | |
| 562 | + } | |
| 563 | + } | |
| 564 | + return member; | |
| 565 | + } | |
| 566 | + | |
| 567 | + @Override | |
| 568 | + public String toString() { | |
| 569 | + String retstr; | |
| 570 | + int i; | |
| 571 | + retstr = team_name; | |
| 572 | + for (i = team_name.length(); i < 12; i++) { | |
| 573 | + retstr += " "; | |
| 574 | + } | |
| 575 | + retstr += "[" + owner_name; | |
| 576 | + retstr += "]:"; | |
| 577 | + retstr += (data_name == null) ? "" : data_name.getName(); | |
| 578 | + return retstr; | |
| 579 | + } | |
| 580 | +} |
| @@ -0,0 +1,413 @@ | ||
| 1 | +/* | |
| 2 | + * TeamListPanel.java | |
| 3 | + * | |
| 4 | + * Created on 2010/12/13, 15:07:55 | |
| 5 | + */ | |
| 6 | +package chexaformation; | |
| 7 | + | |
| 8 | +import java.awt.Frame; | |
| 9 | +import java.io.File; | |
| 10 | +import javax.swing.DefaultListModel; | |
| 11 | +import javax.swing.JFileChooser; | |
| 12 | +import javax.swing.JFrame; | |
| 13 | +import javax.swing.JLabel; | |
| 14 | +import javax.swing.filechooser.FileNameExtensionFilter; | |
| 15 | + | |
| 16 | +/** | |
| 17 | + * チームリストパネル | |
| 18 | + * | |
| 19 | + * @author fukui | |
| 20 | + */ | |
| 21 | +public class TeamListPanel extends javax.swing.JPanel { | |
| 22 | + | |
| 23 | + DefaultListModel teamdata; | |
| 24 | + DefaultListModel okedata; | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * Creates new form TeamListPanel | |
| 28 | + */ | |
| 29 | + public TeamListPanel() { | |
| 30 | + teamdata = new DefaultListModel(); | |
| 31 | + okedata = new DefaultListModel(); | |
| 32 | + initComponents(); | |
| 33 | + } | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * 現在選択中のチームデータを取得 | |
| 37 | + * | |
| 38 | + * @return チームデータ | |
| 39 | + */ | |
| 40 | + public cheTeamData get_current_team() { | |
| 41 | + int nsel = teamList.getSelectedIndex(); | |
| 42 | + if (nsel != -1) { | |
| 43 | + return (cheTeamData) teamdata.get(nsel); | |
| 44 | + } | |
| 45 | + return null; | |
| 46 | + } | |
| 47 | + | |
| 48 | + /** | |
| 49 | + * 現在選択中のOKEデータを取得 | |
| 50 | + * | |
| 51 | + * @return OKEデータ | |
| 52 | + */ | |
| 53 | + public cheOkeData get_current_oke() { | |
| 54 | + int nsel = teamList.getSelectedIndex(); | |
| 55 | + if (nsel != -1) { | |
| 56 | + cheTeamData team = (cheTeamData) teamdata.get(nsel); | |
| 57 | + nsel = memberList.getSelectedIndex(); | |
| 58 | + if (nsel != -1) { | |
| 59 | + return team.get_member(nsel); | |
| 60 | + } | |
| 61 | + } | |
| 62 | + return null; | |
| 63 | + } | |
| 64 | + | |
| 65 | + /** | |
| 66 | + * 現在選択中のOKE配置場所を取得 | |
| 67 | + * | |
| 68 | + * @return 配置場所 | |
| 69 | + */ | |
| 70 | + public int get_current_oke_pos() { | |
| 71 | + int nsel = teamList.getSelectedIndex(); | |
| 72 | + if (nsel != -1) { | |
| 73 | + cheTeamData team = (cheTeamData) teamdata.get(nsel); | |
| 74 | + nsel = memberList.getSelectedIndex(); | |
| 75 | + if (nsel != -1) { | |
| 76 | + return team.get_position(nsel); | |
| 77 | + } | |
| 78 | + } | |
| 79 | + return -1; | |
| 80 | + } | |
| 81 | + | |
| 82 | + /** | |
| 83 | + * This method is called from within the constructor to initialize the form. | |
| 84 | + * WARNING: Do NOT modify this code. The content of this method is always | |
| 85 | + * regenerated by the Form Editor. | |
| 86 | + */ | |
| 87 | + @SuppressWarnings("unchecked") | |
| 88 | + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents | |
| 89 | + private void initComponents() { | |
| 90 | + | |
| 91 | + jScrollPane1 = new javax.swing.JScrollPane(); | |
| 92 | + teamList = new javax.swing.JList(); | |
| 93 | + jScrollPane2 = new javax.swing.JScrollPane(); | |
| 94 | + memberList = new javax.swing.JList(); | |
| 95 | + positionPanel = new javax.swing.JPanel(); | |
| 96 | + pos0 = new javax.swing.JLabel(); | |
| 97 | + pos1 = new javax.swing.JLabel(); | |
| 98 | + pos2 = new javax.swing.JLabel(); | |
| 99 | + pos3 = new javax.swing.JLabel(); | |
| 100 | + pos4 = new javax.swing.JLabel(); | |
| 101 | + pos5 = new javax.swing.JLabel(); | |
| 102 | + pos6 = new javax.swing.JLabel(); | |
| 103 | + pos7 = new javax.swing.JLabel(); | |
| 104 | + pos8 = new javax.swing.JLabel(); | |
| 105 | + loadCHE = new javax.swing.JButton(); | |
| 106 | + clearCHE = new javax.swing.JButton(); | |
| 107 | + exitGUI = new javax.swing.JButton(); | |
| 108 | + teamIcon = new javax.swing.JLabel(); | |
| 109 | + removeCHE = new javax.swing.JButton(); | |
| 110 | + | |
| 111 | + teamList.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 112 | + teamList.setModel(teamdata); | |
| 113 | + teamList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); | |
| 114 | + teamList.setDragEnabled(true); | |
| 115 | + teamList.addListSelectionListener(new javax.swing.event.ListSelectionListener() { | |
| 116 | + public void valueChanged(javax.swing.event.ListSelectionEvent evt) { | |
| 117 | + teamListValueChanged(evt); | |
| 118 | + } | |
| 119 | + }); | |
| 120 | + jScrollPane1.setViewportView(teamList); | |
| 121 | + teamList.setTransferHandler(new transTeamHandler()); | |
| 122 | + | |
| 123 | + memberList.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 124 | + memberList.setModel(okedata); | |
| 125 | + memberList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); | |
| 126 | + memberList.setCellRenderer(new okeView()); | |
| 127 | + memberList.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); | |
| 128 | + memberList.setDragEnabled(true); | |
| 129 | + jScrollPane2.setViewportView(memberList); | |
| 130 | + memberList.setTransferHandler(new transOkeHandler()); | |
| 131 | + | |
| 132 | + positionPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "配置", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("MingLiU", 0, 12), java.awt.SystemColor.windowText)); // NOI18N | |
| 133 | + positionPanel.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 134 | + | |
| 135 | + pos0.setFont(new java.awt.Font("Courier New", 0, 12)); // NOI18N | |
| 136 | + pos0.setText("-"); | |
| 137 | + | |
| 138 | + pos1.setFont(new java.awt.Font("Courier New", 0, 12)); // NOI18N | |
| 139 | + pos1.setText("-"); | |
| 140 | + | |
| 141 | + pos2.setFont(new java.awt.Font("Courier New", 0, 12)); // NOI18N | |
| 142 | + pos2.setText("-"); | |
| 143 | + | |
| 144 | + pos3.setFont(new java.awt.Font("Courier New", 0, 12)); // NOI18N | |
| 145 | + pos3.setText("-"); | |
| 146 | + | |
| 147 | + pos4.setFont(new java.awt.Font("Courier New", 0, 12)); // NOI18N | |
| 148 | + pos4.setText("-"); | |
| 149 | + | |
| 150 | + pos5.setFont(new java.awt.Font("Courier New", 0, 12)); // NOI18N | |
| 151 | + pos5.setText("-"); | |
| 152 | + | |
| 153 | + pos6.setFont(new java.awt.Font("Courier New", 0, 12)); // NOI18N | |
| 154 | + pos6.setText("-"); | |
| 155 | + | |
| 156 | + pos7.setFont(new java.awt.Font("Courier New", 0, 12)); // NOI18N | |
| 157 | + pos7.setText("-"); | |
| 158 | + | |
| 159 | + pos8.setFont(new java.awt.Font("Courier New", 0, 12)); // NOI18N | |
| 160 | + pos8.setText("-"); | |
| 161 | + | |
| 162 | + javax.swing.GroupLayout positionPanelLayout = new javax.swing.GroupLayout(positionPanel); | |
| 163 | + positionPanel.setLayout(positionPanelLayout); | |
| 164 | + positionPanelLayout.setHorizontalGroup( | |
| 165 | + positionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
| 166 | + .addGroup(positionPanelLayout.createSequentialGroup() | |
| 167 | + .addGroup(positionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
| 168 | + .addGroup(positionPanelLayout.createSequentialGroup() | |
| 169 | + .addComponent(pos0) | |
| 170 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 171 | + .addComponent(pos1) | |
| 172 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 173 | + .addComponent(pos2)) | |
| 174 | + .addGroup(positionPanelLayout.createSequentialGroup() | |
| 175 | + .addComponent(pos3) | |
| 176 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 177 | + .addComponent(pos4) | |
| 178 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 179 | + .addComponent(pos5)) | |
| 180 | + .addGroup(positionPanelLayout.createSequentialGroup() | |
| 181 | + .addComponent(pos6) | |
| 182 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 183 | + .addComponent(pos7) | |
| 184 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 185 | + .addComponent(pos8))) | |
| 186 | + .addContainerGap(13, Short.MAX_VALUE)) | |
| 187 | + ); | |
| 188 | + positionPanelLayout.setVerticalGroup( | |
| 189 | + positionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
| 190 | + .addGroup(positionPanelLayout.createSequentialGroup() | |
| 191 | + .addGroup(positionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |
| 192 | + .addComponent(pos0) | |
| 193 | + .addComponent(pos1) | |
| 194 | + .addComponent(pos2)) | |
| 195 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 196 | + .addGroup(positionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |
| 197 | + .addComponent(pos3) | |
| 198 | + .addComponent(pos4) | |
| 199 | + .addComponent(pos5)) | |
| 200 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 201 | + .addGroup(positionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |
| 202 | + .addComponent(pos6) | |
| 203 | + .addComponent(pos7) | |
| 204 | + .addComponent(pos8)) | |
| 205 | + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) | |
| 206 | + ); | |
| 207 | + | |
| 208 | + loadCHE.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 209 | + java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("chexaformation/resource"); // NOI18N | |
| 210 | + loadCHE.setText(bundle.getString("loadCHE")); // NOI18N | |
| 211 | + loadCHE.addActionListener(new java.awt.event.ActionListener() { | |
| 212 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
| 213 | + loadCHEActionPerformed(evt); | |
| 214 | + } | |
| 215 | + }); | |
| 216 | + | |
| 217 | + clearCHE.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 218 | + clearCHE.setText(bundle.getString("allClearTeam")); // NOI18N | |
| 219 | + clearCHE.addActionListener(new java.awt.event.ActionListener() { | |
| 220 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
| 221 | + clearCHEActionPerformed(evt); | |
| 222 | + } | |
| 223 | + }); | |
| 224 | + | |
| 225 | + exitGUI.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 226 | + exitGUI.setText(bundle.getString("exitAPP")); // NOI18N | |
| 227 | + exitGUI.addActionListener(new java.awt.event.ActionListener() { | |
| 228 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
| 229 | + exitGUIActionPerformed(evt); | |
| 230 | + } | |
| 231 | + }); | |
| 232 | + | |
| 233 | + teamIcon.setBackground(java.awt.Color.white); | |
| 234 | + teamIcon.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); | |
| 235 | + teamIcon.setMaximumSize(new java.awt.Dimension(34, 34)); | |
| 236 | + teamIcon.setMinimumSize(new java.awt.Dimension(34, 34)); | |
| 237 | + teamIcon.setPreferredSize(new java.awt.Dimension(34, 34)); | |
| 238 | + | |
| 239 | + removeCHE.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 240 | + removeCHE.setText(bundle.getString("removeCHE")); // NOI18N | |
| 241 | + removeCHE.addActionListener(new java.awt.event.ActionListener() { | |
| 242 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
| 243 | + removeCHEActionPerformed(evt); | |
| 244 | + } | |
| 245 | + }); | |
| 246 | + | |
| 247 | + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); | |
| 248 | + this.setLayout(layout); | |
| 249 | + layout.setHorizontalGroup( | |
| 250 | + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
| 251 | + .addGroup(layout.createSequentialGroup() | |
| 252 | + .addContainerGap() | |
| 253 | + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
| 254 | + .addGroup(layout.createSequentialGroup() | |
| 255 | + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 416, Short.MAX_VALUE) | |
| 256 | + .addContainerGap()) | |
| 257 | + .addGroup(layout.createSequentialGroup() | |
| 258 | + .addComponent(loadCHE) | |
| 259 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 260 | + .addComponent(removeCHE) | |
| 261 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 146, Short.MAX_VALUE) | |
| 262 | + .addComponent(clearCHE) | |
| 263 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 264 | + .addComponent(exitGUI) | |
| 265 | + .addGap(70, 70, 70)) | |
| 266 | + .addGroup(layout.createSequentialGroup() | |
| 267 | + .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 357, Short.MAX_VALUE) | |
| 268 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 269 | + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
| 270 | + .addComponent(teamIcon, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | |
| 271 | + .addComponent(positionPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) | |
| 272 | + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) | |
| 273 | + ); | |
| 274 | + layout.setVerticalGroup( | |
| 275 | + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
| 276 | + .addGroup(layout.createSequentialGroup() | |
| 277 | + .addContainerGap() | |
| 278 | + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 186, Short.MAX_VALUE) | |
| 279 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 280 | + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
| 281 | + .addGroup(layout.createSequentialGroup() | |
| 282 | + .addComponent(positionPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | |
| 283 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 284 | + .addComponent(teamIcon, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) | |
| 285 | + .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)) | |
| 286 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 287 | + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
| 288 | + .addComponent(clearCHE, javax.swing.GroupLayout.Alignment.TRAILING) | |
| 289 | + .addComponent(exitGUI, javax.swing.GroupLayout.Alignment.TRAILING) | |
| 290 | + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |
| 291 | + .addComponent(loadCHE) | |
| 292 | + .addComponent(removeCHE))) | |
| 293 | + .addContainerGap()) | |
| 294 | + ); | |
| 295 | + }// </editor-fold>//GEN-END:initComponents | |
| 296 | + | |
| 297 | + private void loadCHEActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadCHEActionPerformed | |
| 298 | + int nret; | |
| 299 | + JFileChooser fdlg = new JFileChooser(Main.cheDataDir); | |
| 300 | + String filterTitle | |
| 301 | + = java.util.ResourceBundle.getBundle("chexaformation/resource"). | |
| 302 | + getString("filterTitleCHE"); | |
| 303 | + FileNameExtensionFilter ffilter | |
| 304 | + = new FileNameExtensionFilter(filterTitle, "CHE"); | |
| 305 | + fdlg.setFileFilter(ffilter); | |
| 306 | + fdlg.setMultiSelectionEnabled(true); | |
| 307 | + nret = fdlg.showOpenDialog(getRootPane().getParent()); | |
| 308 | + if (nret == JFileChooser.APPROVE_OPTION) { | |
| 309 | + int nidx; | |
| 310 | + File ifiles[] = fdlg.getSelectedFiles(); | |
| 311 | + for (nidx = 0; nidx < ifiles.length; nidx++) { | |
| 312 | + cheFile che = new cheFile(ifiles[nidx].getAbsolutePath()); | |
| 313 | + Main.cheDataDir = ifiles[nidx].getParent(); | |
| 314 | + if (che.load() == true) { | |
| 315 | + int i; | |
| 316 | + for (i = 0; i < che.get_team_max(); i++) { | |
| 317 | + cheTeamData team = che.get_team(i); | |
| 318 | + if (team != null && team.is_enable() == true) { | |
| 319 | + teamdata.addElement(team); | |
| 320 | + } | |
| 321 | + } | |
| 322 | + } else { | |
| 323 | + Main.mesg_box((Frame) (getRootPane().getParent()), | |
| 324 | + java.util.ResourceBundle.getBundle( | |
| 325 | + "chexaformation/resource").getString("loadCHE"), | |
| 326 | + java.util.ResourceBundle.getBundle( | |
| 327 | + "chexaformation/resource").getString("faileReadCHE"), | |
| 328 | + ifiles[nidx].getAbsolutePath()); | |
| 329 | + } | |
| 330 | + } | |
| 331 | + } | |
| 332 | + }//GEN-LAST:event_loadCHEActionPerformed | |
| 333 | + | |
| 334 | + /** | |
| 335 | + * チーム詳細表示のクリア | |
| 336 | + */ | |
| 337 | + private void resetTeamDetail() { | |
| 338 | + okedata.clear(); | |
| 339 | + pos0.setText("-"); | |
| 340 | + pos1.setText("-"); | |
| 341 | + pos2.setText("-"); | |
| 342 | + pos3.setText("-"); | |
| 343 | + pos4.setText("-"); | |
| 344 | + pos5.setText("-"); | |
| 345 | + pos6.setText("-"); | |
| 346 | + pos7.setText("-"); | |
| 347 | + pos8.setText("-"); | |
| 348 | + } | |
| 349 | + | |
| 350 | + private void clearCHEActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clearCHEActionPerformed | |
| 351 | + teamdata.clear(); | |
| 352 | + resetTeamDetail(); | |
| 353 | + teamIcon.setIcon(null); | |
| 354 | + }//GEN-LAST:event_clearCHEActionPerformed | |
| 355 | + | |
| 356 | + private void teamListValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_teamListValueChanged | |
| 357 | + int i; | |
| 358 | + int nidx = teamList.getSelectedIndex(); | |
| 359 | + if (nidx != -1) { | |
| 360 | + cheTeamData team = (cheTeamData) teamdata.get(nidx); | |
| 361 | + resetTeamDetail(); | |
| 362 | + for (i = 0; i < 3; i++) { | |
| 363 | + okedata.addElement(team); | |
| 364 | + if (team.get_member(i) != null) { | |
| 365 | + int n = team.get_position(i); | |
| 366 | + if (n != -1) { | |
| 367 | + JLabel wk = (JLabel) positionPanel.getComponent(n); | |
| 368 | + wk.setText(Integer.toString(i + 1)); | |
| 369 | + } | |
| 370 | + } | |
| 371 | + } | |
| 372 | + teamIcon.setIcon(team.get_emblem().getImgicon()); | |
| 373 | + } else { | |
| 374 | + resetTeamDetail(); | |
| 375 | + teamIcon.setIcon(null); | |
| 376 | + } | |
| 377 | + }//GEN-LAST:event_teamListValueChanged | |
| 378 | + | |
| 379 | + private void exitGUIActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitGUIActionPerformed | |
| 380 | + ((JFrame) (getRootPane().getParent())).dispose(); | |
| 381 | + }//GEN-LAST:event_exitGUIActionPerformed | |
| 382 | + | |
| 383 | + private void removeCHEActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeCHEActionPerformed | |
| 384 | + int nidx = teamList.getSelectedIndex(); | |
| 385 | + if (nidx != -1) { | |
| 386 | + teamdata.remove(nidx); | |
| 387 | + resetTeamDetail(); | |
| 388 | + teamIcon.setIcon(null); | |
| 389 | + } | |
| 390 | + }//GEN-LAST:event_removeCHEActionPerformed | |
| 391 | + | |
| 392 | + // Variables declaration - do not modify//GEN-BEGIN:variables | |
| 393 | + private javax.swing.JButton clearCHE; | |
| 394 | + private javax.swing.JButton exitGUI; | |
| 395 | + private javax.swing.JScrollPane jScrollPane1; | |
| 396 | + private javax.swing.JScrollPane jScrollPane2; | |
| 397 | + private javax.swing.JButton loadCHE; | |
| 398 | + private javax.swing.JList memberList; | |
| 399 | + private javax.swing.JLabel pos0; | |
| 400 | + private javax.swing.JLabel pos1; | |
| 401 | + private javax.swing.JLabel pos2; | |
| 402 | + private javax.swing.JLabel pos3; | |
| 403 | + private javax.swing.JLabel pos4; | |
| 404 | + private javax.swing.JLabel pos5; | |
| 405 | + private javax.swing.JLabel pos6; | |
| 406 | + private javax.swing.JLabel pos7; | |
| 407 | + private javax.swing.JLabel pos8; | |
| 408 | + private javax.swing.JPanel positionPanel; | |
| 409 | + private javax.swing.JButton removeCHE; | |
| 410 | + private javax.swing.JLabel teamIcon; | |
| 411 | + private javax.swing.JList teamList; | |
| 412 | + // End of variables declaration//GEN-END:variables | |
| 413 | +} |
| @@ -0,0 +1,127 @@ | ||
| 1 | +package chexaformation; | |
| 2 | + | |
| 3 | +import java.awt.datatransfer.DataFlavor; | |
| 4 | +import java.awt.datatransfer.Transferable; | |
| 5 | +import java.awt.datatransfer.UnsupportedFlavorException; | |
| 6 | +import java.io.IOException; | |
| 7 | +import java.util.logging.Level; | |
| 8 | +import java.util.logging.Logger; | |
| 9 | +import javax.swing.Icon; | |
| 10 | +import javax.swing.JComponent; | |
| 11 | +import javax.swing.JList; | |
| 12 | +import javax.swing.TransferHandler; | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * | |
| 16 | + * @author fukui | |
| 17 | + */ | |
| 18 | +public class transDestHandler extends TransferHandler { | |
| 19 | + | |
| 20 | + /** | |
| 21 | + * コンストラクタ | |
| 22 | + */ | |
| 23 | + public transDestHandler() { | |
| 24 | + super(); | |
| 25 | + } | |
| 26 | + | |
| 27 | + @Override | |
| 28 | + public boolean canImport(JComponent comp, DataFlavor[] transferFlavors) { | |
| 29 | + int i; | |
| 30 | + DataFlavor df1 = new DataFlavor(cheOkeData.class, null); | |
| 31 | + DataFlavor df2 = new DataFlavor(cheTeamData.class, null); | |
| 32 | + for (i = 0; i < transferFlavors.length; i++) { | |
| 33 | + if (df1.equals(transferFlavors[i]) == true) { | |
| 34 | + return true; | |
| 35 | + } else if (df2.equals(transferFlavors[i]) == true) { | |
| 36 | + return true; | |
| 37 | + } | |
| 38 | + } | |
| 39 | + return false; | |
| 40 | + } | |
| 41 | + | |
| 42 | + @Override | |
| 43 | + public int getSourceActions(JComponent c) { | |
| 44 | + return COPY; | |
| 45 | + } | |
| 46 | + | |
| 47 | + @Override | |
| 48 | + protected Transferable createTransferable(JComponent c) { | |
| 49 | + TeamPanel p; | |
| 50 | + try { | |
| 51 | + p = (TeamPanel) (c.getParent().getParent().getParent()); | |
| 52 | + } catch (Exception e) { | |
| 53 | + Logger.getLogger(transDestHandler.class.getName()).log(Level.SEVERE, | |
| 54 | + null, e); | |
| 55 | + return null; | |
| 56 | + } | |
| 57 | + cheOkeData oke = p.get_current_oke(); | |
| 58 | + if (oke == null) { | |
| 59 | + return null; | |
| 60 | + } | |
| 61 | + return new transData(oke, p.get_current_oke_pos()); | |
| 62 | + } | |
| 63 | + | |
| 64 | + @Override | |
| 65 | + @SuppressWarnings("null") | |
| 66 | + public boolean importData(JComponent comp, Transferable t) { | |
| 67 | + TeamPanel p = null; | |
| 68 | + try { | |
| 69 | + p = (TeamPanel) (comp.getParent().getParent().getParent()); | |
| 70 | + } catch (Exception e) { | |
| 71 | + Logger.getLogger(transDestHandler.class.getName()).log(Level.SEVERE, | |
| 72 | + null, e); | |
| 73 | + } | |
| 74 | + cheTeamData team; | |
| 75 | + try { | |
| 76 | + team = (cheTeamData) t.getTransferData(new DataFlavor( | |
| 77 | + cheOkeData.class, null)); | |
| 78 | + if (team != null) { | |
| 79 | + JList list = (JList) comp; | |
| 80 | + int nsel = list.getDropLocation().getIndex(); | |
| 81 | + if (nsel != -1) { | |
| 82 | + p.load_oke(nsel, team.get_member(0), team.get_position(0)); | |
| 83 | + return true; | |
| 84 | + } | |
| 85 | + } else { | |
| 86 | + team = (cheTeamData) t.getTransferData(new DataFlavor( | |
| 87 | + cheTeamData.class, null)); | |
| 88 | + if (team != null) { | |
| 89 | + p.load_team(team); | |
| 90 | + return true; | |
| 91 | + } | |
| 92 | + } | |
| 93 | + } catch (UnsupportedFlavorException ex) { | |
| 94 | + Logger.getLogger(transDestHandler.class.getName()).log(Level.SEVERE, | |
| 95 | + null, ex); | |
| 96 | + } catch (IOException ex) { | |
| 97 | + Logger.getLogger(transDestHandler.class.getName()).log(Level.SEVERE, | |
| 98 | + null, ex); | |
| 99 | + } | |
| 100 | + return false; | |
| 101 | + } | |
| 102 | + | |
| 103 | + @Override | |
| 104 | + public Icon getVisualRepresentation(Transferable t) { | |
| 105 | + cheTeamData team; | |
| 106 | + try { | |
| 107 | + team = (cheTeamData) t.getTransferData(new DataFlavor( | |
| 108 | + cheOkeData.class, null)); | |
| 109 | + if (team != null) { | |
| 110 | + return team.get_emblem().getImgicon(); | |
| 111 | + } else { | |
| 112 | + team = (cheTeamData) t.getTransferData(new DataFlavor( | |
| 113 | + cheTeamData.class, null)); | |
| 114 | + if (team != null) { | |
| 115 | + return team.get_emblem().getImgicon(); | |
| 116 | + } | |
| 117 | + } | |
| 118 | + } catch (UnsupportedFlavorException ex) { | |
| 119 | + Logger.getLogger(transDestHandler.class.getName()).log(Level.SEVERE, | |
| 120 | + null, ex); | |
| 121 | + } catch (IOException ex) { | |
| 122 | + Logger.getLogger(transDestHandler.class.getName()).log(Level.SEVERE, | |
| 123 | + null, ex); | |
| 124 | + } | |
| 125 | + return null; | |
| 126 | + } | |
| 127 | +} |
| @@ -0,0 +1,582 @@ | ||
| 1 | +/* | |
| 2 | + * TeamPanel.java | |
| 3 | + * | |
| 4 | + * Created on 2010/12/13, 17:27:58 | |
| 5 | + */ | |
| 6 | +package chexaformation; | |
| 7 | + | |
| 8 | +import java.awt.Component; | |
| 9 | +import java.awt.Dialog; | |
| 10 | +import java.io.File; | |
| 11 | +import javax.swing.DefaultListModel; | |
| 12 | +import javax.swing.JButton; | |
| 13 | +import javax.swing.JDialog; | |
| 14 | +import javax.swing.JFileChooser; | |
| 15 | +import javax.swing.filechooser.FileNameExtensionFilter; | |
| 16 | + | |
| 17 | +/** | |
| 18 | + * | |
| 19 | + * @author fukui | |
| 20 | + */ | |
| 21 | +public class TeamPanel extends javax.swing.JPanel { | |
| 22 | + | |
| 23 | + DefaultListModel okedata; | |
| 24 | + cheFile che; | |
| 25 | + cheTeamData team; | |
| 26 | + | |
| 27 | + /** Creates new form TeamPanel */ | |
| 28 | + public TeamPanel() { | |
| 29 | + okedata = new DefaultListModel(); | |
| 30 | + che = new cheFile(); | |
| 31 | + team = new cheTeamData(); | |
| 32 | + okedata.addElement(null); | |
| 33 | + okedata.addElement(null); | |
| 34 | + okedata.addElement(null); | |
| 35 | + initComponents(); | |
| 36 | + } | |
| 37 | + | |
| 38 | + /** | |
| 39 | + * タイトル表示の更新 | |
| 40 | + */ | |
| 41 | + public void update_title() { | |
| 42 | + File fn = new File(che.get_fname()); | |
| 43 | + JDialog dlg = ((JDialog) (getRootPane().getParent())); | |
| 44 | + String title; | |
| 45 | + title = java.util.ResourceBundle.getBundle("chexaformation/resource"). | |
| 46 | + getString("titleTeamPanel"); | |
| 47 | + title += fn.getName(); | |
| 48 | + dlg.setTitle(title); | |
| 49 | + } | |
| 50 | + | |
| 51 | + /** | |
| 52 | + * チームデータを読み込み | |
| 53 | + * @param p チームデータ | |
| 54 | + */ | |
| 55 | + public void load_team(cheTeamData p) { | |
| 56 | + p.copy(team); | |
| 57 | + teamName.setText(team.get_team_name()); | |
| 58 | + ownerName.setText(team.get_owner_name()); | |
| 59 | + teamIcon.setIcon(team.get_emblem().getImgicon()); | |
| 60 | + che.set_fname(p.get_data_name()); | |
| 61 | + update_title(); | |
| 62 | + update_memberlist(); | |
| 63 | + } | |
| 64 | + | |
| 65 | + /** | |
| 66 | + * OKEデータを読み込み | |
| 67 | + * @param nidx OKE番号 | |
| 68 | + * @param p OKEデータ | |
| 69 | + * @param n 配置場所ID | |
| 70 | + */ | |
| 71 | + public void load_oke(int nidx, cheOkeData p, int n) { | |
| 72 | + team.add_member(nidx, p, n); | |
| 73 | + if (nidx == 0) { | |
| 74 | + team.set_emblem(p); | |
| 75 | + teamIcon.setIcon(team.get_emblem().getImgicon()); | |
| 76 | + } | |
| 77 | + update_memberlist(); | |
| 78 | + } | |
| 79 | + | |
| 80 | + /** | |
| 81 | + * 登録されている情報を初期化 | |
| 82 | + */ | |
| 83 | + private void resetTeamDetail() { | |
| 84 | + okedata.clear(); | |
| 85 | + pos0.setText("-"); | |
| 86 | + pos1.setText("-"); | |
| 87 | + pos2.setText("-"); | |
| 88 | + pos3.setText("-"); | |
| 89 | + pos4.setText("-"); | |
| 90 | + pos5.setText("-"); | |
| 91 | + pos6.setText("-"); | |
| 92 | + pos7.setText("-"); | |
| 93 | + pos8.setText("-"); | |
| 94 | + } | |
| 95 | + | |
| 96 | + /** | |
| 97 | + * メンバーリストの更新 | |
| 98 | + */ | |
| 99 | + public void update_memberlist() { | |
| 100 | + int i; | |
| 101 | + resetTeamDetail(); | |
| 102 | + for (i = 0; i < 3; i++) { | |
| 103 | + okedata.addElement(team); | |
| 104 | + if (team.get_member(i) != null) { | |
| 105 | + int n = team.get_position(i); | |
| 106 | + if (n != -1) { | |
| 107 | + JButton wk = (JButton) positionPanel.getComponent(n); | |
| 108 | + wk.setText(Integer.toString(i + 1)); | |
| 109 | + } | |
| 110 | + } | |
| 111 | + } | |
| 112 | + } | |
| 113 | + | |
| 114 | + /** | |
| 115 | + * 選択中のOKEデータを取得 | |
| 116 | + * @return OKEデータ。未選択時はnull | |
| 117 | + */ | |
| 118 | + public cheOkeData get_current_oke() { | |
| 119 | + int nsel = memberList.getSelectedIndex(); | |
| 120 | + if (nsel != -1) { | |
| 121 | + return team.get_member(nsel); | |
| 122 | + } | |
| 123 | + return null; | |
| 124 | + } | |
| 125 | + | |
| 126 | + /** | |
| 127 | + * 選択中のOKE配置場所IDを取得 | |
| 128 | + * @return 配置場所ID。未選択時は-1 | |
| 129 | + */ | |
| 130 | + public int get_current_oke_pos() { | |
| 131 | + int nsel = memberList.getSelectedIndex(); | |
| 132 | + if (nsel != -1) { | |
| 133 | + return team.get_position(nsel); | |
| 134 | + } | |
| 135 | + return -1; | |
| 136 | + } | |
| 137 | + | |
| 138 | + /** | |
| 139 | + * チームリストの取得 | |
| 140 | + * @return チームリストパネル | |
| 141 | + */ | |
| 142 | + private TeamListPanel get_teamlist() { | |
| 143 | + mainForm form = (mainForm) (getRootPane().getParent().getParent()); | |
| 144 | + return form.get_teamlist(); | |
| 145 | + } | |
| 146 | + | |
| 147 | + /** This method is called from within the constructor to | |
| 148 | + * initialize the form. | |
| 149 | + * WARNING: Do NOT modify this code. The content of this method is | |
| 150 | + * always regenerated by the Form Editor. | |
| 151 | + */ | |
| 152 | + @SuppressWarnings("unchecked") | |
| 153 | + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents | |
| 154 | + private void initComponents() { | |
| 155 | + | |
| 156 | + titleTeam = new javax.swing.JLabel(); | |
| 157 | + teamName = new javax.swing.JTextField(); | |
| 158 | + titleOwner = new javax.swing.JLabel(); | |
| 159 | + ownerName = new javax.swing.JTextField(); | |
| 160 | + jScrollPane1 = new javax.swing.JScrollPane(); | |
| 161 | + memberList = new javax.swing.JList(); | |
| 162 | + positionPanel = new javax.swing.JPanel(); | |
| 163 | + pos0 = new javax.swing.JButton(); | |
| 164 | + pos1 = new javax.swing.JButton(); | |
| 165 | + pos2 = new javax.swing.JButton(); | |
| 166 | + pos3 = new javax.swing.JButton(); | |
| 167 | + pos4 = new javax.swing.JButton(); | |
| 168 | + pos5 = new javax.swing.JButton(); | |
| 169 | + pos6 = new javax.swing.JButton(); | |
| 170 | + pos7 = new javax.swing.JButton(); | |
| 171 | + pos8 = new javax.swing.JButton(); | |
| 172 | + addOKE = new javax.swing.JButton(); | |
| 173 | + delOKE = new javax.swing.JButton(); | |
| 174 | + loadTEAM = new javax.swing.JButton(); | |
| 175 | + closeTEAM = new javax.swing.JButton(); | |
| 176 | + saveTEAM = new javax.swing.JButton(); | |
| 177 | + teamIcon = new javax.swing.JLabel(); | |
| 178 | + titleEmblem = new javax.swing.JLabel(); | |
| 179 | + | |
| 180 | + titleTeam.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 181 | + java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("chexaformation/resource"); // NOI18N | |
| 182 | + titleTeam.setText(bundle.getString("labelTeamName")); // NOI18N | |
| 183 | + | |
| 184 | + teamName.setDocument(new cheNameDocument()); | |
| 185 | + teamName.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 186 | + teamName.setText(team.get_team_name()); | |
| 187 | + | |
| 188 | + titleOwner.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 189 | + titleOwner.setText(bundle.getString("labelOwnerName")); // NOI18N | |
| 190 | + | |
| 191 | + ownerName.setDocument(new cheNameDocument()); | |
| 192 | + ownerName.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 193 | + ownerName.setText(team.get_owner_name()); | |
| 194 | + | |
| 195 | + jScrollPane1.setFont(new java.awt.Font("MingLiU", 0, 12)); // NOI18N | |
| 196 | + | |
| 197 | + memberList.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 198 | + memberList.setModel(okedata); | |
| 199 | + memberList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); | |
| 200 | + memberList.setCellRenderer(new okeView()); | |
| 201 | + memberList.setDragEnabled(true); | |
| 202 | + jScrollPane1.setViewportView(memberList); | |
| 203 | + memberList.setTransferHandler(new transDestHandler()); | |
| 204 | + | |
| 205 | + positionPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "配置", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("MingLiU", 0, 12), null)); // NOI18N | |
| 206 | + positionPanel.setFont(new java.awt.Font("Monospaced", 0, 15)); // NOI18N | |
| 207 | + | |
| 208 | + pos0.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 209 | + pos0.setText("-"); | |
| 210 | + pos0.addActionListener(new java.awt.event.ActionListener() { | |
| 211 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
| 212 | + pushPosition(evt); | |
| 213 | + } | |
| 214 | + }); | |
| 215 | + | |
| 216 | + pos1.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 217 | + pos1.setText("-"); | |
| 218 | + pos1.addActionListener(new java.awt.event.ActionListener() { | |
| 219 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
| 220 | + pushPosition(evt); | |
| 221 | + } | |
| 222 | + }); | |
| 223 | + | |
| 224 | + pos2.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 225 | + pos2.setText("-"); | |
| 226 | + pos2.addActionListener(new java.awt.event.ActionListener() { | |
| 227 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
| 228 | + pushPosition(evt); | |
| 229 | + } | |
| 230 | + }); | |
| 231 | + | |
| 232 | + pos3.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 233 | + pos3.setText("-"); | |
| 234 | + pos3.addActionListener(new java.awt.event.ActionListener() { | |
| 235 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
| 236 | + pushPosition(evt); | |
| 237 | + } | |
| 238 | + }); | |
| 239 | + | |
| 240 | + pos4.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 241 | + pos4.setText("-"); | |
| 242 | + pos4.addActionListener(new java.awt.event.ActionListener() { | |
| 243 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
| 244 | + pushPosition(evt); | |
| 245 | + } | |
| 246 | + }); | |
| 247 | + | |
| 248 | + pos5.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 249 | + pos5.setText("-"); | |
| 250 | + pos5.addActionListener(new java.awt.event.ActionListener() { | |
| 251 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
| 252 | + pushPosition(evt); | |
| 253 | + } | |
| 254 | + }); | |
| 255 | + | |
| 256 | + pos6.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 257 | + pos6.setText("-"); | |
| 258 | + pos6.addActionListener(new java.awt.event.ActionListener() { | |
| 259 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
| 260 | + pushPosition(evt); | |
| 261 | + } | |
| 262 | + }); | |
| 263 | + | |
| 264 | + pos7.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 265 | + pos7.setText("-"); | |
| 266 | + pos7.addActionListener(new java.awt.event.ActionListener() { | |
| 267 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
| 268 | + pushPosition(evt); | |
| 269 | + } | |
| 270 | + }); | |
| 271 | + | |
| 272 | + pos8.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 273 | + pos8.setText("-"); | |
| 274 | + pos8.addActionListener(new java.awt.event.ActionListener() { | |
| 275 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
| 276 | + pushPosition(evt); | |
| 277 | + } | |
| 278 | + }); | |
| 279 | + | |
| 280 | + javax.swing.GroupLayout positionPanelLayout = new javax.swing.GroupLayout(positionPanel); | |
| 281 | + positionPanel.setLayout(positionPanelLayout); | |
| 282 | + positionPanelLayout.setHorizontalGroup( | |
| 283 | + positionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
| 284 | + .addGroup(positionPanelLayout.createSequentialGroup() | |
| 285 | + .addContainerGap() | |
| 286 | + .addGroup(positionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
| 287 | + .addGroup(positionPanelLayout.createSequentialGroup() | |
| 288 | + .addComponent(pos0) | |
| 289 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 290 | + .addComponent(pos1) | |
| 291 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 292 | + .addComponent(pos2)) | |
| 293 | + .addGroup(positionPanelLayout.createSequentialGroup() | |
| 294 | + .addComponent(pos3) | |
| 295 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 296 | + .addComponent(pos4) | |
| 297 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 298 | + .addComponent(pos5)) | |
| 299 | + .addGroup(positionPanelLayout.createSequentialGroup() | |
| 300 | + .addComponent(pos6) | |
| 301 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 302 | + .addComponent(pos7) | |
| 303 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 304 | + .addComponent(pos8))) | |
| 305 | + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) | |
| 306 | + ); | |
| 307 | + positionPanelLayout.setVerticalGroup( | |
| 308 | + positionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
| 309 | + .addGroup(positionPanelLayout.createSequentialGroup() | |
| 310 | + .addContainerGap() | |
| 311 | + .addGroup(positionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |
| 312 | + .addComponent(pos0) | |
| 313 | + .addComponent(pos1) | |
| 314 | + .addComponent(pos2)) | |
| 315 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 316 | + .addGroup(positionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |
| 317 | + .addComponent(pos3) | |
| 318 | + .addComponent(pos4) | |
| 319 | + .addComponent(pos5)) | |
| 320 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 321 | + .addGroup(positionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |
| 322 | + .addComponent(pos6) | |
| 323 | + .addComponent(pos7) | |
| 324 | + .addComponent(pos8)) | |
| 325 | + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) | |
| 326 | + ); | |
| 327 | + | |
| 328 | + addOKE.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 329 | + addOKE.setText(bundle.getString("addOKE")); // NOI18N | |
| 330 | + addOKE.addActionListener(new java.awt.event.ActionListener() { | |
| 331 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
| 332 | + addOKEActionPerformed(evt); | |
| 333 | + } | |
| 334 | + }); | |
| 335 | + | |
| 336 | + delOKE.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 337 | + delOKE.setText(bundle.getString("delOKE")); // NOI18N | |
| 338 | + delOKE.addActionListener(new java.awt.event.ActionListener() { | |
| 339 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
| 340 | + delOKEActionPerformed(evt); | |
| 341 | + } | |
| 342 | + }); | |
| 343 | + | |
| 344 | + loadTEAM.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 345 | + loadTEAM.setText(bundle.getString("readTeam")); // NOI18N | |
| 346 | + loadTEAM.addActionListener(new java.awt.event.ActionListener() { | |
| 347 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
| 348 | + loadTEAMActionPerformed(evt); | |
| 349 | + } | |
| 350 | + }); | |
| 351 | + | |
| 352 | + closeTEAM.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 353 | + closeTEAM.setText(bundle.getString("closeWindow")); // NOI18N | |
| 354 | + closeTEAM.addActionListener(new java.awt.event.ActionListener() { | |
| 355 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
| 356 | + closeTEAMActionPerformed(evt); | |
| 357 | + } | |
| 358 | + }); | |
| 359 | + | |
| 360 | + saveTEAM.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 361 | + saveTEAM.setText(bundle.getString("saveTeam")); // NOI18N | |
| 362 | + saveTEAM.addActionListener(new java.awt.event.ActionListener() { | |
| 363 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
| 364 | + saveTEAMActionPerformed(evt); | |
| 365 | + } | |
| 366 | + }); | |
| 367 | + | |
| 368 | + teamIcon.setBackground(java.awt.Color.white); | |
| 369 | + teamIcon.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 370 | + teamIcon.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); | |
| 371 | + teamIcon.setMaximumSize(new java.awt.Dimension(34, 34)); | |
| 372 | + teamIcon.setMinimumSize(new java.awt.Dimension(34, 34)); | |
| 373 | + teamIcon.setPreferredSize(new java.awt.Dimension(34, 34)); | |
| 374 | + | |
| 375 | + titleEmblem.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 376 | + titleEmblem.setText(bundle.getString("labelTeamEmblem")); // NOI18N | |
| 377 | + | |
| 378 | + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); | |
| 379 | + this.setLayout(layout); | |
| 380 | + layout.setHorizontalGroup( | |
| 381 | + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
| 382 | + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() | |
| 383 | + .addContainerGap() | |
| 384 | + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) | |
| 385 | + .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 404, Short.MAX_VALUE) | |
| 386 | + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() | |
| 387 | + .addComponent(titleTeam) | |
| 388 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 389 | + .addComponent(teamName, javax.swing.GroupLayout.DEFAULT_SIZE, 332, Short.MAX_VALUE)) | |
| 390 | + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() | |
| 391 | + .addComponent(titleOwner) | |
| 392 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 393 | + .addComponent(ownerName, javax.swing.GroupLayout.DEFAULT_SIZE, 332, Short.MAX_VALUE)) | |
| 394 | + .addGroup(layout.createSequentialGroup() | |
| 395 | + .addComponent(saveTEAM) | |
| 396 | + .addGap(54, 54, 54) | |
| 397 | + .addComponent(closeTEAM)) | |
| 398 | + .addGroup(layout.createSequentialGroup() | |
| 399 | + .addComponent(positionPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | |
| 400 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 401 | + .addComponent(titleEmblem) | |
| 402 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 76, Short.MAX_VALUE) | |
| 403 | + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) | |
| 404 | + .addComponent(loadTEAM) | |
| 405 | + .addComponent(delOKE) | |
| 406 | + .addComponent(addOKE) | |
| 407 | + .addGroup(layout.createSequentialGroup() | |
| 408 | + .addComponent(teamIcon, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | |
| 409 | + .addGap(84, 84, 84))))) | |
| 410 | + .addContainerGap()) | |
| 411 | + ); | |
| 412 | + layout.setVerticalGroup( | |
| 413 | + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
| 414 | + .addGroup(layout.createSequentialGroup() | |
| 415 | + .addContainerGap() | |
| 416 | + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |
| 417 | + .addComponent(titleTeam) | |
| 418 | + .addComponent(teamName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) | |
| 419 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 420 | + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |
| 421 | + .addComponent(titleOwner) | |
| 422 | + .addComponent(ownerName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) | |
| 423 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 424 | + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 103, Short.MAX_VALUE) | |
| 425 | + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
| 426 | + .addGroup(layout.createSequentialGroup() | |
| 427 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) | |
| 428 | + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
| 429 | + .addGroup(layout.createSequentialGroup() | |
| 430 | + .addComponent(teamIcon, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | |
| 431 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |
| 432 | + .addComponent(addOKE) | |
| 433 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 434 | + .addComponent(delOKE) | |
| 435 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 436 | + .addComponent(loadTEAM)) | |
| 437 | + .addComponent(titleEmblem)) | |
| 438 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 439 | + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |
| 440 | + .addComponent(closeTEAM) | |
| 441 | + .addComponent(saveTEAM))) | |
| 442 | + .addComponent(positionPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) | |
| 443 | + .addContainerGap()) | |
| 444 | + ); | |
| 445 | + }// </editor-fold>//GEN-END:initComponents | |
| 446 | + | |
| 447 | + private void closeTEAMActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_closeTEAMActionPerformed | |
| 448 | + JDialog dlg = (JDialog) (getRootPane().getParent()); | |
| 449 | + dlg.dispose(); | |
| 450 | + }//GEN-LAST:event_closeTEAMActionPerformed | |
| 451 | + | |
| 452 | + private void addOKEActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addOKEActionPerformed | |
| 453 | + int nsel = memberList.getSelectedIndex(); | |
| 454 | + if (nsel != -1) { | |
| 455 | + TeamListPanel teamlist = get_teamlist(); | |
| 456 | + cheOkeData wkoke = teamlist.get_current_oke(); | |
| 457 | + if (wkoke != null) { | |
| 458 | + team.add_member(nsel, wkoke, teamlist.get_current_oke_pos()); | |
| 459 | + if (nsel == 0) { | |
| 460 | + team.set_emblem(wkoke); | |
| 461 | + teamIcon.setIcon(team.get_emblem().getImgicon()); | |
| 462 | + } | |
| 463 | + update_memberlist(); | |
| 464 | + } | |
| 465 | + } | |
| 466 | + }//GEN-LAST:event_addOKEActionPerformed | |
| 467 | + | |
| 468 | + private void delOKEActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_delOKEActionPerformed | |
| 469 | + int nsel = memberList.getSelectedIndex(); | |
| 470 | + if (nsel != -1) { | |
| 471 | + team.del_member(nsel); | |
| 472 | + update_memberlist(); | |
| 473 | + } | |
| 474 | + }//GEN-LAST:event_delOKEActionPerformed | |
| 475 | + | |
| 476 | + private void saveTEAMActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveTEAMActionPerformed | |
| 477 | + int nret; | |
| 478 | + JFileChooser fdlg = new JFileChooser(Main.cheDataDir); | |
| 479 | + String filterTitle = | |
| 480 | + java.util.ResourceBundle.getBundle("chexaformation/resource"). | |
| 481 | + getString("filterTitleCHE"); | |
| 482 | + FileNameExtensionFilter ffilter = | |
| 483 | + new FileNameExtensionFilter(filterTitle, "CHE"); | |
| 484 | + fdlg.setFileFilter(ffilter); | |
| 485 | + fdlg.setSelectedFile(new File(che.get_fname())); | |
| 486 | + nret = fdlg.showSaveDialog(getRootPane().getParent()); | |
| 487 | + if (nret == JFileChooser.APPROVE_OPTION) { | |
| 488 | + File ifile = fdlg.getSelectedFile(); | |
| 489 | + if (ifile.exists() == true) { | |
| 490 | + String wktitle; | |
| 491 | + String wkmesg; | |
| 492 | + wktitle = java.util.ResourceBundle.getBundle( | |
| 493 | + "chexaformation/resource"). | |
| 494 | + getString("titleSaveTeam"); | |
| 495 | + wkmesg = java.util.ResourceBundle.getBundle( | |
| 496 | + "chexaformation/resource"). | |
| 497 | + getString("confirmExistCHE"); | |
| 498 | + if (Main.confirm_box((Dialog) (getRootPane().getParent()), | |
| 499 | + wktitle, wkmesg, "") == false) { | |
| 500 | + return; | |
| 501 | + } | |
| 502 | + } | |
| 503 | + Main.cheDataDir = ifile.getParent(); | |
| 504 | + team.set_team_name(teamName.getText()); | |
| 505 | + team.set_owner_name(ownerName.getText()); | |
| 506 | + che.set_team(0, team); | |
| 507 | + che.set_fname(ifile.getAbsolutePath()); | |
| 508 | + if (che.save() == true) { | |
| 509 | + Main.mesg_box((Dialog) (getRootPane().getParent()), | |
| 510 | + java.util.ResourceBundle.getBundle( | |
| 511 | + "chexaformation/resource"). | |
| 512 | + getString("titleSaveTeam"), | |
| 513 | + java.util.ResourceBundle.getBundle( | |
| 514 | + "chexaformation/resource"). | |
| 515 | + getString("mesgSaveTeam"), ""); | |
| 516 | + } else { | |
| 517 | + Main.mesg_box((Dialog) (getRootPane().getParent()), | |
| 518 | + java.util.ResourceBundle.getBundle( | |
| 519 | + "chexaformation/resource"). | |
| 520 | + getString("titleSaveTeam"), | |
| 521 | + java.util.ResourceBundle.getBundle( | |
| 522 | + "chexaformation/resource"). | |
| 523 | + getString("failSaveTeam"), | |
| 524 | + ifile.getAbsolutePath()); | |
| 525 | + } | |
| 526 | + update_title(); | |
| 527 | + } | |
| 528 | + }//GEN-LAST:event_saveTEAMActionPerformed | |
| 529 | + | |
| 530 | + private void pushPosition(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pushPosition | |
| 531 | + int nsel = memberList.getSelectedIndex(); | |
| 532 | + if (nsel != -1) { | |
| 533 | + int i; | |
| 534 | + Component btnlist[] = positionPanel.getComponents(); | |
| 535 | + for (i = 0; i < btnlist.length; i++) { | |
| 536 | + if (btnlist[i] == evt.getSource()) { | |
| 537 | + if (team.check_position(nsel, i) == true) { | |
| 538 | + int old_pos = team.get_position(nsel); | |
| 539 | + if (old_pos != -1) { | |
| 540 | + ((JButton) btnlist[old_pos]).setText("_"); | |
| 541 | + } | |
| 542 | + team.set_position(nsel, i); | |
| 543 | + ((JButton) btnlist[i]).setText( | |
| 544 | + Integer.toString(nsel + 1)); | |
| 545 | + okedata.setElementAt(team, nsel); | |
| 546 | + break; | |
| 547 | + } | |
| 548 | + } | |
| 549 | + } | |
| 550 | + } | |
| 551 | + }//GEN-LAST:event_pushPosition | |
| 552 | + | |
| 553 | + private void loadTEAMActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadTEAMActionPerformed | |
| 554 | + TeamListPanel teamlist = get_teamlist(); | |
| 555 | + load_team(teamlist.get_current_team()); | |
| 556 | + }//GEN-LAST:event_loadTEAMActionPerformed | |
| 557 | + // Variables declaration - do not modify//GEN-BEGIN:variables | |
| 558 | + private javax.swing.JButton addOKE; | |
| 559 | + private javax.swing.JButton closeTEAM; | |
| 560 | + private javax.swing.JButton delOKE; | |
| 561 | + private javax.swing.JScrollPane jScrollPane1; | |
| 562 | + private javax.swing.JButton loadTEAM; | |
| 563 | + private javax.swing.JList memberList; | |
| 564 | + private javax.swing.JTextField ownerName; | |
| 565 | + private javax.swing.JButton pos0; | |
| 566 | + private javax.swing.JButton pos1; | |
| 567 | + private javax.swing.JButton pos2; | |
| 568 | + private javax.swing.JButton pos3; | |
| 569 | + private javax.swing.JButton pos4; | |
| 570 | + private javax.swing.JButton pos5; | |
| 571 | + private javax.swing.JButton pos6; | |
| 572 | + private javax.swing.JButton pos7; | |
| 573 | + private javax.swing.JButton pos8; | |
| 574 | + private javax.swing.JPanel positionPanel; | |
| 575 | + private javax.swing.JButton saveTEAM; | |
| 576 | + private javax.swing.JLabel teamIcon; | |
| 577 | + private javax.swing.JTextField teamName; | |
| 578 | + private javax.swing.JLabel titleEmblem; | |
| 579 | + private javax.swing.JLabel titleOwner; | |
| 580 | + private javax.swing.JLabel titleTeam; | |
| 581 | + // End of variables declaration//GEN-END:variables | |
| 582 | +} |
| @@ -0,0 +1,361 @@ | ||
| 1 | +/* | |
| 2 | + * MatchDataPanel.java | |
| 3 | + * | |
| 4 | + * Created on 2011/09/27, 16:47:47 | |
| 5 | + */ | |
| 6 | +package chexaformation; | |
| 7 | + | |
| 8 | +import java.awt.Dialog; | |
| 9 | +import java.io.File; | |
| 10 | +import javax.swing.DefaultListModel; | |
| 11 | +import javax.swing.JDialog; | |
| 12 | +import javax.swing.JFileChooser; | |
| 13 | +import javax.swing.filechooser.FileNameExtensionFilter; | |
| 14 | + | |
| 15 | +/** | |
| 16 | + * | |
| 17 | + * @author fukui | |
| 18 | + */ | |
| 19 | +public class MatchDataPanel extends javax.swing.JPanel { | |
| 20 | + | |
| 21 | + cheFile matchdata; | |
| 22 | + DefaultListModel teamdata; | |
| 23 | + | |
| 24 | + /** Creates new form MatchDataPanel | |
| 25 | + * @param p */ | |
| 26 | + public MatchDataPanel(cheFile p) { | |
| 27 | + if (p == null) { | |
| 28 | + p = new cheFile(); | |
| 29 | + } | |
| 30 | + matchdata = p; | |
| 31 | + teamdata = new DefaultListModel(); | |
| 32 | + update_teamlist(); | |
| 33 | + initComponents(); | |
| 34 | + } | |
| 35 | + | |
| 36 | + /** | |
| 37 | + * チームリストの更新 | |
| 38 | + */ | |
| 39 | + private void update_teamlist() { | |
| 40 | + int i; | |
| 41 | + teamdata.clear(); | |
| 42 | + for (i = 0; i < matchdata.get_team_max(); i++) { | |
| 43 | + cheTeamData pwk = matchdata.get_team(i); | |
| 44 | + if (pwk == null) { | |
| 45 | + pwk = new cheTeamData(); | |
| 46 | + pwk.set_team_name("-nothing-"); | |
| 47 | + pwk.set_owner_name("-nothing-"); | |
| 48 | + pwk.set_enable(false); | |
| 49 | + } | |
| 50 | + teamdata.addElement(pwk); | |
| 51 | + } | |
| 52 | + } | |
| 53 | + | |
| 54 | + /** | |
| 55 | + * チームリストの正規化 | |
| 56 | + */ | |
| 57 | + private void normalize_teamlist() { | |
| 58 | + int i; | |
| 59 | + for (i = 0; i < matchdata.get_team_max() - 1; i++) { | |
| 60 | + cheTeamData pwk = matchdata.get_team(i); | |
| 61 | + if (pwk == null) { | |
| 62 | + int j; | |
| 63 | + for (j = i; j < matchdata.get_team_max(); j++) { | |
| 64 | + pwk = matchdata.get_team(j); | |
| 65 | + if (pwk != null) { | |
| 66 | + break; | |
| 67 | + } | |
| 68 | + } | |
| 69 | + if (j < matchdata.get_team_max()) { | |
| 70 | + matchdata.remove_team(j); | |
| 71 | + matchdata.set_team(i, pwk); | |
| 72 | + } else { | |
| 73 | + break; | |
| 74 | + } | |
| 75 | + } | |
| 76 | + } | |
| 77 | + } | |
| 78 | + | |
| 79 | + /** | |
| 80 | + * タイトル表示の更新 | |
| 81 | + */ | |
| 82 | + public void update_title() { | |
| 83 | + File fn = new File(matchdata.get_fname()); | |
| 84 | + JDialog dlg = ((JDialog) (getRootPane().getParent())); | |
| 85 | + String title; | |
| 86 | + title = java.util.ResourceBundle.getBundle("chexaformation/resource"). | |
| 87 | + getString("titleMatchDataPanel"); | |
| 88 | + title += fn.getName(); | |
| 89 | + dlg.setTitle(title); | |
| 90 | + } | |
| 91 | + | |
| 92 | + /** | |
| 93 | + * チームリストの取得 | |
| 94 | + * @return チームリストパネル | |
| 95 | + */ | |
| 96 | + private TeamListPanel get_teampanel() { | |
| 97 | + mainForm form = (mainForm) (getRootPane().getParent().getParent()); | |
| 98 | + return form.get_teamlist(); | |
| 99 | + } | |
| 100 | + | |
| 101 | + /** | |
| 102 | + * 現在選択中のチームデータを取得 | |
| 103 | + * @return チームデータ | |
| 104 | + */ | |
| 105 | + public cheTeamData get_current_team() { | |
| 106 | + int nsel = teamList.getSelectedIndex(); | |
| 107 | + if (nsel != -1) { | |
| 108 | + return (cheTeamData) teamdata.get(nsel); | |
| 109 | + } | |
| 110 | + return null; | |
| 111 | + } | |
| 112 | + | |
| 113 | + /** | |
| 114 | + * 現在の選択位置を取得 | |
| 115 | + * @return 選択位置 | |
| 116 | + */ | |
| 117 | + public int get_current_index() { | |
| 118 | + return teamList.getSelectedIndex(); | |
| 119 | + } | |
| 120 | + | |
| 121 | + /** | |
| 122 | + * チームデータを設定 | |
| 123 | + * @param p チームデータ | |
| 124 | + * @param n 設定位置 | |
| 125 | + */ | |
| 126 | + public void load_team(cheTeamData p, int n) { | |
| 127 | + if (n == -1) { | |
| 128 | + int i; | |
| 129 | + for (i = 0; i < matchdata.get_team_max(); i++) { | |
| 130 | + if (matchdata.get_team(i) == null) { | |
| 131 | + n = i; | |
| 132 | + break; | |
| 133 | + } | |
| 134 | + } | |
| 135 | + if (n == -1) { | |
| 136 | + Main.mesg_box((Dialog) (getRootPane().getParent()), | |
| 137 | + java.util.ResourceBundle.getBundle( | |
| 138 | + "chexaformation/resource").getString("addTEAM"), | |
| 139 | + java.util.ResourceBundle.getBundle( | |
| 140 | + "chexaformation/resource"). | |
| 141 | + getString("errNoSpaceTeam"), ""); | |
| 142 | + return; | |
| 143 | + } | |
| 144 | + } | |
| 145 | + if (n >= 0 && n < matchdata.get_team_max()) { | |
| 146 | + if (matchdata.set_team(n, p) == false) { | |
| 147 | + Main.mesg_box((Dialog) (getRootPane().getParent()), | |
| 148 | + java.util.ResourceBundle.getBundle( | |
| 149 | + "chexaformation/resource").getString("addTEAM"), | |
| 150 | + java.util.ResourceBundle.getBundle( | |
| 151 | + "chexaformation/resource"). | |
| 152 | + getString("errNoSpaceTeam"), ""); | |
| 153 | + } else { | |
| 154 | + update_teamlist(); | |
| 155 | + } | |
| 156 | + } | |
| 157 | + } | |
| 158 | + | |
| 159 | + /** | |
| 160 | + * チームデータを移動 | |
| 161 | + * @param src_idx 移動元インデックス | |
| 162 | + * @param dest_idx 移動先インデックス | |
| 163 | + */ | |
| 164 | + public void move_team(int src_idx,int dest_idx) { | |
| 165 | + matchdata.move_team(src_idx, dest_idx); | |
| 166 | + update_teamlist(); | |
| 167 | + } | |
| 168 | + | |
| 169 | + /** This method is called from within the constructor to | |
| 170 | + * initialize the form. | |
| 171 | + * WARNING: Do NOT modify this code. The content of this method is | |
| 172 | + * always regenerated by the Form Editor. | |
| 173 | + */ | |
| 174 | + @SuppressWarnings("unchecked") | |
| 175 | + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents | |
| 176 | + private void initComponents() { | |
| 177 | + | |
| 178 | + titleMatch = new javax.swing.JLabel(); | |
| 179 | + matchName = new javax.swing.JTextField(); | |
| 180 | + jScrollPane1 = new javax.swing.JScrollPane(); | |
| 181 | + teamList = new javax.swing.JList(); | |
| 182 | + addTeam = new javax.swing.JButton(); | |
| 183 | + delTeam = new javax.swing.JButton(); | |
| 184 | + saveMatch = new javax.swing.JButton(); | |
| 185 | + closeButton = new javax.swing.JButton(); | |
| 186 | + | |
| 187 | + titleMatch.setFont(new java.awt.Font("Monospaced", 0, 15)); // NOI18N | |
| 188 | + java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("chexaformation/resource"); // NOI18N | |
| 189 | + titleMatch.setText(bundle.getString("titleMatchName")); // NOI18N | |
| 190 | + | |
| 191 | + matchName.setDocument(new cheNameDocument()); | |
| 192 | + matchName.setFont(new java.awt.Font("Monospaced", 0, 15)); // NOI18N | |
| 193 | + matchName.setText(matchdata.get_match_name()); | |
| 194 | + | |
| 195 | + teamList.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 196 | + teamList.setModel(teamdata); | |
| 197 | + teamList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); | |
| 198 | + teamList.setDragEnabled(true); | |
| 199 | + jScrollPane1.setViewportView(teamList); | |
| 200 | + teamList.setTransferHandler(new transDestHandler2()); | |
| 201 | + | |
| 202 | + addTeam.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 203 | + addTeam.setText(bundle.getString("addTEAM")); // NOI18N | |
| 204 | + addTeam.addActionListener(new java.awt.event.ActionListener() { | |
| 205 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
| 206 | + addTeamActionPerformed(evt); | |
| 207 | + } | |
| 208 | + }); | |
| 209 | + | |
| 210 | + delTeam.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 211 | + delTeam.setText(bundle.getString("delTEAM")); // NOI18N | |
| 212 | + delTeam.addActionListener(new java.awt.event.ActionListener() { | |
| 213 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
| 214 | + delTeamActionPerformed(evt); | |
| 215 | + } | |
| 216 | + }); | |
| 217 | + | |
| 218 | + saveMatch.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 219 | + saveMatch.setText(bundle.getString("saveMatchData")); // NOI18N | |
| 220 | + saveMatch.addActionListener(new java.awt.event.ActionListener() { | |
| 221 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
| 222 | + saveMatchActionPerformed(evt); | |
| 223 | + } | |
| 224 | + }); | |
| 225 | + | |
| 226 | + closeButton.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 227 | + closeButton.setText(bundle.getString("closeWindow")); // NOI18N | |
| 228 | + closeButton.addActionListener(new java.awt.event.ActionListener() { | |
| 229 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
| 230 | + closeButtonActionPerformed(evt); | |
| 231 | + } | |
| 232 | + }); | |
| 233 | + | |
| 234 | + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); | |
| 235 | + this.setLayout(layout); | |
| 236 | + layout.setHorizontalGroup( | |
| 237 | + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
| 238 | + .addGroup(layout.createSequentialGroup() | |
| 239 | + .addContainerGap() | |
| 240 | + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
| 241 | + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 401, Short.MAX_VALUE) | |
| 242 | + .addGroup(layout.createSequentialGroup() | |
| 243 | + .addComponent(addTeam) | |
| 244 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 245 | + .addComponent(delTeam) | |
| 246 | + .addGap(18, 18, 18) | |
| 247 | + .addComponent(saveMatch) | |
| 248 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 149, Short.MAX_VALUE) | |
| 249 | + .addComponent(closeButton)) | |
| 250 | + .addGroup(layout.createSequentialGroup() | |
| 251 | + .addComponent(titleMatch) | |
| 252 | + .addGap(6, 6, 6) | |
| 253 | + .addComponent(matchName, javax.swing.GroupLayout.DEFAULT_SIZE, 320, Short.MAX_VALUE))) | |
| 254 | + .addContainerGap()) | |
| 255 | + ); | |
| 256 | + layout.setVerticalGroup( | |
| 257 | + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
| 258 | + .addGroup(layout.createSequentialGroup() | |
| 259 | + .addContainerGap() | |
| 260 | + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |
| 261 | + .addComponent(matchName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) | |
| 262 | + .addComponent(titleMatch)) | |
| 263 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 264 | + .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 277, javax.swing.GroupLayout.PREFERRED_SIZE) | |
| 265 | + .addGap(18, 18, 18) | |
| 266 | + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |
| 267 | + .addComponent(addTeam) | |
| 268 | + .addComponent(delTeam) | |
| 269 | + .addComponent(saveMatch) | |
| 270 | + .addComponent(closeButton)) | |
| 271 | + .addContainerGap(14, Short.MAX_VALUE)) | |
| 272 | + ); | |
| 273 | + }// </editor-fold>//GEN-END:initComponents | |
| 274 | + | |
| 275 | + private void addTeamActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addTeamActionPerformed | |
| 276 | + int nsel = teamList.getSelectedIndex(); | |
| 277 | + TeamListPanel teampanel = get_teampanel(); | |
| 278 | + cheTeamData team = teampanel.get_current_team(); | |
| 279 | + if (team != null) { | |
| 280 | + load_team(team, nsel); | |
| 281 | + update_teamlist(); | |
| 282 | + } | |
| 283 | + }//GEN-LAST:event_addTeamActionPerformed | |
| 284 | + | |
| 285 | + private void delTeamActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_delTeamActionPerformed | |
| 286 | + int nsel = teamList.getSelectedIndex(); | |
| 287 | + if (nsel != -1) { | |
| 288 | + matchdata.remove_team(nsel); | |
| 289 | + update_teamlist(); | |
| 290 | + } | |
| 291 | + }//GEN-LAST:event_delTeamActionPerformed | |
| 292 | + | |
| 293 | + private void saveMatchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveMatchActionPerformed | |
| 294 | + int nret; | |
| 295 | + JFileChooser fdlg = new JFileChooser(Main.cheMatchDataDir); | |
| 296 | + String filterTitle = | |
| 297 | + java.util.ResourceBundle.getBundle("chexaformation/resource"). | |
| 298 | + getString("filterTitleCHE"); | |
| 299 | + FileNameExtensionFilter ffilter = | |
| 300 | + new FileNameExtensionFilter(filterTitle, "CHE"); | |
| 301 | + fdlg.setFileFilter(ffilter); | |
| 302 | + fdlg.setSelectedFile(new File(matchdata.get_fname())); | |
| 303 | + nret = fdlg.showSaveDialog(getRootPane().getParent()); | |
| 304 | + if (nret == JFileChooser.APPROVE_OPTION) { | |
| 305 | + File ifile = fdlg.getSelectedFile(); | |
| 306 | + if (ifile.exists() == true) { | |
| 307 | + String wktitle; | |
| 308 | + String wkmesg; | |
| 309 | + wktitle = java.util.ResourceBundle.getBundle( | |
| 310 | + "chexaformation/resource"). | |
| 311 | + getString("titleSaveMatch"); | |
| 312 | + wkmesg = java.util.ResourceBundle.getBundle( | |
| 313 | + "chexaformation/resource"). | |
| 314 | + getString("confirmExistCHE"); | |
| 315 | + if (Main.confirm_box((Dialog) (getRootPane().getParent()), | |
| 316 | + wktitle, wkmesg, "") == false) { | |
| 317 | + return; | |
| 318 | + } | |
| 319 | + } | |
| 320 | + Main.cheMatchDataDir = ifile.getParent(); | |
| 321 | + normalize_teamlist(); | |
| 322 | + matchdata.set_match_name(matchName.getText()); | |
| 323 | + matchdata.set_fname(ifile.getAbsolutePath()); | |
| 324 | + if (matchdata.save() == true) { | |
| 325 | + Main.mesg_box((Dialog) (getRootPane().getParent()), | |
| 326 | + java.util.ResourceBundle.getBundle( | |
| 327 | + "chexaformation/resource"). | |
| 328 | + getString("titleSaveMatch"), | |
| 329 | + java.util.ResourceBundle.getBundle( | |
| 330 | + "chexaformation/resource"). | |
| 331 | + getString("mesgSaveMatch"), ""); | |
| 332 | + } else { | |
| 333 | + Main.mesg_box((Dialog) (getRootPane().getParent()), | |
| 334 | + java.util.ResourceBundle.getBundle( | |
| 335 | + "chexaformation/resource"). | |
| 336 | + getString("titleSaveMatch"), | |
| 337 | + java.util.ResourceBundle.getBundle( | |
| 338 | + "chexaformation/resource"). | |
| 339 | + getString("failSaveMatch"), | |
| 340 | + ifile.getAbsolutePath()); | |
| 341 | + } | |
| 342 | + update_teamlist(); | |
| 343 | + update_title(); | |
| 344 | + } | |
| 345 | + }//GEN-LAST:event_saveMatchActionPerformed | |
| 346 | + | |
| 347 | + private void closeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_closeButtonActionPerformed | |
| 348 | + JDialog dlg = (JDialog) (getRootPane().getParent()); | |
| 349 | + dlg.dispose(); | |
| 350 | + }//GEN-LAST:event_closeButtonActionPerformed | |
| 351 | + // Variables declaration - do not modify//GEN-BEGIN:variables | |
| 352 | + private javax.swing.JButton addTeam; | |
| 353 | + private javax.swing.JButton closeButton; | |
| 354 | + private javax.swing.JButton delTeam; | |
| 355 | + private javax.swing.JScrollPane jScrollPane1; | |
| 356 | + private javax.swing.JTextField matchName; | |
| 357 | + private javax.swing.JButton saveMatch; | |
| 358 | + private javax.swing.JList teamList; | |
| 359 | + private javax.swing.JLabel titleMatch; | |
| 360 | + // End of variables declaration//GEN-END:variables | |
| 361 | +} |
| @@ -0,0 +1,154 @@ | ||
| 1 | +/* | |
| 2 | + * mainForm.java | |
| 3 | + * | |
| 4 | + * Created on 2010/12/14, 16:19:55 | |
| 5 | + */ | |
| 6 | +package chexaformation; | |
| 7 | + | |
| 8 | +import java.awt.Point; | |
| 9 | +import java.io.File; | |
| 10 | +import javax.swing.JDialog; | |
| 11 | +import javax.swing.JFileChooser; | |
| 12 | +import javax.swing.filechooser.FileNameExtensionFilter; | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * | |
| 16 | + * @author fukui | |
| 17 | + */ | |
| 18 | +public class mainForm extends javax.swing.JFrame { | |
| 19 | + | |
| 20 | + /** Creates new form mainForm */ | |
| 21 | + public mainForm() { | |
| 22 | + initComponents(); | |
| 23 | + } | |
| 24 | + | |
| 25 | + public TeamListPanel get_teamlist() { | |
| 26 | + return mainPanel; | |
| 27 | + } | |
| 28 | + | |
| 29 | + /** This method is called from within the constructor to | |
| 30 | + * initialize the form. | |
| 31 | + * WARNING: Do NOT modify this code. The content of this method is | |
| 32 | + * always regenerated by the Form Editor. | |
| 33 | + */ | |
| 34 | + @SuppressWarnings("unchecked") | |
| 35 | + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents | |
| 36 | + private void initComponents() { | |
| 37 | + | |
| 38 | + openTeam = new javax.swing.JButton(); | |
| 39 | + makeMatchData = new javax.swing.JButton(); | |
| 40 | + mainPanel = new chexaformation.TeamListPanel(); | |
| 41 | + | |
| 42 | + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); | |
| 43 | + setTitle("CHEXA Team formation " + Main.app_version); | |
| 44 | + setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); | |
| 45 | + | |
| 46 | + openTeam.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 47 | + java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("chexaformation/resource"); // NOI18N | |
| 48 | + openTeam.setText(bundle.getString("makeTeam")); // NOI18N | |
| 49 | + openTeam.addActionListener(new java.awt.event.ActionListener() { | |
| 50 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
| 51 | + openTeamActionPerformed(evt); | |
| 52 | + } | |
| 53 | + }); | |
| 54 | + | |
| 55 | + makeMatchData.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 56 | + makeMatchData.setText(bundle.getString("makeMatchData")); // NOI18N | |
| 57 | + makeMatchData.addActionListener(new java.awt.event.ActionListener() { | |
| 58 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
| 59 | + makeMatchDataActionPerformed(evt); | |
| 60 | + } | |
| 61 | + }); | |
| 62 | + | |
| 63 | + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); | |
| 64 | + getContentPane().setLayout(layout); | |
| 65 | + layout.setHorizontalGroup( | |
| 66 | + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
| 67 | + .addGroup(layout.createSequentialGroup() | |
| 68 | + .addContainerGap() | |
| 69 | + .addComponent(openTeam) | |
| 70 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 71 | + .addComponent(makeMatchData) | |
| 72 | + .addContainerGap(214, Short.MAX_VALUE)) | |
| 73 | + .addComponent(mainPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 412, Short.MAX_VALUE) | |
| 74 | + ); | |
| 75 | + layout.setVerticalGroup( | |
| 76 | + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
| 77 | + .addGroup(layout.createSequentialGroup() | |
| 78 | + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |
| 79 | + .addComponent(openTeam) | |
| 80 | + .addComponent(makeMatchData)) | |
| 81 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 82 | + .addComponent(mainPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 398, Short.MAX_VALUE)) | |
| 83 | + ); | |
| 84 | + | |
| 85 | + pack(); | |
| 86 | + }// </editor-fold>//GEN-END:initComponents | |
| 87 | + | |
| 88 | + private void openTeamActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openTeamActionPerformed | |
| 89 | + JDialog dlg = new JDialog(this, | |
| 90 | + java.util.ResourceBundle.getBundle( | |
| 91 | + "chexaformation/resource").getString("titleTeamWindow"), | |
| 92 | + false); | |
| 93 | + dlg.add(new TeamPanel()); | |
| 94 | + dlg.pack(); | |
| 95 | + Point pos = this.getLocation(); | |
| 96 | + pos.x += this.getWidth(); | |
| 97 | + dlg.setLocation(pos); | |
| 98 | + dlg.setVisible(true); | |
| 99 | + }//GEN-LAST:event_openTeamActionPerformed | |
| 100 | + | |
| 101 | + private void makeMatchDataActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_makeMatchDataActionPerformed | |
| 102 | + int nret; | |
| 103 | + JFileChooser fdlg = new JFileChooser(Main.cheMatchDataDir); | |
| 104 | + String filterTitle = | |
| 105 | + java.util.ResourceBundle.getBundle("chexaformation/resource"). | |
| 106 | + getString("filterTitleCHE"); | |
| 107 | + FileNameExtensionFilter ffilter = | |
| 108 | + new FileNameExtensionFilter(filterTitle, "CHE"); | |
| 109 | + fdlg.setFileFilter(ffilter); | |
| 110 | + nret = fdlg.showOpenDialog(getRootPane().getParent()); | |
| 111 | + if (nret == JFileChooser.APPROVE_OPTION) { | |
| 112 | + File ifile = fdlg.getSelectedFile(); | |
| 113 | + cheFile che = new cheFile(ifile.getAbsolutePath()); | |
| 114 | + Main.cheMatchDataDir = ifile.getParent(); | |
| 115 | + if (che.load() == true) { | |
| 116 | + if (che.is_teamfile() == false) { | |
| 117 | + JDialog dlg = new JDialog(this, | |
| 118 | + java.util.ResourceBundle.getBundle( | |
| 119 | + "chexaformation/resource"). | |
| 120 | + getString("titleMatchWindow"), | |
| 121 | + false); | |
| 122 | + che.set_fname("NEWMATCH.CHE"); | |
| 123 | + che.clear_oke(); | |
| 124 | + dlg.add(new MatchDataPanel(che)); | |
| 125 | + dlg.pack(); | |
| 126 | + Point pos = this.getLocation(); | |
| 127 | + pos.x += this.getWidth(); | |
| 128 | + dlg.setLocation(pos); | |
| 129 | + dlg.setVisible(true); | |
| 130 | + } else { | |
| 131 | + Main.mesg_box(this, | |
| 132 | + java.util.ResourceBundle.getBundle( | |
| 133 | + "chexaformation/resource").getString("loadCHE"), | |
| 134 | + java.util.ResourceBundle.getBundle( | |
| 135 | + "chexaformation/resource"). | |
| 136 | + getString("errNotMatchData"), | |
| 137 | + ifile.getAbsolutePath()); | |
| 138 | + } | |
| 139 | + } else { | |
| 140 | + Main.mesg_box(this, | |
| 141 | + java.util.ResourceBundle.getBundle( | |
| 142 | + "chexaformation/resource").getString("loadCHE"), | |
| 143 | + java.util.ResourceBundle.getBundle( | |
| 144 | + "chexaformation/resource").getString("faileReadCHE"), | |
| 145 | + ifile.getAbsolutePath()); | |
| 146 | + } | |
| 147 | + } | |
| 148 | + }//GEN-LAST:event_makeMatchDataActionPerformed | |
| 149 | + // Variables declaration - do not modify//GEN-BEGIN:variables | |
| 150 | + private chexaformation.TeamListPanel mainPanel; | |
| 151 | + private javax.swing.JButton makeMatchData; | |
| 152 | + private javax.swing.JButton openTeam; | |
| 153 | + // End of variables declaration//GEN-END:variables | |
| 154 | +} |
| @@ -0,0 +1,116 @@ | ||
| 1 | +package chexaformation; | |
| 2 | + | |
| 3 | +import java.awt.Color; | |
| 4 | +import java.awt.Component; | |
| 5 | +import javax.swing.Icon; | |
| 6 | +import javax.swing.JLabel; | |
| 7 | +import javax.swing.JList; | |
| 8 | +import javax.swing.ListCellRenderer; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * OKE表示クラス | |
| 12 | + * | |
| 13 | + * @author fukui | |
| 14 | + */ | |
| 15 | +public class okeView extends JLabel implements ListCellRenderer { | |
| 16 | + | |
| 17 | + /** | |
| 18 | + * コンストラクタ | |
| 19 | + */ | |
| 20 | + public okeView() { | |
| 21 | + super(); | |
| 22 | + setOpaque(true); | |
| 23 | + } | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * コンストラクタ | |
| 27 | + * | |
| 28 | + * @param image アイコンイメージ | |
| 29 | + */ | |
| 30 | + public okeView(Icon image) { | |
| 31 | + super(image); | |
| 32 | + setOpaque(true); | |
| 33 | + } | |
| 34 | + | |
| 35 | + /** | |
| 36 | + * コンストラクタ | |
| 37 | + * | |
| 38 | + * @param image アイコンイメージ | |
| 39 | + * @param horizontalAlignment 水平方向編集属性 | |
| 40 | + */ | |
| 41 | + public okeView(Icon image, int horizontalAlignment) { | |
| 42 | + super(image, horizontalAlignment); | |
| 43 | + setOpaque(true); | |
| 44 | + } | |
| 45 | + | |
| 46 | + /** | |
| 47 | + * コンストラクタ | |
| 48 | + * | |
| 49 | + * @param text 表示文字列 | |
| 50 | + */ | |
| 51 | + public okeView(String text) { | |
| 52 | + super(text); | |
| 53 | + setOpaque(true); | |
| 54 | + } | |
| 55 | + | |
| 56 | + /** | |
| 57 | + * コンストラクタ | |
| 58 | + * | |
| 59 | + * @param text 表示文字列 | |
| 60 | + * @param horizontalAlignment 水平方向編集属性 | |
| 61 | + */ | |
| 62 | + public okeView(String text, int horizontalAlignment) { | |
| 63 | + super(text, horizontalAlignment); | |
| 64 | + setOpaque(true); | |
| 65 | + } | |
| 66 | + | |
| 67 | + /** | |
| 68 | + * コンストラクタ | |
| 69 | + * | |
| 70 | + * @param text 表示文字列 | |
| 71 | + * @param icon アイコンイメージ | |
| 72 | + * @param horizontalAlignment 水平方向編集属性 | |
| 73 | + */ | |
| 74 | + public okeView(String text, Icon icon, int horizontalAlignment) { | |
| 75 | + super(text, icon, horizontalAlignment); | |
| 76 | + setOpaque(true); | |
| 77 | + } | |
| 78 | + | |
| 79 | + public Component getListCellRendererComponent(JList list, Object value, | |
| 80 | + int index, boolean isSelected, boolean cellHasFocus) { | |
| 81 | + Color fg; | |
| 82 | + Color bg; | |
| 83 | + String wkstr; | |
| 84 | + cheTeamData team = (cheTeamData) value; | |
| 85 | + if (isSelected == true) { | |
| 86 | + fg = list.getSelectionForeground(); | |
| 87 | + bg = list.getSelectionBackground(); | |
| 88 | + } else { | |
| 89 | + fg = list.getForeground(); | |
| 90 | + bg = list.getBackground(); | |
| 91 | + } | |
| 92 | + wkstr = Integer.toString(index + 1) + ":"; | |
| 93 | + setIcon(null); | |
| 94 | + if (team != null) { | |
| 95 | + cheOkeData oke = team.get_member(index); | |
| 96 | + if (oke != null) { | |
| 97 | + setIcon(oke.get_emblem().getImgicon()); | |
| 98 | + wkstr += oke.toString(); | |
| 99 | + wkstr += "["; | |
| 100 | + wkstr += team.member_pos(index); | |
| 101 | + wkstr += "]"; | |
| 102 | + //oke.dump("OKE"); | |
| 103 | + } else { | |
| 104 | + wkstr += "-nothing-"; | |
| 105 | + } | |
| 106 | + } else { | |
| 107 | + wkstr += "-no data-"; | |
| 108 | + } | |
| 109 | + setText(wkstr); | |
| 110 | + setForeground(fg); | |
| 111 | + setBackground(bg); | |
| 112 | + setEnabled(list.isEnabled()); | |
| 113 | + setFont(list.getFont()); | |
| 114 | + return this; | |
| 115 | + } | |
| 116 | +} |
| @@ -0,0 +1,101 @@ | ||
| 1 | +/* | |
| 2 | + * mesgPanel.java | |
| 3 | + * | |
| 4 | + * Created on 2010/12/17, 11:57:55 | |
| 5 | + */ | |
| 6 | +package chexaformation; | |
| 7 | + | |
| 8 | +import javax.swing.JDialog; | |
| 9 | +import javax.swing.JLabel; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * | |
| 13 | + * @author fukui | |
| 14 | + */ | |
| 15 | +public class mesgPanel extends javax.swing.JPanel { | |
| 16 | + | |
| 17 | + /** Creates new form mesgPanel */ | |
| 18 | + public mesgPanel() { | |
| 19 | + initComponents(); | |
| 20 | + } | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 一行目のラベルコントロールを取得 | |
| 24 | + * @return ラベル | |
| 25 | + */ | |
| 26 | + public JLabel getMesg1() { | |
| 27 | + return mesg1; | |
| 28 | + } | |
| 29 | + | |
| 30 | + /** | |
| 31 | + * 二行目のラベルコントロールを取得 | |
| 32 | + * @return ラベル | |
| 33 | + */ | |
| 34 | + public JLabel getMesg2() { | |
| 35 | + return mesg2; | |
| 36 | + } | |
| 37 | + | |
| 38 | + /** This method is called from within the constructor to | |
| 39 | + * initialize the form. | |
| 40 | + * WARNING: Do NOT modify this code. The content of this method is | |
| 41 | + * always regenerated by the Form Editor. | |
| 42 | + */ | |
| 43 | + @SuppressWarnings("unchecked") | |
| 44 | + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents | |
| 45 | + private void initComponents() { | |
| 46 | + | |
| 47 | + mesg1 = new javax.swing.JLabel(); | |
| 48 | + mesg2 = new javax.swing.JLabel(); | |
| 49 | + okButton = new javax.swing.JButton(); | |
| 50 | + | |
| 51 | + mesg1.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 52 | + mesg1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); | |
| 53 | + mesg1.setText("TEXT1"); | |
| 54 | + | |
| 55 | + mesg2.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 56 | + mesg2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); | |
| 57 | + mesg2.setText("TEXT2"); | |
| 58 | + | |
| 59 | + okButton.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 60 | + java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("chexaformation/resource"); // NOI18N | |
| 61 | + okButton.setText(bundle.getString("mesgButtonOk")); // NOI18N | |
| 62 | + okButton.addActionListener(new java.awt.event.ActionListener() { | |
| 63 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
| 64 | + okButtonActionPerformed(evt); | |
| 65 | + } | |
| 66 | + }); | |
| 67 | + | |
| 68 | + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); | |
| 69 | + this.setLayout(layout); | |
| 70 | + layout.setHorizontalGroup( | |
| 71 | + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
| 72 | + .addGroup(layout.createSequentialGroup() | |
| 73 | + .addContainerGap() | |
| 74 | + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) | |
| 75 | + .addComponent(okButton) | |
| 76 | + .addComponent(mesg2, javax.swing.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE) | |
| 77 | + .addComponent(mesg1, javax.swing.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE)) | |
| 78 | + .addContainerGap()) | |
| 79 | + ); | |
| 80 | + layout.setVerticalGroup( | |
| 81 | + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
| 82 | + .addGroup(layout.createSequentialGroup() | |
| 83 | + .addContainerGap() | |
| 84 | + .addComponent(mesg1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |
| 85 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 86 | + .addComponent(mesg2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |
| 87 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |
| 88 | + .addComponent(okButton) | |
| 89 | + .addContainerGap()) | |
| 90 | + ); | |
| 91 | + }// </editor-fold>//GEN-END:initComponents | |
| 92 | + | |
| 93 | + private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed | |
| 94 | + ((JDialog) (getRootPane().getParent())).dispose(); | |
| 95 | + }//GEN-LAST:event_okButtonActionPerformed | |
| 96 | + // Variables declaration - do not modify//GEN-BEGIN:variables | |
| 97 | + private javax.swing.JLabel mesg1; | |
| 98 | + private javax.swing.JLabel mesg2; | |
| 99 | + private javax.swing.JButton okButton; | |
| 100 | + // End of variables declaration//GEN-END:variables | |
| 101 | +} |
| @@ -0,0 +1,132 @@ | ||
| 1 | +/* | |
| 2 | + * mesgPanel.java | |
| 3 | + * | |
| 4 | + * Created on 2010/12/17, 11:57:55 | |
| 5 | + */ | |
| 6 | +package chexaformation; | |
| 7 | + | |
| 8 | +import javax.swing.JDialog; | |
| 9 | +import javax.swing.JLabel; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * | |
| 13 | + * @author fukui | |
| 14 | + */ | |
| 15 | +public class confirmPanel extends javax.swing.JPanel { | |
| 16 | + | |
| 17 | + boolean bconfirm; | |
| 18 | + | |
| 19 | + /** Creates new form mesgPanel */ | |
| 20 | + public confirmPanel() { | |
| 21 | + bconfirm = false; | |
| 22 | + initComponents(); | |
| 23 | + } | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 一行目のラベルコントロールを取得 | |
| 27 | + * @return ラベル | |
| 28 | + */ | |
| 29 | + public JLabel getMesg1() { | |
| 30 | + return mesg1; | |
| 31 | + } | |
| 32 | + | |
| 33 | + /** | |
| 34 | + * 二行目のラベルコントロールを取得 | |
| 35 | + * @return ラベル | |
| 36 | + */ | |
| 37 | + public JLabel getMesg2() { | |
| 38 | + return mesg2; | |
| 39 | + } | |
| 40 | + | |
| 41 | + /** | |
| 42 | + * 押した確認ボタンを取得 | |
| 43 | + * @return YESボタンを押したときにはtrue | |
| 44 | + */ | |
| 45 | + public boolean isConfirm() { | |
| 46 | + return bconfirm; | |
| 47 | + } | |
| 48 | + | |
| 49 | + /** This method is called from within the constructor to | |
| 50 | + * initialize the form. | |
| 51 | + * WARNING: Do NOT modify this code. The content of this method is | |
| 52 | + * always regenerated by the Form Editor. | |
| 53 | + */ | |
| 54 | + @SuppressWarnings("unchecked") | |
| 55 | + // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents | |
| 56 | + private void initComponents() { | |
| 57 | + | |
| 58 | + mesg1 = new javax.swing.JLabel(); | |
| 59 | + mesg2 = new javax.swing.JLabel(); | |
| 60 | + yesButton = new javax.swing.JButton(); | |
| 61 | + noButton1 = new javax.swing.JButton(); | |
| 62 | + | |
| 63 | + mesg1.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 64 | + mesg1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); | |
| 65 | + mesg1.setText("TEXT1"); | |
| 66 | + | |
| 67 | + mesg2.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 68 | + mesg2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); | |
| 69 | + mesg2.setText("TEXT2"); | |
| 70 | + | |
| 71 | + yesButton.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 72 | + java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("chexaformation/resource"); // NOI18N | |
| 73 | + yesButton.setText(bundle.getString("confirmButtonYes")); // NOI18N | |
| 74 | + yesButton.addActionListener(new java.awt.event.ActionListener() { | |
| 75 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
| 76 | + yesButtonActionPerformed(evt); | |
| 77 | + } | |
| 78 | + }); | |
| 79 | + | |
| 80 | + noButton1.setFont(new java.awt.Font("Monospaced", 0, 12)); // NOI18N | |
| 81 | + noButton1.setText(bundle.getString("confirmButtonNo")); // NOI18N | |
| 82 | + noButton1.addActionListener(new java.awt.event.ActionListener() { | |
| 83 | + public void actionPerformed(java.awt.event.ActionEvent evt) { | |
| 84 | + noButton1ActionPerformed(evt); | |
| 85 | + } | |
| 86 | + }); | |
| 87 | + | |
| 88 | + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); | |
| 89 | + this.setLayout(layout); | |
| 90 | + layout.setHorizontalGroup( | |
| 91 | + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
| 92 | + .addGroup(layout.createSequentialGroup() | |
| 93 | + .addContainerGap() | |
| 94 | + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) | |
| 95 | + .addGroup(layout.createSequentialGroup() | |
| 96 | + .addComponent(yesButton) | |
| 97 | + .addGap(14, 14, 14) | |
| 98 | + .addComponent(noButton1)) | |
| 99 | + .addComponent(mesg2, javax.swing.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE) | |
| 100 | + .addComponent(mesg1, javax.swing.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE)) | |
| 101 | + .addContainerGap()) | |
| 102 | + ); | |
| 103 | + layout.setVerticalGroup( | |
| 104 | + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) | |
| 105 | + .addGroup(layout.createSequentialGroup() | |
| 106 | + .addContainerGap() | |
| 107 | + .addComponent(mesg1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |
| 108 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) | |
| 109 | + .addComponent(mesg2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |
| 110 | + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) | |
| 111 | + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) | |
| 112 | + .addComponent(yesButton) | |
| 113 | + .addComponent(noButton1)) | |
| 114 | + .addContainerGap()) | |
| 115 | + ); | |
| 116 | + }// </editor-fold>//GEN-END:initComponents | |
| 117 | + | |
| 118 | + private void yesButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_yesButtonActionPerformed | |
| 119 | + bconfirm = true; | |
| 120 | + ((JDialog) (getRootPane().getParent())).dispose(); | |
| 121 | + }//GEN-LAST:event_yesButtonActionPerformed | |
| 122 | + | |
| 123 | + private void noButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_noButton1ActionPerformed | |
| 124 | + ((JDialog) (getRootPane().getParent())).dispose(); | |
| 125 | + }//GEN-LAST:event_noButton1ActionPerformed | |
| 126 | + // Variables declaration - do not modify//GEN-BEGIN:variables | |
| 127 | + private javax.swing.JLabel mesg1; | |
| 128 | + private javax.swing.JLabel mesg2; | |
| 129 | + private javax.swing.JButton noButton1; | |
| 130 | + private javax.swing.JButton yesButton; | |
| 131 | + // End of variables declaration//GEN-END:variables | |
| 132 | +} |
| @@ -0,0 +1,89 @@ | ||
| 1 | +package chexaformation; | |
| 2 | + | |
| 3 | +import java.awt.datatransfer.DataFlavor; | |
| 4 | +import java.awt.datatransfer.Transferable; | |
| 5 | +import java.awt.datatransfer.UnsupportedFlavorException; | |
| 6 | +import java.io.IOException; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * | |
| 10 | + * @author fukui | |
| 11 | + */ | |
| 12 | +public class transData implements Transferable { | |
| 13 | + | |
| 14 | + cheTeamData obj; | |
| 15 | + DataFlavor support_data[]; | |
| 16 | + int src_idx; | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * コンストラクタ | |
| 20 | + * @param oke OKEデータ | |
| 21 | + * @param n 配置場所ID | |
| 22 | + */ | |
| 23 | + public transData(cheOkeData oke, int n) { | |
| 24 | + obj = new cheTeamData(); | |
| 25 | + obj.add_member(0, oke, n); | |
| 26 | + support_data = new DataFlavor[2]; | |
| 27 | + support_data[0] = new DataFlavor(cheOkeData.class, null); | |
| 28 | + support_data[1] = new DataFlavor(Integer.class, null); | |
| 29 | + src_idx = -1; | |
| 30 | + } | |
| 31 | + | |
| 32 | + /** | |
| 33 | + * コンストラクタ | |
| 34 | + * @param team チームデータ | |
| 35 | + */ | |
| 36 | + public transData(cheTeamData team) { | |
| 37 | + obj = team; | |
| 38 | + support_data = new DataFlavor[2]; | |
| 39 | + support_data[0] = new DataFlavor(cheTeamData.class, null); | |
| 40 | + support_data[1] = new DataFlavor(Integer.class, null); | |
| 41 | + src_idx = -1; | |
| 42 | + } | |
| 43 | + | |
| 44 | + /** | |
| 45 | + * コンストラクタ | |
| 46 | + * @param team チームデータ | |
| 47 | + * @param idx マッチデータ内インデックス | |
| 48 | + */ | |
| 49 | + public transData(cheTeamData team, int idx) { | |
| 50 | + obj = team; | |
| 51 | + support_data = new DataFlavor[2]; | |
| 52 | + support_data[0] = new DataFlavor(cheTeamData.class, null); | |
| 53 | + support_data[1] = new DataFlavor(Integer.class, null); | |
| 54 | + src_idx = idx; | |
| 55 | + } | |
| 56 | + | |
| 57 | + public DataFlavor[] getTransferDataFlavors() { | |
| 58 | + return support_data; | |
| 59 | + } | |
| 60 | + | |
| 61 | + public boolean isDataFlavorSupported(DataFlavor flavor) { | |
| 62 | + int i; | |
| 63 | + for (i = 0 ; i < support_data.length ; i++) { | |
| 64 | + if (flavor.equals(support_data[i]) == true) { | |
| 65 | + return true; | |
| 66 | + } | |
| 67 | + } | |
| 68 | + return false; | |
| 69 | + } | |
| 70 | + | |
| 71 | + public Object getTransferData(DataFlavor flavor) | |
| 72 | + throws UnsupportedFlavorException, IOException { | |
| 73 | + if (flavor.equals(support_data[0]) == true) { | |
| 74 | + return obj; | |
| 75 | + } | |
| 76 | + if (flavor.equals(support_data[1]) == true) { | |
| 77 | + return src_idx; | |
| 78 | + } | |
| 79 | + return null; | |
| 80 | + } | |
| 81 | + | |
| 82 | + public cheTeamData get_obj() { | |
| 83 | + return obj; | |
| 84 | + } | |
| 85 | + | |
| 86 | + public int get_src_idx() { | |
| 87 | + return src_idx; | |
| 88 | + } | |
| 89 | +} |
| @@ -0,0 +1,147 @@ | ||
| 1 | +package chexaformation; | |
| 2 | + | |
| 3 | +import java.awt.image.BufferedImage; | |
| 4 | +import java.util.logging.Level; | |
| 5 | +import java.util.logging.Logger; | |
| 6 | +import javax.swing.ImageIcon; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * エンブレムデータ | |
| 10 | + * @author fukui | |
| 11 | + */ | |
| 12 | +public class cheEmblem { | |
| 13 | + | |
| 14 | + static final public int datasize = 576; | |
| 15 | + private BufferedImage img; | |
| 16 | + private ImageIcon imgicon; | |
| 17 | + byte realData[]; | |
| 18 | + | |
| 19 | + /** | |
| 20 | + * データの読み込み | |
| 21 | + * @param s 読み込み元データポインタ | |
| 22 | + * @param nofs 読み込み元オフセット | |
| 23 | + * @return 正常に読み込めたときにtrue | |
| 24 | + */ | |
| 25 | + private boolean inner_load(byte s[], int nofs) { | |
| 26 | + int i; | |
| 27 | + int x; | |
| 28 | + int y; | |
| 29 | + int palet_work[] = new int[16]; | |
| 30 | + if (nofs + datasize > s.length) { | |
| 31 | + return false; | |
| 32 | + } | |
| 33 | + for (i = 0; i < 16; i++) { | |
| 34 | + int c1, c2, c3, c4; | |
| 35 | + c1 = s[i * 4 + 512 + nofs] & 255; | |
| 36 | + c2 = s[i * 4 + 1 + 512 + nofs] & 255; | |
| 37 | + c3 = s[i * 4 + 2 + 512 + nofs] & 255; | |
| 38 | + c4 = s[i * 4 + 3 + 512 + nofs] & 255; | |
| 39 | + palet_work[i] = c3 | (c2 << 8) | (c1 << 16) | (c4 << 24); | |
| 40 | + realData[i * 4 + 512] = (byte) c1; | |
| 41 | + realData[i * 4 + 1 + 512] = (byte) c2; | |
| 42 | + realData[i * 4 + 2 + 512] = (byte) c3; | |
| 43 | + realData[i * 4 + 3 + 512] = (byte) c4; | |
| 44 | + } | |
| 45 | + x = 0; | |
| 46 | + y = 0; | |
| 47 | + try { | |
| 48 | + for (i = 0; i < 512; i++) { | |
| 49 | + byte c = s[i + nofs]; | |
| 50 | + realData[i] = c; | |
| 51 | + getImg().setRGB(x, y, palet_work[c & 15]); | |
| 52 | + x++; | |
| 53 | + getImg().setRGB(x, y, palet_work[(c >> 4) & 15]); | |
| 54 | + x++; | |
| 55 | + if (x >= 32) { | |
| 56 | + y++; | |
| 57 | + x = 0; | |
| 58 | + } | |
| 59 | + } | |
| 60 | + } catch (ArrayIndexOutOfBoundsException e) { | |
| 61 | + Logger.getLogger(cheEmblem.class.getName()).log(Level.SEVERE, | |
| 62 | + null, e); | |
| 63 | + } | |
| 64 | + return true; | |
| 65 | + } | |
| 66 | + | |
| 67 | + /** | |
| 68 | + * コンストラクタ | |
| 69 | + */ | |
| 70 | + public cheEmblem() { | |
| 71 | + realData = new byte[datasize]; | |
| 72 | + img = new BufferedImage(32, 32, BufferedImage.TYPE_INT_ARGB); | |
| 73 | + } | |
| 74 | + | |
| 75 | + /** | |
| 76 | + * コンストラクタ | |
| 77 | + * @param s 読み込み元データポインタ | |
| 78 | + * @param nofs 読み込み元オフセット | |
| 79 | + */ | |
| 80 | + public cheEmblem(byte s[], int nofs) { | |
| 81 | + realData = new byte[datasize]; | |
| 82 | + img = new BufferedImage(32, 32, BufferedImage.TYPE_INT_ARGB); | |
| 83 | + if (inner_load(s, nofs) == false) { | |
| 84 | + /* no image */ | |
| 85 | + img.getGraphics().clearRect(0, 0, 32, 32); | |
| 86 | + } | |
| 87 | + } | |
| 88 | + | |
| 89 | + /** | |
| 90 | + * エンブレムデータをコピー | |
| 91 | + * @param s コピー先エンブレムデータ | |
| 92 | + */ | |
| 93 | + public void copy(cheEmblem s) { | |
| 94 | + s.img = img; | |
| 95 | + s.imgicon = imgicon; | |
| 96 | + System.arraycopy(realData, 0, s.realData, 0, datasize); | |
| 97 | + } | |
| 98 | + | |
| 99 | + /** | |
| 100 | + * データの読み込み | |
| 101 | + * @param s 読み込み元データポインタ | |
| 102 | + * @param nofs 読み込み元オフセット | |
| 103 | + * @return 正常に読み込めたときにtrue | |
| 104 | + */ | |
| 105 | + public boolean load(byte s[], int nofs) { | |
| 106 | + return inner_load(s, nofs); | |
| 107 | + } | |
| 108 | + | |
| 109 | + public boolean save(byte s[], int nofs) { | |
| 110 | + if (nofs + datasize > s.length) { | |
| 111 | + return false; | |
| 112 | + } | |
| 113 | + System.arraycopy(realData, 0, s, nofs, datasize); | |
| 114 | + return true; | |
| 115 | + } | |
| 116 | + | |
| 117 | + /** | |
| 118 | + * @return the img | |
| 119 | + */ | |
| 120 | + public BufferedImage getImg() { | |
| 121 | + return img; | |
| 122 | + } | |
| 123 | + | |
| 124 | + /** | |
| 125 | + * @param img the img to set | |
| 126 | + */ | |
| 127 | + public void setImg(BufferedImage img) { | |
| 128 | + this.img = img; | |
| 129 | + } | |
| 130 | + | |
| 131 | + /** | |
| 132 | + * @return the imgicon | |
| 133 | + */ | |
| 134 | + public ImageIcon getImgicon() { | |
| 135 | + if (imgicon == null) { | |
| 136 | + imgicon = new ImageIcon(img); | |
| 137 | + } | |
| 138 | + return imgicon; | |
| 139 | + } | |
| 140 | + | |
| 141 | + /** | |
| 142 | + * @param imgicon the imgicon to set | |
| 143 | + */ | |
| 144 | + public void setImgicon(ImageIcon imgicon) { | |
| 145 | + this.imgicon = imgicon; | |
| 146 | + } | |
| 147 | +} |
| @@ -0,0 +1,57 @@ | ||
| 1 | +package chexaformation; | |
| 2 | + | |
| 3 | +import java.awt.datatransfer.DataFlavor; | |
| 4 | +import java.awt.datatransfer.Transferable; | |
| 5 | +import java.awt.datatransfer.UnsupportedFlavorException; | |
| 6 | +import java.io.IOException; | |
| 7 | +import java.util.logging.Level; | |
| 8 | +import java.util.logging.Logger; | |
| 9 | +import javax.swing.Icon; | |
| 10 | +import javax.swing.JComponent; | |
| 11 | +import javax.swing.TransferHandler; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * | |
| 15 | + * @author fukui | |
| 16 | + */ | |
| 17 | +public class transOkeHandler extends TransferHandler { | |
| 18 | + | |
| 19 | + /** コンストラクタ */ | |
| 20 | + public transOkeHandler() { | |
| 21 | + super(); | |
| 22 | + } | |
| 23 | + | |
| 24 | + @Override | |
| 25 | + public int getSourceActions(JComponent c) { | |
| 26 | + return COPY; | |
| 27 | + } | |
| 28 | + | |
| 29 | + @Override | |
| 30 | + public Icon getVisualRepresentation(Transferable t) { | |
| 31 | + cheTeamData team; | |
| 32 | + try { | |
| 33 | + team = (cheTeamData) t.getTransferData(new DataFlavor( | |
| 34 | + cheOkeData.class, null)); | |
| 35 | + if (team != null) { | |
| 36 | + return team.get_emblem().getImgicon(); | |
| 37 | + } | |
| 38 | + } catch (UnsupportedFlavorException ex) { | |
| 39 | + Logger.getLogger(transOkeHandler.class.getName()).log(Level.SEVERE, | |
| 40 | + null, ex); | |
| 41 | + } catch (IOException ex) { | |
| 42 | + Logger.getLogger(transOkeHandler.class.getName()).log(Level.SEVERE, | |
| 43 | + null, ex); | |
| 44 | + } | |
| 45 | + return null; | |
| 46 | + } | |
| 47 | + | |
| 48 | + @Override | |
| 49 | + protected Transferable createTransferable(JComponent c) { | |
| 50 | + mainForm mform = (mainForm) (c.getRootPane().getParent()); | |
| 51 | + cheOkeData oke = mform.get_teamlist().get_current_oke(); | |
| 52 | + if (oke == null) { | |
| 53 | + return null; | |
| 54 | + } | |
| 55 | + return new transData(oke, mform.get_teamlist().get_current_oke_pos()); | |
| 56 | + } | |
| 57 | +} |
| @@ -0,0 +1,121 @@ | ||
| 1 | +package chexaformation; | |
| 2 | + | |
| 3 | +import java.awt.Dialog; | |
| 4 | +import java.awt.Frame; | |
| 5 | +import java.awt.Point; | |
| 6 | +import javax.swing.JDialog; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * メイン | |
| 10 | + * @author fukui | |
| 11 | + */ | |
| 12 | +public class Main { | |
| 13 | + | |
| 14 | + static public final String app_version = "Version 1.1"; | |
| 15 | + static public String cheDataDir = null; | |
| 16 | + static public String cheMatchDataDir = null; | |
| 17 | + | |
| 18 | + /** | |
| 19 | + * メッセージボックス表示 | |
| 20 | + * @param owner 親ダイアログボックス | |
| 21 | + * @param title タイトル | |
| 22 | + * @param mesg1 メッセージ一行目 | |
| 23 | + * @param mesg2 メッセージ二行目 | |
| 24 | + */ | |
| 25 | + static public void mesg_box(Dialog owner, String title, | |
| 26 | + String mesg1, String mesg2) { | |
| 27 | + JDialog dlg = new JDialog(owner, title, true); | |
| 28 | + mesgPanel mpanel = new mesgPanel(); | |
| 29 | + mpanel.getMesg1().setText(mesg1); | |
| 30 | + mpanel.getMesg2().setText(mesg2); | |
| 31 | + dlg.add(mpanel); | |
| 32 | + dlg.pack(); | |
| 33 | + Point pos = owner.getLocation(); | |
| 34 | + pos.x += (owner.getWidth() - dlg.getWidth()) / 2; | |
| 35 | + pos.y += (owner.getHeight() - dlg.getHeight()) / 2; | |
| 36 | + dlg.setLocation(pos); | |
| 37 | + dlg.setVisible(true); | |
| 38 | + } | |
| 39 | + | |
| 40 | + /** | |
| 41 | + * メッセージボックス表示 | |
| 42 | + * @param owner 親フレームウィンドウ | |
| 43 | + * @param title タイトル | |
| 44 | + * @param mesg1 メッセージ一行目 | |
| 45 | + * @param mesg2 メッセージ二行目 | |
| 46 | + */ | |
| 47 | + static public void mesg_box(Frame owner, String title, | |
| 48 | + String mesg1, String mesg2) { | |
| 49 | + JDialog dlg = new JDialog(owner, title, true); | |
| 50 | + mesgPanel mpanel = new mesgPanel(); | |
| 51 | + mpanel.getMesg1().setText(mesg1); | |
| 52 | + mpanel.getMesg2().setText(mesg2); | |
| 53 | + dlg.add(mpanel); | |
| 54 | + dlg.pack(); | |
| 55 | + Point pos = owner.getLocation(); | |
| 56 | + pos.x += (owner.getWidth() - dlg.getWidth()) / 2; | |
| 57 | + pos.y += (owner.getHeight() - dlg.getHeight()) / 2; | |
| 58 | + dlg.setLocation(pos); | |
| 59 | + dlg.setVisible(true); | |
| 60 | + } | |
| 61 | + | |
| 62 | + /** | |
| 63 | + * 確認メッセージ表示 | |
| 64 | + * @param owner 親ダイアログボックス | |
| 65 | + * @param title タイトル | |
| 66 | + * @param mesg1 メッセージ一行目 | |
| 67 | + * @param mesg2 メッセージ二行目 | |
| 68 | + * @return YESが押されたときにtrue | |
| 69 | + */ | |
| 70 | + static public boolean confirm_box(Dialog owner, String title, | |
| 71 | + String mesg1, String mesg2) { | |
| 72 | + JDialog dlg = new JDialog(owner, title, true); | |
| 73 | + confirmPanel mpanel = new confirmPanel(); | |
| 74 | + mpanel.getMesg1().setText(mesg1); | |
| 75 | + mpanel.getMesg2().setText(mesg2); | |
| 76 | + dlg.add(mpanel); | |
| 77 | + dlg.pack(); | |
| 78 | + Point pos = owner.getLocation(); | |
| 79 | + pos.x += (owner.getWidth() - dlg.getWidth()) / 2; | |
| 80 | + pos.y += (owner.getHeight() - dlg.getHeight()) / 2; | |
| 81 | + dlg.setLocation(pos); | |
| 82 | + dlg.setVisible(true); | |
| 83 | + return mpanel.isConfirm(); | |
| 84 | + } | |
| 85 | + | |
| 86 | + /** | |
| 87 | + * 確認メッセージ表示 | |
| 88 | + * @param owner 親フレームウィンドウ | |
| 89 | + * @param title タイトル | |
| 90 | + * @param mesg1 メッセージ一行目 | |
| 91 | + * @param mesg2 メッセージ二行目 | |
| 92 | + * @return YESが押されたときにtrue | |
| 93 | + */ | |
| 94 | + static public boolean confirm_box(Frame owner, String title, | |
| 95 | + String mesg1, String mesg2) { | |
| 96 | + JDialog dlg = new JDialog(owner, title, true); | |
| 97 | + confirmPanel mpanel = new confirmPanel(); | |
| 98 | + mpanel.getMesg1().setText(mesg1); | |
| 99 | + mpanel.getMesg2().setText(mesg2); | |
| 100 | + dlg.add(mpanel); | |
| 101 | + dlg.pack(); | |
| 102 | + Point pos = owner.getLocation(); | |
| 103 | + pos.x += (owner.getWidth() - dlg.getWidth()) / 2; | |
| 104 | + pos.y += (owner.getHeight() - dlg.getHeight()) / 2; | |
| 105 | + dlg.setLocation(pos); | |
| 106 | + dlg.setVisible(true); | |
| 107 | + return mpanel.isConfirm(); | |
| 108 | + } | |
| 109 | + | |
| 110 | + /** | |
| 111 | + * @param args the command line arguments | |
| 112 | + */ | |
| 113 | + public static void main(String[] args) { | |
| 114 | + java.awt.EventQueue.invokeLater(new Runnable() { | |
| 115 | + | |
| 116 | + public void run() { | |
| 117 | + new mainForm().setVisible(true); | |
| 118 | + } | |
| 119 | + }); | |
| 120 | + } | |
| 121 | +} |