OSDN Git Service

Commandのマルチタスク化
authorhayashi yuu <hayashi.yuu@gmail.com>
Sun, 2 Aug 2015 13:50:25 +0000 (22:50 +0900)
committerhayashi yuu <hayashi.yuu@gmail.com>
Sun, 2 Aug 2015 13:50:25 +0000 (22:50 +0900)
AdjustTime/master-application.jnlp [new file with mode: 0644]
AdjustTime/nbproject/build-impl.xml
AdjustTime/nbproject/configs/JWS_generated.properties [new file with mode: 0644]
AdjustTime/nbproject/genfiles.properties
AdjustTime/nbproject/jnlp-impl.xml [new file with mode: 0644]
AdjustTime/nbproject/project.properties
AdjustTime/nbproject/project.xml
AdjustTime/preview-application.html [new file with mode: 0644]
importPicture/src/osm/jp/gpx/ImportPicture.java
importPicture/src/osm/jp/gpx/matchtime/gui/Command.java
importPicture/src/osm/jp/gpx/matchtime/gui/DoDialog.java

diff --git a/AdjustTime/master-application.jnlp b/AdjustTime/master-application.jnlp
new file mode 100644 (file)
index 0000000..1859df2
--- /dev/null
@@ -0,0 +1,22 @@
+<jnlp spec="1.0+" codebase="${jnlp.codebase}" href="launch.jnlp">
+    <information>
+        <title>${APPLICATION.TITLE}</title>
+        <vendor>${APPLICATION.VENDOR}</vendor>
+        <homepage href="${APPLICATION.HOMEPAGE}"/>
+        <description>${APPLICATION.DESC}</description>
+        <description kind="short">${APPLICATION.DESC.SHORT}</description>
+        <!--${JNLP.ICONS}-->
+        <!--${JNLP.OFFLINE.ALLOWED}-->
+    </information>
+    <!--${JNLP.UPDATE}-->
+    <!--${JNLP.SECURITY}-->
+    <resources>
+        <!--${JNLP.RESOURCES.RUNTIME}-->
+        <!--${JNLP.RESOURCES.MAIN.JAR}-->
+        <!--${JNLP.RESOURCES.JARS}-->
+        <!--${JNLP.RESOURCES.EXTENSIONS}-->
+    </resources>
+    <application-desc main-class="${jnlp.main.class}">
+        <!--${JNLP.APPLICATION.ARGS}-->
+    </application-desc>
+</jnlp>
index 84defd8..6d48b0f 100644 (file)
@@ -20,6 +20,7 @@ is divided into following sections:
 
         -->
 <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="AdjustTime-impl">
+    <import file="jnlp-impl.xml"/>
     <fail message="Please build using Ant 1.8.0 or higher.">
         <condition>
             <not>
@@ -1018,12 +1019,12 @@ is divided into following sections:
     </target>
     <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"/>
     <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"/>
-    <target name="-post-jar">
+    <target depends="jnlp" name="-post-jar">
         <!-- Empty placeholder for easier customization. -->
         <!-- You can override this target in the ../build.xml file. -->
     </target>
     <target depends="init,compile,-pre-jar,-do-jar-without-libraries,-do-jar-with-libraries,-post-jar" name="-do-jar"/>
-    <target depends="init,compile,-pre-jar,-do-jar,-post-jar" description="Build JAR." name="jar"/>
+    <target depends="init,compile,-pre-jar,-do-jar,-post-jar,jnlp" description="Build JAR." name="jar"/>
     <!--
                 =================
                 EXECUTION SECTION
diff --git a/AdjustTime/nbproject/configs/JWS_generated.properties b/AdjustTime/nbproject/configs/JWS_generated.properties
new file mode 100644 (file)
index 0000000..7a873bf
--- /dev/null
@@ -0,0 +1,4 @@
+$label=Web Start
+$target.debug=jws-debug
+$target.run=jws-run
+compile.on.save.unsupported.javawebstart=true
index 7beff30..c67985b 100644 (file)
@@ -1,8 +1,8 @@
-build.xml.data.CRC32=c9679f2a
+build.xml.data.CRC32=e15f07bd
 build.xml.script.CRC32=ab56f916
 build.xml.stylesheet.CRC32=8064a381@1.75.2.48
 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
-nbproject/build-impl.xml.data.CRC32=c9679f2a
-nbproject/build-impl.xml.script.CRC32=68212a92
+nbproject/build-impl.xml.data.CRC32=e15f07bd
+nbproject/build-impl.xml.script.CRC32=f24093bb
 nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48
diff --git a/AdjustTime/nbproject/jnlp-impl.xml b/AdjustTime/nbproject/jnlp-impl.xml
new file mode 100644 (file)
index 0000000..d0e7703
--- /dev/null
@@ -0,0 +1,771 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+Copyright 1997-2013 Oracle and/or its affiliates. All rights reserved.
+
+Oracle and Java are registered trademarks of Oracle and/or its affiliates.
+Other names may be trademarks of their respective owners.
+
+
+The contents of this file are subject to the terms of either the GNU
+General Public License Version 2 only ("GPL") or the Common
+Development and Distribution License("CDDL") (collectively, the
+"License"). You may not use this file except in compliance with the
+License. You can obtain a copy of the License at
+http://www.netbeans.org/cddl-gplv2.html
+or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
+specific language governing permissions and limitations under the
+License.  When distributing the software, include this License Header
+Notice in each file and include the License file at
+nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
+particular file as subject to the "Classpath" exception as provided
+by Oracle in the GPL Version 2 section of the License file that
+accompanied this code. If applicable, add the following below the
+License Header, with the fields enclosed by brackets [] replaced by
+your own identifying information:
+"Portions Copyrighted [year] [name of copyright owner]"
+
+Contributor(s):
+
+The Original Software is NetBeans. The Initial Developer of the Original
+Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
+Microsystems, Inc. All Rights Reserved.
+
+If you wish your version of this file to be governed by only the CDDL
+or only the GPL Version 2, indicate your decision by adding
+"[Contributor] elects to include this software in this distribution
+under the [CDDL or GPL Version 2] license." If you do not indicate a
+single choice of license, a recipient has the option to distribute
+your version of this file under either the CDDL, the GPL Version 2 or
+to extend the choice of license to its licensees as provided above.
+However, if you add GPL Version 2 code and therefore, elected the GPL
+Version 2 license, then the option applies only if the new code is
+made subject to such option by the copyright holder.
+-->
+
+<project name="jnlp-impl" default="default" basedir=".." xmlns:jnlp="http://www.netbeans.org/ns/j2se-project/jnlp" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3">
+
+    <property name="jnlp.file.name.default" value="launch.jnlp"/>
+    <property name="jnlp.dest.dir" location="dist"/>
+    
+    <!-- helper file to create list of arguments, etc. -->
+    <property name="helper.file" location="helper.txt"/>
+    
+    <target name="default">
+        <echo message="Default target is not set, you must specify which target you want to run."/>
+    </target>
+
+    <target name="-check-operating-system">
+        <condition property="running.on.mac">
+            <os family="mac"/>
+        </condition>
+        <condition property="running.on.unix">
+            <os family="unix"/>
+        </condition>
+        <condition property="running.on.windows">
+            <os family="windows"/>
+        </condition>
+        <echo message="running.on.mac = ${running.on.mac}" level="verbose"/>
+        <echo message="running.on.unix = ${running.on.unix}" level="verbose"/>
+        <echo message="running.on.windows = ${running.on.windows}" level="verbose"/>
+    </target>
+
+    <target name="-substitute-platform-home" unless="platform.home">
+        <property name="platform.home" value="${java.home}"/>
+    </target>
+
+    <target name="-init-platform" depends="-substitute-platform-home">
+        <condition property="java.exe.found">
+            <or>
+                <available file="${platform.home}${file.separator}bin${file.separator}java"/>
+                <available file="${platform.home}${file.separator}bin${file.separator}java.exe"/>
+            </or>
+        </condition>
+        <fail message="Error: java executable not found in current platform." unless="java.exe.found"/>
+        <local name="version-output"/>
+        <exec executable="${platform.home}${file.separator}bin${file.separator}java" outputproperty="version-output">
+            <arg value="-version"/>
+        </exec>
+        <echo message="java executable version-output:${line.separator}${version-output}" level="verbose"/>
+        <condition property="have-jdk-7u4-mac">
+            <and>
+                <contains string="${version-output}" substring="java version &quot;1.7.0_04"/>
+                <os family="mac"/>
+            </and>
+        </condition>
+        <fail message="Error:${line.separator}JDK 7u4 Mac does not support WebStart technology.${line.separator}Please upgrade to JDK 7u6 or later." if="have-jdk-7u4-mac"/>
+    </target>
+
+    <!-- Check availability of WebStart executable -->
+
+    <target name="-check-webstart-in-platform-home-jre" if="platform.home">
+        <condition property="do.set.webstart.in.platform.home.jre">
+            <and>
+                <not><isset property="active.webstart.executable"/></not>
+                <or>
+                    <available file="${platform.home}${file.separator}jre${file.separator}bin${file.separator}javaws.exe"/>
+                    <available file="${platform.home}${file.separator}jre${file.separator}bin${file.separator}javaws"/>
+                </or>
+            </and>
+        </condition>
+    </target>
+    <target name="-set-webstart-in-platform-home-jre" depends="-check-webstart-in-platform-home-jre" if="do.set.webstart.in.platform.home.jre">
+        <property name="active.webstart.executable" value="${platform.home}${file.separator}jre${file.separator}bin${file.separator}javaws"/>
+    </target>
+    <target name="-check-webstart-in-platform-home" if="platform.home">
+        <condition property="do.set.webstart.in.platform.home">
+            <and>
+                <not><isset property="active.webstart.executable"/></not>
+                <or>
+                    <available file="${platform.home}${file.separator}bin${file.separator}javaws.exe"/>
+                    <available file="${platform.home}${file.separator}bin${file.separator}javaws"/>
+                </or>
+            </and>
+        </condition>
+    </target>
+    <target name="-set-webstart-in-platform-home" depends="-set-webstart-in-platform-home-jre,-check-webstart-in-platform-home" if="do.set.webstart.in.platform.home">
+        <property name="active.webstart.executable" value="${platform.home}${file.separator}bin${file.separator}javaws"/>
+    </target>
+    <target name="-check-webstart-in-platform-home-220918workaround" if="platform.home">
+        <condition property="do.set.webstart.in.platform.home.220918workaround">
+            <and>
+                <not><isset property="active.webstart.executable"/></not>
+                <or>
+                    <available file="${platform.home}${file.separator}..${file.separator}bin${file.separator}javaws.exe"/>
+                    <available file="${platform.home}${file.separator}..${file.separator}bin${file.separator}javaws"/>
+                </or>
+            </and>
+        </condition>
+    </target>
+    <target name="-set-webstart-in-platform-home-220918workaround" depends="-set-webstart-in-platform-home,-check-webstart-in-platform-home-220918workaround" if="do.set.webstart.in.platform.home.220918workaround">
+        <property name="active.webstart.executable" value="${platform.home}${file.separator}..${file.separator}bin${file.separator}javaws"/>
+    </target>
+    <target name="-check-webstart-in-jre" unless="active.webstart.executable">
+        <condition property="do.set.webstart.in.jre">
+            <and>
+                <not><isset property="active.webstart.executable"/></not>
+                <or>
+                    <available file="${java.home}${file.separator}bin${file.separator}javaws.exe"/>
+                    <available file="${java.home}${file.separator}bin${file.separator}javaws"/>
+                </or>
+            </and>
+        </condition>
+    </target>
+    <target name="-set-webstart-in-jre" depends="-set-webstart-in-platform-home-220918workaround,-check-webstart-in-jre" if="do.set.webstart.in.jre">
+        <property name="active.webstart.executable" value="${java.home}${file.separator}bin${file.separator}javaws"/>
+    </target>
+    <target name="-check-webstart-in-probjdk" unless="active.webstart.executable">
+        <condition property="do.set.webstart.in.probjdk">
+            <and>
+                <not><isset property="active.webstart.executable"/></not>
+                <or>
+                    <available file="${java.home}${file.separator}..${file.separator}bin${file.separator}javaws.exe"/>
+                    <available file="${java.home}${file.separator}..${file.separator}bin${file.separator}javaws"/>
+                </or>
+            </and>
+        </condition>
+    </target>
+    <target name="-set-webstart-in-probjdk" depends="-set-webstart-in-jre,-check-webstart-in-probjdk" if="do.set.webstart.in.probjdk">
+        <property name="active.webstart.executable" value="${java.home}${file.separator}..${file.separator}bin${file.separator}javaws"/>
+    </target>
+    <target name="-check-webstart-in-envjdk" unless="active.webstart.executable">
+        <property environment="env"/>
+        <condition property="do.set.webstart.in.envjdk">
+            <and>
+                <not><isset property="active.webstart.executable"/></not>
+                <or>
+                    <available file="${env.JAVA_HOME}${file.separator}bin${file.separator}javaws.exe"/>
+                    <available file="${env.JAVA_HOME}${file.separator}bin${file.separator}javaws"/>
+                </or>
+            </and>
+        </condition>
+    </target>
+    <target name="-set-webstart-in-envjdk" depends="-set-webstart-in-probjdk,-check-webstart-in-envjdk" if="do.set.webstart.in.envjdk">
+        <property name="active.webstart.executable" value="${env.JAVA_HOME}${file.separator}bin${file.separator}javaws"/>
+    </target>
+    <target name="-check-webstart-in-usr-bin" unless="active.webstart.executable">
+        <condition property="do.set.webstart.in.usr.bin">
+            <and>
+                <not><isset property="active.webstart.executable"/></not>
+                <available file="${file.separator}usr${file.separator}bin${file.separator}javaws"/>
+            </and>
+        </condition>
+    </target>
+    <target name="-set-webstart-in-usr-bin" depends="-set-webstart-in-envjdk,-check-webstart-in-usr-bin" if="do.set.webstart.in.usr.bin">
+        <property name="active.webstart.executable" value="${file.separator}usr${file.separator}bin${file.separator}javaws"/>
+    </target>
+    <target name="-pre-check-webstart-in-unix" depends="-check-operating-system,-set-webstart-in-usr-bin" unless="active.webstart.executable">
+        <condition property="running.on.unix-active.webstart.executable">
+            <and>
+                <not><isset property="active.webstart.executable"/></not>
+                <isset property="running.on.unix"/>
+            </and>
+        </condition>
+    </target>
+    <target name="-check-webstart-in-unix" depends="-pre-check-webstart-in-unix" if="running.on.unix-active.webstart.executable">
+        <local name="exec.which.javaws.result"/>
+        <exec executable="which" failifexecutionfails="false" failonerror="false" resultproperty="exec.which.javaws.result" outputproperty="exec.which.javaws.output">
+            <arg value="javaws"/>
+        </exec>
+        <condition property="do.set.webstart.in.unix">
+            <and>
+                <not><isset property="active.webstart.executable"/></not>
+                <isset property="exec.which.javaws.result"/>
+                <equals arg1="${exec.which.javaws.result}" arg2="0"/>
+                <isset property="exec.which.javaws.output"/>
+                <not><equals arg1="${exec.which.javaws.output}" arg2=""/></not>
+            </and>
+        </condition>
+        <echo message="do.set.webstart.in.unix = ${do.set.webstart.in.unix}" level="verbose"/>
+    </target>
+    <target name="-set-webstart-in-unix" depends="-set-webstart-in-envjdk,-check-webstart-in-unix" if="do.set.webstart.in.unix">
+        <property name="active.webstart.executable" value="${exec.which.javaws.output}"/>
+    </target>
+    <target name="-pre-check-webstart" depends="-set-webstart-in-unix">
+        <echo message="active.webstart.executable = ${active.webstart.executable}" level="verbose"/>
+    </target>
+
+    <target name="-check-webstart" depends="-pre-check-webstart">
+        <condition property="webstart-available">
+            <and>
+                <or>
+                    <isset property="do.set.webstart.in.platform.home.jre"/>
+                    <isset property="do.set.webstart.in.platform.home"/>
+                    <isset property="do.set.webstart.in.platform.home.220918workaround"/>
+                    <isset property="do.set.webstart.in.jre"/>
+                    <isset property="do.set.webstart.in.probjdk"/>
+                    <isset property="do.set.webstart.in.envjdk"/>
+                    <isset property="do.set.webstart.in.usr.bin"/>
+                    <isset property="do.set.webstart.in.unix"/>
+                </or>
+                <isset property="active.webstart.executable"/>
+            </and>
+        </condition>
+        <fail message="Error:${line.separator}WebStart executable could not be found." unless="webstart-available"/>
+        <echo message="webstart-available = ${webstart-available}" level="verbose"/>
+    </target>
+
+    <!-- Main target -->
+
+    <target name="jnlp" depends="-init-filename,-test-jnlp-enabled,-do-jar-jnlp" if="is.jnlp.enabled">
+        <makeurl property="jnlp.local.codebase.url" file="${basedir}/dist" validate="false"/>
+        <antcall target="generate-jnlp"/>
+        <antcall target="generate-html-preview"/>
+        <antcall target="-warn-insufficient-signing"/>
+    </target>
+
+    <!-- JNLP archiving -->
+
+    <target name="-init-macrodef-extend-manifest">
+        <macrodef name="extend-manifest" uri="http://www.netbeans.org/ns/j2se-project/jnlp">
+            <element name="customize"/>
+            <sequential>
+                <manifest file="${tmp.manifest.file}" mode="update">
+                    <customize/>
+                </manifest>
+            </sequential>
+        </macrodef>
+    </target>
+
+    <target name="-test-jnlp-type" depends="-test-jnlp-enabled" if="is.jnlp.enabled">
+        <condition property="is.applet">
+            <equals arg1="${jnlp.descriptor}" arg2="applet" trim="true"/>
+        </condition>
+        <condition property="is.application">
+            <equals arg1="${jnlp.descriptor}" arg2="application" trim="true"/>
+        </condition>
+        <condition property="is.component">
+            <equals arg1="${jnlp.descriptor}" arg2="component" trim="true"/>
+        </condition>
+        <condition property="is.applet+mkdist.available">
+            <and>
+                <isset property="libs.CopyLibs.classpath"/>
+                <istrue value="${is.applet}"/>
+            </and>
+        </condition>
+        <condition property="is.application+mkdist.available">
+            <and>
+                <isset property="libs.CopyLibs.classpath"/>
+                <istrue value="${is.application}"/>
+            </and>
+        </condition>
+        <condition property="is.component+mkdist.available">
+            <and>
+                <isset property="libs.CopyLibs.classpath"/>
+                <istrue value="${is.component}"/>
+            </and>
+        </condition>
+    </target>
+
+    <target name="-create-tmp-manifest" unless="manifest.file">
+        <property name="tmp.manifest.file" value="${build.dir}/manifest.mf"/>
+        <delete file="${tmp.manifest.file}" failonerror="false"/>
+        <touch file="${tmp.manifest.file}"/>
+    </target>
+
+    <target name="-copy-tmp-manifest" if="manifest.file">
+        <property name="tmp.manifest.file" value="${build.dir}/manifest.mf"/>
+        <copy file="${manifest.file}" tofile="${build.dir}/manifest.mf"/>
+    </target>
+
+    <target name="-set-mixed-code-properties" depends="-check-signing-possible" if="jnlp.signed.true+signjars.task.available">
+        <property name="jnlp.mixed.code" value=""/>
+        <condition property="mixed.code.trusted.only">
+            <equals arg1="trusted_only" arg2="${jnlp.mixed.code}"/>
+        </condition>
+        <condition property="mixed.code.trusted.library">
+            <equals arg1="trusted_library" arg2="${jnlp.mixed.code}"/>
+        </condition>
+    </target>
+
+    <target name="-add-trusted-only-attribute" depends="-set-mixed-code-properties,-init-macrodef-extend-manifest" if="mixed.code.trusted.only">
+        <jnlp:extend-manifest>
+            <customize>
+                <attribute name="Trusted-Only" value="true"/>
+            </customize>
+        </jnlp:extend-manifest>
+    </target>
+    <target name="-add-trusted-library-attribute" depends="-set-mixed-code-properties,-init-macrodef-extend-manifest" if="mixed.code.trusted.library">
+        <jnlp:extend-manifest>
+            <customize>
+                <attribute name="Trusted-Library" value="true"/>
+            </customize>
+        </jnlp:extend-manifest>
+    </target>
+    
+    <target name="-check-manifest-codebase">
+        <condition property="manifest.codebase.copy" value="${jnlp.dest.dir}">
+            <and>
+                <isset property="jnlp.codebase.type"/>
+                <equals arg1="${jnlp.codebase.type}" arg2="local"/>
+                <or>
+                    <not><isset property="manifest.custom.codebase"/></not>
+                    <equals arg1="${manifest.custom.codebase}" arg2=""/>
+                </or>
+            </and>
+        </condition>
+        <condition property="manifest.codebase.copy" value="${jnlp.codebase.user}">
+            <and>
+                <isset property="jnlp.codebase.type"/>
+                <equals arg1="${jnlp.codebase.type}" arg2="user"/>
+                <isset property="jnlp.codebase.user"/>
+                <not><equals arg1="${jnlp.codebase.type}" arg2=""/></not>
+                <or>
+                    <not><isset property="manifest.custom.codebase"/></not>
+                    <equals arg1="${manifest.custom.codebase}" arg2=""/>
+                </or>
+            </and>
+        </condition>
+        <condition property="manifest.codebase.web">
+            <and>
+                <isset property="jnlp.codebase.type"/>
+                <equals arg1="${jnlp.codebase.type}" arg2="web"/>
+                <or>
+                    <not><isset property="manifest.custom.codebase"/></not>
+                    <equals arg1="${manifest.custom.codebase}" arg2=""/>
+                </or>
+            </and>
+        </condition>
+        <condition property="manifest.codebase.other">
+            <and>
+                <not><isset property="manifest.codebase.copy"/></not>
+                <not><isset property="manifest.codebase.web"/></not>
+                <or>
+                    <not><isset property="manifest.custom.codebase"/></not>
+                    <equals arg1="${manifest.custom.codebase}" arg2=""/>
+                </or>
+            </and>
+        </condition>
+        <condition property="manifest.codebase.override">
+            <and>
+                <isset property="manifest.custom.codebase"/>
+                <not><equals arg1="${manifest.custom.codebase}" arg2=""/></not>
+            </and>
+        </condition>
+        <condition property="manifest.codebase.override.warning">
+            <and>
+                <isset property="manifest.codebase.override"/>
+                <equals arg1="${manifest.custom.codebase}" arg2="*"/>
+            </and>
+        </condition>
+        <echo message="manifest.codebase.copy = ${manifest.codebase.copy}" level="verbose"/>
+        <echo message="manifest.codebase.web = ${manifest.codebase.web}" level="verbose"/>
+        <echo message="manifest.codebase.other = ${manifest.codebase.other}" level="verbose"/>
+        <echo message="manifest.codebase.override = ${manifest.codebase.override}" level="verbose"/>
+    </target>
+    <target name="-extend-manifest-codebase-copy" depends="-check-manifest-codebase" if="manifest.codebase.copy">
+        <property name="manifest.codebase.attribute" value="${manifest.codebase.copy}"/>
+    </target>
+    <target name="-extend-manifest-codebase-web" depends="-check-manifest-codebase" if="manifest.codebase.web">
+        <property name="manifest.codebase.attribute" value="*"/>
+        <echo message="Warning: Setting Codebase manifest attribute to '*' due to current JNLP Codebase setting. Set manifest.custom.codebase property to override the non-secure value '*'." level="warning"/>
+    </target>
+    <target name="-extend-manifest-codebase-other" depends="-check-manifest-codebase" if="manifest.codebase.other">
+        <property name="manifest.codebase.attribute" value="*"/>
+        <echo message="Warning: Setting Codebase manifest attribute to '*' due to current JNLP Codebase. Set manifest.custom.codebase property to override the non-secure value '*'." level="warning"/>
+    </target>
+    <target name="-extend-manifest-codebase-override-warning" depends="-check-manifest-codebase" if="manifest.codebase.override.warning">
+        <echo message="Warning: Codebase manifest attribute should be used to restrict JAR repurposing. Preferably set manifest.custom.codebase to more specific value than the non-secure '*'" level="warning"/>
+    </target>
+    <target name="-extend-manifest-codebase-override" depends="-check-manifest-codebase,-extend-manifest-codebase-override-warning" if="manifest.codebase.override">
+        <property name="manifest.codebase.attribute" value="${manifest.custom.codebase}"/>
+    </target>
+    <target name="-check-manifest-permissions">
+        <condition property="manifest.permissions.all">
+            <and>
+                <istrue value="${jnlp.signed}"/>
+                <or>
+                    <not><isset property="manifest.custom.permissions"/></not>
+                    <equals arg1="${manifest.custom.permissions}" arg2=""/>
+                </or>
+            </and>
+        </condition>
+        <condition property="manifest.permissions.sandbox">
+            <and>
+                <not><istrue value="${jnlp.signed}"/></not>
+                <or>
+                    <not><isset property="manifest.custom.permissions"/></not>
+                    <equals arg1="${manifest.custom.permissions}" arg2=""/>
+                </or>
+            </and>
+        </condition>
+        <condition property="manifest.permissions.override">
+            <and>
+                <isset property="manifest.custom.permissions"/>
+                <not><equals arg1="${manifest.custom.permissions}" arg2=""/></not>
+            </and>
+        </condition>
+        <echo message="manifest.permissions.all = ${manifest.permissions.all}" level="verbose"/>
+        <echo message="manifest.permissions.sandbox = ${manifest.permissions.sandbox}" level="verbose"/>
+        <echo message="manifest.permissions.override = ${manifest.permissions.override}" level="verbose"/>
+    </target>    
+    <target name="-extend-manifest-permissions-sandbox" depends="-check-manifest-permissions" if="manifest.permissions.sandbox">
+        <property name="manifest.permissions.attribute" value="sandbox"/>
+    </target>
+    <target name="-extend-manifest-permissions-all" depends="-check-manifest-permissions" if="manifest.permissions.all">
+        <property name="manifest.permissions.attribute" value="all-permissions"/>
+    </target>
+    <target name="-extend-manifest-permissions-override" depends="-check-manifest-permissions" if="manifest.permissions.override">
+        <property name="manifest.permissions.attribute" value="${manifest.custom.permissions}"/>
+    </target>
+    <target name="-extend-manifest-application-name">
+        <condition property="manifest.application.name.attribute" value="${manifest.custom.application.name}" else="${application.title}">
+            <and>
+                <isset property="manifest.custom.application.name"/>
+                <not><equals arg1="${manifest.custom.application.name}" arg2=""/></not>
+            </and>
+        </condition>
+    </target>
+    <target name="-add-manifest-security" depends="-init-macrodef-extend-manifest,
+                    -extend-manifest-codebase-copy,-extend-manifest-codebase-web,-extend-manifest-codebase-other,-extend-manifest-codebase-override,
+                    -extend-manifest-permissions-sandbox,-extend-manifest-permissions-all,-extend-manifest-permissions-override,
+                    -extend-manifest-application-name">
+        <jnlp:extend-manifest>
+            <customize>
+                <attribute name="Codebase" value="${manifest.codebase.attribute}"/>
+                <attribute name="Permissions" value="${manifest.permissions.attribute}"/>
+                <attribute name="Application-Name" value="${manifest.application.name.attribute}"/>
+            </customize>
+        </jnlp:extend-manifest>
+        <echo message="Added manifest attribute Codebase: ${manifest.codebase.attribute}" level="verbose"/>
+        <echo message="Added manifest attribute Permissions: ${manifest.permissions.attribute}" level="verbose"/>
+        <echo message="Added manifest attribute Application-Name: ${manifest.application.name.attribute}" level="verbose"/>
+    </target>
+
+    <target name="-do-jar-applet" depends="-test-jnlp-type,-init-macrodef-copylibs" if="is.applet+mkdist.available">
+        <j2seproject3:copylibs manifest="${tmp.manifest.file}"/>
+    </target>
+    <target name="-do-jar-jnlp-application" depends="-init-filename,-test-jnlp-type,-init-macrodef-copylibs" if="is.application+mkdist.available">
+        <j2seproject3:copylibs manifest="${tmp.manifest.file}">
+            <customize>
+                <attribute name="Main-Class" value="${main.class}"/>
+            </customize>
+        </j2seproject3:copylibs>
+        <echo>To run this application from the command line without Ant, try:</echo>
+        <property location="${jnlp.dest.dir}/${jnlp.file}" name="jnlp.file.resolved"/>
+        <echo>javaws "${jnlp.file.resolved}"</echo>
+    </target>
+    <target name="-do-jar-jnlp-component" depends="-test-jnlp-type,-init-macrodef-copylibs" if="is.component+mkdist.available">
+        <j2seproject3:copylibs manifest="${tmp.manifest.file}"/>
+    </target>
+    <target name="-do-jar-jnlp" depends="-create-tmp-manifest,-copy-tmp-manifest,-add-trusted-only-attribute,-add-trusted-library-attribute,-add-manifest-security,-do-jar-applet,-do-jar-jnlp-application,-do-jar-jnlp-component"/>
+
+    <!-- Init jnlp filename -->
+    
+    <target name="-init-filename" depends="-check-filename-prop,-set-jnlp-filename-custom,-set-jnlp-filename-default"/>
+    
+    <target name="-set-jnlp-filename-custom" if="jnlp.file.name.set">
+        <property name="jnlp.file" value="${jnlp.file.name}"/>
+    </target>
+    
+    <target name="-set-jnlp-filename-default" unless="jnlp.file.name.set">
+        <property name="jnlp.file" value="${jnlp.file.name.default}"/>
+    </target>
+    
+    <target name="-check-filename-prop">
+        <condition property="jnlp.file.name.set">
+            <and>
+                <isset property="jnlp.file.name"/>
+                <not>
+                    <equals arg1="jnlp.file.name" arg2="" trim="true"/>
+                </not>
+            </and>
+        </condition>
+    </target>
+    
+    <!-- Test JNLP enabled-->
+    
+    <target name="-test-jnlp-enabled">
+        <condition property="is.jnlp.enabled">
+            <istrue value="${jnlp.enabled}"/>
+        </condition>
+    </target>
+    
+    <target name="-test-signing-security">
+        <condition property="is.signing.unsafe">
+            <and>
+                <istrue value="${jnlp.enabled}"/>
+                <or>
+                    <not><istrue value="${jnlp.signed}"/></not>
+                    <equals arg1="${jnlp.signing}" arg2="generated" casesensitive="false" trim="true"/>
+                </or>
+            </and>
+        </condition>
+    </target>
+    
+    <!-- Generating JNLP file -->
+    
+    <target name="generate-jnlp" depends="sign-jars,-test-generate-task-available,-unavailable-generate-task" if="generate.task.available">
+        <taskdef name="generate-jnlp" classname="org.netbeans.modules.javawebstart.anttasks.GenerateJnlpFileTask" 
+            classpath="${libs.JWSAntTasks.classpath}"/>
+        <property name="jnlp.lazy.jars" value=""/>
+        <generate-jnlp destfile="${jnlp.dest.dir}/${jnlp.file}_" template="master-${jnlp.descriptor}.jnlp" destdir="dist" lazyJars="${jnlp.lazy.jars}"/>
+        <antcall target="-strip-empty-lines"/>
+    </target>
+    
+    <target name="-strip-empty-lines">
+        <copy file="${jnlp.dest.dir}/${jnlp.file}_" tofile="${jnlp.dest.dir}/${jnlp.file}" overwrite="true" encoding="UTF-8">
+            <filterchain>
+                <tokenfilter>
+                    <ignoreblank/>
+                </tokenfilter>
+            </filterchain>
+        </copy>
+        <delete file="${jnlp.dest.dir}/${jnlp.file}_" failonerror="false"/>
+    </target>
+    
+    <target name="-test-generate-task-available">
+        <available property="generate.task.available" classname="org.netbeans.modules.javawebstart.anttasks.GenerateJnlpFileTask" 
+        classpath="${libs.JWSAntTasks.classpath}"/>
+    </target>
+    
+    <target name="-unavailable-generate-task" unless="generate.task.available">
+        <echo message="Task required to generate JNLP file is missing, probably the library 'JWS Ant Tasks' is missing either from shared folder or from IDE installation."/>
+        <fail/>
+    </target>
+    
+    <!-- Codebase processing -->
+    
+    <target name="-codebase-props-check">
+        <condition property="local.codebase">
+            <or>
+                <not>
+                    <isset property="jnlp.codebase.type"/>
+                </not>
+                <equals arg1="${jnlp.codebase.type}" arg2="local" trim="true"/>
+            </or>
+        </condition>
+        <condition property="non.user.codebase">
+            <or>
+                <not>
+                    <isset property="jnlp.codebase.type"/>
+                </not>
+                <equals arg1="${jnlp.codebase.type}" arg2="local" trim="true"/>
+                <equals arg1="${jnlp.codebase.type}" arg2="web" trim="true"/>
+            </or>
+        </condition>
+        <condition property="user.codebase">
+            <equals arg1="${jnlp.codebase.type}" arg2="user" trim="true"/>
+        </condition>
+        <condition property="no.codebase">
+            <equals arg1="${jnlp.codebase.type}" arg2="no.codebase" trim="true"/>
+        </condition>
+        <condition property="local.codebase+no.codebase">
+            <or>
+                <istrue value="${local.codebase}"/>
+                <istrue value="${no.codebase}"/>
+            </or>
+        </condition>
+    </target>
+    
+    <target name="-init-non-user-codebase" if="non.user.codebase">
+        <property name="jnlp.codebase.value" value="${jnlp.codebase.url}"/>
+    </target>
+    
+    <target name="-init-user-codebase" if="user.codebase">
+        <property name="jnlp.codebase.value" value="${jnlp.codebase.user}"/>
+    </target>
+
+    <!-- Security -->
+    
+    <target name="-security-props-check">
+        <condition property="jnlp.signed.true">
+            <istrue value="${jnlp.signed}"/>
+        </condition>
+    </target>
+    
+    <target name="-jnlp-init-keystore" depends="-jnlp-init-signing,-jnlp-init-keystore1,-jnlp-init-keystore2,-check-keystore-exists" if="do.init.keystore">
+        <echo message="${application.vendor}" file="${helper.file}"/>
+        <loadfile property="application.vendor.filtered" srcfile="${helper.file}">
+            <filterchain>
+                <deletecharacters chars=","/>
+            </filterchain>
+        </loadfile>
+        <delete file="${helper.file}"/>
+        <property name="jnlp.signjar.vendor" value="CN=${application.vendor.filtered}"/>
+        <echo message="Going to create default keystore in ${jnlp.signjar.keystore}"/>
+        <genkey dname="${jnlp.signjar.vendor}" alias="${jnlp.signjar.alias}" keystore="${jnlp.signjar.keystore}"
+            storepass="${jnlp.signjar.storepass}" keypass="${jnlp.signjar.keypass}"/>
+    </target>
+    
+    <target name="-check-keystore-exists" depends="-security-props-check">
+        <available property="jnlp.signjar.keystore.exists" file="${jnlp.signjar.keystore}"/>
+        <condition property="do.init.keystore">
+            <and>
+                <isset property="jnlp.signed.true"/>
+                <not><isset property="jnlp.signjar.keystore.exists"/></not>
+            </and>
+        </condition>
+    </target>
+
+    <target name="-jnlp-init-signing">
+        <condition property="generated.key.signing">
+            <equals arg1="${jnlp.signing}" arg2="generated" trim="true"/>
+        </condition>
+    </target>
+
+    <target name="-jnlp-init-keystore1" if="generated.key.signing">
+        <local name="generated.signing.alias"/>
+        <condition property="generated.signing.alias" value="${jnlp.signing.alias}" else="nb-jws">
+            <isset property="jnlp.signing.alias"/>
+        </condition>
+        <property name="jnlp.signjar.keystore" value="${basedir}/build/${generated.signing.alias}.ks" />
+        <property name="jnlp.signjar.storepass" value="storepass"/>
+        <property name="jnlp.signjar.keypass" value="keypass"/>
+        <property name="jnlp.signjar.alias" value="${generated.signing.alias}"/>
+    </target>
+
+    <target name="-jnlp-init-keystore2" unless="generated.key.signing">
+        <property name="jnlp.signjar.keystore" value="${jnlp.signing.keystore}" />
+        <property name="jnlp.signjar.storepass" value="${jnlp.signing.storepass}"/>
+        <property name="jnlp.signjar.keypass" value="${jnlp.signing.keypass}"/>
+        <property name="jnlp.signjar.alias" value="${jnlp.signing.alias}"/>
+    </target>
+
+    <!-- Signing -->
+
+    <target name="-test-signjars-task-available">
+        <available property="signjars.task.available" 
+            classname="org.netbeans.modules.javawebstart.anttasks.SignJarsTask" 
+            classpath="${libs.JWSAntTasks.classpath}"/>
+    </target>
+    
+    <target name="-check-signing-possible" depends="-security-props-check,-test-signjars-task-available,-unavailable-signjars-task">
+        <condition property="jnlp.signed.true+signjars.task.available">
+            <and>
+                <isset property="jnlp.signed.true"/>
+                <isset property="signjars.task.available"/>
+            </and>
+        </condition>
+    </target>
+    
+    <target name="-unavailable-signjars-task" depends="-test-signjars-task-available" unless="signjars.task.available">
+        <echo message="Task required to sign JAR file is missing, probably the library 'JWS Ant Tasks' is missing either from shared folder or from IDE installation. JAR files will not be signed."/>
+    </target>
+
+    <target name="sign-jars" depends="-jnlp-init-keystore,-check-signing-possible" if="jnlp.signed.true+signjars.task.available">
+        <taskdef name="sign-jars" classname="org.netbeans.modules.javawebstart.anttasks.SignJarsTask" 
+            classpath="${libs.JWSAntTasks.classpath}"/>
+        <sign-jars keystore="${jnlp.signjar.keystore}" storepass="${jnlp.signjar.storepass}" 
+                keypass="${jnlp.signjar.keypass}" alias="${jnlp.signjar.alias}" mainjar="${dist.jar}" destdir="dist"
+                codebase="${jnlp.codebase.value}" signedjarsprop="jnlp.signed.jars"
+                componentsprop="jnlp.components">
+            <fileset dir="dist/lib">
+                <include name="*.jar"/>
+            </fileset>
+        </sign-jars>
+    </target>
+    
+    <target name="-warn-insufficient-signing" depends="-test-signing-security" if="is.signing.unsafe">
+        <echo message="Warning: Unsigned and self-signed WebStart applications and Applets are deprecated from JDK7u21 onwards due to security reasons.${line.separator}         To ensure future correct functionality please sign WebStart applications and Applets using trusted certificate."/>
+    </target>
+
+    <!-- Running/Debugging -->
+    
+    <target name="jws-run" depends="jar,-verify-jnlp-enabled,-verify-codebase,-init-platform,-check-webstart" description="Start javaws execution">
+        <echo message="Executing ${jnlp.dest.dir}${file.separator}${jnlp.file} using ${active.webstart.executable}"/>
+        <exec executable="${active.webstart.executable}">
+            <arg file="${jnlp.dest.dir}${file.separator}${jnlp.file}"/>
+        </exec>
+    </target>
+    
+    <target name="jws-debug" if="netbeans.home" depends="jar,-verify-jnlp-enabled,-verify-codebase,-debug-start-debugger,-debug-javaws-debuggee" 
+        description="Debug javaws project in IDE"/>
+        
+    <target name="-init-debug-args">
+        <property name="version-output" value="java version &quot;${ant.java.version}"/>
+        <condition property="have-jdk-older-than-1.4">
+            <or>
+                <contains string="${version-output}" substring="java version &quot;1.0"/>
+                <contains string="${version-output}" substring="java version &quot;1.1"/>
+                <contains string="${version-output}" substring="java version &quot;1.2"/>
+                <contains string="${version-output}" substring="java version &quot;1.3"/>
+            </or>
+        </condition>
+        <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
+            <istrue value="${have-jdk-older-than-1.4}"/>
+        </condition>
+        <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
+            <os family="windows"/>
+        </condition>
+        <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
+            <isset property="debug.transport"/>
+        </condition>
+    </target>
+
+    <target name="-debug-javaws-debuggee" depends="-init-debug-args,-init-platform,-check-webstart">
+        <echo message="Executing ${jnlp.dest.dir}${file.separator}${jnlp.file} in debug mode using ${active.webstart.executable}"/>
+        <exec executable="${active.webstart.executable}">
+            <env key="JAVAWS_VM_ARGS" value="${debug-args-line} -Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
+            <arg value="-wait"/>
+            <arg file="${jnlp.dest.dir}${file.separator}${jnlp.file}"/>
+        </exec>
+    </target>
+    
+    <target name="-verify-codebase" depends="-codebase-props-check" unless="local.codebase+no.codebase">
+        <fail message="Project cannot be run with non-local codebase. Open project properties dialog and set Web Start Codebase to Local Execution or No Codebase Execution."/>
+    </target>
+    
+    <target name="-verify-jnlp-enabled" depends="-test-jnlp-enabled" unless="is.jnlp.enabled">
+        <fail message="Project cannot be run with selected Run Configuration when Java Web Start is disabled."/>
+    </target>
+    
+    <!-- Generate simple HTML preview page -->
+
+    <target name="-check-html-preview">
+         <condition property="generate.html.preview">
+             <or>
+                 <equals arg1="${jnlp.descriptor}" arg2="application"/>
+                 <equals arg1="${jnlp.descriptor}" arg2="applet"/>
+             </or>
+         </condition>
+     </target>
+
+    <target name="generate-html-preview" depends="-check-html-preview" if="generate.html.preview">
+        <taskdef name="copy-template-page" classname="org.netbeans.modules.javawebstart.anttasks.CopyTemplatePageTask"
+            classpath="${libs.JWSAntTasks.classpath}"/>
+        <copy-template-page destfile="${jnlp.dest.dir}/launch.html" template="preview-${jnlp.descriptor}.html" destdir="${jnlp.dest.dir}"/>
+    </target>
+    
+</project>
index c69d20d..596f5c9 100644 (file)
@@ -3,11 +3,12 @@ annotation.processing.enabled.in.editor=false
 annotation.processing.processors.list=
 annotation.processing.run.all.processors=true
 annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
+ant.customtasks.libs=JWSAntTasks
 application.title=AdjustTime
 application.vendor=yuu
 auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml
 build.classes.dir=${build.dir}/classes
-build.classes.excludes=**/*.java,**/*.form
+build.classes.excludes=**/*.form
 # This directory is removed when the project is cleaned:
 build.dir=build
 build.generated.dir=${build.dir}/generated
@@ -16,6 +17,7 @@ build.generated.sources.dir=${build.dir}/generated-sources
 build.sysclasspath=ignore
 build.test.classes.dir=${build.dir}/test/classes
 build.test.results.dir=${build.dir}/test/results
+copylibs.excludes=${javafx.classpath.extension}
 # Uncomment to specify the preferred debugger connection transport:
 #debug.transport=dt_socket
 debug.classpath=\
@@ -28,7 +30,8 @@ dist.archive.excludes=
 dist.dir=dist
 dist.jar=${dist.dir}/AdjustTime.jar
 dist.javadoc.dir=${dist.dir}/javadoc
-endorsed.classpath=
+endorsed.classpath=\
+    ${java.home}/lib/javaws.jar
 excludes=
 file.reference.commons-imaging-1.0-SNAPSHOT.jar=../importPicture/commons-imaging-1.0-SNAPSHOT.jar
 file.reference.importPicture-src=../importPicture/src
@@ -37,7 +40,8 @@ jar.archive.disabled=${jnlp.enabled}
 jar.compress=false
 jar.index=${jnlp.enabled}
 javac.classpath=\
-    ${file.reference.commons-imaging-1.0-SNAPSHOT.jar}
+    ${file.reference.commons-imaging-1.0-SNAPSHOT.jar}:\
+    ${javafx.classpath.extension}
 # Space-separated list of extra javac options
 javac.compilerargs=
 javac.deprecation=false
@@ -61,15 +65,20 @@ javadoc.splitindex=true
 javadoc.use=true
 javadoc.version=false
 javadoc.windowtitle=
+javafx.classpath.extension=\
+    ${java.home}/lib/javaws.jar:\
+    ${java.home}/lib/deploy.jar:\
+    ${java.home}/lib/plugin.jar
 jnlp.codebase.type=no.codebase
 jnlp.descriptor=application
-jnlp.enabled=false
+jnlp.enabled=true
 jnlp.mixed.code=default
-jnlp.offline-allowed=false
+jnlp.offline-allowed=true
 jnlp.signed=false
 jnlp.signing=
 jnlp.signing.alias=
 jnlp.signing.keystore=
+keep.javafx.runtime.on.classpath=true
 main.class=osm.jp.gpx.matchtime.gui.AdjustTime
 # \u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30b3\u30fc\u30c9\u30d9\u30fc\u30b9\u30fb\u30de\u30cb\u30d5\u30a7\u30b9\u30c8\u5c5e\u6027\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u306e\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u306f\u3001RIA\u306e\u518d\u5229\u7528\u3092\u9632\u3050\u305f\u3081\u306b\u4f7f\u7528\u3057\u307e\u3059
 manifest.custom.codebase=
@@ -79,6 +88,7 @@ manifest.file=manifest.mf
 meta.inf.dir=${src.dir}/META-INF
 mkdist.disabled=false
 platform.active=default_platform
+project.license=mit
 run.classpath=\
     ${javac.classpath}:\
     ${build.classes.dir}
index 5ec4c20..566a685 100644 (file)
@@ -2,6 +2,12 @@
 <project xmlns="http://www.netbeans.org/ns/project/1">
     <type>org.netbeans.modules.java.j2seproject</type>
     <configuration>
+        <buildExtensions xmlns="http://www.netbeans.org/ns/ant-build-extender/1">
+            <extension file="jnlp-impl.xml" id="jws">
+                <dependency dependsOn="jnlp" target="-post-jar"/>
+                <dependency dependsOn="jnlp" target="jar"/>
+            </extension>
+        </buildExtensions>
         <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
             <name>AdjustTime</name>
             <source-roots>
diff --git a/AdjustTime/preview-application.html b/AdjustTime/preview-application.html
new file mode 100644 (file)
index 0000000..4834dd8
--- /dev/null
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+    <head>
+        <title>Test page for launching the application via JNLP</title>
+    </head>
+    <body>
+        <h3>Test page for launching the application via JNLP</h3>
+        <script src="http://java.com/js/deployJava.js"></script>
+        <script>
+            deployJava.createWebStartLaunchButton("${JNLP.FILE}")
+        </script>
+        <!-- Or use the following link element to launch with the application -->
+        <!--
+        <a href="${JNLP.FILE}">Launch the application</a>
+        -->
+    </body>
+</html>
index 5c14a62..63668a3 100644 (file)
@@ -36,11 +36,9 @@ import org.apache.commons.imaging.formats.tiff.constants.GpsTagConstants;
 import org.apache.commons.imaging.formats.tiff.write.TiffOutputDirectory;\r
 import org.apache.commons.imaging.formats.tiff.write.TiffOutputSet;\r
 import org.w3c.dom.*;\r
+import org.xml.sax.SAXException;\r
 \r
-public class ImportPicture {\r
-    public static File gpxDir = new File(".");\r
-    public static File outDir = null;\r
-       \r
+public class ImportPicture extends Thread {\r
     /**\r
      * ログ設定プロパティファイルのファイル内容\r
      */\r
@@ -103,10 +101,12 @@ public class ImportPicture {
     public static void main(String[] argv) throws Exception\r
     {\r
         Date jptime;\r
-        outDir = null;\r
+\r
+        ImportPicture obj = new ImportPicture();\r
+        obj.outDir = null;\r
 \r
         if (argv.length > 0) {\r
-            gpxDir = new File(argv[0]);\r
+            obj.gpxDir = new File(argv[0]);\r
         }\r
 \r
         if (argv.length < 4) {\r
@@ -119,35 +119,56 @@ public class ImportPicture {
         }\r
 \r
         // 基準時刻ファイルの「更新日時」を使って時刻合わせを行う。\r
-        File baseFile = new File(gpxDir, argv[1]);\r
+        File baseFile = new File(obj.gpxDir, argv[1]);\r
         jptime = new Date(baseFile.lastModified());\r
+        String timeStr = argv[2];\r
+        try {\r
+            dfjp.setTimeZone(TimeZone.getTimeZone("JST"));\r
+            Date t = dfjp.parse(timeStr);\r
+            obj.delta = t.getTime() - jptime.getTime();\r
+        }\r
+        catch (ParseException e) {\r
+            System.out.println("'"+ timeStr +"' の書式が違います("+ TIME_FORMAT_STRING +")");\r
+        }\r
 \r
         // \r
-        boolean exif = false;\r
         if (argv[3].toUpperCase().equals("EXIF")) {\r
-            exif = true;\r
+            obj.exif = true;\r
         }\r
 \r
         // 第6引数が指定されなければ、指定されたディレクトリ内のGPXファイルすべてを対象とする\r
-        ArrayList<File> gpxFiles = new ArrayList<>();\r
         if (argv.length > 4) {\r
-            gpxFiles.add(new File(gpxDir, argv[4]));\r
+            obj.gpxFiles.add(new File(obj.gpxDir, argv[4]));\r
         }\r
         else {\r
-            File[] files = gpxDir.listFiles();\r
+            File[] files = obj.gpxDir.listFiles();\r
             for (File file : files) {\r
                 if (file.isFile()) {\r
                     String filename = file.getName().toUpperCase();\r
                     if (filename.endsWith(".GPX")) {\r
                         if (!filename.endsWith("_.GPX")) {\r
-                            gpxFiles.add(file);\r
+                            obj.gpxFiles.add(file);\r
                         }\r
                     }\r
                 }\r
             }\r
         }\r
-\r
-\r
+        \r
+        obj.start();\r
+        try {\r
+            obj.join();                            \r
+        } catch(InterruptedException e) {}\r
+    }\r
+    \r
+    public File gpxDir = new File(".");\r
+    public File outDir = null;\r
+    public long delta = 0;\r
+    public boolean exif = false;\r
+    public ArrayList<File> gpxFiles = new ArrayList<>();\r
+    \r
+    @Override\r
+    public void run() {\r
+        \r
         /**\r
          *\r
                 <wpt lat="35.25714922" lon="139.15490497">\r
@@ -166,59 +187,54 @@ public class ImportPicture {
         DocumentBuilder        builder;\r
         Node gpx;\r
 \r
-        for (File gpxFile : gpxFiles) {\r
-            String fileName = gpxFile.getName();\r
-            String iStr = fileName.substring(0, fileName.length() - 4);\r
-\r
-            File outputFile = new File(gpxFile.getParent(), iStr +"_.gpx");\r
-            System.out.println(iStr + " => "+ outputFile.getName());\r
-\r
-            factory = DocumentBuilderFactory.newInstance();\r
-            builder = factory.newDocumentBuilder();\r
-            factory.setIgnoringElementContentWhitespace(true);\r
-            factory.setIgnoringComments(true);\r
-            factory.setValidating(true);\r
-\r
-            // GPX file --> Node root\r
-            DOMImplementation domImpl = builder.getDOMImplementation();\r
-            document = domImpl.createDocument("", "gpx", null);\r
-\r
-            /*\r
-            <gpx>\r
-            <trk>\r
-            <name><![CDATA[Tracked with OSMTracker for Android?]]></name>\r
-            <cmt><![CDATA[警告: HDOP values aren't the HDOP as returned by the GPS device. They're approximated from the location accuracy in meters.]]></cmt>\r
-            <trkseg>\r
-            <trkpt lat="35.32123832" lon="139.56965631">\r
-            <ele>47.20000076293945</ele>\r
-            <time>2012-06-15T03:00:29Z</time>\r
-            <hdop>0.5</hdop>\r
-            </trkpt>\r
-            </trkseg>\r
-            </trk>\r
-            <wpt lat="35.2564461" lon="139.15437809">\r
-            </wpt>\r
-            </gpx>\r
-            */\r
-            TreeMap<Long,Element> map = new TreeMap<>();\r
-            Element trk = null;\r
-            gpx    = builder.parse(gpxFile).getFirstChild();\r
-            NodeList nodes = gpx.getChildNodes();\r
-            for (int i=0; i < nodes.getLength(); i++) {\r
-                Node node2 = nodes.item(i);\r
-                if (node2.getNodeName().equals("trk")) {\r
-                    trk = (Element) node2;\r
-                    trkptMap(trk, map);\r
+        try {\r
+            for (File gpxFile : this.gpxFiles) {\r
+                String fileName = gpxFile.getName();\r
+                String iStr = fileName.substring(0, fileName.length() - 4);\r
+\r
+                File outputFile = new File(gpxFile.getParent(), iStr +"_.gpx");\r
+                System.out.println(iStr + " => "+ outputFile.getName());\r
+\r
+                factory = DocumentBuilderFactory.newInstance();\r
+                builder = factory.newDocumentBuilder();\r
+                factory.setIgnoringElementContentWhitespace(true);\r
+                factory.setIgnoringComments(true);\r
+                factory.setValidating(true);\r
+\r
+                // GPX file --> Node root\r
+                DOMImplementation domImpl = builder.getDOMImplementation();\r
+                document = domImpl.createDocument("", "gpx", null);\r
+\r
+                /*\r
+                <gpx>\r
+                <trk>\r
+                <name><![CDATA[Tracked with OSMTracker for Android?]]></name>\r
+                <cmt><![CDATA[警告: HDOP values aren't the HDOP as returned by the GPS device. They're approximated from the location accuracy in meters.]]></cmt>\r
+                <trkseg>\r
+                <trkpt lat="35.32123832" lon="139.56965631">\r
+                <ele>47.20000076293945</ele>\r
+                <time>2012-06-15T03:00:29Z</time>\r
+                <hdop>0.5</hdop>\r
+                </trkpt>\r
+                </trkseg>\r
+                </trk>\r
+                <wpt lat="35.2564461" lon="139.15437809">\r
+                </wpt>\r
+                </gpx>\r
+                */\r
+                TreeMap<Long,Element> map = new TreeMap<>();\r
+                Element trk = null;\r
+                gpx    = builder.parse(gpxFile).getFirstChild();\r
+                NodeList nodes = gpx.getChildNodes();\r
+                for (int i=0; i < nodes.getLength(); i++) {\r
+                    Node node2 = nodes.item(i);\r
+                    if (node2.getNodeName().equals("trk")) {\r
+                        trk = (Element) node2;\r
+                        trkptMap(trk, map);\r
+                    }\r
                 }\r
-            }\r
-\r
-            if (trk != null) {\r
-                dfjp.setTimeZone(TimeZone.getTimeZone("JST"));\r
-                String timeStr = argv[2];\r
-                try {\r
-                    Date t = dfjp.parse(timeStr);\r
-                    long delta = t.getTime() - jptime.getTime();\r
 \r
+                if (trk != null) {\r
                     /*\r
                     * GPXへ割りつける開始時刻と終了時刻を求める\r
                     */\r
@@ -246,20 +262,20 @@ public class ImportPicture {
                     proc(gpxDir, delta, gpxStartTime, gpxEndTime, map, exif, gpx);\r
                     System.out.println("------------|--------------------|--------------------|------------|------------|--------|------|");\r
                 }\r
-                catch (ParseException e) {\r
-                    System.out.println("'"+ timeStr +"' の書式が違います("+ TIME_FORMAT_STRING +")");\r
-                }\r
-            }\r
 \r
-            // 出力\r
-            DOMSource source = new DOMSource(gpx);\r
-            FileOutputStream os = new FileOutputStream(outputFile);\r
-            StreamResult result = new StreamResult(os);\r
-            TransformerFactory transFactory = TransformerFactory.newInstance();\r
-            Transformer transformer = transFactory.newTransformer();\r
-            transformer.setOutputProperty(OutputKeys.INDENT, "yes");\r
-            transformer.setOutputProperty(OutputKeys.METHOD, "xml");\r
-            transformer.transform(source, result);\r
+                // 出力\r
+                DOMSource source = new DOMSource(gpx);\r
+                FileOutputStream os = new FileOutputStream(outputFile);\r
+                StreamResult result = new StreamResult(os);\r
+                TransformerFactory transFactory = TransformerFactory.newInstance();\r
+                Transformer transformer = transFactory.newTransformer();\r
+                transformer.setOutputProperty(OutputKeys.INDENT, "yes");\r
+                transformer.setOutputProperty(OutputKeys.METHOD, "xml");\r
+                transformer.transform(source, result);\r
+            }\r
+        }\r
+        catch(Exception e) {\r
+            e.printStackTrace();\r
         }\r
     }\r
        \r
@@ -270,7 +286,7 @@ public class ImportPicture {
      * @throws ImageReadException \r
      * @throws ImageWriteException \r
      */\r
-    static void proc(File dir, long delta, long gpxStartTime, long gpxEndTime, TreeMap<Long,Element> map, boolean exifWrite, Node gpx) throws ParseException, ImageReadException, IOException, ImageWriteException {\r
+    void proc(File dir, long delta, long gpxStartTime, long gpxEndTime, TreeMap<Long,Element> map, boolean exifWrite, Node gpx) throws ParseException, ImageReadException, IOException, ImageWriteException {\r
         DecimalFormat yearFormatter = new DecimalFormat("0000");\r
         DecimalFormat monthFormatter = new DecimalFormat("00");\r
         DecimalFormat dayFormatter = new DecimalFormat("00");\r
@@ -317,6 +333,9 @@ public class ImportPicture {
                                 }\r
                             }\r
                             System.out.println(String.format("%8s|%6s|", eleStr, magvarStr));\r
+                            try {\r
+                                Thread.sleep(1);                            \r
+                            } catch(InterruptedException e) {}\r
 \r
                             if (exifWrite) {\r
                                 TiffOutputSet outputSet = null;\r
@@ -654,7 +673,7 @@ public class ImportPicture {
      * @param timestamp\r
      * @param trkpt\r
      */\r
-    public static Element createWptTag(File iFile, long timestamp, Element trkpt) {\r
+    public Element createWptTag(File iFile, long timestamp, Element trkpt) {\r
         Element wpt = document.createElement("wpt");\r
 \r
         NamedNodeMap nodeMap = trkpt.getAttributes();\r
index 130af21..93f1e1e 100644 (file)
@@ -3,67 +3,67 @@ import java.lang.reflect.InvocationTargetException;
 import java.text.SimpleDateFormat;
 
 class Command extends Thread {
-       String[] args;          // コマンドパラメータ
-       private String commandName = "";        // コマンド名
-       @SuppressWarnings({ "rawtypes" })
-       private Class cmd;              // 実行対象インスタンス
+    String[] args;             // コマンドパラメータ
+    private String commandName = "";   // コマンド名
+    @SuppressWarnings({ "rawtypes" })
+    private Class cmd;         // 実行対象インスタンス
 
-       /**
-        * コンストラクタ:実行対象のインスタンスを得る
-        * @param cmd
-        */
-       public Command(Class<?> cmd) {
-               super();
-               this.cmd = cmd;
-               this.commandName = cmd.getName();
-               this.args = new String[0];
-       }
+    /**
+     * コンストラクタ:実行対象のインスタンスを得る
+     * @param cmd
+     */
+    public Command(Class<?> cmd) {
+        super();
+        this.cmd = cmd;
+        this.commandName = cmd.getName();
+        this.args = new String[0];
+    }
 
-       /**
-        * コマンドパラメータの設定
-        * @param folder
-        */
-       public void setArgs(String[] args) {
-               this.args = args;
-       }
+    /**
+     * コマンドパラメータの設定
+     * @param folder
+     */
+    public void setArgs(String[] args) {
+        this.args = args;
+    }
 
-       public void setCommandName(String name) {
-               this.commandName = name;
-       }
-       public String getCommandName() {
-               return this.commandName;
-       }
+    public void setCommandName(String name) {
+        this.commandName = name;
+    }
+    public String getCommandName() {
+        return this.commandName;
+    }
 
-       @SuppressWarnings("unchecked")
-       public void run() {
-               System.out.println("[START:"+ (new SimpleDateFormat("yyyy/MM/dd-HH:mm:ss")).format(new java.util.Date()) +"]\t"+ this.commandName);
-               for (int i=0; i < args.length; i++) {
-                       System.out.println(" args["+ i +"]: "+ this.args[i]);
-               }
-               System.out.println();
+    @SuppressWarnings("unchecked")
+    public void run() {
+        System.out.println("[START:"+ (new SimpleDateFormat("yyyy/MM/dd-HH:mm:ss")).format(new java.util.Date()) +"]\t"+ this.commandName);
+        for (int i=0; i < args.length; i++) {
+            System.out.println(" args["+ i +"]: "+ this.args[i]);
+        }
+        System.out.println();
 
-               try {
-               try {
-                       java.lang.reflect.Method method = this.cmd.getMethod("main", new Class[] {String[].class});
-                       method.setAccessible(true);
-                       method.invoke(null, new Object[]{this.args});
+        try {
+            try {
+                java.lang.reflect.Method method = this.cmd.getMethod("main", new Class[] {String[].class});
+                method.setAccessible(true);
+                method.invoke(null, new Object[]{this.args});
 
-                       System.out.println();
-                       System.out.println("[END:"+ (new SimpleDateFormat("yyyy/MM/dd-HH:mm:ss")).format(new java.util.Date()) +"]\t"+ this.commandName);
-               }
-               catch (InvocationTargetException e) {
-                       System.out.println("[ERR!:"+ (new SimpleDateFormat("yyyy/MM/dd-HH:mm:ss")).format(new java.util.Date()) +"]\t"+ this.commandName);
-                   e.getCause().printStackTrace();
-                       throw e;
-               }
-               catch (Exception e) {
-                       System.out.println("[ERR!:"+ (new SimpleDateFormat("yyyy/MM/dd-HH:mm:ss")).format(new java.util.Date()) +"]\t"+ this.commandName);
-                       throw e;
-               }
+                System.out.println();
+                System.out.println("[END:"+ (new SimpleDateFormat("yyyy/MM/dd-HH:mm:ss")).format(new java.util.Date()) +"]\t"+ this.commandName);
+            }
+            catch (InvocationTargetException e) {
+                System.out.println("[ERR!:"+ (new SimpleDateFormat("yyyy/MM/dd-HH:mm:ss")).format(new java.util.Date()) +"]\t"+ this.commandName);
+                e.getCause().printStackTrace();
+                throw e;
+            }
+            catch (Exception e) {
+                System.out.println("[ERR!:"+ (new SimpleDateFormat("yyyy/MM/dd-HH:mm:ss")).format(new java.util.Date()) +"]\t"+ this.commandName);
+                throw e;
+            }
         }
         catch(Exception e) {
             e.printStackTrace();
         }
-               System.out.println();
+        System.out.println();
     }
 }
index e82f3fa..6e6f634 100644 (file)
@@ -8,7 +8,7 @@ import javax.swing.*;
  */
 @SuppressWarnings("serial")
 public class DoDialog extends JDialog {
-       public static final String TITLE = "Do Command";
+    public static final String TITLE = "Do Command";
        
     // Used for addNotify check.
     boolean fComponentsAdjusted = false;
@@ -61,7 +61,7 @@ public class DoDialog extends JDialog {
         
         this.getContentPane().add("South", buttonPanel);
         
-               // 説明文
+        // 説明文
         textArea = new JTextArea();
         JScrollPane sc=new JScrollPane(textArea);
         textArea.setFont(new Font(Font.MONOSPACED,Font.PLAIN,12));
@@ -129,27 +129,27 @@ public class DoDialog extends JDialog {
 
        ByteArrayOutputStream stdout = new ByteArrayOutputStream();
         try {
-               System.setOut(new PrintStream(stdout));
-               System.setErr(new PrintStream(stdout));
+            System.setOut(new PrintStream(stdout));
+            System.setErr(new PrintStream(stdout));
 
-               Command command = new Command(osm.jp.gpx.ImportPicture.class);
-               command.setArgs(args);
-               command.start();                // コマンドを実行
-               while (command.isAlive()) {
-                       Thread.sleep(1000);
+            Command command = new Command(osm.jp.gpx.ImportPicture.class);
+            command.setArgs(args);
+            command.start();           // コマンドを実行
+            while (command.isAlive()) {
+                Thread.sleep(1000);
                 textArea.append(stdout.toString());
                 stdout.reset();
-               }
-               textArea.append(stdout.toString());
-               JOptionPane.showMessageDialog(this, "'"+ TITLE +"'処理を完了しました。", "処理完了", JOptionPane.INFORMATION_MESSAGE);
+            }
+            textArea.append(stdout.toString());
+            JOptionPane.showMessageDialog(this, "'"+ TITLE +"'処理を完了しました。", "処理完了", JOptionPane.INFORMATION_MESSAGE);
         }
         catch(Exception e) {
             e.printStackTrace();
             JOptionPane.showMessageDialog(this, e.toString(), "Exception", JOptionPane.ERROR_MESSAGE);
         }
         finally {
-               System.setOut(defOut);
-               System.setErr(defErr);
+            System.setOut(defOut);
+            System.setErr(defErr);
             doButton.setEnabled(true);
         }
     }