Support configuration screen.
Support Quit operation from configuration frame. Req#5596
--- /dev/null
+build
+dist
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- You may freely edit this file. See commented blocks below for -->
+<!-- some examples of how to customize the build. -->
+<!-- (If you delete it and reopen the project it will be recreated.) -->
+<project name="mdc2" default="default" basedir=".">
+ <description>Builds, tests, and runs the project mdc2.</description>
+ <import file="nbproject/build-impl.xml"/>
+ <!--
+
+ There exist several targets which are by default empty and which can be
+ used for execution of your tasks. These targets are usually executed
+ before and after some main targets. They are:
+
+ -pre-init: called before initialization of project properties
+ -post-init: called after initialization of project properties
+ -pre-compile: called before javac compilation
+ -post-compile: called after javac compilation
+ -pre-compile-single: called before javac compilation of single file
+ -post-compile-single: called after javac compilation of single file
+ -pre-compile-test: called before javac compilation of JUnit tests
+ -post-compile-test: called after javac compilation of JUnit tests
+ -pre-compile-test-single: called before javac compilation of single JUnit test
+ -post-compile-test-single: called after javac compilation of single JUunit test
+ -pre-jar: called before JAR building
+ -post-jar: called after JAR building
+ -post-clean: called after cleaning build products
+
+ (Targets beginning with '-' are not intended to be called on their own.)
+
+ Example of inserting an obfuscator after compilation could look like this:
+
+ <target name="-post-compile">
+ <obfuscate>
+ <fileset dir="${build.classes.dir}"/>
+ </obfuscate>
+ </target>
+
+ For list of available properties check the imported
+ nbproject/build-impl.xml file.
+
+
+ Another way to customize the build is by overriding existing main targets.
+ The targets of interest are:
+
+ -init-macrodef-javac: defines macro for javac compilation
+ -init-macrodef-junit: defines macro for junit execution
+ -init-macrodef-debug: defines macro for class debugging
+ -init-macrodef-java: defines macro for class execution
+ -do-jar-with-manifest: JAR building (if you are using a manifest)
+ -do-jar-without-manifest: JAR building (if you are not using a manifest)
+ run: execution of project
+ -javadoc-build: Javadoc generation
+ test-report: JUnit report generation
+
+ An example of overriding the target for project execution could look like this:
+
+ <target name="run" depends="mdc2-impl.jar">
+ <exec dir="bin" executable="launcher.exe">
+ <arg file="${dist.jar}"/>
+ </exec>
+ </target>
+
+ Notice that the overridden target depends on the jar target and not only on
+ the compile target as the regular run target does. Again, for a list of available
+ properties which you can use, check the target you are overriding in the
+ nbproject/build-impl.xml file.
+
+ -->
+</project>
--- /dev/null
+Manifest-Version: 1.0
+X-COMMENT: Main-Class will be added automatically by build
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+*** GENERATED FROM project.xml - DO NOT EDIT ***
+*** EDIT ../build.xml INSTEAD ***
+
+For the purpose of easier reading the script
+is divided into following sections:
+
+ - initialization
+ - compilation
+ - jar
+ - execution
+ - debugging
+ - javadoc
+ - junit compilation
+ - junit execution
+ - junit debugging
+ - applet
+ - cleanup
+
+-->
+<project name="mdc2-impl" default="default" basedir=".." xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:j2seproject2="http://www.netbeans.org/ns/j2se-project/2" xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:jaxws="http://www.netbeans.org/ns/jax-ws/1">
+ <target name="default" depends="test,jar,javadoc" description="Build and test whole project."/>
+ <!--
+ ======================
+ INITIALIZATION SECTION
+ ======================
+ -->
+ <target name="-pre-init">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target name="-init-private" depends="-pre-init">
+ <property file="nbproject/private/private.properties"/>
+ </target>
+ <target name="-init-user" depends="-pre-init,-init-private">
+ <property file="${user.properties.file}"/>
+ <!-- The two properties below are usually overridden -->
+ <!-- by the active platform. Just a fallback. -->
+ <property name="default.javac.source" value="1.4"/>
+ <property name="default.javac.target" value="1.4"/>
+ </target>
+ <target name="-init-project" depends="-pre-init,-init-private,-init-user">
+ <property file="nbproject/project.properties"/>
+ </target>
+ <target name="-do-init" depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property">
+ <available file="${manifest.file}" property="manifest.available"/>
+ <condition property="manifest.available+main.class">
+ <and>
+ <isset property="manifest.available"/>
+ <isset property="main.class"/>
+ <not>
+ <equals arg1="${main.class}" arg2="" trim="true"/>
+ </not>
+ </and>
+ </condition>
+ <condition property="manifest.available+main.class+mkdist.available">
+ <and>
+ <istrue value="${manifest.available+main.class}"/>
+ <isset property="libs.CopyLibs.classpath"/>
+ </and>
+ </condition>
+ <condition property="have.tests">
+ <or>
+ <available file="${test.test.dir}"/>
+ </or>
+ </condition>
+ <condition property="have.sources">
+ <or>
+ <available file="${src.src.dir}"/>
+ </or>
+ </condition>
+ <condition property="netbeans.home+have.tests">
+ <and>
+ <isset property="netbeans.home"/>
+ <isset property="have.tests"/>
+ </and>
+ </condition>
+ <condition property="no.javadoc.preview">
+ <isfalse value="${javadoc.preview}"/>
+ </condition>
+ <property name="run.jvmargs" value=""/>
+ <property name="javac.compilerargs" value=""/>
+ <property name="work.dir" value="${basedir}"/>
+ <condition property="no.deps">
+ <and>
+ <istrue value="${no.dependencies}"/>
+ </and>
+ </condition>
+ <property name="javac.debug" value="true"/>
+ <property name="javadoc.preview" value="true"/>
+ </target>
+ <target name="-post-init">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target name="-init-check" depends="-pre-init,-init-private,-init-user,-init-project,-do-init">
+ <fail unless="src.src.dir">Must set src.src.dir</fail>
+ <fail unless="test.test.dir">Must set test.test.dir</fail>
+ <fail unless="build.dir">Must set build.dir</fail>
+ <fail unless="dist.dir">Must set dist.dir</fail>
+ <fail unless="build.classes.dir">Must set build.classes.dir</fail>
+ <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
+ <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
+ <fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
+ <fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
+ <fail unless="dist.jar">Must set dist.jar</fail>
+ </target>
+ <target name="-init-macrodef-property">
+ <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1">
+ <attribute name="name"/>
+ <attribute name="value"/>
+ <sequential>
+ <property name="@{name}" value="${@{value}}"/>
+ </sequential>
+ </macrodef>
+ </target>
+ <target name="-init-macrodef-javac">
+ <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute name="srcdir" default="${src.src.dir}"/>
+ <attribute name="destdir" default="${build.classes.dir}"/>
+ <attribute name="classpath" default="${javac.classpath}"/>
+ <attribute name="debug" default="${javac.debug}"/>
+ <element name="customize" optional="true"/>
+ <sequential>
+ <javac srcdir="@{srcdir}" destdir="@{destdir}" debug="@{debug}" deprecation="${javac.deprecation}" source="${javac.source}" target="${javac.target}" includeantruntime="false">
+ <classpath>
+ <path path="@{classpath}"/>
+ </classpath>
+ <compilerarg line="${javac.compilerargs}"/>
+ <customize/>
+ </javac>
+ </sequential>
+ </macrodef>
+ </target>
+ <target name="-init-macrodef-junit">
+ <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute name="includes" default="**/*Test.java"/>
+ <sequential>
+ <junit showoutput="true" fork="true" dir="${basedir}" failureproperty="tests.failed" errorproperty="tests.failed">
+ <batchtest todir="${build.test.results.dir}">
+ <fileset dir="${test.test.dir}" includes="@{includes}"/>
+ </batchtest>
+ <classpath>
+ <path path="${run.test.classpath}"/>
+ </classpath>
+ <syspropertyset>
+ <propertyref prefix="test-sys-prop."/>
+ <mapper type="glob" from="test-sys-prop.*" to="*"/>
+ </syspropertyset>
+ <formatter type="brief" usefile="false"/>
+ <formatter type="xml"/>
+ <jvmarg line="${run.jvmargs}"/>
+ </junit>
+ </sequential>
+ </macrodef>
+ </target>
+ <target name="-init-macrodef-nbjpda">
+ <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
+ <attribute name="name" default="${main.class}"/>
+ <attribute name="classpath" default="${debug.classpath}"/>
+ <attribute name="stopclassname" default=""/>
+ <sequential>
+ <nbjpdastart transport="dt_socket" addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}">
+ <classpath>
+ <path path="@{classpath}"/>
+ </classpath>
+ </nbjpdastart>
+ </sequential>
+ </macrodef>
+ <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1">
+ <attribute name="dir" default="${build.classes.dir}"/>
+ <sequential>
+ <nbjpdareload>
+ <fileset includes="${fix.includes}*.class" dir="@{dir}"/>
+ </nbjpdareload>
+ </sequential>
+ </macrodef>
+ </target>
+ <target name="-init-macrodef-debug">
+ <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
+ <attribute name="classname" default="${main.class}"/>
+ <attribute name="classpath" default="${debug.classpath}"/>
+ <element name="customize" optional="true"/>
+ <sequential>
+ <java fork="true" classname="@{classname}" dir="${work.dir}">
+ <jvmarg value="-Xdebug"/>
+ <jvmarg value="-Xnoagent"/>
+ <jvmarg value="-Djava.compiler=none"/>
+ <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
+ <jvmarg line="${run.jvmargs}"/>
+ <classpath>
+ <path path="@{classpath}"/>
+ </classpath>
+ <syspropertyset>
+ <propertyref prefix="run-sys-prop."/>
+ <mapper type="glob" from="run-sys-prop.*" to="*"/>
+ </syspropertyset>
+ <customize/>
+ </java>
+ </sequential>
+ </macrodef>
+ </target>
+ <target name="-init-macrodef-java">
+ <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
+ <attribute name="classname" default="${main.class}"/>
+ <element name="customize" optional="true"/>
+ <sequential>
+ <java fork="true" classname="@{classname}" dir="${work.dir}">
+ <jvmarg line="${run.jvmargs}"/>
+ <classpath>
+ <path path="${run.classpath}"/>
+ </classpath>
+ <syspropertyset>
+ <propertyref prefix="run-sys-prop."/>
+ <mapper type="glob" from="run-sys-prop.*" to="*"/>
+ </syspropertyset>
+ <customize/>
+ </java>
+ </sequential>
+ </macrodef>
+ </target>
+ <target name="-init-presetdef-jar">
+ <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1">
+ <jar jarfile="${dist.jar}" compress="${jar.compress}">
+ <j2seproject1:fileset dir="${build.classes.dir}"/>
+ </jar>
+ </presetdef>
+ </target>
+ <target name="init" depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar"/>
+ <!--
+ ===================
+ COMPILATION SECTION
+ ===================
+ -->
+ <target name="deps-jar" depends="init" unless="no.deps"/>
+ <target name="-pre-pre-compile" depends="init,deps-jar">
+ <mkdir dir="${build.classes.dir}"/>
+ </target>
+ <target name="-pre-compile">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target name="-do-compile" depends="init,deps-jar,-pre-pre-compile,-pre-compile" if="have.sources">
+ <j2seproject3:javac/>
+ <copy todir="${build.classes.dir}">
+ <fileset dir="${src.src.dir}" excludes="${build.classes.excludes}"/>
+ </copy>
+ </target>
+ <target name="-post-compile">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target name="compile" depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project."/>
+ <target name="-pre-compile-single">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target name="-do-compile-single" depends="init,deps-jar,-pre-pre-compile">
+ <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
+ <j2seproject3:javac>
+ <customize>
+ <patternset includes="${javac.includes}"/>
+ </customize>
+ </j2seproject3:javac>
+ </target>
+ <target name="-post-compile-single">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target name="compile-single" depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single"/>
+ <!--
+ ====================
+ JAR BUILDING SECTION
+ ====================
+ -->
+ <target name="-pre-pre-jar" depends="init">
+ <dirname property="dist.jar.dir" file="${dist.jar}"/>
+ <mkdir dir="${dist.jar.dir}"/>
+ </target>
+ <target name="-pre-jar">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target name="-do-jar-without-manifest" depends="init,compile,-pre-pre-jar,-pre-jar" unless="manifest.available">
+ <j2seproject1:jar/>
+ </target>
+ <target name="-do-jar-with-manifest" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" unless="manifest.available+main.class">
+ <j2seproject1:jar manifest="${manifest.file}"/>
+ </target>
+ <target name="-do-jar-with-mainclass" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" unless="manifest.available+main.class+mkdist.available">
+ <j2seproject1:jar manifest="${manifest.file}">
+ <j2seproject1:manifest>
+ <j2seproject1:attribute name="Main-Class" value="${main.class}"/>
+ </j2seproject1:manifest>
+ </j2seproject1:jar>
+ <echo>To run this application from the command line without Ant, try:</echo>
+ <property name="build.classes.dir.resolved" location="${build.classes.dir}"/>
+ <property name="dist.jar.resolved" location="${dist.jar}"/>
+ <pathconvert property="run.classpath.with.dist.jar">
+ <path path="${run.classpath}"/>
+ <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
+ </pathconvert>
+ <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo>
+ </target>
+ <target name="-do-jar-with-libraries" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available">
+ <property name="build.classes.dir.resolved" location="${build.classes.dir}"/>
+ <pathconvert property="run.classpath.without.build.classes.dir">
+ <path path="${run.classpath}"/>
+ <map from="${build.classes.dir.resolved}" to=""/>
+ </pathconvert>
+ <pathconvert property="jar.classpath" pathsep=" ">
+ <path path="${run.classpath.without.build.classes.dir}"/>
+ <chainedmapper>
+ <flattenmapper/>
+ <globmapper from="*" to="lib/*"/>
+ </chainedmapper>
+ </pathconvert>
+ <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" name="copylibs" classpath="${libs.CopyLibs.classpath}"/>
+ <copylibs manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}" jarfile="${dist.jar}" compress="${jar.compress}">
+ <fileset dir="${build.classes.dir}"/>
+ <manifest>
+ <attribute name="Main-Class" value="${main.class}"/>
+ <attribute name="Class-Path" value="${jar.classpath}"/>
+ </manifest>
+ </copylibs>
+ <echo>To run this application from the command line without Ant, try:</echo>
+ <property name="dist.jar.resolved" location="${dist.jar}"/>
+ <echo>java -jar "${dist.jar.resolved}"</echo>
+ </target>
+ <target name="-post-jar">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target name="jar" depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR."/>
+ <!--
+ =================
+ EXECUTION SECTION
+ =================
+ -->
+ <target name="run" depends="init,compile" description="Run a main class.">
+ <j2seproject1:java>
+ <customize>
+ <arg line="${application.args}"/>
+ </customize>
+ </j2seproject1:java>
+ </target>
+ <target name="run-single" depends="init,compile-single">
+ <fail unless="run.class">Must select one file in the IDE or set run.class</fail>
+ <j2seproject1:java classname="${run.class}"/>
+ </target>
+ <!--
+ =================
+ DEBUGGING SECTION
+ =================
+ -->
+ <target name="-debug-start-debugger" if="netbeans.home" depends="init">
+ <j2seproject1:nbjpdastart name="${debug.class}"/>
+ </target>
+ <target name="-debug-start-debuggee" depends="init,compile">
+ <j2seproject3:debug>
+ <customize>
+ <arg line="${application.args}"/>
+ </customize>
+ </j2seproject3:debug>
+ </target>
+ <target name="debug" if="netbeans.home" depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE."/>
+ <target name="-debug-start-debugger-stepinto" if="netbeans.home" depends="init">
+ <j2seproject1:nbjpdastart stopclassname="${main.class}"/>
+ </target>
+ <target name="debug-stepinto" if="netbeans.home" depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee"/>
+ <target name="-debug-start-debuggee-single" if="netbeans.home" depends="init,compile-single">
+ <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
+ <j2seproject3:debug classname="${debug.class}"/>
+ </target>
+ <target name="debug-single" if="netbeans.home" depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single"/>
+ <target name="-pre-debug-fix" depends="init">
+ <fail unless="fix.includes">Must set fix.includes</fail>
+ <property name="javac.includes" value="${fix.includes}.java"/>
+ </target>
+ <target name="-do-debug-fix" if="netbeans.home" depends="init,-pre-debug-fix,compile-single">
+ <j2seproject1:nbjpdareload/>
+ </target>
+ <target name="debug-fix" if="netbeans.home" depends="init,-pre-debug-fix,-do-debug-fix"/>
+ <!--
+ ===============
+ JAVADOC SECTION
+ ===============
+ -->
+ <target name="-javadoc-build" depends="init">
+ <mkdir dir="${dist.javadoc.dir}"/>
+ <javadoc destdir="${dist.javadoc.dir}" source="${javac.source}" notree="${javadoc.notree}" use="${javadoc.use}" nonavbar="${javadoc.nonavbar}" noindex="${javadoc.noindex}" splitindex="${javadoc.splitindex}" author="${javadoc.author}" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}" private="${javadoc.private}" additionalparam="${javadoc.additionalparam}" failonerror="true" useexternalfile="true">
+ <classpath>
+ <path path="${javac.classpath}"/>
+ </classpath>
+ <sourcepath>
+ <pathelement location="${src.src.dir}"/>
+ </sourcepath>
+ <packageset dir="${src.src.dir}" includes="*/**"/>
+ <fileset dir="${src.src.dir}" includes="*.java"/>
+ </javadoc>
+ </target>
+ <target name="-javadoc-browse" if="netbeans.home" unless="no.javadoc.preview" depends="init,-javadoc-build">
+ <nbbrowse file="${dist.javadoc.dir}/index.html"/>
+ </target>
+ <target name="javadoc" depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc."/>
+ <!--
+ =========================
+ JUNIT COMPILATION SECTION
+ =========================
+ -->
+ <target name="-pre-pre-compile-test" if="have.tests" depends="init,compile">
+ <mkdir dir="${build.test.classes.dir}"/>
+ </target>
+ <target name="-pre-compile-test">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target name="-do-compile-test" if="have.tests" depends="init,compile,-pre-pre-compile-test,-pre-compile-test">
+ <j2seproject3:javac srcdir="${test.test.dir}" destdir="${build.test.classes.dir}" debug="true" classpath="${javac.test.classpath}"/>
+ <copy todir="${build.test.classes.dir}">
+ <fileset dir="${test.test.dir}" excludes="**/*.java"/>
+ </copy>
+ </target>
+ <target name="-post-compile-test">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target name="compile-test" depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test"/>
+ <target name="-pre-compile-test-single">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target name="-do-compile-test-single" if="have.tests" depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single">
+ <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
+ <j2seproject3:javac srcdir="${test.test.dir}" destdir="${build.test.classes.dir}" debug="true" classpath="${javac.test.classpath}">
+ <customize>
+ <patternset includes="${javac.includes}"/>
+ </customize>
+ </j2seproject3:javac>
+ <copy todir="${build.test.classes.dir}">
+ <fileset dir="${test.test.dir}" excludes="**/*.java"/>
+ </copy>
+ </target>
+ <target name="-post-compile-test-single">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target name="compile-test-single" depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single"/>
+ <!--
+ =======================
+ JUNIT EXECUTION SECTION
+ =======================
+ -->
+ <target name="-pre-test-run" if="have.tests" depends="init">
+ <mkdir dir="${build.test.results.dir}"/>
+ </target>
+ <target name="-do-test-run" if="have.tests" depends="init,compile-test,-pre-test-run">
+ <j2seproject3:junit/>
+ </target>
+ <target name="-post-test-run" if="have.tests" depends="init,compile-test,-pre-test-run,-do-test-run">
+ <fail if="tests.failed">Some tests failed; see details above.</fail>
+ </target>
+ <target name="test-report" if="have.tests" depends="init"/>
+ <target name="-test-browse" if="netbeans.home+have.tests" depends="init"/>
+ <target name="test" depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests."/>
+ <target name="-pre-test-run-single" if="have.tests" depends="init">
+ <mkdir dir="${build.test.results.dir}"/>
+ </target>
+ <target name="-do-test-run-single" if="have.tests" depends="init,compile-test-single,-pre-test-run-single">
+ <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
+ <j2seproject3:junit includes="${test.includes}"/>
+ </target>
+ <target name="-post-test-run-single" if="have.tests" depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single">
+ <fail if="tests.failed">Some tests failed; see details above.</fail>
+ </target>
+ <target name="test-single" depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test."/>
+ <!--
+ =======================
+ JUNIT DEBUGGING SECTION
+ =======================
+ -->
+ <target name="-debug-start-debuggee-test" if="have.tests" depends="init,compile-test">
+ <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
+ <j2seproject3:debug classname="junit.textui.TestRunner" classpath="${debug.test.classpath}">
+ <customize>
+ <arg line="${test.class}"/>
+ </customize>
+ </j2seproject3:debug>
+ </target>
+ <target name="-debug-start-debugger-test" if="netbeans.home+have.tests" depends="init,compile-test">
+ <j2seproject1:nbjpdastart name="${test.class}" classpath="${debug.test.classpath}"/>
+ </target>
+ <target name="debug-test" depends="init,compile-test,-debug-start-debugger-test,-debug-start-debuggee-test"/>
+ <target name="-do-debug-fix-test" if="netbeans.home" depends="init,-pre-debug-fix,compile-test-single">
+ <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
+ </target>
+ <target name="debug-fix-test" if="netbeans.home" depends="init,-pre-debug-fix,-do-debug-fix-test"/>
+ <!--
+ =========================
+ APPLET EXECUTION SECTION
+ =========================
+ -->
+ <target name="run-applet" depends="init,compile-single">
+ <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
+ <j2seproject1:java classname="sun.applet.AppletViewer">
+ <customize>
+ <arg value="${applet.url}"/>
+ </customize>
+ </j2seproject1:java>
+ </target>
+ <!--
+ =========================
+ APPLET DEBUGGING SECTION
+ =========================
+ -->
+ <target name="-debug-start-debuggee-applet" if="netbeans.home" depends="init,compile-single">
+ <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
+ <j2seproject3:debug classname="sun.applet.AppletViewer">
+ <customize>
+ <arg value="${applet.url}"/>
+ </customize>
+ </j2seproject3:debug>
+ </target>
+ <target name="debug-applet" if="netbeans.home" depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet"/>
+ <!--
+ ===============
+ CLEANUP SECTION
+ ===============
+ -->
+ <target name="deps-clean" depends="init" unless="no.deps"/>
+ <target name="-do-clean" depends="init">
+ <delete dir="${build.dir}"/>
+ <delete dir="${dist.dir}"/>
+ </target>
+ <target name="-post-clean">
+ <!-- Empty placeholder for easier customization. -->
+ <!-- You can override this target in the ../build.xml file. -->
+ </target>
+ <target name="clean" depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products."/>
+</project>
--- /dev/null
+build.xml.data.CRC32=715a224e
+build.xml.script.CRC32=1bb9c400
+build.xml.stylesheet.CRC32=240b97a2
+# 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=715a224e
+nbproject/build-impl.xml.script.CRC32=c01b1fa7
+nbproject/build-impl.xml.stylesheet.CRC32=65d7ca21
--- /dev/null
+application.args=
+build.classes.dir=${build.dir}/classes
+build.classes.excludes=**/*.java,**/*.form
+# This directory is removed when the project is cleaned:
+build.dir=build
+build.generated.dir=${build.dir}/generated
+# Only compile against the classpath explicitly listed here:
+build.sysclasspath=ignore
+build.test.classes.dir=${build.dir}/test/classes
+build.test.results.dir=${build.dir}/test/results
+debug.classpath=\
+ ${run.classpath}
+debug.test.classpath=\
+ ${run.test.classpath}
+# This directory is removed when the project is cleaned:
+dist.dir=dist
+dist.jar=${dist.dir}/mdc2.jar
+dist.javadoc.dir=${dist.dir}/javadoc
+file.reference.BetaProject-src=test
+file.reference.BetaProject-test=src
+jar.compress=false
+javac.classpath=\
+ ${libs.swing-layout.classpath}
+# Space-separated list of extra javac options
+javac.compilerargs=
+javac.deprecation=true
+javac.source=1.5
+javac.target=1.5
+javac.test.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}:\
+ ${libs.junit.classpath}
+javadoc.additionalparam=
+javadoc.author=false
+javadoc.encoding=
+javadoc.noindex=false
+javadoc.nonavbar=false
+javadoc.notree=false
+javadoc.private=false
+javadoc.splitindex=true
+javadoc.use=true
+javadoc.version=false
+javadoc.windowtitle=
+main.class=org.jent.checksmtp.ApplicationUI
+manifest.file=manifest.mf
+meta.inf.dir=${src.dir}/META-INF
+platform.active=default_platform
+run.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}
+# Space-separated list of JVM arguments used when running the project
+# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
+# or test-sys-prop.name=value to set system properties for unit tests):
+run.jvmargs=
+run.test.classpath=\
+ ${javac.test.classpath}:\
+ ${build.test.classes.dir}
+src.src.dir=src
+test.test.dir=test
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.java.j2seproject</type>
+ <configuration>
+ <data xmlns="http://www.netbeans.org/ns/j2se-project/3">
+ <name>mdc2</name>
+ <minimum-ant-version>1.6.5</minimum-ant-version>
+ <source-roots>
+ <root id="src.src.dir" name="Source Package"/>
+ </source-roots>
+ <test-roots>
+ <root id="test.test.dir" name="Test Package"/>
+ </test-roots>
+ </data>
+ </configuration>
+</project>
package org.jent.checksmtp;
+import java.awt.Dimension;
import java.io.File;
import java.io.FileInputStream;
-import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
* <DT> -.ldap.attribues<DD>LDAP Search attribues separate by space (Defaut:cn)
* </DL>
*/
-public class ApplicationProperties
-{
+public class ApplicationProperties {
private static final String PREFIX = "org.jent.checksmtp";
private static final String SMTP_PORT = PREFIX + ".port";
private static final String SMTP_ENEBLE_REMOTE_CONNECT = PREFIX + ".enableRemoteConnect";
private static final String LDAP_ROOT = LDAP_PREFIX + ".baseDn";
private static final String LDAP_IS_SJIS = LDAP_PREFIX + ".isSjis";
private static final String LDAP_IS_ATTRIBUTES = LDAP_PREFIX + ".attributes";
-
+ private static final String CONFIG_DIALOG_PREFIX = PREFIX + ".configDialog";
+ private static final String CONFIG_DIALOG_POS_X = CONFIG_DIALOG_PREFIX + ".pos.x";
+ private static final String CONFIG_DIALOG_POS_Y = CONFIG_DIALOG_PREFIX + ".pos.y";
+ private static final String CONFIG_DIALOG_POS_W = CONFIG_DIALOG_PREFIX + ".pos.w";
+ private static final String CONFIG_DIALOG_POS_H = CONFIG_DIALOG_PREFIX + ".pos.h";
+ private static final String CONFIRM_DIALOG_PREFIX = PREFIX + ".confirmDialog";
+ private static final String CONFIRM_DIALOG_POS_X = CONFIRM_DIALOG_PREFIX + ".pos.x";
+ private static final String CONFIRM_DIALOG_POS_Y = CONFIRM_DIALOG_PREFIX + ".pos.y";
+ private static final String CONFIRM_DIALOG_POS_W = CONFIRM_DIALOG_PREFIX + ".pos.w";
+ private static final String CONFIRM_DIALOG_POS_H = CONFIRM_DIALOG_PREFIX + ".pos.h";
+
private static final String PROPERTIES_FILENAME = ".checksmtp.properties";
-
+
private static Properties applicationProperties = new Properties();
-
+
private static String fileName = PROPERTIES_FILENAME;
-
+
+ private static boolean isFileLoaded = false; //Exsist configuration file.
+
+ public static boolean isFileLoaded() {
+ return isFileLoaded;
+ }
+
static {
- try
- {
+ try {
//InputStream is = ApplicationProperties.class.getClassLoader().getResourceAsStream("checksmtp.properties");
fileName = System.getProperty("user.home") + File.separator + PROPERTIES_FILENAME;
FileInputStream is = new FileInputStream(fileName);
applicationProperties.load(is);
+ isFileLoaded = true;
is.close();
- }
- catch (IOException e)
- {
+ } catch (IOException e) {
System.err.println("No checksmtp.properties in " + fileName);
}
}
-
- private ApplicationProperties()
- {
+
+ private ApplicationProperties() {
}
-
+
/**
- * Application Properties Save
- */
- public static void save()
- {
+ * Application Properties Save
+ */
+ public static boolean save() {
FileOutputStream fos;
- try
- {
+ boolean resultOK = true;
+
+ try {
fos = new FileOutputStream(fileName);
applicationProperties.store(fos, "Appliction Properties");
fos.close();
- }
- catch (IOException e)
- {
+ } catch (IOException e) {
+ resultOK = false;
System.err.println(fileName + "was occrred save error.");
e.printStackTrace();
}
+ return resultOK;
}
-
- public static String getSmtpServerHost()
- {
+
+ public static String getSmtpServerHost() {
return applicationProperties.getProperty(SMTP_SERVER_HOST, "mail");
}
-
- public static void setSmtpServerHost(String obj)
- {
+
+ public static void setSmtpServerHost(String obj) {
applicationProperties.setProperty(SMTP_SERVER_HOST, obj);
}
-
- public static int getSmtpServerPort()
- {
+
+ public static int getSmtpServerPort() {
return Integer.parseInt(applicationProperties.getProperty(SMTP_SERVER_PORT, "25"));
}
-
- public static void setSmtpServerPort(int port)
- {
+
+ public static void setSmtpServerPort(int port) {
applicationProperties.setProperty(SMTP_SERVER_PORT, new Integer(port).toString());
}
-
- public static int getSmtpPort()
- {
+
+ public static int getSmtpPort() {
return Integer.parseInt(applicationProperties.getProperty(SMTP_PORT, "8725"));
}
-
- public static void setSmtpPort(int port)
- {
+
+ public static void setSmtpPort(int port) {
applicationProperties.setProperty(SMTP_PORT, new Integer(port).toString());
}
- public static boolean getSmtpEnebleRemoteConnect()
- {
+ public static boolean getSmtpEnebleRemoteConnect() {
String str = applicationProperties.getProperty(SMTP_ENEBLE_REMOTE_CONNECT);
return new Boolean(str).booleanValue();
}
-
- public static void setSmtpEnableRemoteConnect(boolean obj)
- {
+
+ public static void setSmtpEnableRemoteConnect(boolean obj) {
applicationProperties.setProperty(SMTP_ENEBLE_REMOTE_CONNECT, Boolean.toString(obj));
}
-
- public static String getLdapProviderURL()
- {
+
+ public static String getLdapProviderURL() {
return applicationProperties.getProperty(LDAP_PROVIDER_URL, "ldap://localhost:389");
}
-
- public static void setLdapProviderURL(String obj)
- {
+
+ public static void setLdapProviderURL(String obj) {
applicationProperties.setProperty(LDAP_PROVIDER_URL, obj);
}
-
- public static String getLdapRoot()
- {
+
+ public static String getLdapRoot() {
return applicationProperties.getProperty(LDAP_ROOT, "C=JP");
}
-
- public static void setLdapRoot(String obj)
- {
+
+ public static void setLdapRoot(String obj) {
applicationProperties.setProperty(LDAP_ROOT, obj);
}
-
- public static boolean getLdapIsSjis()
- {
+
+ public static boolean getLdapIsSjis() {
return new Boolean(applicationProperties.getProperty(LDAP_IS_SJIS)).booleanValue();
}
-
- public static void setLdapRoot(boolean obj)
- {
+
+ public static void setLdapIsSjis(boolean obj) {
applicationProperties.setProperty(LDAP_IS_SJIS, Boolean.toString(obj));
}
-
- public static boolean getLdap()
- {
+
+ public static boolean getLdap() {
String str = applicationProperties.getProperty(LDAP_PREFIX);
Boolean flg = new Boolean(str);
return flg.booleanValue();
}
-
- public static void setLdap(boolean obj)
- {
+
+ public static void setLdap(boolean obj) {
applicationProperties.setProperty(LDAP_PREFIX, Boolean.toString(obj));
}
-
- public static String getLdapAttributes()
- {
+
+ public static String getLdapAttributes() {
return applicationProperties.getProperty(LDAP_IS_ATTRIBUTES, "cn");
}
-
- public static void setLdapAttributes(String obj)
- {
+
+ public static void setLdapAttributes(String obj) {
applicationProperties.setProperty(LDAP_IS_ATTRIBUTES, obj);
}
-
+
+ //
+ // Config Dialog
+ //
+ public static Dimension getConfigurationDialogSize() {
+ Dimension resultDimension = new Dimension(getConfigDialogPosW(), getConfigDialogPosH());
+ return resultDimension;
+ }
+ public static int getConfigDialogPosX() {
+ return Integer.parseInt(applicationProperties.getProperty(CONFIG_DIALOG_POS_X, "0"));
+ }
+
+ public static void setConfigDialogPosX(int x) {
+ applicationProperties.setProperty(CONFIG_DIALOG_POS_X, new Integer(x).toString());
+ }
+
+ public static int getConfigDialogPosY() {
+ return Integer.parseInt(applicationProperties.getProperty(CONFIG_DIALOG_POS_Y, "0"));
+ }
+
+ public static void setConfigDialogPosY(int y) {
+ applicationProperties.setProperty(CONFIG_DIALOG_POS_Y, new Integer(y).toString());
+ }
+
+ public static int getConfigDialogPosW() {
+ return Integer.parseInt(applicationProperties.getProperty(CONFIG_DIALOG_POS_W, "400"));
+ }
+
+ public static void setConfigDialogPosW(int w) {
+ applicationProperties.setProperty(CONFIG_DIALOG_POS_W, new Integer(w).toString());
+ }
+
+ public static int getConfigDialogPosH() {
+ return Integer.parseInt(applicationProperties.getProperty(CONFIG_DIALOG_POS_H, "232"));
+ }
+
+ public static void setConfigDialogPosH(int h) {
+ applicationProperties.setProperty(CONFIG_DIALOG_POS_H, new Integer(h).toString());
+ }
+
+ //
+ // Confirm Dialog
+ //
+ static Dimension getConfirmDialogSize() {
+ Dimension resultDimension = new Dimension(getConfirmDialogPosW(), getConfirmDialogPosH());
+ return resultDimension;
+ }
+
+ public static int getConfirmDialogPosX() {
+ return Integer.parseInt(applicationProperties.getProperty(CONFIG_DIALOG_POS_X, "0"));
+ }
+
+ public static void setConfirmDialogPosX(int x) {
+ applicationProperties.setProperty(CONFIRM_DIALOG_POS_X, new Integer(x).toString());
+ }
+
+ public static int getConfirmDialogPosY() {
+ return Integer.parseInt(applicationProperties.getProperty(CONFIRM_DIALOG_POS_Y, "0"));
+ }
+
+ public static void setConfirmDialogPosY(int y) {
+ applicationProperties.setProperty(CONFIRM_DIALOG_POS_Y, new Integer(y).toString());
+ }
+
+ public static int getConfirmDialogPosW() {
+ return Integer.parseInt(applicationProperties.getProperty(CONFIRM_DIALOG_POS_W, "400"));
+ }
+
+ public static void setConfirmDialogPosW(int w) {
+ applicationProperties.setProperty(CONFIRM_DIALOG_POS_W, new Integer(w).toString());
+ }
+
+ public static int getConfirmDialogPosH() {
+ return Integer.parseInt(applicationProperties.getProperty(CONFIRM_DIALOG_POS_H, "177"));
+ }
+
+ public static void setConfirmDialogPosH(int h) {
+ applicationProperties.setProperty(CONFIRM_DIALOG_POS_H, new Integer(h).toString());
+ }
+
}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="1.3" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
+ <Properties>
+ <Property name="defaultCloseOperation" type="int" value="0"/>
+ <Property name="title" type="java.lang.String" value="Mail Dest. Confirm Properties"/>
+ </Properties>
+ <SyntheticProperties>
+ <SyntheticProperty name="formSizePolicy" type="int" value="1"/>
+ </SyntheticProperties>
+ <Events>
+ <EventHandler event="componentHidden" listener="java.awt.event.ComponentListener" parameters="java.awt.event.ComponentEvent" handler="formComponentHidden"/>
+ </Events>
+ <AuxValues>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="jTabbedPane" alignment="0" pref="400" max="32767" attributes="0"/>
+ <Group type="102" alignment="1" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="jButtonQuit" linkSize="1" min="-2" max="-2" attributes="0"/>
+ <EmptySpace pref="145" max="32767" attributes="0"/>
+ <Component id="jButtonOK" linkSize="1" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="jButtonCancel" linkSize="1" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="jTabbedPane" pref="157" max="32767" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="jButtonCancel" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="jButtonOK" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="jButtonQuit" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Container class="javax.swing.JTabbedPane" name="jTabbedPane">
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout"/>
+ <SubComponents>
+ <Container class="javax.swing.JPanel" name="jPanelMail">
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
+ <JTabbedPaneConstraints tabName="Mail">
+ <Property name="tabTitle" type="java.lang.String" value="Mail"/>
+ </JTabbedPaneConstraints>
+ </Constraint>
+ </Constraints>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="jLabel1" linkSize="2" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="jTextFieldReceiverPort" pref="112" max="32767" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="jCheckBoxEnableRemoteConnect" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="jLabel2" linkSize="2" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="jTextFieldServerHost" pref="170" max="32767" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="jLabel3" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="jTextFieldServerPort" min="-2" pref="54" max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="jCheckBoxEnableRemoteConnect" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="jTextFieldReceiverPort" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="jTextFieldServerHost" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="jTextFieldServerPort" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace pref="74" max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JLabel" name="jLabel1">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="Receiver Port:"/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="jLabel2">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="Mail Server:"/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="jLabel3">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="Port:"/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JTextField" name="jTextFieldReceiverPort">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="8725"/>
+ <Property name="toolTipText" type="java.lang.String" value="Mail Destination Confirmer SMTP port number."/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JTextField" name="jTextFieldServerHost">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="mail"/>
+ <Property name="toolTipText" type="java.lang.String" value="Mail server host name or IP address."/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JTextField" name="jTextFieldServerPort">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="25"/>
+ <Property name="toolTipText" type="java.lang.String" value="Mail server port number."/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JCheckBox" name="jCheckBoxEnableRemoteConnect">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="Enable remote connect"/>
+ <Property name="toolTipText" type="java.lang.String" value="Enable remote machine access this service. (Usually: disable)"/>
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
+ <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
+ <EmptyBorder bottom="0" left="0" right="0" top="0"/>
+ </Border>
+ </Property>
+ <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
+ <Insets value="[0, 0, 0, 0]"/>
+ </Property>
+ </Properties>
+ </Component>
+ </SubComponents>
+ </Container>
+ <Container class="javax.swing.JPanel" name="jPanelLDAP">
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
+ <JTabbedPaneConstraints tabName="LDAP">
+ <Property name="tabTitle" type="java.lang.String" value="LDAP"/>
+ </JTabbedPaneConstraints>
+ </Constraint>
+ </Constraints>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="jLabel6" linkSize="4" alignment="1" min="-2" max="-2" attributes="0"/>
+ <Component id="jLabel5" linkSize="4" alignment="1" min="-2" max="-2" attributes="0"/>
+ <Component id="jLabel4" linkSize="4" alignment="1" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="jTextFieldAttribute" alignment="0" pref="296" max="32767" attributes="0"/>
+ <Component id="jTextFieldBaseDn" pref="296" max="32767" attributes="0"/>
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="jTextFieldProviderUrl" pref="213" max="32767" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="jCheckBoxIsSjis" min="-2" max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </Group>
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace min="12" pref="12" max="12" attributes="0"/>
+ <Component id="jCheckBoxLdap" min="-2" max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="jCheckBoxLdap" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="jTextFieldProviderUrl" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="jCheckBoxIsSjis" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="jTextFieldBaseDn" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="jLabel6" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="jTextFieldAttribute" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace pref="28" max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JCheckBox" name="jCheckBoxLdap">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="Enable LDAP search"/>
+ <Property name="toolTipText" type="java.lang.String" value="Enable LDAP configration."/>
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
+ <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
+ <EmptyBorder bottom="0" left="0" right="0" top="0"/>
+ </Border>
+ </Property>
+ <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
+ <Insets value="[0, 0, 0, 0]"/>
+ </Property>
+ </Properties>
+ <Events>
+ <EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="jCheckBoxLdapStateChanged"/>
+ </Events>
+ </Component>
+ <Component class="javax.swing.JLabel" name="jLabel4">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="URL:"/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="jLabel5">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="Root DN:"/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="jLabel6">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="Attribuite:"/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JTextField" name="jTextFieldProviderUrl">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="ldap://localhost:389/"/>
+ <Property name="toolTipText" type="java.lang.String" value="LDAP server URL."/>
+ <Property name="enabled" type="boolean" value="false"/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JTextField" name="jTextFieldBaseDn">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="C=JP"/>
+ <Property name="toolTipText" type="java.lang.String" value="LDAP search start DN."/>
+ <Property name="enabled" type="boolean" value="false"/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JTextField" name="jTextFieldAttribute">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="cn"/>
+ <Property name="toolTipText" type="java.lang.String" value="Display Attribuite. Example: cn title;lang-ja-jp"/>
+ <Property name="enabled" type="boolean" value="false"/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JCheckBox" name="jCheckBoxIsSjis">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="Force SJIS"/>
+ <Property name="toolTipText" type="java.lang.String" value="Check this, when LDAP server use Shift JIS on network."/>
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
+ <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
+ <EmptyBorder bottom="0" left="0" right="0" top="0"/>
+ </Border>
+ </Property>
+ <Property name="enabled" type="boolean" value="false"/>
+ <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
+ <Insets value="[0, 0, 0, 0]"/>
+ </Property>
+ </Properties>
+ </Component>
+ </SubComponents>
+ </Container>
+ </SubComponents>
+ </Container>
+ <Component class="javax.swing.JButton" name="jButtonOK">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="OK"/>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonOKActionPerformed"/>
+ </Events>
+ </Component>
+ <Component class="javax.swing.JButton" name="jButtonCancel">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="Cancel"/>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonCancelActionPerformed"/>
+ </Events>
+ </Component>
+ <Component class="javax.swing.JButton" name="jButtonQuit">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="Quit"/>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonQuitActionPerformed"/>
+ </Events>
+ </Component>
+ </SubComponents>
+</Form>
--- /dev/null
+/*
+ * ApplicationUI.java
+ *
+ * Created on 2007/07/21, 22:37
+ */
+
+package org.jent.checksmtp;
+
+import java.awt.Dimension;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+/**
+ *
+ * @author Takuya Ono <takuya-o@users.sourceforge.jp>
+ */
+public class ApplicationUI extends javax.swing.JFrame {
+
+ /** Creates new form ApplicationUI */
+ public ApplicationUI() {
+ initComponents();
+
+ resetDisplay();
+ }
+
+ private void resetDisplay() {
+ jTextFieldReceiverPort.setText(Integer.toString(ApplicationProperties.getSmtpPort()));
+ jTextFieldServerHost.setText(ApplicationProperties.getSmtpServerHost());
+ jTextFieldServerPort.setText(Integer.toString(ApplicationProperties.getSmtpServerPort()));
+ jCheckBoxEnableRemoteConnect.setSelected(ApplicationProperties.getSmtpEnebleRemoteConnect());
+
+ jCheckBoxLdap.setSelected(ApplicationProperties.getLdap());
+ jTextFieldProviderUrl.setText(ApplicationProperties.getLdapProviderURL());
+ jTextFieldBaseDn.setText(ApplicationProperties.getLdapRoot());
+ jTextFieldAttribute.setText(ApplicationProperties.getLdapAttributes());
+ jCheckBoxIsSjis.setSelected(ApplicationProperties.getLdapIsSjis());
+
+ }
+
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ // <editor-fold defaultstate="collapsed" desc=" Generated Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+ jTabbedPane = new javax.swing.JTabbedPane();
+ jPanelMail = new javax.swing.JPanel();
+ jLabel1 = new javax.swing.JLabel();
+ jLabel2 = new javax.swing.JLabel();
+ jLabel3 = new javax.swing.JLabel();
+ jTextFieldReceiverPort = new javax.swing.JTextField();
+ jTextFieldServerHost = new javax.swing.JTextField();
+ jTextFieldServerPort = new javax.swing.JTextField();
+ jCheckBoxEnableRemoteConnect = new javax.swing.JCheckBox();
+ jPanelLDAP = new javax.swing.JPanel();
+ jCheckBoxLdap = new javax.swing.JCheckBox();
+ jLabel4 = new javax.swing.JLabel();
+ jLabel5 = new javax.swing.JLabel();
+ jLabel6 = new javax.swing.JLabel();
+ jTextFieldProviderUrl = new javax.swing.JTextField();
+ jTextFieldBaseDn = new javax.swing.JTextField();
+ jTextFieldAttribute = new javax.swing.JTextField();
+ jCheckBoxIsSjis = new javax.swing.JCheckBox();
+ jButtonOK = new javax.swing.JButton();
+ jButtonCancel = new javax.swing.JButton();
+ jButtonQuit = new javax.swing.JButton();
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
+ setTitle("Mail Dest. Confirm Properties");
+ addComponentListener(new java.awt.event.ComponentAdapter() {
+ public void componentHidden(java.awt.event.ComponentEvent evt) {
+ formComponentHidden(evt);
+ }
+ });
+
+ jLabel1.setText("Receiver Port:");
+
+ jLabel2.setText("Mail Server:");
+
+ jLabel3.setText("Port:");
+
+ jTextFieldReceiverPort.setText("8725");
+ jTextFieldReceiverPort.setToolTipText("Mail Destination Confirmer SMTP port number.");
+
+ jTextFieldServerHost.setText("mail");
+ jTextFieldServerHost.setToolTipText("Mail server host name or IP address.");
+
+ jTextFieldServerPort.setText("25");
+ jTextFieldServerPort.setToolTipText("Mail server port number.");
+
+ jCheckBoxEnableRemoteConnect.setText("Enable remote connect");
+ jCheckBoxEnableRemoteConnect.setToolTipText("Enable remote machine access this service. (Usually: disable)");
+ jCheckBoxEnableRemoteConnect.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
+ jCheckBoxEnableRemoteConnect.setMargin(new java.awt.Insets(0, 0, 0, 0));
+
+ org.jdesktop.layout.GroupLayout jPanelMailLayout = new org.jdesktop.layout.GroupLayout(jPanelMail);
+ jPanelMail.setLayout(jPanelMailLayout);
+ jPanelMailLayout.setHorizontalGroup(
+ jPanelMailLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(jPanelMailLayout.createSequentialGroup()
+ .addContainerGap()
+ .add(jPanelMailLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(jPanelMailLayout.createSequentialGroup()
+ .add(jLabel1)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(jTextFieldReceiverPort, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 112, Short.MAX_VALUE)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(jCheckBoxEnableRemoteConnect))
+ .add(jPanelMailLayout.createSequentialGroup()
+ .add(jLabel2)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(jTextFieldServerHost, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 170, Short.MAX_VALUE)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(jLabel3)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(jTextFieldServerPort, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 54, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
+ .addContainerGap())
+ );
+
+ jPanelMailLayout.linkSize(new java.awt.Component[] {jLabel1, jLabel2}, org.jdesktop.layout.GroupLayout.HORIZONTAL);
+
+ jPanelMailLayout.setVerticalGroup(
+ jPanelMailLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(jPanelMailLayout.createSequentialGroup()
+ .addContainerGap()
+ .add(jPanelMailLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
+ .add(jLabel1)
+ .add(jCheckBoxEnableRemoteConnect)
+ .add(jTextFieldReceiverPort, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(jPanelMailLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
+ .add(jLabel2)
+ .add(jLabel3)
+ .add(jTextFieldServerHost, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+ .add(jTextFieldServerPort, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
+ .addContainerGap(74, Short.MAX_VALUE))
+ );
+ jTabbedPane.addTab("Mail", jPanelMail);
+
+ jCheckBoxLdap.setText("Enable LDAP search");
+ jCheckBoxLdap.setToolTipText("Enable LDAP configration.");
+ jCheckBoxLdap.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
+ jCheckBoxLdap.setMargin(new java.awt.Insets(0, 0, 0, 0));
+ jCheckBoxLdap.addChangeListener(new javax.swing.event.ChangeListener() {
+ public void stateChanged(javax.swing.event.ChangeEvent evt) {
+ jCheckBoxLdapStateChanged(evt);
+ }
+ });
+
+ jLabel4.setText("URL:");
+
+ jLabel5.setText("Root DN:");
+
+ jLabel6.setText("Attribuite:");
+
+ jTextFieldProviderUrl.setText("ldap://localhost:389/");
+ jTextFieldProviderUrl.setToolTipText("LDAP server URL.");
+ jTextFieldProviderUrl.setEnabled(false);
+
+ jTextFieldBaseDn.setText("C=JP");
+ jTextFieldBaseDn.setToolTipText("LDAP search start DN.");
+ jTextFieldBaseDn.setEnabled(false);
+
+ jTextFieldAttribute.setText("cn");
+ jTextFieldAttribute.setToolTipText("Display Attribuite. Example: cn title;lang-ja-jp");
+ jTextFieldAttribute.setEnabled(false);
+
+ jCheckBoxIsSjis.setText("Force SJIS");
+ jCheckBoxIsSjis.setToolTipText("Check this, when LDAP server use Shift JIS on network.");
+ jCheckBoxIsSjis.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
+ jCheckBoxIsSjis.setEnabled(false);
+ jCheckBoxIsSjis.setMargin(new java.awt.Insets(0, 0, 0, 0));
+
+ org.jdesktop.layout.GroupLayout jPanelLDAPLayout = new org.jdesktop.layout.GroupLayout(jPanelLDAP);
+ jPanelLDAP.setLayout(jPanelLDAPLayout);
+ jPanelLDAPLayout.setHorizontalGroup(
+ jPanelLDAPLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(jPanelLDAPLayout.createSequentialGroup()
+ .add(jPanelLDAPLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(jPanelLDAPLayout.createSequentialGroup()
+ .addContainerGap()
+ .add(jPanelLDAPLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel6)
+ .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel5)
+ .add(org.jdesktop.layout.GroupLayout.TRAILING, jLabel4))
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(jPanelLDAPLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(jTextFieldAttribute, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 296, Short.MAX_VALUE)
+ .add(jTextFieldBaseDn, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 296, Short.MAX_VALUE)
+ .add(jPanelLDAPLayout.createSequentialGroup()
+ .add(jTextFieldProviderUrl, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 213, Short.MAX_VALUE)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(jCheckBoxIsSjis))))
+ .add(jPanelLDAPLayout.createSequentialGroup()
+ .add(12, 12, 12)
+ .add(jCheckBoxLdap)))
+ .addContainerGap())
+ );
+
+ jPanelLDAPLayout.linkSize(new java.awt.Component[] {jLabel4, jLabel5, jLabel6}, org.jdesktop.layout.GroupLayout.HORIZONTAL);
+
+ jPanelLDAPLayout.setVerticalGroup(
+ jPanelLDAPLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(jPanelLDAPLayout.createSequentialGroup()
+ .addContainerGap()
+ .add(jCheckBoxLdap)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(jPanelLDAPLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
+ .add(jLabel4)
+ .add(jTextFieldProviderUrl, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+ .add(jCheckBoxIsSjis))
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(jPanelLDAPLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
+ .add(jLabel5)
+ .add(jTextFieldBaseDn, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(jPanelLDAPLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
+ .add(jLabel6)
+ .add(jTextFieldAttribute, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
+ .addContainerGap(28, Short.MAX_VALUE))
+ );
+ jTabbedPane.addTab("LDAP", jPanelLDAP);
+
+ jButtonOK.setText("OK");
+ jButtonOK.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButtonOKActionPerformed(evt);
+ }
+ });
+
+ jButtonCancel.setText("Cancel");
+ jButtonCancel.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButtonCancelActionPerformed(evt);
+ }
+ });
+
+ jButtonQuit.setText("Quit");
+ jButtonQuit.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButtonQuitActionPerformed(evt);
+ }
+ });
+
+ org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
+ getContentPane().setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(jTabbedPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
+ .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
+ .addContainerGap()
+ .add(jButtonQuit)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 145, Short.MAX_VALUE)
+ .add(jButtonOK)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(jButtonCancel)
+ .addContainerGap())
+ );
+
+ layout.linkSize(new java.awt.Component[] {jButtonCancel, jButtonOK, jButtonQuit}, org.jdesktop.layout.GroupLayout.HORIZONTAL);
+
+ layout.setVerticalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(layout.createSequentialGroup()
+ .add(jTabbedPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 157, Short.MAX_VALUE)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
+ .add(jButtonCancel)
+ .add(jButtonOK)
+ .add(jButtonQuit))
+ .addContainerGap())
+ );
+ pack();
+ }// </editor-fold>//GEN-END:initComponents
+
+ private void formComponentHidden(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentHidden
+// TODO add your handling code here:
+ }//GEN-LAST:event_formComponentHidden
+
+ private void jButtonOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonOKActionPerformed
+ int port;
+ try {
+ port = Integer.parseInt(jTextFieldReceiverPort.getText());
+ } catch (NumberFormatException ex) {
+ ex.printStackTrace();
+ port = ApplicationProperties.getSmtpPort(); //last saved value.
+ jTextFieldReceiverPort.setText(Integer.toString(port));
+ }
+ String serverHost = jTextFieldServerHost.getText();
+ int serverPort;
+ try {
+ serverPort = Integer.parseInt(jTextFieldServerPort.getText());
+ } catch (NumberFormatException ex) {
+ ex.printStackTrace();
+ serverPort = ApplicationProperties.getSmtpServerPort(); //last saved value.
+ jTextFieldServerPort.setText(Integer.toString(serverPort));
+ }
+ boolean enableRemoteConnect = jCheckBoxEnableRemoteConnect.isSelected();
+
+ boolean enableLdap = jCheckBoxLdap.isSelected();
+ String ldapUrl = jTextFieldProviderUrl.getText();
+ String rootDn = jTextFieldBaseDn.getText();
+ String attribute = jTextFieldAttribute.getText();
+ boolean isSjis = jCheckBoxIsSjis.isSelected();
+
+ if ( port != ApplicationProperties.getSmtpPort()
+ || !serverHost.equals(ApplicationProperties.getSmtpServerHost())
+ || serverPort != ApplicationProperties.getSmtpServerPort()
+ || enableRemoteConnect != ApplicationProperties.getSmtpEnebleRemoteConnect()
+
+ || enableLdap != ApplicationProperties.getLdap()
+ || !ldapUrl.equals(ApplicationProperties.getLdapProviderURL())
+ || !rootDn.equals(ApplicationProperties.getLdapRoot())
+ || !attribute.equals(ApplicationProperties.getLdapAttributes())
+ || isSjis != ApplicationProperties.getLdapIsSjis()
+ || isModifiedPotition()
+ ) {
+ // When modify data, save properries file.
+ ApplicationProperties.setSmtpPort(port);
+ ApplicationProperties.setSmtpServerHost(serverHost);
+ ApplicationProperties.setSmtpServerPort(serverPort);
+ ApplicationProperties.setSmtpEnableRemoteConnect(enableRemoteConnect);
+
+ ApplicationProperties.setLdap(enableLdap);
+ ApplicationProperties.setLdapProviderURL(ldapUrl);
+ ApplicationProperties.setLdapRoot(rootDn);
+ ApplicationProperties.setLdapAttributes(attribute);
+ ApplicationProperties.setLdapIsSjis(isSjis);
+
+ smtpClient.configChangeNotify();
+ if ( !ApplicationProperties.save() ) {
+ //TODO: Display Save error Dialog.
+ }
+ }
+ iconified();
+
+ }//GEN-LAST:event_jButtonOKActionPerformed
+
+ private void jButtonQuitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonQuitActionPerformed
+ System.exit(0);
+ }//GEN-LAST:event_jButtonQuitActionPerformed
+
+ private void jCheckBoxLdapStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jCheckBoxLdapStateChanged
+// TODO add your handling code here:
+ boolean check = jCheckBoxLdap.isSelected();
+ jTextFieldProviderUrl.setEnabled(check);
+ jTextFieldBaseDn.setEnabled(check);
+ jTextFieldAttribute.setEnabled(check);
+ jCheckBoxIsSjis.setEnabled(check);
+ }//GEN-LAST:event_jCheckBoxLdapStateChanged
+
+ private void jButtonCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCancelActionPerformed
+// TODO add your handling code here:
+ //this.setVisible(false);
+ resetDisplay();
+ iconified();
+ }//GEN-LAST:event_jButtonCancelActionPerformed
+
+ private boolean isModifiedPotition() {
+ int x = this.getX(); //TODO: get real potition on screen.
+ int y = this.getY();
+ int h = this.getHeight();
+ int w = this.getWidth();
+ boolean modified = false;
+
+ if ( x != ApplicationProperties.getConfigDialogPosX()
+ || y != ApplicationProperties.getConfigDialogPosY()
+ || h != ApplicationProperties.getConfigDialogPosH()
+ || w != ApplicationProperties.getConfigDialogPosW()
+ ) {
+ modified = true;
+ ApplicationProperties.setConfigDialogPosX(x);
+ ApplicationProperties.setConfigDialogPosY(y);
+ ApplicationProperties.setConfigDialogPosH(h);
+ ApplicationProperties.setConfigDialogPosW(w);
+ }
+ return modified;
+ }
+
+
+ private boolean initSystemTray() {
+ boolean useSystemTray = false;
+ try {
+ Class.forName("java.awt.SystemTray");
+ /* TODO: SystemTray suuport
+ java.awt.SystemTray tray = java.awt.SystemTray.getSystemTray();
+ if(tray.isSupported()){
+ java.awt.TrayIcon trayIcon = new java.awt.TrayIcon(
+ new javax.swing.ImageIcon(
+ SystemTrayTest.class.getResource("images/mdc.gif")).getImage());
+ trayIcon.setImageAutoSize(true);
+
+ // create a action listener to listen for default action executed on the tray icon
+ ActionListener listener = new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ // execute default action of the application
+ if ( e.paramString().equal("Quit")) {
+ System.exit(0);
+ } else {
+ setVisible(true);
+ if ( this.getExtendedState() == ICONIFIED ) {
+ this.setExtendedState(NORMAL);
+ }
+ }
+ }
+ };
+ java.awt.PopupMenu popup = new java.awt.PopupMenu();
+ popup.addActionListener(listener);
+ popup.add("Config");
+ popup.add("Quit");
+ trayIcon.setPopupMenu(popup);
+ tray.add(trayIcon);
+ useSystemTray = true;
+ }
+ */
+ } catch (ClassNotFoundException ex) {
+ // Do not support SystemTray on this VM.
+ }
+ return useSystemTray;
+}
+
+private void iconified() {
+ if ( useSystemTray ) {
+ this.setVisible(false);
+ } else {
+ this.setExtendedState(ICONIFIED);
+ }
+}
+
+/**
+ * @param args the command line arguments
+ */
+public static void main(String args[]) {
+ /* TKYN OLD
+ try {
+ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ */
+
+ //TKYN ORIGNAL BLOCK
+ java.awt.EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
+ ApplicationUI applicationUI = new ApplicationUI();
+ applicationUI.setVisible(true);
+
+ applicationUI.useSystemTray = applicationUI.initSystemTray();
+
+ //If exsist configuration file, iconise at start up.
+ if ( ApplicationProperties.isFileLoaded() ) {
+ int x = ApplicationProperties.getConfigDialogPosX();
+ int y = ApplicationProperties.getConfigDialogPosY();
+ int w = ApplicationProperties.getConfigDialogPosW();
+ int h = ApplicationProperties.getConfigDialogPosH();
+
+ if ( x > screenSize.width ) {
+ x = screenSize.width - w;
+ if ( x < 0 ) { x = 0; };
+ }
+ if ( y > screenSize.height ) {
+ y = screenSize.height - h;
+ if ( y < 0 ) { y = 0; };
+ }
+ applicationUI.setBounds(x, y, w, h);
+ applicationUI.iconified();
+ } else {
+ //No Configuration file.
+ Dimension frameSize = ApplicationProperties.getConfigurationDialogSize();
+ if (frameSize.height > screenSize.height) {
+ frameSize.height = screenSize.height;
+ }
+ if (frameSize.width > screenSize.width) {
+ frameSize.width = screenSize.width;
+ }
+
+ applicationUI.setBounds(
+ (screenSize.width - frameSize.width) / 2,
+ (screenSize.height - frameSize.height) / 2,
+ frameSize.width, frameSize.height );
+ }
+ }
+ });
+
+ smtpClient = new SMTPclient();
+}
+private static SMTPclient smtpClient = null;
+private boolean useSystemTray = false;
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton jButtonCancel;
+ private javax.swing.JButton jButtonOK;
+ private javax.swing.JButton jButtonQuit;
+ private javax.swing.JCheckBox jCheckBoxEnableRemoteConnect;
+ private javax.swing.JCheckBox jCheckBoxIsSjis;
+ private javax.swing.JCheckBox jCheckBoxLdap;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JLabel jLabel2;
+ private javax.swing.JLabel jLabel3;
+ private javax.swing.JLabel jLabel4;
+ private javax.swing.JLabel jLabel5;
+ private javax.swing.JLabel jLabel6;
+ private javax.swing.JPanel jPanelLDAP;
+ private javax.swing.JPanel jPanelMail;
+ private javax.swing.JTabbedPane jTabbedPane;
+ private javax.swing.JTextField jTextFieldAttribute;
+ private javax.swing.JTextField jTextFieldBaseDn;
+ private javax.swing.JTextField jTextFieldProviderUrl;
+ private javax.swing.JTextField jTextFieldReceiverPort;
+ private javax.swing.JTextField jTextFieldServerHost;
+ private javax.swing.JTextField jTextFieldServerPort;
+ // End of variables declaration//GEN-END:variables
+
+}
client = null;
} catch (IOException e) {
System.err.println("Execption occurred in Processer.");
+ //TODO: Display error Dialog.
e.printStackTrace();
} finally {
//for failsafe Socket close.
}
//checkout toList
- new ToListDialog(this, toList);
+ new ToListUI(this, toList);
while (result == RESULT_UNKNOWN) {
try {
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
+import java.net.SocketTimeoutException;
public class SMTPclient implements Runnable {
+ private boolean isConfigChange = false;
+ private boolean fatalError = false;
+
public SMTPclient() {
Thread thread = new Thread(this);
thread.start();
}
+ public void configChangeNotify() {
+ isConfigChange = true;
+ }
+
public void run() {
- while (true) {
+ while (!fatalError) {
ServerSocket server = null;
try {
try {
if ( ApplicationProperties.getSmtpEnebleRemoteConnect() ) {
System.out.println("Enable remote connection.");
- server = new ServerSocket(serverport, 10);
+ server = new ServerSocket(serverport, 10); //TODO: Backlog Configuable
} else {
- server = new ServerSocket(serverport, 10,
+ server = new ServerSocket(serverport, 10, //TODO: Backlog Configuable
InetAddress.getByAddress(
new byte[] { 127, 0, 0, 1 }));
}
} catch (IOException e) {
+ fatalError = true;
+ System.err.println("Fatal Error Occurred. Stop service.");
+ //TODO: Display error dialog.
e.printStackTrace(); //Unexpected!!
}
+ acceptWait:
while (true) {
// Wait connect from mail client
- Socket client = server.accept();
+ server.setSoTimeout(1000); //TODO: Configuable accept wait time.
+ Socket client;
+ try {
+ client = server.accept();
+ } catch (SocketTimeoutException ex) {
+ //Check interupt
+ if ( isConfigChange ) {
+ System.err.println("Configuration change restart service.");
+ isConfigChange = false;
+ server.close();
+ break; // renew ServerSocket
+ }
+ continue;
+ }
System.err.println("Accept new STMP socket.");
-
Processer processer = new Processer(client);
Thread clientThread = new Thread(processer);
clientThread.start();
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="1.3" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
+ <Properties>
+ <Property name="defaultCloseOperation" type="int" value="2"/>
+ <Property name="title" type="java.lang.String" value="Confirm Address"/>
+ </Properties>
+ <SyntheticProperties>
+ <SyntheticProperty name="formSizePolicy" type="int" value="1"/>
+ </SyntheticProperties>
+ <Events>
+ <EventHandler event="windowClosed" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="formWindowClosed"/>
+ </Events>
+ <AuxValues>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="jPanel1" max="32767" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace min="-2" max="-2" attributes="0"/>
+ <Component id="jPanel1" max="32767" attributes="0"/>
+ <EmptySpace min="-2" max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Container class="javax.swing.JPanel" name="jPanel1">
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <EmptySpace pref="200" max="32767" attributes="0"/>
+ <Component id="jButtonOK" linkSize="1" min="-2" max="-2" attributes="0"/>
+ <EmptySpace min="-2" pref="14" max="-2" attributes="0"/>
+ <Component id="jButtonCancel" linkSize="1" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ <Component id="jScrollPane1" alignment="0" pref="376" max="32767" attributes="0"/>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="1" attributes="0">
+ <Component id="jScrollPane1" pref="90" max="32767" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="jButtonOK" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="jButtonCancel" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Container class="javax.swing.JScrollPane" name="jScrollPane1">
+ <AuxValues>
+ <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
+ <SubComponents>
+ <Component class="javax.swing.JList" name="jList1">
+ <Properties>
+ <Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
+ <StringArray count="5">
+ <StringItem index="0" value="Item 1"/>
+ <StringItem index="1" value="Item 2"/>
+ <StringItem index="2" value="Item 3"/>
+ <StringItem index="3" value="Item 4"/>
+ <StringItem index="4" value="Item 5"/>
+ </StringArray>
+ </Property>
+ </Properties>
+ </Component>
+ </SubComponents>
+ </Container>
+ <Component class="javax.swing.JButton" name="jButtonOK">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="OK"/>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonOKActionPerformed"/>
+ </Events>
+ </Component>
+ <Component class="javax.swing.JButton" name="jButtonCancel">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="Cancel"/>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonCancelActionPerformed"/>
+ </Events>
+ </Component>
+ </SubComponents>
+ </Container>
+ </SubComponents>
+</Form>
--- /dev/null
+/*
+ * ToListUI.java
+ *
+ * Created on 2007/07/22, 11:17
+ */
+
+package org.jent.checksmtp;
+
+import java.awt.Dimension;
+import java.awt.Toolkit;
+import java.util.List;
+
+/**
+ *
+ * @author tkyn
+ */
+public class ToListUI extends javax.swing.JFrame {
+ private List toList = null;
+ private ResultNotify resultNotify = null;
+
+ /** Creates new form ToListUI */
+ public ToListUI() {
+ initComponents();
+ }
+
+ public ToListUI(ResultNotify processer, List toList) {
+ this(); //TODO: test dould call...
+ this.toList = toList;
+ this.resultNotify = processer;
+
+ if (toList != null) {
+ jList1.setListData(toList.toArray());
+ //jList1.update();
+ jList1.setVisible(true);
+ }
+ this.setVisible(true);
+
+ Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
+ //If exsist configuration file, iconise at start up.
+ if ( ApplicationProperties.isFileLoaded() ) {
+ int x = ApplicationProperties.getConfirmDialogPosX();
+ int y = ApplicationProperties.getConfirmDialogPosY();
+ int w = ApplicationProperties.getConfirmDialogPosW();
+ int h = ApplicationProperties.getConfirmDialogPosH();
+ if ( x > screenSize.width ) {
+ x = screenSize.width - w;
+ if ( x < 0 ) { x = 0; };
+ }
+ if ( y > screenSize.height ) {
+ y = screenSize.height - h;
+ if ( y < 0 ) { y = 0; };
+ }
+ this.setBounds(x, y, w, h);
+ } else {
+ //No Configuration file.
+ Dimension frameSize = ApplicationProperties.getConfirmDialogSize();
+ if (frameSize.height > screenSize.height) {
+ frameSize.height = screenSize.height;
+ }
+ if (frameSize.width > screenSize.width) {
+ frameSize.width = screenSize.width;
+ }
+ this.setBounds(
+ (screenSize.width - frameSize.width) / 2,
+ (screenSize.height - frameSize.height) / 2,
+ frameSize.width, frameSize.height );
+ }
+
+
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ // <editor-fold defaultstate="collapsed" desc=" Generated Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+ jPanel1 = new javax.swing.JPanel();
+ jScrollPane1 = new javax.swing.JScrollPane();
+ jList1 = new javax.swing.JList();
+ jButtonOK = new javax.swing.JButton();
+ jButtonCancel = new javax.swing.JButton();
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
+ setTitle("Confirm Address");
+ addWindowListener(new java.awt.event.WindowAdapter() {
+ public void windowClosed(java.awt.event.WindowEvent evt) {
+ formWindowClosed(evt);
+ }
+ });
+
+ jList1.setModel(new javax.swing.AbstractListModel() {
+ String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
+ public int getSize() { return strings.length; }
+ public Object getElementAt(int i) { return strings[i]; }
+ });
+ jScrollPane1.setViewportView(jList1);
+
+ jButtonOK.setText("OK");
+ jButtonOK.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButtonOKActionPerformed(evt);
+ }
+ });
+
+ jButtonCancel.setText("Cancel");
+ jButtonCancel.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButtonCancelActionPerformed(evt);
+ }
+ });
+
+ org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
+ jPanel1.setLayout(jPanel1Layout);
+ jPanel1Layout.setHorizontalGroup(
+ jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(jPanel1Layout.createSequentialGroup()
+ .addContainerGap(200, Short.MAX_VALUE)
+ .add(jButtonOK)
+ .add(14, 14, 14)
+ .add(jButtonCancel)
+ .addContainerGap())
+ .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE)
+ );
+
+ jPanel1Layout.linkSize(new java.awt.Component[] {jButtonCancel, jButtonOK}, org.jdesktop.layout.GroupLayout.HORIZONTAL);
+
+ jPanel1Layout.setVerticalGroup(
+ jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
+ .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 90, Short.MAX_VALUE)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
+ .add(jButtonOK)
+ .add(jButtonCancel)))
+ );
+
+ org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
+ getContentPane().setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(layout.createSequentialGroup()
+ .addContainerGap()
+ .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(layout.createSequentialGroup()
+ .addContainerGap()
+ .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addContainerGap())
+ );
+ pack();
+ }// </editor-fold>//GEN-END:initComponents
+
+ private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed
+ restorePosition();
+ resultNotify.sayNG();
+ }//GEN-LAST:event_formWindowClosed
+
+ private void jButtonCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCancelActionPerformed
+ resultNotify.sayNG();
+ this.dispose();
+ }//GEN-LAST:event_jButtonCancelActionPerformed
+
+ private void jButtonOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonOKActionPerformed
+ //push OK
+ resultNotify.sayOK();
+ this.dispose();
+ }//GEN-LAST:event_jButtonOKActionPerformed
+
+ private boolean restorePosition() {
+ int x = this.getX(); //TODO: get real potition on screen.
+ int y = this.getY();
+ int h = this.getHeight();
+ int w = this.getWidth();
+ boolean modified = false;
+
+ if ( x != ApplicationProperties.getConfirmDialogPosX()
+ || y != ApplicationProperties.getConfirmDialogPosY()
+ || h != ApplicationProperties.getConfirmDialogPosH()
+ || w != ApplicationProperties.getConfirmDialogPosW()
+ ) {
+ modified = true;
+ ApplicationProperties.setConfirmDialogPosX(x);
+ ApplicationProperties.setConfirmDialogPosY(y);
+ ApplicationProperties.setConfirmDialogPosH(h);
+ ApplicationProperties.setConfirmDialogPosW(w);
+ if ( !ApplicationProperties.save() ) {
+ //TODO: save error dialog.
+ }
+ }
+ return modified;
+ }
+
+ /**
+ * @param args the command line arguments
+ *
+ * public static void main(String args[]) {
+ * java.awt.EventQueue.invokeLater(new Runnable() {
+ * public void run() {
+ * new ToListUI().setVisible(true);
+ * }
+ * });
+ * }
+ */
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton jButtonCancel;
+ private javax.swing.JButton jButtonOK;
+ private javax.swing.JList jList1;
+ private javax.swing.JPanel jPanel1;
+ private javax.swing.JScrollPane jScrollPane1;
+ // End of variables declaration//GEN-END:variables
+
+}
--- /dev/null
+/*
+ * ToListUITest.java
+ * JUnit based test
+ *
+ * Created on 2007/07/22, 11:41
+ */
+
+package org.jent.checksmtp;
+
+import java.util.ArrayList;
+import javax.swing.JFrame;
+import junit.framework.*;
+import junit.swingui.TestRunner;
+
+/**
+ *
+ * @author tkyn
+ */
+public class ToListUITest extends TestCase implements ResultNotify {
+ private final ArrayList arrayList = new ArrayList();
+ private JFrame toListUI = null;
+ private boolean result = false;
+
+ public ToListUITest(String testName) {
+ super(testName);
+ }
+
+ protected void setUp() throws Exception {
+ }
+
+ /**
+ * Test of main method, of class org.jent.checksmtp.ToListUI.
+ */
+ public void testMain() {
+ System.out.println("main");
+
+ String[] args = null;
+
+ //ToListUI.main(args);
+
+ // review the generated test code and remove the default call to fail.
+ //fail("The test case is a prototype.");
+
+ }
+
+ private void pushTestSetup(String msg) {
+ arrayList.add(msg);
+ for (int i = 0; i < 100; i++) {
+ arrayList.add("NO" + i);
+ }
+ toListUI = new ToListUI(this, arrayList);
+ arrayList.clear();
+
+ try {
+ synchronized (this) {
+ wait(30 * 1000);
+ //Wait 30sec
+ }
+ } catch (InterruptedException e) {
+ fail("Dialg wait interrupted");
+ }
+ }
+
+ private synchronized void notifyResult() {
+ notify();
+ }
+
+ public void sayOK() {
+ result = true;
+ notifyResult();
+ }
+
+ public void sayNG() {
+ result = false;
+ notifyResult();
+ }
+
+ public void testPushOK() {
+ pushTestSetup("Please push OK button.");
+ assertTrue("Time out or push CANCEL", result);
+ }
+
+ public void testPushCANCEL() {
+ pushTestSetup("Please push CANCEL button.");
+ assertTrue("Time out or push OK", !result);
+ }
+
+ public void testPushClose() {
+ pushTestSetup("Please close Window.");
+ assertTrue("Time out or push OK", !result);
+ }
+
+}