Initial commit of multiasset branch
This commit is contained in:
parent
45684a9d0e
commit
bb18f7cf03
@ -1,3 +1,3 @@
|
||||
# SeSim
|
||||
|
||||
SeSim - Sock Exchange Simulator
|
||||
OpenSeSim - Open Source Sock Exchange Simulator
|
@ -110,7 +110,7 @@
|
||||
|
||||
|
||||
<target name="single-jar" depends="jar">
|
||||
<property name="store.jar.name" value="SeSim"/>
|
||||
<property name="store.jar.name" value="OpenSeSim"/>
|
||||
<property name="store.dir" value="store"/>
|
||||
<property name="store.jar" value="${store.dir}/${store.jar.name}.jar"/>
|
||||
<echo message="Packaging ${application.title} into a single JAR at ${store.jar}"/>
|
||||
|
@ -1,22 +0,0 @@
|
||||
<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>
|
@ -1,20 +0,0 @@
|
||||
<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>
|
||||
<component-desc/>
|
||||
</jnlp>
|
@ -19,7 +19,7 @@ is divided into following sections:
|
||||
- cleanup
|
||||
|
||||
-->
|
||||
<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="SeSim-impl">
|
||||
<project xmlns:if="ant:if" 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" xmlns:unless="ant:unless" basedir=".." default="default" name="OpenSeSim-impl">
|
||||
<import file="jnlp-impl.xml"/>
|
||||
<fail message="Please build using Ant 1.8.0 or higher.">
|
||||
<condition>
|
||||
@ -54,7 +54,72 @@ is divided into following sections:
|
||||
<property file="nbproject/configs/${config}.properties"/>
|
||||
<property file="nbproject/project.properties"/>
|
||||
</target>
|
||||
<target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
|
||||
<target name="-init-modules-supported">
|
||||
<condition property="modules.supported.internal" value="true">
|
||||
<not>
|
||||
<matches pattern="1\.[0-8](\..*)?" string="${javac.source}"/>
|
||||
</not>
|
||||
</condition>
|
||||
</target>
|
||||
<target depends="-init-modules-supported" if="modules.supported.internal" name="-init-macrodef-modulename">
|
||||
<macrodef name="modulename" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<attribute name="property"/>
|
||||
<attribute name="sourcepath"/>
|
||||
<sequential>
|
||||
<loadresource property="@{property}" quiet="true">
|
||||
<javaresource classpath="@{sourcepath}" name="module-info.java" parentFirst="false"/>
|
||||
<filterchain>
|
||||
<stripjavacomments/>
|
||||
<linecontainsregexp>
|
||||
<regexp pattern="module .* \{"/>
|
||||
</linecontainsregexp>
|
||||
<tokenfilter>
|
||||
<linetokenizer/>
|
||||
<replaceregex flags="s" pattern="(\s*module\s+)(\S*)(\s*\{.*)" replace="\2"/>
|
||||
</tokenfilter>
|
||||
<striplinebreaks/>
|
||||
</filterchain>
|
||||
</loadresource>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target depends="-init-modules-supported,-init-macrodef-modulename" if="modules.supported.internal" name="-init-source-module-properties">
|
||||
<fail message="Java 9 support requires Ant 1.10.0 or higher.">
|
||||
<condition>
|
||||
<not>
|
||||
<antversion atleast="1.10.0"/>
|
||||
</not>
|
||||
</condition>
|
||||
</fail>
|
||||
<j2seproject3:modulename property="module.name" sourcepath="${src.dir}"/>
|
||||
<condition property="named.module.internal">
|
||||
<and>
|
||||
<isset property="module.name"/>
|
||||
<length length="0" string="${module.name}" when="greater"/>
|
||||
</and>
|
||||
</condition>
|
||||
<condition property="unnamed.module.internal">
|
||||
<not>
|
||||
<isset property="named.module.internal"/>
|
||||
</not>
|
||||
</condition>
|
||||
<property name="javac.modulepath" value=""/>
|
||||
<property name="run.modulepath" value="${javac.modulepath}"/>
|
||||
<property name="module.build.classes.dir" value="${build.classes.dir}"/>
|
||||
<property name="debug.modulepath" value="${run.modulepath}"/>
|
||||
<property name="javac.upgrademodulepath" value=""/>
|
||||
<property name="run.upgrademodulepath" value="${javac.upgrademodulepath}"/>
|
||||
<condition else="" property="javac.systemmodulepath.cmd.line.arg" value="--system '${javac.systemmodulepath}'">
|
||||
<and>
|
||||
<isset property="javac.systemmodulepath"/>
|
||||
<length length="0" string="${javac.systemmodulepath}" when="greater"/>
|
||||
</and>
|
||||
</condition>
|
||||
<property name="dist.jlink.dir" value="${dist.dir}/jlink"/>
|
||||
<property name="dist.jlink.output" value="${dist.jlink.dir}/${application.title}"/>
|
||||
<property name="module.name" value=""/>
|
||||
</target>
|
||||
<target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property,-init-modules-supported" name="-do-init">
|
||||
<property name="platform.java" value="${java.home}/bin/java"/>
|
||||
<available file="${manifest.file}" property="manifest.available"/>
|
||||
<condition property="splashscreen.available">
|
||||
@ -77,7 +142,9 @@ is divided into following sections:
|
||||
<and>
|
||||
<isset property="javac.profile"/>
|
||||
<length length="0" string="${javac.profile}" when="greater"/>
|
||||
<matches pattern="((1\.[89])|9)(\..*)?" string="${javac.source}"/>
|
||||
<not>
|
||||
<matches pattern="1\.[0-7](\..*)?" string="${javac.source}"/>
|
||||
</not>
|
||||
</and>
|
||||
</condition>
|
||||
<condition property="do.archive">
|
||||
@ -95,6 +162,9 @@ is divided into following sections:
|
||||
<not>
|
||||
<istrue value="${mkdist.disabled}"/>
|
||||
</not>
|
||||
<not>
|
||||
<istrue value="${modules.supported.internal}"/>
|
||||
</not>
|
||||
</and>
|
||||
</condition>
|
||||
<condition property="do.archive+manifest.available">
|
||||
@ -251,11 +321,80 @@ is divided into following sections:
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors">
|
||||
<target depends="-init-ap-cmdline-properties,-init-source-module-properties" if="modules.supported.internal" name="-init-macrodef-javac-with-module">
|
||||
<macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<attribute default="${src.dir}" name="srcdir"/>
|
||||
<attribute default="${build.classes.dir}" name="destdir"/>
|
||||
<attribute default="${javac.classpath}" name="classpath"/>
|
||||
<attribute default="${javac.modulepath}" name="modulepath"/>
|
||||
<attribute default="${javac.upgrademodulepath}" name="upgrademodulepath"/>
|
||||
<attribute default="${javac.processorpath}" name="processorpath"/>
|
||||
<attribute default="${javac.processormodulepath}" name="processormodulepath"/>
|
||||
<attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
|
||||
<attribute default="${includes}" name="includes"/>
|
||||
<attribute default="${excludes}" name="excludes"/>
|
||||
<attribute default="${javac.debug}" name="debug"/>
|
||||
<attribute default="${empty.dir}" name="sourcepath" unless:set="named.module.internal"/>
|
||||
<attribute default="${src.dir}" if:set="named.module.internal" name="sourcepath"/>
|
||||
<attribute default="${empty.dir}" name="gensrcdir"/>
|
||||
<element name="customize" optional="true"/>
|
||||
<sequential>
|
||||
<condition property="warn.excludes.internal">
|
||||
<and>
|
||||
<isset property="named.module.internal"/>
|
||||
<length length="0" string="@{excludes}" trim="true" when="greater"/>
|
||||
</and>
|
||||
</condition>
|
||||
<echo if:set="warn.excludes.internal" level="warning" message="The javac excludes are not supported in the JDK 9 Named Module."/>
|
||||
<property location="${build.dir}/empty" name="empty.dir"/>
|
||||
<mkdir dir="${empty.dir}"/>
|
||||
<mkdir dir="@{apgeneratedsrcdir}"/>
|
||||
<condition property="processormodulepath.set">
|
||||
<resourcecount count="0" when="greater">
|
||||
<path>
|
||||
<pathelement path="@{processormodulepath}"/>
|
||||
</path>
|
||||
</resourcecount>
|
||||
</condition>
|
||||
<javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}">
|
||||
<src>
|
||||
<dirset dir="@{gensrcdir}" erroronmissingdir="false">
|
||||
<include name="*"/>
|
||||
</dirset>
|
||||
</src>
|
||||
<classpath>
|
||||
<path path="@{classpath}"/>
|
||||
</classpath>
|
||||
<modulepath>
|
||||
<path path="@{modulepath}"/>
|
||||
</modulepath>
|
||||
<upgrademodulepath>
|
||||
<path path="@{upgrademodulepath}"/>
|
||||
</upgrademodulepath>
|
||||
<compilerarg line="${javac.systemmodulepath.cmd.line.arg}"/>
|
||||
<compilerarg line="${javac.profile.cmd.line.arg}"/>
|
||||
<compilerarg line="${javac.compilerargs}"/>
|
||||
<compilerarg if:set="processormodulepath.set" value="--processor-module-path"/>
|
||||
<compilerarg if:set="processormodulepath.set" path="@{processormodulepath}"/>
|
||||
<compilerarg unless:set="processormodulepath.set" value="-processorpath"/>
|
||||
<compilerarg path="@{processorpath}:${empty.dir}" unless:set="processormodulepath.set"/>
|
||||
<compilerarg line="${ap.processors.internal}"/>
|
||||
<compilerarg line="${annotation.processing.processor.options}"/>
|
||||
<compilerarg value="-s"/>
|
||||
<compilerarg path="@{apgeneratedsrcdir}"/>
|
||||
<compilerarg line="${ap.proc.none.internal}"/>
|
||||
<customize/>
|
||||
</javac>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target depends="-init-ap-cmdline-properties,-init-source-module-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors" unless="modules.supported.internal">
|
||||
<macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<attribute default="${src.dir}" name="srcdir"/>
|
||||
<attribute default="${build.classes.dir}" name="destdir"/>
|
||||
<attribute default="${javac.classpath}" name="classpath"/>
|
||||
<attribute default="${javac.modulepath}" name="modulepath"/>
|
||||
<attribute default="${javac.upgrademodulepath}" name="upgrademodulepath"/>
|
||||
<attribute default="${javac.processorpath}" name="processorpath"/>
|
||||
<attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
|
||||
<attribute default="${includes}" name="includes"/>
|
||||
@ -292,11 +431,13 @@ is divided into following sections:
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal">
|
||||
<target depends="-init-ap-cmdline-properties,-init-source-module-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal">
|
||||
<macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<attribute default="${src.dir}" name="srcdir"/>
|
||||
<attribute default="${build.classes.dir}" name="destdir"/>
|
||||
<attribute default="${javac.classpath}" name="classpath"/>
|
||||
<attribute default="${javac.modulepath}" name="modulepath"/>
|
||||
<attribute default="${javac.upgrademodulepath}" name="upgrademodulepath"/>
|
||||
<attribute default="${javac.processorpath}" name="processorpath"/>
|
||||
<attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
|
||||
<attribute default="${includes}" name="includes"/>
|
||||
@ -325,7 +466,7 @@ is divided into following sections:
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac">
|
||||
<target depends="-init-macrodef-javac-with-module,-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac">
|
||||
<macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<attribute default="${src.dir}" name="srcdir"/>
|
||||
<attribute default="${build.classes.dir}" name="destdir"/>
|
||||
@ -380,30 +521,59 @@ is divided into following sections:
|
||||
<property name="test.binarytestincludes" value=""/>
|
||||
<property name="test.binaryexcludes" value=""/>
|
||||
</target>
|
||||
<target if="${nb.junit.single}" name="-init-macrodef-junit-single" unless="${nb.junit.batch}">
|
||||
<macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<target depends="-init-modules-supported" if="modules.supported.internal" name="-init-macrodef-junit-prototype-with-module">
|
||||
<macrodef name="junit-prototype" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<attribute default="${includes}" name="includes"/>
|
||||
<attribute default="${excludes}" name="excludes"/>
|
||||
<attribute default="**" name="testincludes"/>
|
||||
<attribute default="" name="testmethods"/>
|
||||
<element name="customize" optional="true"/>
|
||||
<element name="customizePrototype" optional="true"/>
|
||||
<sequential>
|
||||
<property name="junit.forkmode" value="perTest"/>
|
||||
<junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
|
||||
<test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/>
|
||||
<syspropertyset>
|
||||
<propertyref prefix="test-sys-prop."/>
|
||||
<mapper from="test-sys-prop.*" to="*" type="glob"/>
|
||||
</syspropertyset>
|
||||
<classpath>
|
||||
<path path="${run.test.classpath}"/>
|
||||
</classpath>
|
||||
<modulepath>
|
||||
<path path="${run.test.modulepath}"/>
|
||||
</modulepath>
|
||||
<formatter type="brief" usefile="false"/>
|
||||
<formatter type="xml"/>
|
||||
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
|
||||
<jvmarg value="-ea"/>
|
||||
<customize/>
|
||||
<jvmarg line="${run.test.jvmargs}"/>
|
||||
<customizePrototype/>
|
||||
</junit>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}">
|
||||
<target depends="-init-modules-supported" name="-init-macrodef-junit-prototype-without-module" unless="modules.supported.internal">
|
||||
<macrodef name="junit-prototype" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<attribute default="${includes}" name="includes"/>
|
||||
<attribute default="${excludes}" name="excludes"/>
|
||||
<element name="customizePrototype" optional="true"/>
|
||||
<sequential>
|
||||
<property name="junit.forkmode" value="perTest"/>
|
||||
<junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
|
||||
<syspropertyset>
|
||||
<propertyref prefix="test-sys-prop."/>
|
||||
<mapper from="test-sys-prop.*" to="*" type="glob"/>
|
||||
</syspropertyset>
|
||||
<classpath>
|
||||
<path path="${run.test.classpath}"/>
|
||||
</classpath>
|
||||
<formatter type="brief" usefile="false"/>
|
||||
<formatter type="xml"/>
|
||||
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
|
||||
<jvmarg value="-ea"/>
|
||||
<customizePrototype/>
|
||||
</junit>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target depends="-init-test-properties,-init-macrodef-junit-prototype-with-module,-init-macrodef-junit-prototype-without-module" if="${nb.junit.single}" name="-init-macrodef-junit-single" unless="${nb.junit.batch}">
|
||||
<macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<attribute default="${includes}" name="includes"/>
|
||||
<attribute default="${excludes}" name="excludes"/>
|
||||
@ -411,8 +581,25 @@ is divided into following sections:
|
||||
<attribute default="" name="testmethods"/>
|
||||
<element name="customize" optional="true"/>
|
||||
<sequential>
|
||||
<property name="junit.forkmode" value="perTest"/>
|
||||
<junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
|
||||
<j2seproject3:junit-prototype>
|
||||
<customizePrototype>
|
||||
<test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/>
|
||||
<customize/>
|
||||
</customizePrototype>
|
||||
</j2seproject3:junit-prototype>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target depends="-init-test-properties,-init-macrodef-junit-prototype-with-module,-init-macrodef-junit-prototype-without-module" if="${nb.junit.batch}" name="-init-macrodef-junit-batch" unless="${nb.junit.single}">
|
||||
<macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<attribute default="${includes}" name="includes"/>
|
||||
<attribute default="${excludes}" name="excludes"/>
|
||||
<attribute default="**" name="testincludes"/>
|
||||
<attribute default="" name="testmethods"/>
|
||||
<element name="customize" optional="true"/>
|
||||
<sequential>
|
||||
<j2seproject3:junit-prototype>
|
||||
<customizePrototype>
|
||||
<batchtest todir="${build.test.results.dir}">
|
||||
<fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
|
||||
<filename name="@{testincludes}"/>
|
||||
@ -421,15 +608,9 @@ is divided into following sections:
|
||||
<filename name="${test.binarytestincludes}"/>
|
||||
</fileset>
|
||||
</batchtest>
|
||||
<syspropertyset>
|
||||
<propertyref prefix="test-sys-prop."/>
|
||||
<mapper from="test-sys-prop.*" to="*" type="glob"/>
|
||||
</syspropertyset>
|
||||
<formatter type="brief" usefile="false"/>
|
||||
<formatter type="xml"/>
|
||||
<jvmarg value="-ea"/>
|
||||
<customize/>
|
||||
</junit>
|
||||
</customizePrototype>
|
||||
</j2seproject3:junit-prototype>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
@ -451,12 +632,16 @@ is divided into following sections:
|
||||
</fileset>
|
||||
</union>
|
||||
<taskdef classname="org.testng.TestNGAntTask" classpath="${run.test.classpath}" name="testng"/>
|
||||
<testng classfilesetref="test.set" failureProperty="tests.failed" listeners="org.testng.reporters.VerboseReporter" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="SeSim" testname="TestNG tests" workingDir="${work.dir}">
|
||||
<testng classfilesetref="test.set" failureProperty="tests.failed" listeners="org.testng.reporters.VerboseReporter" methods="${testng.methods.arg}" mode="${testng.mode}" outputdir="${build.test.results.dir}" suitename="OpenSeSim" testname="TestNG tests" workingDir="${work.dir}">
|
||||
<xmlfileset dir="${build.test.classes.dir}" includes="@{testincludes}"/>
|
||||
<propertyset>
|
||||
<propertyref prefix="test-sys-prop."/>
|
||||
<mapper from="test-sys-prop.*" to="*" type="glob"/>
|
||||
</propertyset>
|
||||
<classpath>
|
||||
<path path="${run.test.classpath}"/>
|
||||
</classpath>
|
||||
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
|
||||
<customize/>
|
||||
</testng>
|
||||
</sequential>
|
||||
@ -511,10 +696,6 @@ is divided into following sections:
|
||||
<sequential>
|
||||
<j2seproject3:test-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
|
||||
<customize>
|
||||
<classpath>
|
||||
<path path="${run.test.classpath}"/>
|
||||
</classpath>
|
||||
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
|
||||
<jvmarg line="${run.jvmargs}"/>
|
||||
<jvmarg line="${run.jvmargs.ide}"/>
|
||||
</customize>
|
||||
@ -522,74 +703,20 @@ is divided into following sections:
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target if="${junit.available}" name="-init-macrodef-junit-debug" unless="${nb.junit.batch}">
|
||||
<macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<attribute default="${includes}" name="includes"/>
|
||||
<attribute default="${excludes}" name="excludes"/>
|
||||
<attribute default="**" name="testincludes"/>
|
||||
<attribute default="" name="testmethods"/>
|
||||
<element name="customize" optional="true"/>
|
||||
<sequential>
|
||||
<property name="junit.forkmode" value="perTest"/>
|
||||
<junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
|
||||
<test methods="@{testmethods}" name="@{testincludes}" todir="${build.test.results.dir}"/>
|
||||
<syspropertyset>
|
||||
<propertyref prefix="test-sys-prop."/>
|
||||
<mapper from="test-sys-prop.*" to="*" type="glob"/>
|
||||
</syspropertyset>
|
||||
<formatter type="brief" usefile="false"/>
|
||||
<formatter type="xml"/>
|
||||
<jvmarg value="-ea"/>
|
||||
<jvmarg line="${debug-args-line}"/>
|
||||
<jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
|
||||
<customize/>
|
||||
</junit>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target depends="-init-test-properties" if="${nb.junit.batch}" name="-init-macrodef-junit-debug-batch">
|
||||
<macrodef name="junit-debug" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<attribute default="${includes}" name="includes"/>
|
||||
<attribute default="${excludes}" name="excludes"/>
|
||||
<attribute default="**" name="testincludes"/>
|
||||
<attribute default="" name="testmethods"/>
|
||||
<element name="customize" optional="true"/>
|
||||
<sequential>
|
||||
<property name="junit.forkmode" value="perTest"/>
|
||||
<junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}">
|
||||
<batchtest todir="${build.test.results.dir}">
|
||||
<fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
|
||||
<filename name="@{testincludes}"/>
|
||||
</fileset>
|
||||
<fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes},${test.binaryexcludes}" includes="${test.binaryincludes}">
|
||||
<filename name="${test.binarytestincludes}"/>
|
||||
</fileset>
|
||||
</batchtest>
|
||||
<syspropertyset>
|
||||
<propertyref prefix="test-sys-prop."/>
|
||||
<mapper from="test-sys-prop.*" to="*" type="glob"/>
|
||||
</syspropertyset>
|
||||
<formatter type="brief" usefile="false"/>
|
||||
<formatter type="xml"/>
|
||||
<jvmarg value="-ea"/>
|
||||
<jvmarg line="${debug-args-line}"/>
|
||||
<jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
|
||||
<customize/>
|
||||
</junit>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target depends="-init-macrodef-junit-debug,-init-macrodef-junit-debug-batch" if="${junit.available}" name="-init-macrodef-junit-debug-impl">
|
||||
<target depends="-init-macrodef-junit" if="${junit.available}" name="-init-macrodef-junit-debug-impl">
|
||||
<macrodef name="test-debug-impl" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<attribute default="${includes}" name="includes"/>
|
||||
<attribute default="${excludes}" name="excludes"/>
|
||||
<attribute default="**" name="testincludes"/>
|
||||
<attribute default="" name="testmethods"/>
|
||||
<element implicit="true" name="customize" optional="true"/>
|
||||
<element name="customizeDebuggee" optional="true"/>
|
||||
<sequential>
|
||||
<j2seproject3:junit-debug excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
|
||||
<customize/>
|
||||
</j2seproject3:junit-debug>
|
||||
<j2seproject3:junit excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
|
||||
<customize>
|
||||
<jvmarg value="-agentlib:jdwp=transport=${debug-transport},address=${jpda.address}"/>
|
||||
<customizeDebuggee/>
|
||||
</customize>
|
||||
</j2seproject3:junit>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
@ -602,20 +729,20 @@ is divided into following sections:
|
||||
<condition else="-testclass @{testClass}" property="test.class.or.method" value="-methods @{testClass}.@{testMethod}">
|
||||
<isset property="test.method"/>
|
||||
</condition>
|
||||
<condition else="-suitename SeSim -testname @{testClass} ${test.class.or.method}" property="testng.cmd.args" value="@{testClass}">
|
||||
<condition else="-suitename OpenSeSim -testname @{testClass} ${test.class.or.method}" property="testng.cmd.args" value="@{testClass}">
|
||||
<matches pattern=".*\.xml" string="@{testClass}"/>
|
||||
</condition>
|
||||
<delete dir="${build.test.results.dir}" quiet="true"/>
|
||||
<mkdir dir="${build.test.results.dir}"/>
|
||||
<j2seproject3:debug classname="org.testng.TestNG" classpath="${debug.test.classpath}">
|
||||
<customize>
|
||||
<customizeDebuggee>
|
||||
<customize2/>
|
||||
<jvmarg value="-ea"/>
|
||||
<arg line="${testng.debug.mode}"/>
|
||||
<arg line="-d ${build.test.results.dir}"/>
|
||||
<arg line="-listener org.testng.reporters.VerboseReporter"/>
|
||||
<arg line="${testng.cmd.args}"/>
|
||||
</customize>
|
||||
</customizeDebuggee>
|
||||
</j2seproject3:debug>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
@ -642,14 +769,10 @@ is divided into following sections:
|
||||
<attribute default="" name="testMethod"/>
|
||||
<sequential>
|
||||
<j2seproject3:test-debug-impl excludes="@{excludes}" includes="@{includes}" testincludes="@{testincludes}" testmethods="@{testmethods}">
|
||||
<customize>
|
||||
<classpath>
|
||||
<path path="${run.test.classpath}"/>
|
||||
</classpath>
|
||||
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
|
||||
<customizeDebuggee>
|
||||
<jvmarg line="${run.jvmargs}"/>
|
||||
<jvmarg line="${run.jvmargs.ide}"/>
|
||||
</customize>
|
||||
</customizeDebuggee>
|
||||
</j2seproject3:test-debug-impl>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
@ -729,6 +852,7 @@ is divided into following sections:
|
||||
<target depends="-init-debug-args" name="-init-macrodef-nbjpda">
|
||||
<macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1">
|
||||
<attribute default="${main.class}" name="name"/>
|
||||
<attribute default="${debug.modulepath}" name="modulepath"/>
|
||||
<attribute default="${debug.classpath}" name="classpath"/>
|
||||
<attribute default="" name="stopclassname"/>
|
||||
<sequential>
|
||||
@ -751,18 +875,6 @@ is divided into following sections:
|
||||
</macrodef>
|
||||
</target>
|
||||
<target name="-init-debug-args">
|
||||
<property name="version-output" value="java version "${ant.java.version}"/>
|
||||
<condition property="have-jdk-older-than-1.4">
|
||||
<or>
|
||||
<contains string="${version-output}" substring="java version "1.0"/>
|
||||
<contains string="${version-output}" substring="java version "1.1"/>
|
||||
<contains string="${version-output}" substring="java version "1.2"/>
|
||||
<contains string="${version-output}" substring="java version "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>
|
||||
@ -772,21 +884,46 @@ is divided into following sections:
|
||||
</target>
|
||||
<target depends="-init-debug-args" name="-init-macrodef-debug">
|
||||
<macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<attribute default="${module.name}" name="modulename"/>
|
||||
<attribute default="${main.class}" name="classname"/>
|
||||
<attribute default="${debug.modulepath}" name="modulepath"/>
|
||||
<attribute default="${debug.classpath}" name="classpath"/>
|
||||
<element name="customizeDebuggee" optional="true"/>
|
||||
<sequential>
|
||||
<j2seproject1:java classname="@{classname}" classpath="@{classpath}" modulename="@{modulename}" modulepath="@{modulepath}">
|
||||
<customize>
|
||||
<jvmarg value="-agentlib:jdwp=transport=${debug-transport},address=${jpda.address}"/>
|
||||
<customizeDebuggee/>
|
||||
</customize>
|
||||
</j2seproject1:java>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target depends="-init-source-module-properties" if="named.module.internal" name="-init-macrodef-java-with-module">
|
||||
<macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
|
||||
<attribute default="${module.name}" name="modulename"/>
|
||||
<attribute default="${main.class}" name="classname"/>
|
||||
<attribute default="${run.modulepath}" name="modulepath"/>
|
||||
<attribute default="${run.upgrademodulepath}" name="upgrademodulepath"/>
|
||||
<attribute default="${run.classpath}" name="classpath"/>
|
||||
<attribute default="jvm" name="jvm"/>
|
||||
<element name="customize" optional="true"/>
|
||||
<sequential>
|
||||
<java classname="@{classname}" dir="${work.dir}" failonerror="${java.failonerror}" fork="true">
|
||||
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
|
||||
<jvmarg line="${debug-args-line}"/>
|
||||
<jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
|
||||
<java classname="@{classname}" dir="${work.dir}" failonerror="${java.failonerror}" fork="true" module="@{modulename}">
|
||||
<classpath>
|
||||
<path path="@{classpath}"/>
|
||||
</classpath>
|
||||
<modulepath>
|
||||
<pathelement path="@{modulepath}"/>
|
||||
<pathelement location="${module.build.classes.dir}"/>
|
||||
</modulepath>
|
||||
<upgrademodulepath>
|
||||
<path path="@{upgrademodulepath}"/>
|
||||
</upgrademodulepath>
|
||||
<jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
|
||||
<redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
|
||||
<jvmarg line="${run.jvmargs}"/>
|
||||
<jvmarg line="${run.jvmargs.ide}"/>
|
||||
<classpath>
|
||||
<path path="@{classpath}"/>
|
||||
</classpath>
|
||||
<syspropertyset>
|
||||
<propertyref prefix="run-sys-prop."/>
|
||||
<mapper from="run-sys-prop.*" to="*" type="glob"/>
|
||||
@ -796,9 +933,44 @@ is divided into following sections:
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target name="-init-macrodef-java">
|
||||
<target depends="-init-source-module-properties" if="unnamed.module.internal" name="-init-macrodef-java-with-unnamed-module">
|
||||
<macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
|
||||
<attribute default="" name="modulename"/>
|
||||
<attribute default="${main.class}" name="classname"/>
|
||||
<attribute default="${run.modulepath}" name="modulepath"/>
|
||||
<attribute default="${run.upgrademodulepath}" name="upgrademodulepath"/>
|
||||
<attribute default="${run.classpath}" name="classpath"/>
|
||||
<attribute default="jvm" name="jvm"/>
|
||||
<element name="customize" optional="true"/>
|
||||
<sequential>
|
||||
<java classname="@{classname}" dir="${work.dir}" failonerror="${java.failonerror}" fork="true">
|
||||
<classpath>
|
||||
<path path="@{classpath}"/>
|
||||
</classpath>
|
||||
<modulepath>
|
||||
<path path="@{modulepath}"/>
|
||||
</modulepath>
|
||||
<upgrademodulepath>
|
||||
<path path="@{upgrademodulepath}"/>
|
||||
</upgrademodulepath>
|
||||
<jvmarg value="-Dfile.encoding=${runtime.encoding}"/>
|
||||
<redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>
|
||||
<jvmarg line="${run.jvmargs}"/>
|
||||
<jvmarg line="${run.jvmargs.ide}"/>
|
||||
<syspropertyset>
|
||||
<propertyref prefix="run-sys-prop."/>
|
||||
<mapper from="run-sys-prop.*" to="*" type="glob"/>
|
||||
</syspropertyset>
|
||||
<customize/>
|
||||
</java>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target depends="-init-source-module-properties" name="-init-macrodef-java-without-module" unless="modules.supported.internal">
|
||||
<macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1">
|
||||
<attribute default="" name="modulename"/>
|
||||
<attribute default="${main.class}" name="classname"/>
|
||||
<attribute default="" name="modulepath"/>
|
||||
<attribute default="${run.classpath}" name="classpath"/>
|
||||
<attribute default="jvm" name="jvm"/>
|
||||
<element name="customize" optional="true"/>
|
||||
@ -821,6 +993,7 @@ is divided into following sections:
|
||||
</sequential>
|
||||
</macrodef>
|
||||
</target>
|
||||
<target depends="-init-macrodef-java-with-module, -init-macrodef-java-with-unnamed-module, -init-macrodef-java-without-module" name="-init-macrodef-java"/>
|
||||
<target name="-init-macrodef-copylibs">
|
||||
<macrodef name="copylibs" uri="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<attribute default="${manifest.file}" name="manifest"/>
|
||||
@ -894,7 +1067,7 @@ is divided into following sections:
|
||||
<delete file="${built-jar.properties}" quiet="true"/>
|
||||
</target>
|
||||
<target if="already.built.jar.${basedir}" name="-warn-already-built-jar">
|
||||
<echo level="warn" message="Cycle detected: SeSim was already built"/>
|
||||
<echo level="warn" message="Cycle detected: OpenSeSim was already built"/>
|
||||
</target>
|
||||
<target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps">
|
||||
<mkdir dir="${build.dir}"/>
|
||||
@ -910,7 +1083,9 @@ is divided into following sections:
|
||||
<available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/>
|
||||
</target>
|
||||
<target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build">
|
||||
<antcall target="clean"/>
|
||||
<antcall target="clean">
|
||||
<param name="no.dependencies" value="true"/>
|
||||
</antcall>
|
||||
</target>
|
||||
<target depends="init,deps-jar" name="-pre-pre-compile">
|
||||
<mkdir dir="${build.classes.dir}"/>
|
||||
@ -951,7 +1126,7 @@ is divided into following sections:
|
||||
<target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
|
||||
<fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
|
||||
<j2seproject3:force-recompile/>
|
||||
<j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}"/>
|
||||
<j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}, module-info.java" sourcepath="${src.dir}"/>
|
||||
</target>
|
||||
<target name="-post-compile-single">
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
@ -971,6 +1146,25 @@ is divided into following sections:
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
<!-- You can override this target in the ../build.xml file. -->
|
||||
</target>
|
||||
<target depends="init,compile" name="-check-module-main-class">
|
||||
<pathconvert property="main.class.file">
|
||||
<string value="${main.class}"/>
|
||||
<unpackagemapper from="*" to="*.class"/>
|
||||
</pathconvert>
|
||||
<condition property="do.module.main.class">
|
||||
<and>
|
||||
<isset property="main.class.available"/>
|
||||
<available file="${build.classes.dir}/module-info.class"/>
|
||||
<available file="${build.classes.dir}/${main.class.file}"/>
|
||||
<isset property="libs.CopyLibs.classpath"/>
|
||||
<available classname="org.netbeans.modules.java.j2seproject.moduletask.ModuleMainClass" classpath="${libs.CopyLibs.classpath}"/>
|
||||
</and>
|
||||
</condition>
|
||||
</target>
|
||||
<target depends="-check-module-main-class" if="do.module.main.class" name="-set-module-main-class">
|
||||
<taskdef classname="org.netbeans.modules.java.j2seproject.moduletask.ModuleMainClass" classpath="${libs.CopyLibs.classpath}" name="modulemainclass"/>
|
||||
<modulemainclass failonerror="false" mainclass="${main.class}" moduleinfo="${build.classes.dir}/module-info.class"/>
|
||||
</target>
|
||||
<target depends="init" if="do.archive" name="-do-jar-create-manifest" unless="manifest.available">
|
||||
<tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/>
|
||||
<touch file="${tmp.manifest.file}" verbose="false"/>
|
||||
@ -1007,11 +1201,37 @@ is divided into following sections:
|
||||
<j2seproject1:jar manifest="${tmp.manifest.file}"/>
|
||||
<property location="${build.classes.dir}" name="build.classes.dir.resolved"/>
|
||||
<property location="${dist.jar}" name="dist.jar.resolved"/>
|
||||
<condition else="${dist.jar.resolved}" property="jar.usage.message.class.path.replacement" value="">
|
||||
<isset property="named.module.internal"/>
|
||||
</condition>
|
||||
<pathconvert property="run.classpath.with.dist.jar">
|
||||
<path path="${run.classpath}"/>
|
||||
<map from="${build.classes.dir.resolved}" to="${jar.usage.message.class.path.replacement}"/>
|
||||
</pathconvert>
|
||||
<pathconvert property="run.modulepath.with.dist.jar">
|
||||
<path location="${dist.jar.resolved}"/>
|
||||
<path path="${run.modulepath}"/>
|
||||
<map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/>
|
||||
</pathconvert>
|
||||
<condition else="" property="jar.usage.message" value="To run this application from the command line without Ant, try:${line.separator}${platform.java} -cp ${run.classpath.with.dist.jar} ${main.class}">
|
||||
<condition else="${run.modulepath}" property="jar.usage.message.run.modulepath.with.dist.jar" value="${run.modulepath.with.dist.jar}">
|
||||
<isset property="named.module.internal"/>
|
||||
</condition>
|
||||
<condition else="" property="jar.usage.message.module.path" value=" -p ${jar.usage.message.run.modulepath.with.dist.jar}">
|
||||
<and>
|
||||
<isset property="modules.supported.internal"/>
|
||||
<length length="0" string="${jar.usage.message.run.modulepath.with.dist.jar}" when="greater"/>
|
||||
</and>
|
||||
</condition>
|
||||
<condition else="" property="jar.usage.message.class.path" value=" -cp ${run.classpath.with.dist.jar}">
|
||||
<length length="0" string="${run.classpath.with.dist.jar}" when="greater"/>
|
||||
</condition>
|
||||
<condition else="/${main.class}" property="jar.usage.message.main.class.class.selector" value="">
|
||||
<isset property="do.module.main.class"/>
|
||||
</condition>
|
||||
<condition else=" ${main.class}" property="jar.usage.message.main.class" value=" -m ${module.name}${jar.usage.message.main.class.class.selector}">
|
||||
<isset property="named.module.internal"/>
|
||||
</condition>
|
||||
<condition else="" property="jar.usage.message" value="To run this application from the command line without Ant, try:${line.separator}${platform.java}${jar.usage.message.module.path}${jar.usage.message.class.path}${jar.usage.message.main.class}">
|
||||
<isset property="main.class.available"/>
|
||||
</condition>
|
||||
<condition else="debug" property="jar.usage.level" value="info">
|
||||
@ -1030,8 +1250,73 @@ is divided into following sections:
|
||||
<!-- 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,jnlp" description="Build JAR." name="jar"/>
|
||||
<target depends="init,compile,-pre-jar,-set-module-main-class,-do-jar-without-libraries,-do-jar-with-libraries,-post-jar" name="-do-jar"/>
|
||||
<target depends="init,compile,-pre-jar,-do-jar,-post-jar,deploy,jnlp" description="Build JAR." name="jar"/>
|
||||
<!--
|
||||
=================
|
||||
DEPLOY SECTION
|
||||
=================
|
||||
-->
|
||||
<target name="-pre-deploy">
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
<!-- You can override this target in the ../build.xml file. -->
|
||||
</target>
|
||||
<target depends="init" name="-check-jlink">
|
||||
<condition property="do.jlink.internal">
|
||||
<and>
|
||||
<istrue value="${do.jlink}"/>
|
||||
<isset property="do.archive"/>
|
||||
<isset property="named.module.internal"/>
|
||||
</and>
|
||||
</condition>
|
||||
</target>
|
||||
<target depends="init,-do-jar,-post-jar,-pre-deploy,-check-jlink" if="do.jlink.internal" name="-do-deploy">
|
||||
<delete dir="${dist.jlink.dir}" failonerror="false" quiet="true"/>
|
||||
<property name="jlink.launcher.name" value="${application.title}"/>
|
||||
<condition else="${module.name}" property="jlink.add.modules" value="${module.name},${jlink.additionalmodules}">
|
||||
<and>
|
||||
<isset property="jlink.additionalmodules"/>
|
||||
<length length="0" string="${jlink.additionalmodules}" when="greater"/>
|
||||
</and>
|
||||
</condition>
|
||||
<condition property="jlink.do.strip.internal">
|
||||
<and>
|
||||
<isset property="jlink.strip"/>
|
||||
<istrue value="${jlink.strip}"/>
|
||||
</and>
|
||||
</condition>
|
||||
<condition property="jlink.do.additionalparam.internal">
|
||||
<and>
|
||||
<isset property="jlink.additionalparam"/>
|
||||
<length length="0" string="${jlink.additionalparam}" when="greater"/>
|
||||
</and>
|
||||
</condition>
|
||||
<condition property="jlink.do.launcher.internal">
|
||||
<and>
|
||||
<istrue value="${jlink.launcher}"/>
|
||||
<isset property="main.class.available"/>
|
||||
</and>
|
||||
</condition>
|
||||
<property name="platform.jlink" value="${jdk.home}/bin/jlink"/>
|
||||
<property name="jlink.systemmodules.internal" value="${jdk.home}/jmods"/>
|
||||
<exec executable="${platform.jlink}">
|
||||
<arg value="--module-path"/>
|
||||
<arg path="${jlink.systemmodules.internal}:${run.modulepath}:${dist.jar}"/>
|
||||
<arg value="--add-modules"/>
|
||||
<arg value="${jlink.add.modules}"/>
|
||||
<arg if:set="jlink.do.strip.internal" value="--strip-debug"/>
|
||||
<arg if:set="jlink.do.launcher.internal" value="--launcher"/>
|
||||
<arg if:set="jlink.do.launcher.internal" value="${jlink.launcher.name}=${module.name}/${main.class}"/>
|
||||
<arg if:set="jlink.do.additionalparam.internal" line="${jlink.additionalparam}"/>
|
||||
<arg value="--output"/>
|
||||
<arg value="${dist.jlink.output}"/>
|
||||
</exec>
|
||||
</target>
|
||||
<target name="-post-deploy">
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
<!-- You can override this target in the ../build.xml file. -->
|
||||
</target>
|
||||
<target depends="-do-jar,-post-jar,-pre-deploy,-do-deploy,-post-deploy" name="deploy"/>
|
||||
<!--
|
||||
=================
|
||||
EXECUTION SECTION
|
||||
@ -1068,9 +1353,9 @@ is divided into following sections:
|
||||
</target>
|
||||
<target depends="init,compile" name="-debug-start-debuggee">
|
||||
<j2seproject3:debug>
|
||||
<customize>
|
||||
<customizeDebuggee>
|
||||
<arg line="${application.args}"/>
|
||||
</customize>
|
||||
</customizeDebuggee>
|
||||
</j2seproject3:debug>
|
||||
</target>
|
||||
<target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/>
|
||||
@ -1136,28 +1421,24 @@ is divided into following sections:
|
||||
</customize>
|
||||
</profile>
|
||||
</target>
|
||||
<target depends="profile-init,compile-test-single" if="profiler.info.jvmargs.agent" name="-profile-test-single-pre72">
|
||||
<target depends="-init-macrodef-junit,profile-init,compile-test-single" if="profiler.info.jvmargs.agent" name="-profile-test-single-pre72">
|
||||
<fail unless="netbeans.home">This target only works when run from inside the NetBeans IDE.</fail>
|
||||
<nbprofiledirect>
|
||||
<classpath>
|
||||
<path path="${run.test.classpath}"/>
|
||||
</classpath>
|
||||
</nbprofiledirect>
|
||||
<junit dir="${profiler.info.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" jvm="${profiler.info.jvm}" showoutput="true">
|
||||
<j2seproject3:junit excludes="${excludes}" includes="${includes}" testincludes="${profile.class}" testmethods="">
|
||||
<customize>
|
||||
<jvmarg value="-agentlib:jdwp=transport=${debug-transport},address=${jpda.address}"/>
|
||||
<env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/>
|
||||
<jvmarg value="${profiler.info.jvmargs.agent}"/>
|
||||
<jvmarg line="${profiler.info.jvmargs}"/>
|
||||
<test name="${profile.class}"/>
|
||||
<classpath>
|
||||
<path path="${run.test.classpath}"/>
|
||||
</classpath>
|
||||
<syspropertyset>
|
||||
<propertyref prefix="test-sys-prop."/>
|
||||
<mapper from="test-sys-prop.*" to="*" type="glob"/>
|
||||
</syspropertyset>
|
||||
<formatter type="brief" usefile="false"/>
|
||||
<formatter type="xml"/>
|
||||
</junit>
|
||||
</customize>
|
||||
</j2seproject3:junit>
|
||||
</target>
|
||||
<!--
|
||||
end of pre NB72 profiling section
|
||||
@ -1213,6 +1494,12 @@ is divided into following sections:
|
||||
<condition else="" property="bug5101868workaround" value="*.java">
|
||||
<matches pattern="1\.[56](\..*)?" string="${java.version}"/>
|
||||
</condition>
|
||||
<condition else="" property="javadoc.html5.cmd.line.arg" value="-html5">
|
||||
<and>
|
||||
<isset property="javadoc.html5"/>
|
||||
<available file="${jdk.home}${file.separator}lib${file.separator}jrt-fs.jar"/>
|
||||
</and>
|
||||
</condition>
|
||||
<javadoc additionalparam="-J-Dfile.encoding=${file.encoding} ${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
|
||||
<classpath>
|
||||
<path path="${javac.classpath}"/>
|
||||
@ -1225,6 +1512,7 @@ is divided into following sections:
|
||||
<exclude name="*.java"/>
|
||||
</fileset>
|
||||
<arg line="${javadoc.endorsed.classpath.cmd.line.arg}"/>
|
||||
<arg line="${javadoc.html5.cmd.line.arg}"/>
|
||||
</javadoc>
|
||||
<copy todir="${dist.javadoc.dir}">
|
||||
<fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
|
||||
@ -1251,11 +1539,63 @@ is divided into following sections:
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
<!-- You can override this target in the ../build.xml file. -->
|
||||
</target>
|
||||
<target depends="-init-source-module-properties" if="named.module.internal" name="-init-test-javac-module-properties-with-module">
|
||||
<j2seproject3:modulename property="test.module.name" sourcepath="${test.src.dir}"/>
|
||||
<condition else="${empty.dir}" property="javac.test.sourcepath" value="${test.src.dir}">
|
||||
<and>
|
||||
<isset property="test.module.name"/>
|
||||
<length length="0" string="${test.module.name}" when="greater"/>
|
||||
</and>
|
||||
</condition>
|
||||
<condition else="--patch-module ${module.name}=${test.src.dir} --add-reads ${module.name}=ALL-UNNAMED" property="javac.test.compilerargs" value="--add-reads ${test.module.name}=ALL-UNNAMED">
|
||||
<and>
|
||||
<isset property="test.module.name"/>
|
||||
<length length="0" string="${test.module.name}" when="greater"/>
|
||||
</and>
|
||||
</condition>
|
||||
</target>
|
||||
<target depends="-init-source-module-properties" if="named.module.internal" name="-init-test-run-module-properties">
|
||||
<condition else="${module.name}" property="run.test.addexport.source.module.internal" value="${test.module.name}">
|
||||
<and>
|
||||
<isset property="test.module.name"/>
|
||||
<length length="0" string="${test.module.name}" when="greater"/>
|
||||
</and>
|
||||
</condition>
|
||||
<fileset dir="${build.test.classes.dir}" id="run.test.packages.internal" includes="**/*.class"/>
|
||||
<property location="${build.test.classes.dir}" name="build.test.classes.dir.abs.internal"/>
|
||||
<pathconvert pathsep=" " property="run.test.addexports.internal" refid="run.test.packages.internal">
|
||||
<chainedmapper>
|
||||
<regexpmapper from="^(.*)\Q${file.separator}\E.*\.class$$" to="\1"/>
|
||||
<filtermapper>
|
||||
<uniqfilter/>
|
||||
<replacestring from="${build.test.classes.dir.abs.internal}" to=""/>
|
||||
</filtermapper>
|
||||
<cutdirsmapper dirs="1"/>
|
||||
<packagemapper from="*" to="--add-exports ${run.test.addexport.source.module.internal}/*=ALL-UNNAMED"/>
|
||||
</chainedmapper>
|
||||
</pathconvert>
|
||||
<condition else="--patch-module ${module.name}=${build.test.classes.dir} --add-modules ${module.name} --add-reads ${module.name}=ALL-UNNAMED ${run.test.addexports.internal}" property="run.test.jvmargs" value="--add-modules ${test.module.name} --add-reads ${test.module.name}=ALL-UNNAMED ${run.test.addexports.internal}">
|
||||
<and>
|
||||
<isset property="test.module.name"/>
|
||||
<length length="0" string="${test.module.name}" when="greater"/>
|
||||
</and>
|
||||
</condition>
|
||||
</target>
|
||||
<target depends="-init-source-module-properties" name="-init-test-module-properties-without-module" unless="named.module.internal">
|
||||
<property name="javac.test.sourcepath" value="${empty.dir}"/>
|
||||
<property name="javac.test.compilerargs" value=""/>
|
||||
<property name="run.test.jvmargs" value=""/>
|
||||
</target>
|
||||
<target depends="-init-test-javac-module-properties-with-module,-init-test-module-properties-without-module" name="-init-test-module-properties"/>
|
||||
<target if="do.depend.true" name="-compile-test-depend">
|
||||
<j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
|
||||
</target>
|
||||
<target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
|
||||
<j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" processorpath="${javac.test.processorpath}" srcdir="${test.src.dir}"/>
|
||||
<target depends="init,deps-jar,compile,-init-test-module-properties,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
|
||||
<j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" modulepath="${javac.test.modulepath}" processorpath="${javac.test.processorpath}" sourcepath="${javac.test.sourcepath}" srcdir="${test.src.dir}">
|
||||
<customize>
|
||||
<compilerarg line="${javac.test.compilerargs}"/>
|
||||
</customize>
|
||||
</j2seproject3:javac>
|
||||
<copy todir="${build.test.classes.dir}">
|
||||
<fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
|
||||
</copy>
|
||||
@ -1269,10 +1609,14 @@ is divided into following sections:
|
||||
<!-- Empty placeholder for easier customization. -->
|
||||
<!-- You can override this target in the ../build.xml file. -->
|
||||
</target>
|
||||
<target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
|
||||
<target depends="init,deps-jar,compile,-init-test-module-properties,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
|
||||
<fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
|
||||
<j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
|
||||
<j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" processorpath="${javac.test.processorpath}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/>
|
||||
<j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}, module-info.java" modulepath="${javac.test.modulepath}" processorpath="${javac.test.processorpath}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}">
|
||||
<customize>
|
||||
<compilerarg line="${javac.test.compilerargs}"/>
|
||||
</customize>
|
||||
</j2seproject3:javac>
|
||||
<copy todir="${build.test.classes.dir}">
|
||||
<fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
|
||||
</copy>
|
||||
@ -1290,7 +1634,7 @@ is divided into following sections:
|
||||
<target depends="init" if="have.tests" name="-pre-test-run">
|
||||
<mkdir dir="${build.test.results.dir}"/>
|
||||
</target>
|
||||
<target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
|
||||
<target depends="init,compile-test,-init-test-run-module-properties,-pre-test-run" if="have.tests" name="-do-test-run">
|
||||
<j2seproject3:test includes="${includes}" testincludes="**/*Test.java"/>
|
||||
</target>
|
||||
<target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
|
||||
@ -1302,14 +1646,14 @@ is divided into following sections:
|
||||
<target depends="init" if="have.tests" name="-pre-test-run-single">
|
||||
<mkdir dir="${build.test.results.dir}"/>
|
||||
</target>
|
||||
<target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
|
||||
<target depends="init,compile-test-single,-init-test-run-module-properties,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
|
||||
<fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
|
||||
<j2seproject3:test excludes="" includes="${test.includes}" testincludes="${test.includes}"/>
|
||||
</target>
|
||||
<target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
|
||||
<fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
|
||||
</target>
|
||||
<target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
|
||||
<target depends="init,compile-test-single,-init-test-run-module-properties,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
|
||||
<target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single-method">
|
||||
<fail unless="test.class">Must select some files in the IDE or set test.class</fail>
|
||||
<fail unless="test.method">Must select some method in the IDE or set test.method</fail>
|
||||
@ -1318,7 +1662,7 @@ is divided into following sections:
|
||||
<target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method" if="have.tests" name="-post-test-run-single-method">
|
||||
<fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
|
||||
</target>
|
||||
<target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single-method,-post-test-run-single-method" description="Run single unit test." name="test-single-method"/>
|
||||
<target depends="init,compile-test-single,-init-test-run-module-properties,-pre-test-run-single,-do-test-run-single-method,-post-test-run-single-method" description="Run single unit test." name="test-single-method"/>
|
||||
<!--
|
||||
=======================
|
||||
TEST DEBUGGING SECTION
|
||||
@ -1336,8 +1680,8 @@ is divided into following sections:
|
||||
<target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
|
||||
<j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
|
||||
</target>
|
||||
<target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
|
||||
<target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test-method" name="debug-test-method"/>
|
||||
<target depends="init,compile-test-single,-init-test-run-module-properties,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
|
||||
<target depends="init,compile-test-single,-init-test-run-module-properties,-debug-start-debugger-test,-debug-start-debuggee-test-method" name="debug-test-method"/>
|
||||
<target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
|
||||
<j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/>
|
||||
</target>
|
||||
@ -1363,9 +1707,9 @@ is divided into following sections:
|
||||
<target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
|
||||
<fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
|
||||
<j2seproject3:debug classname="sun.applet.AppletViewer">
|
||||
<customize>
|
||||
<customizeDebuggee>
|
||||
<arg value="${applet.url}"/>
|
||||
</customize>
|
||||
</customizeDebuggee>
|
||||
</j2seproject3:debug>
|
||||
</target>
|
||||
<target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
|
||||
@ -1379,7 +1723,7 @@ is divided into following sections:
|
||||
<delete file="${built-clean.properties}" quiet="true"/>
|
||||
</target>
|
||||
<target if="already.built.clean.${basedir}" name="-warn-already-built-clean">
|
||||
<echo level="warn" message="Cycle detected: SeSim was already built"/>
|
||||
<echo level="warn" message="Cycle detected: OpenSeSim was already built"/>
|
||||
</target>
|
||||
<target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps">
|
||||
<mkdir dir="${build.dir}"/>
|
||||
@ -1392,6 +1736,7 @@ is divided into following sections:
|
||||
</target>
|
||||
<target depends="init" name="-do-clean">
|
||||
<delete dir="${build.dir}"/>
|
||||
<delete dir="${dist.jlink.output}"/>
|
||||
<delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/>
|
||||
</target>
|
||||
<target name="-post-clean">
|
||||
|
@ -1,4 +0,0 @@
|
||||
$label=Web Start
|
||||
$target.debug=jws-debug
|
||||
$target.run=jws-run
|
||||
compile.on.save.unsupported.javawebstart=true
|
@ -3,6 +3,6 @@ build.xml.script.CRC32=72406d8f
|
||||
build.xml.stylesheet.CRC32=8064a381@1.79.1.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=56c4c4cc
|
||||
nbproject/build-impl.xml.script.CRC32=5f99364f
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48
|
||||
nbproject/build-impl.xml.data.CRC32=65c6cbee
|
||||
nbproject/build-impl.xml.script.CRC32=ae093a94
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=3a2fa800@1.89.1.48
|
||||
|
@ -1,47 +1,23 @@
|
||||
<?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.
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
Oracle and Java are registered trademarks of Oracle and/or its affiliates.
|
||||
Other names may be trademarks of their respective owners.
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
|
||||
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">
|
||||
@ -261,7 +237,7 @@ made subject to such option by the copyright holder.
|
||||
<macrodef name="extend-manifest" uri="http://www.netbeans.org/ns/j2se-project/jnlp">
|
||||
<element name="customize"/>
|
||||
<sequential>
|
||||
<manifest file="${tmp.manifest.file}" mode="update">
|
||||
<manifest file="${tmp.manifest.file}" mode="update" encoding="UTF-8">
|
||||
<customize/>
|
||||
</manifest>
|
||||
</sequential>
|
||||
@ -306,7 +282,7 @@ made subject to such option by the copyright holder.
|
||||
|
||||
<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"/>
|
||||
<copy file="${manifest.file}" tofile="${build.dir}/manifest.mf" encoding="${manifest.encoding}" outputencoding="UTF-8"/>
|
||||
</target>
|
||||
|
||||
<target name="-set-mixed-code-properties" depends="-check-signing-possible" if="jnlp.signed.true+signjars.task.available">
|
||||
@ -866,18 +842,6 @@ made subject to such option by the copyright holder.
|
||||
description="Debug javaws project in IDE"/>
|
||||
|
||||
<target name="-init-debug-args">
|
||||
<property name="version-output" value="java version "${ant.java.version}"/>
|
||||
<condition property="have-jdk-older-than-1.4">
|
||||
<or>
|
||||
<contains string="${version-output}" substring="java version "1.0"/>
|
||||
<contains string="${version-output}" substring="java version "1.1"/>
|
||||
<contains string="${version-output}" substring="java version "1.2"/>
|
||||
<contains string="${version-output}" substring="java version "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>
|
||||
@ -889,7 +853,7 @@ made subject to such option by the copyright holder.
|
||||
<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}"/>
|
||||
<env key="JAVAWS_VM_ARGS" value="-agentlib:jdwp=transport=${debug-transport},address=${jpda.address}"/>
|
||||
<arg value="-wait"/>
|
||||
<arg file="${jnlp.dest.dir}${file.separator}${jnlp.file}"/>
|
||||
</exec>
|
||||
|
@ -1,4 +1,4 @@
|
||||
#Sat, 27 Jan 2018 22:25:12 +0100
|
||||
#Fri, 30 Nov 2018 10:49:27 +0100
|
||||
annotation.processing.enabled=true
|
||||
annotation.processing.enabled.in.editor=false
|
||||
annotation.processing.processors.list=
|
||||
@ -8,8 +8,17 @@ ant.customtasks.libs=JWSAntTasks
|
||||
application.desc=SeSim - Stock Exchange Simulator
|
||||
application.homepage=blog.cauwersin.com
|
||||
application.splash=
|
||||
application.title=SeSim
|
||||
application.title=OpenSeSim
|
||||
application.vendor=Cauwersin
|
||||
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs=true
|
||||
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width=4
|
||||
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab=4
|
||||
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.tab-size=8
|
||||
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=80
|
||||
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-line-wrap=none
|
||||
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=project
|
||||
auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsEnabled=true
|
||||
auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml
|
||||
build.classes.dir=${build.dir}/classes
|
||||
build.classes.excludes=**/*.java,**/*.form
|
||||
# This directory is removed when the project is cleaned:
|
||||
@ -23,12 +32,14 @@ build.test.results.dir=${build.dir}/test/results
|
||||
# Uncomment to specify the preferred debugger connection transport:
|
||||
#debug.transport=dt_socket
|
||||
debug.classpath=${run.classpath}
|
||||
debug.modulepath=${run.modulepath}
|
||||
debug.test.classpath=${run.test.classpath}
|
||||
debug.test.modulepath=${run.test.modulepath}
|
||||
# Files in build.classes.dir which should be excluded from distribution jar
|
||||
dist.archive.excludes=
|
||||
# This directory is removed when the project is cleaned:
|
||||
dist.dir=dist
|
||||
dist.jar=${dist.dir}/SeSim.jar
|
||||
dist.jar=${dist.dir}/OpenSeSim.jar
|
||||
dist.javadoc.dir=${dist.dir}/javadoc
|
||||
endorsed.classpath=
|
||||
excludes=
|
||||
@ -41,10 +52,13 @@ javac.classpath=${ivy.classpath}\:${libs.absolutelayout.classpath}
|
||||
javac.compilerargs=
|
||||
javac.deprecation=false
|
||||
javac.external.vm=true
|
||||
javac.modulepath=
|
||||
javac.processormodulepath=
|
||||
javac.processorpath=${javac.classpath}
|
||||
javac.source=1.8
|
||||
javac.target=1.8
|
||||
javac.test.classpath=${javac.classpath}\:${build.classes.dir}
|
||||
javac.test.classpath=${javac.classpath}\:${build.classes.dir}\:${libs.junit_4.classpath}\:${libs.hamcrest.classpath}\:${libs.testng.classpath}
|
||||
javac.test.modulepath=${javac.modulepath}
|
||||
javac.test.processorpath=${javac.test.classpath}
|
||||
javadoc.additionalparam=
|
||||
javadoc.author=false
|
||||
@ -61,6 +75,7 @@ jnlp.applet.height=300
|
||||
jnlp.applet.width=300
|
||||
jnlp.codebase.type=user
|
||||
jnlp.codebase.url=$$$$codebase
|
||||
jnlp.codebase.user=
|
||||
jnlp.descriptor=component
|
||||
jnlp.enabled=false
|
||||
jnlp.icon=
|
||||
@ -69,7 +84,8 @@ jnlp.offline-allowed=true
|
||||
jnlp.signed=true
|
||||
jnlp.signing=key
|
||||
jnlp.signing.alias=SeSim
|
||||
main.class=gui.SeSimApplication
|
||||
jnlp.signing.keystore=
|
||||
main.class=opensesim.gui.SeSimApplication
|
||||
# Optional override of default Application-Library-Allowable-Codebase attribute identifying the locations where your signed RIA is expected to be found.
|
||||
manifest.custom.application.library.allowable.codebase=
|
||||
# Optional override of default Caller-Allowable-Codebase attribute identifying the domains from which JavaScript code can make calls to your RIA without security prompts.
|
||||
@ -88,7 +104,9 @@ run.classpath=${javac.classpath}\:${build.classes.dir}
|
||||
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
|
||||
# To set system properties for unit tests define test-sys-prop.name=value:
|
||||
run.jvmargs=
|
||||
run.modulepath=${javac.modulepath}
|
||||
run.test.classpath=${javac.test.classpath}\:${build.test.classes.dir}
|
||||
run.test.modulepath=${javac.test.modulepath}
|
||||
source.encoding=UTF-8
|
||||
src.dir=src
|
||||
test.src.dir=test
|
||||
|
@ -9,7 +9,7 @@
|
||||
</extension>
|
||||
</buildExtensions>
|
||||
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
|
||||
<name>SeSim</name>
|
||||
<name>OpenSeSim</name>
|
||||
<source-roots>
|
||||
<root id="src.dir"/>
|
||||
</source-roots>
|
||||
|
@ -1,17 +0,0 @@
|
||||
<!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>
|
@ -1,459 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.8" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<Properties>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[220, 262]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<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="1"/>
|
||||
<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"/>
|
||||
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,2,41,0,0,2,75"/>
|
||||
</AuxValues>
|
||||
<SubComponents>
|
||||
<Component class="gui.AskBook" name="askBook1">
|
||||
<Properties>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[200, 200]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="0" gridY="0" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="1.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="gui.BidBook" name="bidBook1">
|
||||
<Properties>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[200, 200]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="0" gridY="4" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="1.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Container class="gui.QuotePanel" name="quotePanel2">
|
||||
<Properties>
|
||||
<Property name="opaque" type="boolean" value="false"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[587, 200]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="0" gridY="2" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.5" weightY="0.5"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
<LayoutCode>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="1_quotePanel2Layout">
|
||||
<CodeVariable name="quotePanel2Layout" type="4096" declaredType="java.awt.GridBagLayout"/>
|
||||
<ExpressionOrigin>
|
||||
<ExpressionProvider type="CodeConstructor">
|
||||
<CodeConstructor class="java.awt.GridBagLayout" parameterTypes=""/>
|
||||
</ExpressionProvider>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
<StatementProvider type="CodeExpression">
|
||||
<CodeExpression id="1_quotePanel2Layout"/>
|
||||
</StatementProvider>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="1_quotePanel2Layout"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="columnWidths" class="java.awt.GridBagLayout"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="2">
|
||||
<ExpressionOrigin>
|
||||
<Value type="[I" editor="org.netbeans.modules.form.layoutsupport.delegates.GridBagLayoutSupport$IntArrayPropertyEditor">
|
||||
<PropertyValue value="[0, 5, 0, 5, 0]"/>
|
||||
</Value>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="1_quotePanel2Layout"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="rowHeights" class="java.awt.GridBagLayout"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="3">
|
||||
<ExpressionOrigin>
|
||||
<Value type="[I" editor="org.netbeans.modules.form.layoutsupport.delegates.GridBagLayoutSupport$IntArrayPropertyEditor">
|
||||
<PropertyValue value="[0]"/>
|
||||
</Value>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="4_quotePanel2">
|
||||
<CodeVariable name="quotePanel2" type="8194" declaredType="gui.QuotePanel"/>
|
||||
<ExpressionOrigin>
|
||||
<ExpressionProvider type="ComponentRef">
|
||||
<ComponentRef name="quotePanel2"/>
|
||||
</ExpressionProvider>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
<StatementProvider type="CodeMethod">
|
||||
<CodeMethod name="setLayout" class="java.awt.Container" parameterTypes="java.awt.LayoutManager"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="1_quotePanel2Layout"/>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
</LayoutCode>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
<LayoutCode>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="5_layout">
|
||||
<CodeVariable name="layout" type="4096" declaredType="java.awt.GridBagLayout"/>
|
||||
<ExpressionOrigin>
|
||||
<ExpressionProvider type="CodeConstructor">
|
||||
<CodeConstructor class="java.awt.GridBagLayout" parameterTypes=""/>
|
||||
</ExpressionProvider>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
<StatementProvider type="CodeExpression">
|
||||
<CodeExpression id="5_layout"/>
|
||||
</StatementProvider>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="5_layout"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="columnWidths" class="java.awt.GridBagLayout"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="6">
|
||||
<ExpressionOrigin>
|
||||
<Value type="[I" editor="org.netbeans.modules.form.layoutsupport.delegates.GridBagLayoutSupport$IntArrayPropertyEditor">
|
||||
<PropertyValue value="[0]"/>
|
||||
</Value>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="5_layout"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="rowHeights" class="java.awt.GridBagLayout"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="7">
|
||||
<ExpressionOrigin>
|
||||
<Value type="[I" editor="org.netbeans.modules.form.layoutsupport.delegates.GridBagLayoutSupport$IntArrayPropertyEditor">
|
||||
<PropertyValue value="[0, 5, 0, 5, 0]"/>
|
||||
</Value>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="8">
|
||||
<ExpressionOrigin>
|
||||
<ExpressionProvider type="ComponentRef">
|
||||
<ComponentRef name="."/>
|
||||
</ExpressionProvider>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
<StatementProvider type="CodeMethod">
|
||||
<CodeMethod name="setLayout" class="java.awt.Container" parameterTypes="java.awt.LayoutManager"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="5_layout"/>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="9_gridBagConstraints">
|
||||
<CodeVariable name="gridBagConstraints" type="20480" declaredType="java.awt.GridBagConstraints"/>
|
||||
<ExpressionOrigin>
|
||||
<ExpressionProvider type="CodeConstructor">
|
||||
<CodeConstructor class="java.awt.GridBagConstraints" parameterTypes=""/>
|
||||
</ExpressionProvider>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
<StatementProvider type="CodeExpression">
|
||||
<CodeExpression id="9_gridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="9_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="gridx" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="10">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="0"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="9_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="gridy" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="11">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="0"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="9_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="fill" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="12">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="1"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="9_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="weightx" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="13">
|
||||
<ExpressionOrigin>
|
||||
<Value type="double" value="1.0"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="9_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="weighty" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="14">
|
||||
<ExpressionOrigin>
|
||||
<Value type="double" value="1.0"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="8"/>
|
||||
<StatementProvider type="CodeMethod">
|
||||
<CodeMethod name="add" class="java.awt.Container" parameterTypes="java.awt.Component, java.lang.Object"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="15_askBook1">
|
||||
<CodeVariable name="askBook1" type="8194" declaredType="gui.AskBook"/>
|
||||
<ExpressionOrigin>
|
||||
<ExpressionProvider type="ComponentRef">
|
||||
<ComponentRef name="askBook1"/>
|
||||
</ExpressionProvider>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
<CodeExpression id="9_gridBagConstraints"/>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="16_gridBagConstraints">
|
||||
<CodeVariable name="gridBagConstraints"/>
|
||||
<ExpressionOrigin>
|
||||
<ExpressionProvider type="CodeConstructor">
|
||||
<CodeConstructor class="java.awt.GridBagConstraints" parameterTypes=""/>
|
||||
</ExpressionProvider>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
<StatementProvider type="CodeExpression">
|
||||
<CodeExpression id="16_gridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="16_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="gridx" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="17">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="0"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="16_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="gridy" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="18">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="4"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="16_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="fill" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="19">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="1"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="16_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="weightx" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="20">
|
||||
<ExpressionOrigin>
|
||||
<Value type="double" value="1.0"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="16_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="weighty" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="21">
|
||||
<ExpressionOrigin>
|
||||
<Value type="double" value="1.0"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="8"/>
|
||||
<StatementProvider type="CodeMethod">
|
||||
<CodeMethod name="add" class="java.awt.Container" parameterTypes="java.awt.Component, java.lang.Object"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="22_bidBook1">
|
||||
<CodeVariable name="bidBook1" type="8194" declaredType="gui.BidBook"/>
|
||||
<ExpressionOrigin>
|
||||
<ExpressionProvider type="ComponentRef">
|
||||
<ComponentRef name="bidBook1"/>
|
||||
</ExpressionProvider>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
<CodeExpression id="16_gridBagConstraints"/>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="23_gridBagConstraints">
|
||||
<CodeVariable name="gridBagConstraints"/>
|
||||
<ExpressionOrigin>
|
||||
<ExpressionProvider type="CodeConstructor">
|
||||
<CodeConstructor class="java.awt.GridBagConstraints" parameterTypes=""/>
|
||||
</ExpressionProvider>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
<StatementProvider type="CodeExpression">
|
||||
<CodeExpression id="23_gridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="23_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="gridx" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="24">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="0"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="23_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="gridy" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="25">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="2"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="23_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="fill" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="26">
|
||||
<ExpressionOrigin>
|
||||
<Value type="int" value="1"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="23_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="weightx" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="27">
|
||||
<ExpressionOrigin>
|
||||
<Value type="double" value="0.5"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="23_gridBagConstraints"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="weighty" class="java.awt.GridBagConstraints"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="28">
|
||||
<ExpressionOrigin>
|
||||
<Value type="double" value="0.5"/>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="8"/>
|
||||
<StatementProvider type="CodeMethod">
|
||||
<CodeMethod name="add" class="java.awt.Container" parameterTypes="java.awt.Component, java.lang.Object"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="4_quotePanel2"/>
|
||||
<CodeExpression id="23_gridBagConstraints"/>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
</LayoutCode>
|
||||
</Form>
|
186
src/opensesim/AbstractAsset.java
Normal file
186
src/opensesim/AbstractAsset.java
Normal file
@ -0,0 +1,186 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 7u83 <7u83@mail.ru>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package opensesim;
|
||||
|
||||
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.JPanel;
|
||||
import opensesim.sesim.interfaces.Configurable;
|
||||
import opensesim.util.IDGenerator.Id;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 7u83 <7u83@mail.ru>
|
||||
*/
|
||||
public abstract class AbstractAsset implements Configurable {
|
||||
|
||||
private Id id;
|
||||
private String symbol;
|
||||
private String name;
|
||||
private String description;
|
||||
int decimals;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
protected AbstractAsset() {
|
||||
id = null;
|
||||
}
|
||||
|
||||
public abstract String getTypeName();
|
||||
|
||||
|
||||
|
||||
public void setDecimals(int decimals) {
|
||||
this.decimals = decimals;
|
||||
}
|
||||
|
||||
public int getDecimals() {
|
||||
return decimals;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public Id getID() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getSymbol() {
|
||||
return symbol;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public boolean isCurrency(){
|
||||
return false;
|
||||
}
|
||||
public boolean isAsset(){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static final String JSON_ID ="id";
|
||||
public static final String JSON_CLASS = "class";
|
||||
public static final String JSON_SYMBOL = "symbol";
|
||||
public static final String JSON_NAME = "name";
|
||||
public static final String JSON_DESCRIPTION = "description";
|
||||
public static final String JSON_DECIMALS = "decimals";
|
||||
public static final int DECIMALS_DEFAULT = 2;
|
||||
|
||||
public static void rename(World world, AbstractAsset a, String symbol) throws Exception {
|
||||
if (world.assetsBySymbol.get(symbol) != null) {
|
||||
throw new java.lang.Exception("Can't rename asset symbol. Symbol '" + symbol + "' is already in use.");
|
||||
}
|
||||
|
||||
world.assetsBySymbol.remove(a.getSymbol());
|
||||
a.symbol = symbol;
|
||||
world.assetsBySymbol.put(a.getSymbol(), a);
|
||||
|
||||
}
|
||||
|
||||
public static AbstractAsset create(World world, Class<AbstractAsset> cls, String symbol) throws Exception {
|
||||
AbstractAsset a = cls.newInstance();
|
||||
|
||||
if (world.assetsBySymbol.get(symbol) != null) {
|
||||
throw new java.lang.Exception("Can't create asset. Symbol '" + symbol + "' is already in use.");
|
||||
}
|
||||
|
||||
a.id = world.assetIdGenerator.getNext();
|
||||
a.symbol=symbol;
|
||||
|
||||
|
||||
world.assetsById.put(a.id, a);
|
||||
world.assetsBySymbol.put(a.getSymbol(), a);
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
public static AbstractAsset create(World world, JSONObject cfg){
|
||||
AbstractAsset a;
|
||||
String class_name;
|
||||
Class cls;
|
||||
|
||||
String symbol;
|
||||
try {
|
||||
symbol = cfg.getString(JSON_SYMBOL);
|
||||
class_name = cfg.getString(JSON_CLASS);
|
||||
cls = Class.forName(class_name);
|
||||
a = create(world,cls,symbol);
|
||||
a.name = cfg.optString(JSON_NAME, symbol);
|
||||
a.description = cfg.optString(JSON_DESCRIPTION);
|
||||
a.decimals = cfg.optInt(JSON_DECIMALS);
|
||||
|
||||
}catch (JSONException ex){
|
||||
return null;
|
||||
} catch (ClassNotFoundException ex) {
|
||||
Logger.getLogger(AbstractAsset.class.getName()).log(Level.SEVERE, null, ex);
|
||||
return null;
|
||||
} catch (Exception ex) {
|
||||
Logger.getLogger(AbstractAsset.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getConfig() {
|
||||
JSONObject cfg = new JSONObject();
|
||||
cfg.put(AbstractAsset.JSON_ID,id.toString());
|
||||
cfg.put(AbstractAsset.JSON_CLASS, this.getClass().getName());
|
||||
cfg.put(AbstractAsset.JSON_SYMBOL, this.getSymbol());
|
||||
cfg.put(AbstractAsset.JSON_DECIMALS, this.getDecimals());
|
||||
cfg.put(AbstractAsset.JSON_NAME, this.getName());
|
||||
cfg.put(AbstractAsset.JSON_DESCRIPTION, this.getDescription());
|
||||
return cfg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putConfig(JSONObject cfg) {
|
||||
symbol = cfg.optString(AbstractAsset.JSON_SYMBOL);
|
||||
decimals = cfg.optInt(AbstractAsset.JSON_DECIMALS, AbstractAsset.DECIMALS_DEFAULT);
|
||||
name = cfg.optString(AbstractAsset.JSON_NAME, "");
|
||||
description = cfg.optString(AbstractAsset.JSON_DESCRIPTION);
|
||||
}
|
||||
|
||||
public JPanel getEditGui(){
|
||||
return null;
|
||||
}
|
||||
}
|
49
src/opensesim/Account.java
Normal file
49
src/opensesim/Account.java
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 7u83 <7u83@mail.ru>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package opensesim;
|
||||
|
||||
import opensesim.Exchange;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import opensesim.sesim.interfaces.Asset;
|
||||
import opensesim.sesim.interfaces.Trader;
|
||||
|
||||
/**
|
||||
* Class to hold account data of traders
|
||||
* @author 7u83 <7u83@mail.ru>
|
||||
*/
|
||||
public class Account {
|
||||
ConcurrentHashMap <Asset,Double> assets;
|
||||
|
||||
Trader owner;
|
||||
|
||||
Account(Exchange exchange){
|
||||
assets = new ConcurrentHashMap<>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
50
src/opensesim/DefaultFeeModel.java
Normal file
50
src/opensesim/DefaultFeeModel.java
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 7u83 <7u83@mail.ru>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package opensesim;
|
||||
|
||||
import opensesim.sesim.AssetPair;
|
||||
import opensesim.sesim.interfaces.FeeModel;
|
||||
import opensesim.util.AssetVol;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 7u83 <7u83@mail.ru>
|
||||
*/
|
||||
public class DefaultFeeModel implements FeeModel{
|
||||
|
||||
|
||||
public AssetVol xgetTakerFee(AssetPair pair) {
|
||||
double vol = 5;
|
||||
return new AssetVol(pair.getCurrency(),vol);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getTakerFee(double x) {
|
||||
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||
}
|
||||
|
||||
}
|
133
src/opensesim/Exchange.java
Normal file
133
src/opensesim/Exchange.java
Normal file
@ -0,0 +1,133 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 7u83 <7u83@mail.ru>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package opensesim;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
import opensesim.World;
|
||||
import opensesim.sesim.AssetPair;
|
||||
import opensesim.sesim.Order;
|
||||
import opensesim.sesim.interfaces.Configurable;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 7u83
|
||||
*/
|
||||
public class Exchange implements Configurable{
|
||||
|
||||
private World world;
|
||||
private String name;
|
||||
private String symbol;
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
//private final HashMap<String, AssetPair> asset_pairs;
|
||||
|
||||
private final HashMap<AssetPair,TradingEnv> asset_pairs;
|
||||
|
||||
Exchange(World world, String symbol) {
|
||||
asset_pairs = new HashMap<>();
|
||||
this.world = world;
|
||||
this.symbol=symbol;
|
||||
}
|
||||
|
||||
private void reset() {
|
||||
asset_pairs.clear();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getSymbol(){
|
||||
return symbol;
|
||||
}
|
||||
|
||||
Account createAccount() {
|
||||
Account a = new Account(this);
|
||||
return a;
|
||||
}
|
||||
|
||||
public Order createOrder(Account account, AssetPair pair, Order.Type type, double volume, double limit) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Collection getOrderBook(AssetPair a){
|
||||
TradingEnv e = asset_pairs.get(a);
|
||||
SortedSet<Order> ob = e.order_books.get(Order.Type.BUYLIMIT);
|
||||
return Collections.unmodifiableCollection(ob);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getConfig() {
|
||||
JSONObject cfg = new JSONObject();
|
||||
cfg.put("symbol", getSymbol());
|
||||
cfg.put("name", getName());
|
||||
return cfg;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putConfig(JSONObject cfg) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
class TradingEnv {
|
||||
|
||||
protected HashMap<Order.Type, SortedSet<Order>> order_books;
|
||||
|
||||
TradingEnv() {
|
||||
reset();
|
||||
}
|
||||
|
||||
public final void reset() {
|
||||
order_books = new HashMap();
|
||||
|
||||
// Create an order book for each order type
|
||||
for (Order.Type type : Order.Type.values()) {
|
||||
order_books.put(type, new TreeSet<>());
|
||||
}
|
||||
|
||||
// quoteHistory = new TreeSet();
|
||||
// ohlc_data = new HashMap();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// public void add
|
||||
|
||||
}
|
145
src/opensesim/World.java
Normal file
145
src/opensesim/World.java
Normal file
@ -0,0 +1,145 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 7u83 <7u83@mail.ru>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package opensesim;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import opensesim.sesim.AssetPair;
|
||||
import opensesim.sesim.interfaces.Configurable;
|
||||
import opensesim.util.IDGenerator;
|
||||
import opensesim.util.IDGenerator.Id;
|
||||
import opensesim.util.SeSimException;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 7u83 <7u83@mail.ru>
|
||||
*/
|
||||
public class World implements Configurable {
|
||||
|
||||
HashMap<Id, AbstractAsset> assetsById = new HashMap<>();
|
||||
HashMap<String, AbstractAsset> assetsBySymbol = new HashMap<>();
|
||||
IDGenerator assetIdGenerator = new IDGenerator();
|
||||
|
||||
HashSet<AssetPair> assetPairs = new HashSet<>();
|
||||
|
||||
ArrayList<Exchange> exchanges = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Create a World object.
|
||||
*/
|
||||
public World() {
|
||||
|
||||
}
|
||||
|
||||
public Collection<AbstractAsset> getAssetCollection() {
|
||||
return Collections.unmodifiableCollection(assetsById.values());
|
||||
}
|
||||
|
||||
public Collection<AssetPair> getAssetPairsCollection() {
|
||||
return Collections.unmodifiableCollection(assetPairs);
|
||||
}
|
||||
|
||||
public Collection<Exchange> getExchangeCollection() {
|
||||
return Collections.unmodifiableCollection(exchanges);
|
||||
}
|
||||
|
||||
public void add(AssetPair pair) {
|
||||
assetPairs.add(pair);
|
||||
}
|
||||
|
||||
public Exchange addExchange(String symbol) throws SeSimException {
|
||||
for (Exchange ex : getExchangeCollection()) {
|
||||
if (ex.getSymbol().equals(symbol)) {
|
||||
throw (new SeSimException("Exchange already defined."));
|
||||
}
|
||||
}
|
||||
|
||||
Exchange ex = new Exchange(this, symbol);
|
||||
exchanges.add(ex);
|
||||
return ex;
|
||||
}
|
||||
|
||||
static final String JSON_ASSET = "asset";
|
||||
static final String JSON_EXCHANGES = "exchanges";
|
||||
|
||||
@Override
|
||||
public JSONObject getConfig() {
|
||||
JSONObject cfg = new JSONObject();
|
||||
|
||||
// save assets
|
||||
JSONArray arr;
|
||||
arr = new JSONArray();
|
||||
for (AbstractAsset a : getAssetCollection()) {
|
||||
arr.put(a.getConfig());
|
||||
}
|
||||
cfg.put(JSON_ASSET, arr);
|
||||
|
||||
// save exchanges
|
||||
arr = new JSONArray();
|
||||
for (Exchange ex : getExchangeCollection()) {
|
||||
arr.put(ex.getConfig());
|
||||
}
|
||||
cfg.put(JSON_EXCHANGES, arr);
|
||||
|
||||
return cfg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putConfig(JSONObject cfg) {
|
||||
JSONArray arr = cfg.optJSONArray(JSON_ASSET);
|
||||
if (arr == null) {
|
||||
arr = new JSONArray();
|
||||
}
|
||||
for (Object o : arr) {
|
||||
JSONObject acfg = (JSONObject) o;
|
||||
AbstractAsset.create(this, acfg);
|
||||
}
|
||||
}
|
||||
|
||||
public AbstractAsset createAsset(Class cls, String symbol) throws Exception {
|
||||
return AbstractAsset.create(this, cls, symbol);
|
||||
}
|
||||
|
||||
/*
|
||||
static public JSONArray toJson() {
|
||||
|
||||
JSONArray all = new JSONArray();
|
||||
for (Map.Entry<Id, Asset> entry : assetsById.entrySet()) {
|
||||
Id key = entry.getKey();
|
||||
Asset value = entry.getValue();
|
||||
all.put(value.getConfig());
|
||||
|
||||
}
|
||||
|
||||
return all;
|
||||
}
|
||||
*/
|
||||
}
|
@ -4,19 +4,19 @@
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package chart;
|
||||
package opensesim.chart;
|
||||
|
||||
import sesim.OHLCDataItem;
|
||||
import sesim.OHLCData;
|
||||
import opensesim.old_sesim.OHLCDataItem;
|
||||
import opensesim.old_sesim.OHLCData;
|
||||
import java.awt.*;
|
||||
import sesim.Exchange.*;
|
||||
import sesim.Quote;
|
||||
import gui.Globals;
|
||||
import opensesim.old_sesim.Exchange.*;
|
||||
import opensesim.old_sesim.Quote;
|
||||
import opensesim.gui.Globals;
|
||||
import java.util.ArrayList;
|
||||
import javax.swing.JViewport;
|
||||
import javax.swing.Scrollable;
|
||||
import sesim.MinMax;
|
||||
import sesim.Scheduler;
|
||||
import opensesim.old_sesim.MinMax;
|
||||
import opensesim.old_sesim.Scheduler;
|
||||
|
||||
|
||||
|
@ -25,10 +25,10 @@
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<EmptySpace min="0" pref="400" max="32767" attributes="0"/>
|
||||
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace pref="153" max="32767" attributes="0"/>
|
||||
<Component id="jButton1" min="-2" pref="123" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="124" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
@ -37,10 +37,10 @@
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<EmptySpace min="0" pref="300" max="32767" attributes="0"/>
|
||||
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace pref="137" max="32767" attributes="0"/>
|
||||
<Component id="jButton1" min="-2" pref="49" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="114" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
@ -23,7 +23,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package chart;
|
||||
package opensesim.chart;
|
||||
import java.net.URL;
|
||||
import java.util.Locale;
|
||||
import javax.help.*;
|
||||
@ -71,19 +71,19 @@ public class Help extends javax.swing.JDialog {
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 400, Short.MAX_VALUE)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(0, 0, Short.MAX_VALUE)
|
||||
.addComponent(jButton1)
|
||||
.addGap(0, 0, Short.MAX_VALUE)))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addContainerGap(153, Short.MAX_VALUE)
|
||||
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(124, Short.MAX_VALUE)))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 300, Short.MAX_VALUE)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(0, 0, Short.MAX_VALUE)
|
||||
.addComponent(jButton1)
|
||||
.addGap(0, 0, Short.MAX_VALUE)))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addContainerGap(137, Short.MAX_VALUE)
|
||||
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(114, Short.MAX_VALUE)))
|
||||
);
|
||||
|
||||
pack();
|
@ -23,7 +23,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package chart;
|
||||
package opensesim.chart;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.border.Border;
|
@ -23,15 +23,15 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package chart;
|
||||
package opensesim.chart;
|
||||
|
||||
import chart.painter.ChartCrossPainter;
|
||||
import chart.painter.ChartPainter;
|
||||
import chart.painter.OHLCChartPainter;
|
||||
import chart.painter.XLegendDetail;
|
||||
import chart.painter.XLegendPainter;
|
||||
import chart.painter.YLegendPainter;
|
||||
import gui.Globals;
|
||||
import opensesim.chart.painter.ChartCrossPainter;
|
||||
import opensesim.chart.painter.ChartPainter;
|
||||
import opensesim.chart.painter.OHLCChartPainter;
|
||||
import opensesim.chart.painter.XLegendDetail;
|
||||
import opensesim.chart.painter.XLegendPainter;
|
||||
import opensesim.chart.painter.YLegendPainter;
|
||||
import opensesim.gui.Globals;
|
||||
import java.awt.Color;
|
||||
import java.awt.Cursor;
|
||||
import java.awt.Dimension;
|
||||
@ -42,10 +42,10 @@ import java.awt.event.MouseListener;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.border.Border;
|
||||
import sesim.ChartDef;
|
||||
import sesim.ChartPanel;
|
||||
import sesim.OHLCData;
|
||||
import sesim.Stock;
|
||||
import opensesim.old_sesim.ChartDef;
|
||||
import opensesim.old_sesim.ChartPanel;
|
||||
import opensesim.old_sesim.OHLCData;
|
||||
import opensesim.old_sesim.Stock;
|
||||
|
||||
/**
|
||||
*
|
@ -68,7 +68,7 @@
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="sesim.ChartPanel" name="chart">
|
||||
<Container class="old_sesim.ChartPanel" name="chart">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
|
||||
@ -96,7 +96,7 @@
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
</Container>
|
||||
<Container class="sesim.ChartPanel" name="yLegend">
|
||||
<Container class="old_sesim.ChartPanel" name="yLegend">
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
@ -111,7 +111,7 @@
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
</Container>
|
||||
<Container class="sesim.ChartPanel" name="xLegend">
|
||||
<Container class="old_sesim.ChartPanel" name="xLegend">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
|
@ -23,25 +23,25 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package chart;
|
||||
package opensesim.chart;
|
||||
|
||||
import sesim.ChartDef;
|
||||
import chart.painter.CandleStickChartPainter;
|
||||
import chart.painter.ChartPainter;
|
||||
import chart.painter.XLegendPainter;
|
||||
import chart.painter.ChartCrossPainter;
|
||||
import chart.painter.LineChartPainter;
|
||||
import chart.painter.OHLCChartPainter;
|
||||
import chart.painter.YLegendPainter;
|
||||
import gui.Globals;
|
||||
import opensesim.old_sesim.ChartDef;
|
||||
import opensesim.chart.painter.CandleStickChartPainter;
|
||||
import opensesim.chart.painter.ChartPainter;
|
||||
import opensesim.chart.painter.XLegendPainter;
|
||||
import opensesim.chart.painter.ChartCrossPainter;
|
||||
import opensesim.chart.painter.LineChartPainter;
|
||||
import opensesim.chart.painter.OHLCChartPainter;
|
||||
import opensesim.chart.painter.YLegendPainter;
|
||||
import opensesim.gui.Globals;
|
||||
import java.util.ArrayList;
|
||||
import sesim.Exchange.QuoteReceiver;
|
||||
import sesim.Indicator;
|
||||
import sesim.MinMax;
|
||||
import sesim.OHLCData;
|
||||
import sesim.OHLCDataItem;
|
||||
import sesim.Quote;
|
||||
import indicators.SMAIndicator;
|
||||
import opensesim.old_sesim.Exchange.QuoteReceiver;
|
||||
import opensesim.old_sesim.Indicator;
|
||||
import opensesim.old_sesim.MinMax;
|
||||
import opensesim.old_sesim.OHLCData;
|
||||
import opensesim.old_sesim.OHLCDataItem;
|
||||
import opensesim.old_sesim.Quote;
|
||||
import opensesim.indicators.SMAIndicator;
|
||||
import java.util.Objects;
|
||||
import javax.swing.ButtonGroup;
|
||||
import javax.swing.JRadioButtonMenuItem;
|
||||
@ -170,7 +170,7 @@ public class MasterChart extends javax.swing.JPanel implements QuoteReceiver {
|
||||
chart.setXSCrollBar(xScrollBar);
|
||||
chart.addChartPainter(new ChartCrossPainter());
|
||||
|
||||
sma1 = new indicators.SMAIndicator();
|
||||
sma1 = new opensesim.indicators.SMAIndicator();
|
||||
sma1.setParent(mydata);
|
||||
|
||||
JSONObject co;
|
||||
@ -183,7 +183,7 @@ public class MasterChart extends javax.swing.JPanel implements QuoteReceiver {
|
||||
|
||||
chart.addChartPainter(p);
|
||||
|
||||
sma2 = new indicators.SMAIndicator();
|
||||
sma2 = new opensesim.indicators.SMAIndicator();
|
||||
sma2.setParent(mydata);
|
||||
co = new JSONObject("{\"len\": 20}");
|
||||
sma2.putConfig(co);
|
||||
@ -213,9 +213,9 @@ public class MasterChart extends javax.swing.JPanel implements QuoteReceiver {
|
||||
ctxMenu = new javax.swing.JPopupMenu();
|
||||
jMenu1 = new javax.swing.JMenu();
|
||||
jMenuItem1 = new javax.swing.JMenuItem();
|
||||
chart = new sesim.ChartPanel();
|
||||
yLegend = new sesim.ChartPanel();
|
||||
xLegend = new sesim.ChartPanel();
|
||||
chart = new opensesim.old_sesim.ChartPanel();
|
||||
yLegend = new opensesim.old_sesim.ChartPanel();
|
||||
xLegend = new opensesim.old_sesim.ChartPanel();
|
||||
xScrollBar = new javax.swing.JScrollBar();
|
||||
|
||||
jMenu1.setText("jMenu1");
|
||||
@ -369,13 +369,13 @@ public class MasterChart extends javax.swing.JPanel implements QuoteReceiver {
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private sesim.ChartPanel chart;
|
||||
private opensesim.old_sesim.ChartPanel chart;
|
||||
private javax.swing.JPopupMenu ctxMenu;
|
||||
private javax.swing.JMenu jMenu1;
|
||||
private javax.swing.JMenuItem jMenuItem1;
|
||||
private sesim.ChartPanel xLegend;
|
||||
private opensesim.old_sesim.ChartPanel xLegend;
|
||||
private javax.swing.JScrollBar xScrollBar;
|
||||
private sesim.ChartPanel yLegend;
|
||||
private opensesim.old_sesim.ChartPanel yLegend;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
||||
@Override
|
@ -23,7 +23,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package chart;
|
||||
package opensesim.chart;
|
||||
|
||||
/**
|
||||
*
|
@ -23,7 +23,8 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package chart;
|
||||
package opensesim.chart;
|
||||
import opensesim.*;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -49,7 +50,7 @@ public class SuperDlg extends javax.swing.JDialog {
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
masterChart1 = new chart.MasterChart();
|
||||
masterChart1 = new opensesim.chart.MasterChart();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
|
||||
@ -115,6 +116,6 @@ public class SuperDlg extends javax.swing.JDialog {
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private chart.MasterChart masterChart1;
|
||||
private opensesim.chart.MasterChart masterChart1;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
@ -23,13 +23,13 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package chart.painter;
|
||||
package opensesim.chart.painter;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import javax.swing.JScrollBar;
|
||||
import sesim.OHLCData;
|
||||
import sesim.OHLCDataItem;
|
||||
import opensesim.old_sesim.OHLCData;
|
||||
import opensesim.old_sesim.OHLCDataItem;
|
||||
|
||||
/**
|
||||
*
|
@ -23,13 +23,13 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package chart.painter;
|
||||
package opensesim.chart.painter;
|
||||
|
||||
import sesim.ChartDef;
|
||||
import sesim.ChartPanel;
|
||||
import opensesim.old_sesim.ChartDef;
|
||||
import opensesim.old_sesim.ChartPanel;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Point;
|
||||
import sesim.OHLCDataItem;
|
||||
import opensesim.old_sesim.OHLCDataItem;
|
||||
|
||||
|
||||
/**
|
@ -23,15 +23,15 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package chart.painter;
|
||||
package opensesim.chart.painter;
|
||||
|
||||
import sesim.ChartDef;
|
||||
import sesim.ChartPanel;
|
||||
import opensesim.old_sesim.ChartDef;
|
||||
import opensesim.old_sesim.ChartPanel;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import sesim.ChartPainterInterface;
|
||||
import sesim.MinMax;
|
||||
import sesim.OHLCData;
|
||||
import opensesim.old_sesim.ChartPainterInterface;
|
||||
import opensesim.old_sesim.MinMax;
|
||||
import opensesim.old_sesim.OHLCData;
|
||||
|
||||
/**
|
||||
*
|
@ -23,11 +23,11 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package chart.painter;
|
||||
package opensesim.chart.painter;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import sesim.OHLCDataItem;
|
||||
import opensesim.old_sesim.OHLCDataItem;
|
||||
|
||||
/**
|
||||
*
|
@ -23,18 +23,18 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package chart.painter;
|
||||
package opensesim.chart.painter;
|
||||
|
||||
import sesim.ChartDef;
|
||||
import sesim.ChartPanel;
|
||||
import opensesim.old_sesim.ChartDef;
|
||||
import opensesim.old_sesim.ChartPanel;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollBar;
|
||||
import sesim.MinMax;
|
||||
import sesim.OHLCData;
|
||||
import sesim.OHLCDataItem;
|
||||
import opensesim.old_sesim.MinMax;
|
||||
import opensesim.old_sesim.OHLCData;
|
||||
import opensesim.old_sesim.OHLCDataItem;
|
||||
|
||||
/**
|
||||
*
|
@ -23,14 +23,14 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package chart.painter;
|
||||
package opensesim.chart.painter;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Point;
|
||||
import sesim.ChartDef;
|
||||
import sesim.ChartPanel;
|
||||
import sesim.Scheduler;
|
||||
import opensesim.old_sesim.ChartDef;
|
||||
import opensesim.old_sesim.ChartPanel;
|
||||
import opensesim.old_sesim.Scheduler;
|
||||
|
||||
/**
|
||||
*
|
@ -23,14 +23,14 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package chart.painter;
|
||||
package opensesim.chart.painter;
|
||||
|
||||
import sesim.ChartDef;
|
||||
import sesim.ChartPanel;
|
||||
import opensesim.old_sesim.ChartDef;
|
||||
import opensesim.old_sesim.ChartPanel;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import sesim.OHLCData;
|
||||
import sesim.OHLCDataItem;
|
||||
import opensesim.old_sesim.OHLCData;
|
||||
import opensesim.old_sesim.OHLCDataItem;
|
||||
|
||||
/**
|
||||
* Paints an x-legend for OHLC charts
|
||||
@ -42,7 +42,7 @@ public class XLegendPainter extends OHLCChartPainter {
|
||||
private String getTimeStrAt(OHLCData data, int unit) {
|
||||
|
||||
int fs = data.getFrameSize();
|
||||
return sesim.Scheduler.formatTimeMillis(0 + (long) unit * (long) fs);
|
||||
return opensesim.old_sesim.Scheduler.formatTimeMillis(0 + (long) unit * (long) fs);
|
||||
|
||||
}
|
||||
|
@ -23,18 +23,18 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package chart.painter;
|
||||
package opensesim.chart.painter;
|
||||
|
||||
import chart.Chart;
|
||||
import opensesim.chart.Chart;
|
||||
import java.awt.Color;
|
||||
import sesim.ChartDef;
|
||||
import sesim.ChartPanel;
|
||||
import opensesim.old_sesim.ChartDef;
|
||||
import opensesim.old_sesim.ChartPanel;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Rectangle;
|
||||
import sesim.MinMax;
|
||||
import sesim.OHLCData;
|
||||
import sesim.OHLCDataItem;
|
||||
import opensesim.old_sesim.MinMax;
|
||||
import opensesim.old_sesim.OHLCData;
|
||||
import opensesim.old_sesim.OHLCDataItem;
|
||||
|
||||
/**
|
||||
*
|
@ -23,11 +23,11 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package gui;
|
||||
package opensesim.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import sesim.Order.OrderType;
|
||||
import sesim.Order;
|
||||
import opensesim.old_sesim.Order.OrderType;
|
||||
import opensesim.old_sesim.Order;
|
||||
|
||||
|
||||
/**
|
77
src/opensesim/gui/AssetEditor/AssetEditorDialog.form
Normal file
77
src/opensesim/gui/AssetEditor/AssetEditorDialog.form
Normal file
@ -0,0 +1,77 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
|
||||
<Properties>
|
||||
<Property name="defaultCloseOperation" type="int" value="2"/>
|
||||
<Property name="modal" type="boolean" value="true"/>
|
||||
</Properties>
|
||||
<SyntheticProperties>
|
||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
||||
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
|
||||
</SyntheticProperties>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<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="1"/>
|
||||
<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" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
<Component id="okButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="cancelButton" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="assetEditorPanel" alignment="0" pref="527" max="32767" attributes="0"/>
|
||||
</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="assetEditorPanel" pref="138" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="cancelButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="okButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JButton" name="cancelButton">
|
||||
<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="cancelButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="okButton">
|
||||
<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="okButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="opensesim.gui.AssetEditor.AssetEditorPanel" name="assetEditorPanel">
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
284
src/opensesim/gui/AssetEditor/AssetEditorDialog.java
Normal file
284
src/opensesim/gui/AssetEditor/AssetEditorDialog.java
Normal file
@ -0,0 +1,284 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 7u83 <7u83@mail.ru>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package opensesim.gui.AssetEditor;
|
||||
|
||||
import java.awt.Dialog;
|
||||
|
||||
import javax.swing.InputVerifier;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JTextField;
|
||||
import opensesim.AbstractAsset;
|
||||
import opensesim.World;
|
||||
import opensesim.gui.EscDialog;
|
||||
import opensesim.gui.Globals;
|
||||
import opensesim.sesim.Assets.BasicAsset;
|
||||
import opensesim.util.IDGenerator.Id;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 7u83 <7u83@mail.ru>
|
||||
*/
|
||||
public class AssetEditorDialog extends EscDialog {
|
||||
|
||||
AbstractAsset asset;
|
||||
World world;
|
||||
|
||||
/**
|
||||
* Creates new form CreateAssetDialog
|
||||
*/
|
||||
public AssetEditorDialog(Dialog parent, AbstractAsset asset) {
|
||||
super(parent, true);
|
||||
initComponents();
|
||||
world = Globals.world;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
cancelButton = new javax.swing.JButton();
|
||||
okButton = new javax.swing.JButton();
|
||||
assetEditorPanel = new opensesim.gui.AssetEditor.AssetEditorPanel();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
setModal(true);
|
||||
|
||||
cancelButton.setText("Cancel");
|
||||
cancelButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
cancelButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
okButton.setText("Ok");
|
||||
okButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
okButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addGap(0, 0, Short.MAX_VALUE)
|
||||
.addComponent(okButton)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(cancelButton))
|
||||
.addComponent(assetEditorPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 527, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(assetEditorPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 138, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(cancelButton)
|
||||
.addComponent(okButton))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private Id newId = null;
|
||||
|
||||
public Id getCreatedId() {
|
||||
return newId;
|
||||
}
|
||||
|
||||
private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
|
||||
|
||||
if (this.asset == null) {
|
||||
try {
|
||||
int selected = this.assetEditorPanel.assetTypesComboBox.getSelectedIndex();
|
||||
Class<AbstractAsset> cls = (Class<AbstractAsset>) this.assetEditorPanel.asset_types.get(selected);
|
||||
asset = AbstractAsset.create(world, cls, assetEditorPanel.symField.getText());
|
||||
|
||||
|
||||
//new BasicAsset(assetEditor.symField.getText());
|
||||
// newId = BasicAsset.newAssed(asset);
|
||||
} catch (Exception ex) {
|
||||
javax.swing.JOptionPane.showMessageDialog(this, ex.getMessage(),
|
||||
"Error",
|
||||
javax.swing.JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/*else {
|
||||
if (!this.asset.getSymbol().equals(assetEditor.symField.getText())) {
|
||||
try {
|
||||
BasicAsset.rename(asset, assetEditor.symField.getText());
|
||||
|
||||
} catch (Exception ex) {
|
||||
javax.swing.JOptionPane.showMessageDialog(this, ex.getMessage(),
|
||||
"Error",
|
||||
javax.swing.JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
}*/
|
||||
asset.setName(assetEditorPanel.nameField.getText());
|
||||
asset.setDecimals((int) assetEditorPanel.decimalsField.getValue());
|
||||
|
||||
JSONObject cfg = world.getConfig();
|
||||
|
||||
try {
|
||||
String jstr = cfg.toString(5);
|
||||
} catch (JSONException ex) {
|
||||
System.out.println(ex.getMessage());
|
||||
}
|
||||
System.out.printf("JSONARRAY %s\n", cfg.toString(3));
|
||||
JSONObject world_cfg = Globals.world.getConfig();
|
||||
Globals.prefs.put("world", world_cfg.toString());
|
||||
dispose();
|
||||
|
||||
}//GEN-LAST:event_okButtonActionPerformed
|
||||
|
||||
private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
|
||||
// TODO add your handling code here:
|
||||
dispose();
|
||||
|
||||
}//GEN-LAST:event_cancelButtonActionPerformed
|
||||
|
||||
static public Id runDialog(Dialog parent, AbstractAsset asset) {
|
||||
AssetEditorDialog dialog = new AssetEditorDialog(parent, asset);
|
||||
dialog.assetEditorPanel.initFields(asset);
|
||||
|
||||
dialog.assetEditorPanel.dialog = dialog;
|
||||
dialog.setLocationRelativeTo(parent);
|
||||
dialog.setVisible(true);
|
||||
|
||||
return dialog.newId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
public static void main(String args[]) {
|
||||
/* Set the Nimbus look and feel */
|
||||
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
|
||||
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
|
||||
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
|
||||
*/
|
||||
try {
|
||||
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
|
||||
if ("Nimbus".equals(info.getName())) {
|
||||
javax.swing.UIManager.setLookAndFeel(info.getClassName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (ClassNotFoundException ex) {
|
||||
java.util.logging.Logger.getLogger(AssetEditorDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (InstantiationException ex) {
|
||||
java.util.logging.Logger.getLogger(AssetEditorDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (IllegalAccessException ex) {
|
||||
java.util.logging.Logger.getLogger(AssetEditorDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
|
||||
java.util.logging.Logger.getLogger(AssetEditorDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/* Create and display the dialog */
|
||||
/* java.awt.EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
CreateAssetDialog dialog = new CreateAssetDialog(new javax.swing.JFrame(), true);
|
||||
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(java.awt.event.WindowEvent e) {
|
||||
System.exit(0);
|
||||
}
|
||||
});
|
||||
dialog.setVisible(true);
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/* Create and display the dialog */
|
||||
/* java.awt.EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
CreateAssetDialog dialog = new CreateAssetDialog(new javax.swing.JFrame(), true);
|
||||
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(java.awt.event.WindowEvent e) {
|
||||
System.exit(0);
|
||||
}
|
||||
});
|
||||
dialog.setVisible(true);
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/* Create and display the dialog */
|
||||
/* java.awt.EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
CreateAssetDialog dialog = new CreateAssetDialog(new javax.swing.JFrame(), true);
|
||||
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(java.awt.event.WindowEvent e) {
|
||||
System.exit(0);
|
||||
}
|
||||
});
|
||||
dialog.setVisible(true);
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/* Create and display the dialog */
|
||||
/* java.awt.EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
CreateAssetDialog dialog = new CreateAssetDialog(new javax.swing.JFrame(), true);
|
||||
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(java.awt.event.WindowEvent e) {
|
||||
System.exit(0);
|
||||
}
|
||||
});
|
||||
dialog.setVisible(true);
|
||||
}
|
||||
});*/
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private opensesim.gui.AssetEditor.AssetEditorPanel assetEditorPanel;
|
||||
private javax.swing.JButton cancelButton;
|
||||
private javax.swing.JButton okButton;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
186
src/opensesim/gui/AssetEditor/AssetEditorPanel.form
Normal file
186
src/opensesim/gui/AssetEditor/AssetEditorPanel.form
Normal file
@ -0,0 +1,186 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<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="1"/>
|
||||
<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"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="guiPanel" max="32767" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
||||
<Component id="jLabel3" max="32767" attributes="0"/>
|
||||
<Component id="jLabel1" pref="67" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="12" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="symField" min="-2" pref="125" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="assetTypesComboBox" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="nameField" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="jLabel4" min="-2" pref="67" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="decimalsField" min="-2" pref="55" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="32767" 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="assetTypesComboBox" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel2" alignment="3" min="-2" pref="21" max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="symField" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="nameField" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="decimalsField" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="guiPanel" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Symbol:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JComboBox" name="assetTypesComboBox">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||
<Connection code="getComboBoxModel()" type="code"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="assetTypesComboBoxActionPerformed"/>
|
||||
</Events>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/>
|
||||
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Type:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="opensesim.gui.util.JTextFieldLimit" name="symField">
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="4"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel3">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Name:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="opensesim.gui.util.JTextFieldLimit" name="nameField">
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="4"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel4">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Decimals:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JSpinner" name="decimalsField">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
|
||||
<SpinnerModel initial="0" maximum="8" minimum="0" numberType="java.lang.Integer" stepSize="1" type="number"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="guiPanel">
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="defaultGuiPanel">
|
||||
<Properties>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[360, 25]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
|
||||
<BorderConstraints direction="Center"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<EmptySpace min="0" pref="360" max="32767" attributes="0"/>
|
||||
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="0" pref="148" max="32767" attributes="0"/>
|
||||
<Component id="label" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="149" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<EmptySpace min="0" pref="25" max="32767" attributes="0"/>
|
||||
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="0" pref="5" max="32767" attributes="0"/>
|
||||
<Component id="label" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="5" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="label">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="no config"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
292
src/opensesim/gui/AssetEditor/AssetEditorPanel.java
Normal file
292
src/opensesim/gui/AssetEditor/AssetEditorPanel.java
Normal file
@ -0,0 +1,292 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 7u83 <7u83@mail.ru>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package opensesim.gui.AssetEditor;
|
||||
|
||||
import java.awt.Dialog;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.EventQueue;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Vector;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.ComboBoxModel;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JPanel;
|
||||
import opensesim.AbstractAsset;
|
||||
import opensesim.gui.Globals;
|
||||
import opensesim.sesim.interfaces.Asset;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 7u83 <7u83@mail.ru>
|
||||
*/
|
||||
public class AssetEditorPanel extends javax.swing.JPanel {
|
||||
|
||||
/**
|
||||
* Creates new form AssetEditor
|
||||
*/
|
||||
public AssetEditorPanel() {
|
||||
super();
|
||||
asset_types = Globals.getAvailableAssetsTypes();
|
||||
initComponents();
|
||||
symField.setLimit(Globals.MAX.SYMLEN);
|
||||
nameField.setLimit(Globals.MAX.NAMELEN);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void initFields(AbstractAsset asset){
|
||||
if(asset==null)
|
||||
return;
|
||||
|
||||
symField.setText(asset.getSymbol());
|
||||
nameField.setText(asset.getName());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public JDialog dialog;
|
||||
|
||||
ArrayList<Class<AbstractAsset>> asset_types;
|
||||
|
||||
ComboBoxModel getComboBoxModel() {
|
||||
ArrayList vector = new ArrayList();
|
||||
|
||||
// in case asset types are not initialized return a demo
|
||||
// combo box, so it will be displaeyd in NetBens designer
|
||||
if (asset_types == null) {
|
||||
vector.add(0, "Currency");
|
||||
vector.add(1, "Stock");
|
||||
|
||||
return new DefaultComboBoxModel(vector.toArray());
|
||||
}
|
||||
|
||||
int i;
|
||||
|
||||
for (i = 0; i < asset_types.size(); i++) {
|
||||
AbstractAsset ait;
|
||||
Class<?> asset_type = asset_types.get(i);
|
||||
try {
|
||||
|
||||
ait = (AbstractAsset) asset_type.newInstance();
|
||||
vector.add(i, ait.getTypeName());
|
||||
// assetTypesComboBox.addItem(ait.getTypeName());
|
||||
|
||||
} catch (InstantiationException | IllegalAccessException | ClassCastException ex) {
|
||||
Logger.getLogger(AssetEditorPanel.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return new DefaultComboBoxModel(vector.toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
assetTypesComboBox = new javax.swing.JComboBox<>();
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
symField = new opensesim.gui.util.JTextFieldLimit();
|
||||
jLabel3 = new javax.swing.JLabel();
|
||||
nameField = new opensesim.gui.util.JTextFieldLimit();
|
||||
jLabel4 = new javax.swing.JLabel();
|
||||
decimalsField = new javax.swing.JSpinner();
|
||||
guiPanel = new javax.swing.JPanel();
|
||||
defaultGuiPanel = new javax.swing.JPanel();
|
||||
label = new javax.swing.JLabel();
|
||||
|
||||
jLabel1.setText("Symbol:");
|
||||
|
||||
assetTypesComboBox.setModel(getComboBoxModel());
|
||||
assetTypesComboBox.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
assetTypesComboBoxActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jLabel2.setText("Type:");
|
||||
|
||||
jLabel3.setText("Name:");
|
||||
|
||||
jLabel4.setText("Decimals:");
|
||||
|
||||
decimalsField.setModel(new javax.swing.SpinnerNumberModel(0, 0, 8, 1));
|
||||
|
||||
guiPanel.setLayout(new java.awt.BorderLayout());
|
||||
|
||||
defaultGuiPanel.setMinimumSize(new java.awt.Dimension(360, 25));
|
||||
|
||||
label.setText("no config");
|
||||
|
||||
javax.swing.GroupLayout defaultGuiPanelLayout = new javax.swing.GroupLayout(defaultGuiPanel);
|
||||
defaultGuiPanel.setLayout(defaultGuiPanelLayout);
|
||||
defaultGuiPanelLayout.setHorizontalGroup(
|
||||
defaultGuiPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 360, Short.MAX_VALUE)
|
||||
.addGroup(defaultGuiPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(defaultGuiPanelLayout.createSequentialGroup()
|
||||
.addGap(0, 148, Short.MAX_VALUE)
|
||||
.addComponent(label)
|
||||
.addGap(0, 149, Short.MAX_VALUE)))
|
||||
);
|
||||
defaultGuiPanelLayout.setVerticalGroup(
|
||||
defaultGuiPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 25, Short.MAX_VALUE)
|
||||
.addGroup(defaultGuiPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(defaultGuiPanelLayout.createSequentialGroup()
|
||||
.addGap(0, 5, Short.MAX_VALUE)
|
||||
.addComponent(label)
|
||||
.addGap(0, 5, Short.MAX_VALUE)))
|
||||
);
|
||||
|
||||
guiPanel.add(defaultGuiPanel, java.awt.BorderLayout.CENTER);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(guiPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
||||
.addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 67, Short.MAX_VALUE))
|
||||
.addGap(12, 12, 12)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(symField, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jLabel2)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(assetTypesComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addComponent(nameField, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(decimalsField, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 0, Short.MAX_VALUE)))
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(assetTypesComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel1)
|
||||
.addComponent(symField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(nameField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel3))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jLabel4)
|
||||
.addComponent(decimalsField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(guiPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addContainerGap())
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void assetTypesComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_assetTypesComboBoxActionPerformed
|
||||
|
||||
int i = this.assetTypesComboBox.getSelectedIndex();
|
||||
AbstractAsset a;
|
||||
try {
|
||||
a = (AbstractAsset) asset_types.get(i).newInstance();
|
||||
} catch (InstantiationException | IllegalAccessException ex) {
|
||||
Logger.getLogger(AssetEditorPanel.class.getName()).log(Level.SEVERE, null, ex);
|
||||
return;
|
||||
}
|
||||
|
||||
JPanel gui = a.getEditGui();
|
||||
|
||||
guiPanel.removeAll();
|
||||
if (gui != null) {
|
||||
|
||||
guiPanel.add(gui, java.awt.BorderLayout.CENTER);
|
||||
gui.setVisible(true);
|
||||
|
||||
} else {
|
||||
guiPanel.add(defaultGuiPanel, java.awt.BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
//dialog.setPreferredSize(new Dimension(200,200));
|
||||
|
||||
dialog.pack();
|
||||
dialog.revalidate();
|
||||
|
||||
|
||||
// dialog.validate();
|
||||
|
||||
//validate();
|
||||
//this.getParent().getW;
|
||||
//((Dialog)(this.dialog)).getS
|
||||
|
||||
|
||||
/* this.getParent().validate();
|
||||
this.getParent().repaint();
|
||||
(this.getParent().getParent()).repaint();
|
||||
this.dialog.pack();
|
||||
this.dialog.validate();
|
||||
this.dialog.repaint();
|
||||
Dimension rrr = this.dialog.getContentPane().getSize();
|
||||
this.dialog.resize(rrr);
|
||||
*/
|
||||
|
||||
// dialog.pack();
|
||||
System.out.printf("Action performed on combobox %d %s\n", i, a.getTypeName());
|
||||
|
||||
}//GEN-LAST:event_assetTypesComboBoxActionPerformed
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
public javax.swing.JComboBox<String> assetTypesComboBox;
|
||||
public javax.swing.JSpinner decimalsField;
|
||||
private javax.swing.JPanel defaultGuiPanel;
|
||||
private javax.swing.JPanel guiPanel;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JLabel jLabel3;
|
||||
private javax.swing.JLabel jLabel4;
|
||||
private javax.swing.JLabel label;
|
||||
protected opensesim.gui.util.JTextFieldLimit nameField;
|
||||
protected opensesim.gui.util.JTextFieldLimit symField;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
100
src/opensesim/gui/AssetEditor/AssetListDialog.form
Normal file
100
src/opensesim/gui/AssetEditor/AssetListDialog.form
Normal file
@ -0,0 +1,100 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
|
||||
<Properties>
|
||||
<Property name="defaultCloseOperation" type="int" value="2"/>
|
||||
<Property name="title" type="java.lang.String" value="Edit Assets"/>
|
||||
<Property name="modal" type="boolean" value="true"/>
|
||||
</Properties>
|
||||
<SyntheticProperties>
|
||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
||||
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
|
||||
</SyntheticProperties>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<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="1"/>
|
||||
<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" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="0" pref="250" max="32767" attributes="0"/>
|
||||
<Component id="jButton3" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="editButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="newButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="assetListPanel1" max="32767" 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="assetListPanel1" pref="282" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="newButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jButton1" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jButton3" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="editButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JButton" name="jButton1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Done"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="newButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="New ..."/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Creates a new Asset"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="newButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="jButton3">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Delete"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="editButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Edit ..."/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="editButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="opensesim.gui.AssetEditor.AssetListPanel" name="assetListPanel1">
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
247
src/opensesim/gui/AssetEditor/AssetListDialog.java
Normal file
247
src/opensesim/gui/AssetEditor/AssetListDialog.java
Normal file
@ -0,0 +1,247 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 7u83 <7u83@mail.ru>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package opensesim.gui.AssetEditor;
|
||||
|
||||
import com.sun.rowset.internal.Row;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Window;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.SwingUtilities;
|
||||
import opensesim.gui.EscDialog;
|
||||
import opensesim.sesim.Assets.BasicAsset;
|
||||
import opensesim.util.IDGenerator.Id;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 7u83 <7u83@mail.ru>
|
||||
*/
|
||||
public class AssetListDialog extends EscDialog {
|
||||
|
||||
/**
|
||||
* Creates new form EditAssetsDialog
|
||||
*/
|
||||
public AssetListDialog(java.awt.Frame parent, boolean modal) {
|
||||
super(parent, modal);
|
||||
initComponents();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
jButton1 = new javax.swing.JButton();
|
||||
newButton = new javax.swing.JButton();
|
||||
jButton3 = new javax.swing.JButton();
|
||||
editButton = new javax.swing.JButton();
|
||||
assetListPanel1 = new opensesim.gui.AssetEditor.AssetListPanel();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
setTitle("Edit Assets");
|
||||
setModal(true);
|
||||
|
||||
jButton1.setText("Done");
|
||||
jButton1.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jButton1ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
newButton.setText("New ...");
|
||||
newButton.setToolTipText("Creates a new Asset");
|
||||
newButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
newButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jButton3.setText("Delete");
|
||||
|
||||
editButton.setText("Edit ...");
|
||||
editButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
editButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(0, 250, Short.MAX_VALUE)
|
||||
.addComponent(jButton3)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(editButton)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(newButton)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jButton1))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(assetListPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(assetListPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 282, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(newButton)
|
||||
.addComponent(jButton1)
|
||||
.addComponent(jButton3)
|
||||
.addComponent(editButton))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void newButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newButtonActionPerformed
|
||||
|
||||
AssetEditorDialog.runDialog(this, null);
|
||||
this.assetListPanel1.reload();
|
||||
/* javax.swing.JOptionPane.showMessageDialog(this, "Hello", "Error",
|
||||
javax.swing.JOptionPane.ERROR_MESSAGE);*/
|
||||
/* Id id = AssteEditorDialog.runDialog(this, null);
|
||||
if (id != null) {
|
||||
assetList1.addAsset(id);
|
||||
}
|
||||
*/ this.repaint();
|
||||
// JFrame frame = (JFrame) SwingUtilities.getWindowAncestor(this);
|
||||
|
||||
/*
|
||||
// CreateAssetDialog dlg = new CreateAssetDialog();
|
||||
CreateAssetDialog.runDialog(this);
|
||||
|
||||
javax.swing.JOptionPane.showMessageDialog(this, "Hello", "Error",
|
||||
javax.swing.JOptionPane.ERROR_MESSAGE);
|
||||
|
||||
frame = (JFrame) SwingUtilities.getAncestorOfClass(Frame.class, this);
|
||||
dialog = new CreateAssetDialog(frame, false);
|
||||
dialog.setModal(true);
|
||||
this.setModal(true);
|
||||
this.setModalityType(ModalityType.DOCUMENT_MODAL);
|
||||
// addPropertyChangeListener(new ValuePropertyHandler(dialog));
|
||||
|
||||
//dialog.setAlwaysOnTop(true);
|
||||
//this.setVisible(false);
|
||||
dialog.setLocationRelativeTo(this);
|
||||
dialog.setModalityType(ModalityType.DOCUMENT_MODAL);
|
||||
dialog.setModal(true);
|
||||
// dialog.setVisible(true);
|
||||
dialog.show();
|
||||
|
||||
Id id = dialog.getCreatedId();
|
||||
this.setModal(true);
|
||||
this.setVisible(true);
|
||||
|
||||
dialog.dispose();
|
||||
if (id != null) {
|
||||
assetList1.addAsset(id);
|
||||
}
|
||||
this.repaint();
|
||||
*/
|
||||
}//GEN-LAST:event_newButtonActionPerformed
|
||||
|
||||
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
|
||||
dispose();
|
||||
}//GEN-LAST:event_jButton1ActionPerformed
|
||||
|
||||
private void editButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editButtonActionPerformed
|
||||
|
||||
// int row = assetList1.assetList.getSelectedRow();
|
||||
// Id selId = (Id)assetList1.assetList.getValueAt(row, 0);
|
||||
/*
|
||||
BasicAsset a = BasicAsset.getAsset(selId);
|
||||
Id id = AssteEditorDialog.runDialog(this, a);
|
||||
if (id != null) {
|
||||
// assetList1.addAsset(id);
|
||||
}
|
||||
this.assetList1.reload();
|
||||
this.repaint();
|
||||
*/
|
||||
}//GEN-LAST:event_editButtonActionPerformed
|
||||
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
public static void main(String args[]) {
|
||||
/* Set the Nimbus look and feel */
|
||||
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
|
||||
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
|
||||
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
|
||||
*/
|
||||
try {
|
||||
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
|
||||
if ("Nimbus".equals(info.getName())) {
|
||||
javax.swing.UIManager.setLookAndFeel(info.getClassName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (ClassNotFoundException ex) {
|
||||
java.util.logging.Logger.getLogger(AssetListDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (InstantiationException ex) {
|
||||
java.util.logging.Logger.getLogger(AssetListDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (IllegalAccessException ex) {
|
||||
java.util.logging.Logger.getLogger(AssetListDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
|
||||
java.util.logging.Logger.getLogger(AssetListDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
}
|
||||
//</editor-fold>
|
||||
//</editor-fold>
|
||||
|
||||
/* Create and display the dialog */
|
||||
java.awt.EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
AssetListDialog dialog = new AssetListDialog(new javax.swing.JFrame(), true);
|
||||
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(java.awt.event.WindowEvent e) {
|
||||
System.exit(0);
|
||||
}
|
||||
});
|
||||
dialog.setVisible(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private opensesim.gui.AssetEditor.AssetListPanel assetListPanel1;
|
||||
private javax.swing.JButton editButton;
|
||||
private javax.swing.JButton jButton1;
|
||||
private javax.swing.JButton jButton3;
|
||||
private javax.swing.JButton newButton;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
58
src/opensesim/gui/AssetEditor/AssetListPanel.form
Normal file
58
src/opensesim/gui/AssetEditor/AssetListPanel.form
Normal file
@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.6" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<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="1"/>
|
||||
<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">
|
||||
<EmptySpace min="0" pref="548" max="32767" attributes="0"/>
|
||||
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
|
||||
<Component id="jScrollPane1" alignment="1" pref="548" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<EmptySpace min="0" pref="362" max="32767" attributes="0"/>
|
||||
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
|
||||
<Component id="jScrollPane1" alignment="0" pref="362" max="32767" attributes="0"/>
|
||||
</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.JTable" name="assetList">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||
<Connection code="getModel()" type="code"/>
|
||||
</Property>
|
||||
<Property name="selectionModel" type="javax.swing.ListSelectionModel" editor="org.netbeans.modules.form.editors2.JTableSelectionModelEditor">
|
||||
<JTableSelectionModel selectionMode="0"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
167
src/opensesim/gui/AssetEditor/AssetListPanel.java
Normal file
167
src/opensesim/gui/AssetEditor/AssetListPanel.java
Normal file
@ -0,0 +1,167 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 7u83 <7u83@mail.ru>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package opensesim.gui.AssetEditor;
|
||||
|
||||
import java.util.AbstractMap;
|
||||
import java.util.Map;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import javax.swing.table.TableModel;
|
||||
import opensesim.AbstractAsset;
|
||||
import opensesim.sesim.Assets.BasicAsset;
|
||||
import opensesim.World;
|
||||
import opensesim.gui.Globals;
|
||||
import opensesim.util.IDGenerator.Id;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 7u83 <7u83@mail.ru>
|
||||
*/
|
||||
public class AssetListPanel extends javax.swing.JPanel {
|
||||
|
||||
World world;
|
||||
|
||||
/**
|
||||
* Creates new form AssetList
|
||||
*/
|
||||
public AssetListPanel() {
|
||||
world = Globals.world;
|
||||
initComponents();
|
||||
reload();
|
||||
|
||||
assetList.setRowSelectionAllowed(true);
|
||||
assetList.getColumnModel().getColumn(0).setPreferredWidth(10);
|
||||
assetList.getColumnModel().getColumn(1).setPreferredWidth(30);
|
||||
assetList.getColumnModel().getColumn(2).setPreferredWidth(300);
|
||||
assetList.getColumnModel().getColumn(3).setPreferredWidth(30);
|
||||
}
|
||||
|
||||
final void reload() {
|
||||
DefaultTableModel m = (DefaultTableModel) assetList.getModel();
|
||||
/* m.setRowCount(0);
|
||||
Map assets = BasicAsset.getAssets();
|
||||
for (Object key : assets.keySet()) {
|
||||
addAsset((Id) key);
|
||||
}
|
||||
m.fireTableDataChanged();
|
||||
*/
|
||||
if (world == null) {
|
||||
return;
|
||||
}
|
||||
m.setRowCount(0);
|
||||
for (AbstractAsset a : world.getAssetCollection()) {
|
||||
m.addRow(new Object[]{
|
||||
a.getID(),
|
||||
a.getSymbol(),
|
||||
a.getName(),
|
||||
a.getTypeName()
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public TableModel getModel() {
|
||||
|
||||
class TModel extends DefaultTableModel {
|
||||
|
||||
private TModel(Object[] object, int i) {
|
||||
super(object, i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCellEditable(int row, int column) {
|
||||
//all cells false
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
DefaultTableModel model = new TModel(
|
||||
new Object[]{"ID", "Symbol", "Name", "Type"}, 0
|
||||
);
|
||||
|
||||
assetList.setAutoCreateRowSorter(true);
|
||||
assetList.getTableHeader().setReorderingAllowed(false);
|
||||
return model;
|
||||
|
||||
}
|
||||
|
||||
public void uppdate() {
|
||||
DefaultTableModel m;
|
||||
|
||||
m = (DefaultTableModel) this.assetList.getModel();
|
||||
m.fireTableDataChanged();
|
||||
|
||||
}
|
||||
|
||||
/* public void addAsset(Id id) {
|
||||
|
||||
BasicAsset a = (BasicAsset) BasicAsset.getAsset(id);
|
||||
DefaultTableModel m = (DefaultTableModel) this.assetList.getModel();
|
||||
m.addRow(new Object[]{
|
||||
a.getID(),
|
||||
a.getSymbol(),
|
||||
a.getName()});
|
||||
}
|
||||
*/
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
assetList = new javax.swing.JTable();
|
||||
|
||||
assetList.setModel(getModel());
|
||||
assetList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
|
||||
jScrollPane1.setViewportView(assetList);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 548, Short.MAX_VALUE)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 548, Short.MAX_VALUE))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 362, Short.MAX_VALUE)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 362, Short.MAX_VALUE))
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
public javax.swing.JTable assetList;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
47
src/opensesim/gui/AssetEditor/NewJPanel.form
Normal file
47
src/opensesim/gui/AssetEditor/NewJPanel.form
Normal file
@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.9" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<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="1"/>
|
||||
<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"/>
|
||||
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,-109,0,0,2,-93"/>
|
||||
</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="jTextFieldLimit1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="532" max="32767" 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="jTextFieldLimit1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="353" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="opensesim.gui.util.JTextFieldLimit" name="jTextFieldLimit1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="jTextFieldLimit1"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jTextFieldLimit1ActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
85
src/opensesim/gui/AssetEditor/NewJPanel.java
Normal file
85
src/opensesim/gui/AssetEditor/NewJPanel.java
Normal file
@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 7u83 <7u83@mail.ru>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package opensesim.gui.AssetEditor;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 7u83 <7u83@mail.ru>
|
||||
*/
|
||||
public class NewJPanel extends javax.swing.JPanel {
|
||||
|
||||
/**
|
||||
* Creates new form NewJPanel
|
||||
*/
|
||||
public NewJPanel() {
|
||||
initComponents();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
jTextFieldLimit1 = new opensesim.gui.util.JTextFieldLimit();
|
||||
|
||||
jTextFieldLimit1.setText("jTextFieldLimit1");
|
||||
jTextFieldLimit1.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jTextFieldLimit1ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jTextFieldLimit1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(532, Short.MAX_VALUE))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jTextFieldLimit1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(353, Short.MAX_VALUE))
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void jTextFieldLimit1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldLimit1ActionPerformed
|
||||
// TODO add your handling code here:
|
||||
}//GEN-LAST:event_jTextFieldLimit1ActionPerformed
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private opensesim.gui.util.JTextFieldLimit jTextFieldLimit1;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
94
src/opensesim/gui/AssetPairEditor/EditAssetPairPanel.form
Normal file
94
src/opensesim/gui/AssetPairEditor/EditAssetPairPanel.form
Normal file
@ -0,0 +1,94 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<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="1"/>
|
||||
<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" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="assetBox" pref="376" max="32767" attributes="0"/>
|
||||
<Component id="currencyBox" max="32767" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="0" pref="0" max="32767" 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="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="currencyBox" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="assetBox" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace 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="Currency:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JComboBox" name="currencyBox">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
||||
<StringArray count="4">
|
||||
<StringItem index="0" value="Item 1"/>
|
||||
<StringItem index="1" value="Item 2"/>
|
||||
<StringItem index="2" value="Item 3"/>
|
||||
<StringItem index="3" value="Item 4"/>
|
||||
</StringArray>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Asset:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JComboBox" name="assetBox">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
||||
<StringArray count="4">
|
||||
<StringItem index="0" value="Item 1"/>
|
||||
<StringItem index="1" value="Item 2"/>
|
||||
<StringItem index="2" value="Item 3"/>
|
||||
<StringItem index="3" value="Item 4"/>
|
||||
</StringArray>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
125
src/opensesim/gui/AssetPairEditor/EditAssetPairPanel.java
Normal file
125
src/opensesim/gui/AssetPairEditor/EditAssetPairPanel.java
Normal file
@ -0,0 +1,125 @@
|
||||
package opensesim.gui.AssetPairEditor;
|
||||
|
||||
import java.util.Collection;
|
||||
import opensesim.AbstractAsset;
|
||||
import opensesim.World;
|
||||
import opensesim.gui.Globals;
|
||||
|
||||
/*
|
||||
* Copyright (c) 2018, tohe
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @author tohe
|
||||
*/
|
||||
public class EditAssetPairPanel extends javax.swing.JPanel {
|
||||
|
||||
World world;
|
||||
/**
|
||||
* Creates new form EditAssetPairPanel
|
||||
*/
|
||||
public EditAssetPairPanel() {
|
||||
world = Globals.world;
|
||||
initComponents();
|
||||
if (world == null)
|
||||
return;
|
||||
|
||||
assetBox.removeAllItems();
|
||||
currencyBox.removeAllItems();
|
||||
|
||||
Collection<AbstractAsset> ac = world.getAssetCollection();
|
||||
for (AbstractAsset asset: ac ){
|
||||
if (asset.isCurrency()){
|
||||
this.currencyBox.addItem(asset.getSymbol());
|
||||
}
|
||||
if (asset.isAsset()){
|
||||
this.assetBox.addItem(asset.getSymbol());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
currencyBox = new javax.swing.JComboBox<>();
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
assetBox = new javax.swing.JComboBox<>();
|
||||
|
||||
jLabel1.setText("Currency:");
|
||||
|
||||
currencyBox.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
|
||||
|
||||
jLabel2.setText("Asset:");
|
||||
|
||||
assetBox.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(assetBox, 0, 376, Short.MAX_VALUE)
|
||||
.addComponent(currencyBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jLabel1)
|
||||
.addComponent(jLabel2))
|
||||
.addGap(0, 0, Short.MAX_VALUE)))
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jLabel1)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(currencyBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jLabel2)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(assetBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JComboBox<String> assetBox;
|
||||
private javax.swing.JComboBox<String> currencyBox;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
67
src/opensesim/gui/AssetPairEditor/NewJDialog.form
Normal file
67
src/opensesim/gui/AssetPairEditor/NewJDialog.form
Normal file
@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
|
||||
<Properties>
|
||||
<Property name="defaultCloseOperation" type="int" value="2"/>
|
||||
</Properties>
|
||||
<SyntheticProperties>
|
||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
||||
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
|
||||
</SyntheticProperties>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<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="1"/>
|
||||
<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="1" attributes="0">
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jButton2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="editAssetPairPanel2" alignment="1" 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="editAssetPairPanel2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jButton1" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jButton2" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JButton" name="jButton1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Add"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="opensesim.gui.AssetPairEditor.EditAssetPairPanel" name="editAssetPairPanel2">
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="jButton2">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Cancel"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
149
src/opensesim/gui/AssetPairEditor/NewJDialog.java
Normal file
149
src/opensesim/gui/AssetPairEditor/NewJDialog.java
Normal file
@ -0,0 +1,149 @@
|
||||
/*
|
||||
* Copyright (c) 2018, tohe
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package opensesim.gui.AssetPairEditor;
|
||||
|
||||
import opensesim.World;
|
||||
import opensesim.gui.EscDialog;
|
||||
import opensesim.gui.Globals;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author tohe
|
||||
*/
|
||||
public class NewJDialog extends EscDialog /*javax.swing.JDialog*/ {
|
||||
World world;
|
||||
|
||||
/**
|
||||
* Creates new form NewJDialog
|
||||
*/
|
||||
public NewJDialog(java.awt.Frame parent, boolean modal) {
|
||||
super(parent, modal);
|
||||
world = Globals.world;
|
||||
initComponents();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
jButton1 = new javax.swing.JButton();
|
||||
editAssetPairPanel2 = new opensesim.gui.AssetPairEditor.EditAssetPairPanel();
|
||||
jButton2 = new javax.swing.JButton();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
|
||||
jButton1.setText("Add");
|
||||
jButton1.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jButton1ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jButton2.setText("Cancel");
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jButton1)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jButton2)
|
||||
.addContainerGap())
|
||||
.addComponent(editAssetPairPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addComponent(editAssetPairPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jButton1)
|
||||
.addComponent(jButton2))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
|
||||
dispose();
|
||||
}//GEN-LAST:event_jButton1ActionPerformed
|
||||
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
public static void main(String args[]) {
|
||||
/* Set the Nimbus look and feel */
|
||||
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
|
||||
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
|
||||
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
|
||||
*/
|
||||
try {
|
||||
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
|
||||
if ("Nimbus".equals(info.getName())) {
|
||||
javax.swing.UIManager.setLookAndFeel(info.getClassName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (ClassNotFoundException ex) {
|
||||
java.util.logging.Logger.getLogger(NewJDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (InstantiationException ex) {
|
||||
java.util.logging.Logger.getLogger(NewJDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (IllegalAccessException ex) {
|
||||
java.util.logging.Logger.getLogger(NewJDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
|
||||
java.util.logging.Logger.getLogger(NewJDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
}
|
||||
//</editor-fold>
|
||||
|
||||
/* Create and display the dialog */
|
||||
java.awt.EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
NewJDialog dialog = new NewJDialog(new javax.swing.JFrame(), true);
|
||||
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
|
||||
@Override
|
||||
public void windowClosing(java.awt.event.WindowEvent e) {
|
||||
System.exit(0);
|
||||
}
|
||||
});
|
||||
dialog.setVisible(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private opensesim.gui.AssetPairEditor.EditAssetPairPanel editAssetPairPanel2;
|
||||
private javax.swing.JButton jButton1;
|
||||
private javax.swing.JButton jButton2;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
@ -23,12 +23,12 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package gui;
|
||||
package opensesim.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import sesim.Order;
|
||||
import sesim.Order.OrderType;
|
||||
import opensesim.old_sesim.Order;
|
||||
import opensesim.old_sesim.Order.OrderType;
|
||||
|
||||
/**
|
||||
*
|
@ -23,12 +23,12 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package gui;
|
||||
package opensesim.gui;
|
||||
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import sesim.Exchange.Statistics;
|
||||
import sesim.Scheduler;
|
||||
import opensesim.old_sesim.Exchange.Statistics;
|
||||
import opensesim.old_sesim.Scheduler;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -40,7 +40,7 @@ public class Clock extends javax.swing.JPanel {
|
||||
TimerTask clockUpdater;
|
||||
|
||||
|
||||
class ClockUpdater implements sesim.Scheduler.TimerTaskRunner{
|
||||
class ClockUpdater implements opensesim.old_sesim.Scheduler.TimerTaskRunner{
|
||||
|
||||
@Override
|
||||
public long timerTask() {
|
@ -23,7 +23,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package gui;
|
||||
package opensesim.gui;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -49,7 +49,7 @@ public class ClockDialog extends javax.swing.JDialog {
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
clock1 = new gui.Clock();
|
||||
clock1 = new opensesim.gui.Clock();
|
||||
jButton1 = new javax.swing.JButton();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
@ -138,7 +138,7 @@ public class ClockDialog extends javax.swing.JDialog {
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private gui.Clock clock1;
|
||||
private opensesim.gui.Clock clock1;
|
||||
private javax.swing.JButton jButton1;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
@ -23,7 +23,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package gui;
|
||||
package opensesim.gui;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
@ -23,7 +23,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package gui;
|
||||
package opensesim.gui;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -55,7 +55,7 @@ public class EditAutoTraderListDialog extends javax.swing.JDialog {
|
||||
jButton1 = new javax.swing.JButton();
|
||||
jOkButton = new javax.swing.JButton();
|
||||
jButton2 = new javax.swing.JButton();
|
||||
editAutoTraderList1 = new gui.EditAutoTraderList();
|
||||
editAutoTraderList1 = new opensesim.gui.EditAutoTraderList();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
|
||||
@ -173,7 +173,7 @@ public class EditAutoTraderListDialog extends javax.swing.JDialog {
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private gui.EditAutoTraderList editAutoTraderList1;
|
||||
private opensesim.gui.EditAutoTraderList editAutoTraderList1;
|
||||
private javax.swing.JButton jButton1;
|
||||
private javax.swing.JButton jButton2;
|
||||
private javax.swing.JButton jOkButton;
|
@ -23,7 +23,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package gui;
|
||||
package opensesim.gui;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
@ -23,9 +23,9 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package gui;
|
||||
package opensesim.gui;
|
||||
|
||||
import static gui.Globals.LOGGER;
|
||||
import static opensesim.gui.Globals.LOGGER;
|
||||
import java.awt.Frame;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@ -36,8 +36,8 @@ import java.util.logging.Logger;
|
||||
import javax.swing.JPanel;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
import sesim.AutoTraderGui;
|
||||
import sesim.AutoTraderInterface;
|
||||
import opensesim.old_sesim.AutoTraderGui;
|
||||
import opensesim.old_sesim.AutoTraderInterface;
|
||||
|
||||
/**
|
||||
*
|
@ -8,9 +8,6 @@
|
||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
||||
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
|
||||
</SyntheticProperties>
|
||||
<Events>
|
||||
<EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="formKeyReleased"/>
|
||||
</Events>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
@ -23,7 +23,15 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package gui;
|
||||
package opensesim.gui;
|
||||
|
||||
import java.awt.Dialog;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.WindowEvent;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.KeyStroke;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -31,20 +39,37 @@ package gui;
|
||||
*/
|
||||
public class EscDialog extends javax.swing.JDialog {
|
||||
|
||||
final void addEscListener() {
|
||||
javax.swing.JDialog dialog = this;
|
||||
|
||||
ActionListener escListener = (ActionEvent e) -> {
|
||||
dispatchEvent(new WindowEvent(
|
||||
dialog, WindowEvent.WINDOW_CLOSING
|
||||
));
|
||||
};
|
||||
getRootPane().registerKeyboardAction(escListener,
|
||||
KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, true),
|
||||
JComponent.WHEN_IN_FOCUSED_WINDOW);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates new form EscDialog
|
||||
*
|
||||
* @param parent
|
||||
* @param modal
|
||||
*/
|
||||
public EscDialog(java.awt.Frame parent, boolean modal) {
|
||||
public EscDialog(java.awt.Window parent, boolean modal) {
|
||||
super(parent, modal ? ModalityType.DOCUMENT_MODAL : ModalityType.MODELESS);
|
||||
initComponents();
|
||||
addEscListener();
|
||||
}
|
||||
|
||||
/* public EscDialog(Dialog parent, boolean modal) {
|
||||
super(parent, modal);
|
||||
initComponents();
|
||||
System.out.printf("Adding Key Listener\n", "");
|
||||
addKeyListener(new java.awt.event.KeyAdapter() {
|
||||
public void keyReleased(java.awt.event.KeyEvent evt) {
|
||||
formKeyReleased(evt);
|
||||
}
|
||||
});
|
||||
this.setLocationRelativeTo(parent);
|
||||
addEscListener();
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
@ -56,11 +81,6 @@ public class EscDialog extends javax.swing.JDialog {
|
||||
private void initComponents() {
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
addKeyListener(new java.awt.event.KeyAdapter() {
|
||||
public void keyReleased(java.awt.event.KeyEvent evt) {
|
||||
formKeyReleased(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
@ -76,10 +96,6 @@ public class EscDialog extends javax.swing.JDialog {
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void formKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_formKeyReleased
|
||||
dispose();
|
||||
}//GEN-LAST:event_formKeyReleased
|
||||
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
@ -109,6 +125,7 @@ public class EscDialog extends javax.swing.JDialog {
|
||||
|
||||
/* Create and display the dialog */
|
||||
java.awt.EventQueue.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
EscDialog dialog = new EscDialog(new javax.swing.JFrame(), true);
|
||||
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
|
@ -23,12 +23,15 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package gui;
|
||||
package opensesim.gui;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.nio.file.Files;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@ -38,15 +41,22 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.prefs.Preferences;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.LookAndFeel;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.UIManager.LookAndFeelInfo;
|
||||
import opensesim.AbstractAsset;
|
||||
import opensesim.World;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
import sesim.AutoTraderInterface;
|
||||
import sesim.AutoTraderLoader;
|
||||
import sesim.Indicator;
|
||||
import sesim.IndicatorLoader;
|
||||
import sesim.SeSimClassLoader;
|
||||
import opensesim.old_sesim.AutoTraderInterface;
|
||||
import opensesim.old_sesim.AutoTraderLoader;
|
||||
import opensesim.old_sesim.Indicator;
|
||||
import opensesim.old_sesim.IndicatorLoader;
|
||||
import opensesim.sesim.interfaces.Asset;
|
||||
import opensesim.util.XClassLoader;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -54,10 +64,12 @@ import sesim.SeSimClassLoader;
|
||||
*/
|
||||
public class Globals {
|
||||
|
||||
public static World world;
|
||||
|
||||
public static final String SESIM_FILEEXTENSION = "sesim";
|
||||
public static final Double SESIM_FILEVERSION = 0.1;
|
||||
|
||||
public static final String SESIM_APPTITLE = "SeSim - Stock Exchange Simulator";
|
||||
public static final String SESIM_APPTITLE = "OpenSeSim - Stock Exchange Simulator";
|
||||
|
||||
public interface CfgListener {
|
||||
|
||||
@ -80,16 +92,19 @@ public class Globals {
|
||||
|
||||
// static final String STRATEGYPREFS = "Strategies";
|
||||
// static final String TRADERPREFS = "Traders";
|
||||
static final String DEVELSTATUS = "devel_status";
|
||||
public static final String DEVELSTATUS = "devel_status";
|
||||
public static final String GODMODE = "godmode";
|
||||
|
||||
static public sesim.Exchange se;
|
||||
static public opensesim.old_sesim.Exchange se;
|
||||
|
||||
/**
|
||||
* Defines keys for preferences
|
||||
*/
|
||||
public static final class PrefKeys {
|
||||
|
||||
public static final String XCLASSPATH = "xclasspath";
|
||||
public static final String LAF = "laf";
|
||||
|
||||
public static String WORKDIR = "workdir";
|
||||
public static final String CURRENTFILE = "currentfile";
|
||||
|
||||
@ -99,11 +114,20 @@ public class Globals {
|
||||
|
||||
}
|
||||
|
||||
public static final class MAX{
|
||||
public static final int SYMLEN = 6;
|
||||
public static final int NAMELEN = 64;
|
||||
}
|
||||
|
||||
/**
|
||||
* Preferences
|
||||
*/
|
||||
static public Preferences prefs;
|
||||
|
||||
public static class CfgStrings {
|
||||
|
||||
public static final String GODMODE = "godmode";
|
||||
|
||||
}
|
||||
|
||||
public static String DEFAULT_EXCHANGE_CFG
|
||||
@ -112,42 +136,158 @@ public class Globals {
|
||||
+ " shares_decimals: 0"
|
||||
+ "}";
|
||||
|
||||
//CfgStrings
|
||||
static void setLookAndFeel(String selected) {
|
||||
|
||||
try {
|
||||
String look = "com.seaglasslookandfeel.SeaGlassLookAndFeel";
|
||||
Class.forName(look);
|
||||
UIManager.installLookAndFeel("Sea Glass", look);
|
||||
} catch (ClassNotFoundException e) {
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param selected
|
||||
*/
|
||||
public static void setLookAndFeel(String selected) {
|
||||
|
||||
ClassLoader old;
|
||||
old = Globals.setXClassLoader();
|
||||
Logger.getLogger(Globals.class.getName()).log(Level.SEVERE, "Setting LAF:" + selected);
|
||||
UIManager.LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels();
|
||||
for (UIManager.LookAndFeelInfo lafInfo1 : lafInfo) {
|
||||
if (lafInfo1.getName().equals(selected)) {
|
||||
String lafClassName = lafInfo1.getClassName();
|
||||
try {
|
||||
Logger.getLogger(Globals.class.getName()).log(Level.SEVERE, "Setting LAF:" + lafClassName);
|
||||
JFrame.setDefaultLookAndFeelDecorated(true);
|
||||
JDialog.setDefaultLookAndFeelDecorated(true);
|
||||
|
||||
UIManager.setLookAndFeel(lafClassName);
|
||||
// UIManager.setLookAndFeel("com.seaglasslookandfeel.SeaGlassLookAndFeel");
|
||||
break;
|
||||
} catch (Exception e) {
|
||||
Logger.getLogger(Globals.class.getName()).log(Level.SEVERE, null, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Globals.unsetXClassLoader(old);
|
||||
}
|
||||
|
||||
static AutoTraderLoader tloader;
|
||||
static IndicatorLoader iloader;
|
||||
|
||||
static void initGlobals() {
|
||||
ArrayList default_pathlist = new ArrayList<>();
|
||||
String default_path = new java.io.File(SeSimApplication.class.getProtectionDomain()
|
||||
static ArrayList default_pathlist = new ArrayList<>();
|
||||
|
||||
static ArrayList<URL> urllist;
|
||||
|
||||
static public void updateUrlList() {
|
||||
urllist = new ArrayList<>();
|
||||
URL url;
|
||||
try {
|
||||
url = new java.io.File(Globals.class.getProtectionDomain()
|
||||
.getCodeSource()
|
||||
.getLocation()
|
||||
.getPath()).toString();
|
||||
.getPath()).toURI().toURL();
|
||||
urllist.add(url);
|
||||
} catch (MalformedURLException ex) {
|
||||
Logger.getLogger(Globals.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
default_pathlist.add(default_path);
|
||||
String xpath;
|
||||
xpath = prefs.get(Globals.PrefKeys.XCLASSPATH, null);
|
||||
|
||||
urllist.addAll(opensesim.util.XClassLoader.getXPathUrlList(xpath));
|
||||
}
|
||||
|
||||
static ClassLoader setXClassLoader() {
|
||||
ClassLoader old_classloader = Thread.currentThread().getContextClassLoader();
|
||||
if (urllist ==null)
|
||||
return old_classloader;
|
||||
URL[] urls = urllist.toArray(new URL[urllist.size()]);
|
||||
URLClassLoader cl;
|
||||
cl = new URLClassLoader(urls, old_classloader);
|
||||
Thread.currentThread().setContextClassLoader(cl);
|
||||
return old_classloader;
|
||||
}
|
||||
|
||||
static void unsetXClassLoader(ClassLoader old_classloader) {
|
||||
Thread.currentThread().setContextClassLoader(old_classloader);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static public ArrayList<Class<AbstractAsset>> getAvailableAssetsTypes(){
|
||||
ArrayList<Class<?>> asset_types_raw;
|
||||
ClassLoader old = setXClassLoader();
|
||||
asset_types_raw = opensesim.util.XClassLoader.getClassesList(urllist, AbstractAsset.class);
|
||||
unsetXClassLoader(old);
|
||||
|
||||
ArrayList<Class<AbstractAsset>> asset_types=new ArrayList<>();
|
||||
for (Class a: asset_types_raw ){
|
||||
Class <AbstractAsset> aa = a;
|
||||
asset_types.add(aa);
|
||||
// asset_types.put(a.cast(AbstractAsset.class));
|
||||
}
|
||||
|
||||
return asset_types;
|
||||
}
|
||||
|
||||
static public void installLookAndFeels() {
|
||||
ArrayList<Class<?>> lafs;
|
||||
lafs = opensesim.util.XClassLoader.getClassesList(urllist, LookAndFeel.class);
|
||||
|
||||
ClassLoader currentThreadClassLoader
|
||||
= Thread.currentThread().getContextClassLoader();
|
||||
URL[] urls = urllist.toArray(new URL[urllist.size()]);
|
||||
URLClassLoader cl;
|
||||
cl = new URLClassLoader(urls, currentThreadClassLoader);
|
||||
Thread.currentThread().setContextClassLoader(cl);
|
||||
|
||||
for (Class<?> cls : lafs) {
|
||||
System.out.println("Class:");
|
||||
System.out.println(cls.getName());
|
||||
|
||||
Class<LookAndFeel> lafc;
|
||||
lafc = (Class<LookAndFeel>) cls;
|
||||
LookAndFeel laf;
|
||||
try {
|
||||
laf = lafc.newInstance();
|
||||
} catch (InstantiationException | IllegalAccessException | InternalError ex) {
|
||||
Logger.getLogger(SeSimApplication.class.getName()).log(Level.SEVERE, null, ex);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
System.out.println("LAF:");
|
||||
System.out.println(laf.getName());
|
||||
UIManager.installLookAndFeel(laf.getName()+" - "+laf.getDescription(), lafc.getName());
|
||||
|
||||
}
|
||||
|
||||
Thread.currentThread().setContextClassLoader(currentThreadClassLoader);
|
||||
|
||||
// UIManager.installLookAndFeel(laf.getName(), lafc.getName());
|
||||
}
|
||||
|
||||
static void initGlobals(Class<?> c) {
|
||||
|
||||
prefs = Preferences.userNodeForPackage(c);
|
||||
|
||||
world = new World();
|
||||
|
||||
// initialize urllist used by class loader
|
||||
updateUrlList();
|
||||
|
||||
installLookAndFeels();
|
||||
|
||||
/*
|
||||
ArrayList<Class<LookAndFeelInfo>> res;
|
||||
|
||||
res = cl.getInstalledClasses(default_pathlist);
|
||||
|
||||
for (Class<LookAndFeelInfo> laf : res) {
|
||||
System.out.print(laf.getCanonicalName());
|
||||
}
|
||||
*/
|
||||
/* System.out.print("PATH LIST\n");
|
||||
System.out.print(default_pathlist);
|
||||
System.out.print("END PL\n");
|
||||
*/
|
||||
tloader = new AutoTraderLoader(default_pathlist);
|
||||
|
||||
iloader = new IndicatorLoader(default_pathlist);
|
||||
@ -157,12 +297,12 @@ public class Globals {
|
||||
// SeSimClassLoader<Indicator> il = new SeSimClassLoader<>(Indicator.class);
|
||||
// il.setDefaultPathList(default_pathlist);
|
||||
// ArrayList<Class<Indicator>> ires = il.getInstalledClasses();
|
||||
|
||||
}
|
||||
|
||||
static public final Logger LOGGER = Logger.getLogger("com.cauwersin.sesim");
|
||||
|
||||
static public final JSONArray getTraders() {
|
||||
|
||||
String traders_json = Globals.prefs.get(PrefKeys.TRADERS, "[]");
|
||||
JSONArray traders = new JSONArray(traders_json);
|
||||
return traders;
|
@ -23,7 +23,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package gui;
|
||||
package opensesim.gui;
|
||||
|
||||
import java.util.logging.Handler;
|
||||
import java.util.logging.LogRecord;
|
@ -3,9 +3,9 @@
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package gui;
|
||||
package opensesim.gui;
|
||||
|
||||
import chart.Chart;
|
||||
import opensesim.chart.Chart;
|
||||
import java.awt.Color;
|
||||
import java.awt.Cursor;
|
||||
import java.util.ArrayList;
|
||||
@ -14,14 +14,14 @@ import javax.swing.ButtonGroup;
|
||||
import javax.swing.JCheckBoxMenuItem;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JRadioButtonMenuItem;
|
||||
import sesim.Exchange;
|
||||
import sesim.OHLCData;
|
||||
import opensesim.old_sesim.Exchange;
|
||||
import opensesim.old_sesim.OHLCData;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 7u83 <7u83@mail.ru>
|
||||
*/
|
||||
public class MainChart extends chart.Chart {
|
||||
public class MainChart extends opensesim.chart.Chart {
|
||||
|
||||
class MyCursor extends Cursor{
|
||||
|
@ -23,7 +23,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package gui;
|
||||
package opensesim.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -23,7 +23,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package gui;
|
||||
package opensesim.gui;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -47,9 +47,9 @@ public class OderBookPanelNew extends javax.swing.JPanel {
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
quotePanel1 = new gui.QuotePanel();
|
||||
orderBookNew3 = new gui.orderbook.OrderBook();
|
||||
orderBookNew4 = new gui.orderbook.OrderBook();
|
||||
quotePanel1 = new opensesim.gui.QuotePanel();
|
||||
orderBookNew3 = new opensesim.gui.orderbook.OrderBook();
|
||||
orderBookNew4 = new opensesim.gui.orderbook.OrderBook();
|
||||
filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 32767));
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
@ -88,8 +88,8 @@ public class OderBookPanelNew extends javax.swing.JPanel {
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.Box.Filler filler1;
|
||||
private gui.orderbook.OrderBook orderBookNew3;
|
||||
private gui.orderbook.OrderBook orderBookNew4;
|
||||
private gui.QuotePanel quotePanel1;
|
||||
private opensesim.gui.orderbook.OrderBook orderBookNew3;
|
||||
private opensesim.gui.orderbook.OrderBook orderBookNew4;
|
||||
private opensesim.gui.QuotePanel quotePanel1;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
@ -23,7 +23,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package gui;
|
||||
package opensesim.gui;
|
||||
|
||||
|
||||
import java.awt.MouseInfo;
|
||||
@ -34,10 +34,10 @@ import java.util.Map;
|
||||
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
|
||||
import sesim.Account;
|
||||
import sesim.Order;
|
||||
import sesim.Order.OrderType;
|
||||
import traders.ManTrader.CreateOrderDialog;
|
||||
import opensesim.old_sesim.Account;
|
||||
import opensesim.old_sesim.Order;
|
||||
import opensesim.old_sesim.Order.OrderType;
|
||||
import opensesim.traders.ManTrader.CreateOrderDialog;
|
||||
|
||||
/**
|
||||
*
|
@ -23,10 +23,10 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package gui;
|
||||
package opensesim.gui;
|
||||
|
||||
import sesim.Exchange;
|
||||
import sesim.Exchange.*;
|
||||
import opensesim.old_sesim.Exchange;
|
||||
import opensesim.old_sesim.Exchange.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Formatter;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
@ -36,7 +36,7 @@ import java.awt.*;
|
||||
import java.text.DecimalFormat;
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.*;
|
||||
import sesim.Order;
|
||||
import opensesim.old_sesim.Order;
|
||||
|
||||
/**
|
||||
*
|
@ -23,7 +23,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package gui;
|
||||
package opensesim.gui;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -48,9 +48,9 @@ public class OrderBookDialog extends javax.swing.JDialog {
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
orderBookNew1 = new gui.orderbook.OrderBook();
|
||||
quotePanel1 = new gui.QuotePanel();
|
||||
orderBookNew2 = new gui.orderbook.OrderBook();
|
||||
orderBookNew1 = new opensesim.gui.orderbook.OrderBook();
|
||||
quotePanel1 = new opensesim.gui.QuotePanel();
|
||||
orderBookNew2 = new opensesim.gui.orderbook.OrderBook();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
getContentPane().setLayout(new java.awt.FlowLayout());
|
||||
@ -104,8 +104,8 @@ public class OrderBookDialog extends javax.swing.JDialog {
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private gui.orderbook.OrderBook orderBookNew1;
|
||||
private gui.orderbook.OrderBook orderBookNew2;
|
||||
private gui.QuotePanel quotePanel1;
|
||||
private opensesim.gui.orderbook.OrderBook orderBookNew1;
|
||||
private opensesim.gui.orderbook.OrderBook orderBookNew2;
|
||||
private opensesim.gui.QuotePanel quotePanel1;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
81
src/opensesim/gui/OrderBookPanel_old.form
Normal file
81
src/opensesim/gui/OrderBookPanel_old.form
Normal file
@ -0,0 +1,81 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.8" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<Properties>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[220, 262]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<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="1"/>
|
||||
<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"/>
|
||||
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,2,41,0,0,2,75"/>
|
||||
</AuxValues>
|
||||
<LayoutCode>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="1_layout">
|
||||
<CodeVariable name="layout" type="4096" declaredType="java.awt.GridBagLayout"/>
|
||||
<ExpressionOrigin>
|
||||
<ExpressionProvider type="CodeConstructor">
|
||||
<CodeConstructor class="java.awt.GridBagLayout" parameterTypes=""/>
|
||||
</ExpressionProvider>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
<StatementProvider type="CodeExpression">
|
||||
<CodeExpression id="1_layout"/>
|
||||
</StatementProvider>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="1_layout"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="columnWidths" class="java.awt.GridBagLayout"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="2">
|
||||
<ExpressionOrigin>
|
||||
<Value type="[I" editor="org.netbeans.modules.form.layoutsupport.delegates.GridBagLayoutSupport$IntArrayPropertyEditor">
|
||||
<PropertyValue value="[0]"/>
|
||||
</Value>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="1_layout"/>
|
||||
<StatementProvider type="CodeField">
|
||||
<CodeField name="rowHeights" class="java.awt.GridBagLayout"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="3">
|
||||
<ExpressionOrigin>
|
||||
<Value type="[I" editor="org.netbeans.modules.form.layoutsupport.delegates.GridBagLayoutSupport$IntArrayPropertyEditor">
|
||||
<PropertyValue value="[0, 5, 0, 5, 0]"/>
|
||||
</Value>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
<CodeStatement>
|
||||
<CodeExpression id="4">
|
||||
<ExpressionOrigin>
|
||||
<ExpressionProvider type="ComponentRef">
|
||||
<ComponentRef name="."/>
|
||||
</ExpressionProvider>
|
||||
</ExpressionOrigin>
|
||||
</CodeExpression>
|
||||
<StatementProvider type="CodeMethod">
|
||||
<CodeMethod name="setLayout" class="java.awt.Container" parameterTypes="java.awt.LayoutManager"/>
|
||||
</StatementProvider>
|
||||
<Parameters>
|
||||
<CodeExpression id="1_layout"/>
|
||||
</Parameters>
|
||||
</CodeStatement>
|
||||
</LayoutCode>
|
||||
</Form>
|
@ -23,7 +23,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package gui;
|
||||
package opensesim.gui;
|
||||
|
||||
//import SeSim.*;
|
||||
import static java.lang.Thread.sleep;
|
||||
@ -39,7 +39,7 @@ import static java.lang.Thread.sleep;
|
||||
*/
|
||||
public class OrderBookPanel_old extends javax.swing.JPanel {
|
||||
|
||||
sesim.Exchange se;
|
||||
opensesim.old_sesim.Exchange se;
|
||||
|
||||
public OrderBookPanel_old() {
|
||||
this.se = Globals.se;
|
||||
@ -61,51 +61,15 @@ public class OrderBookPanel_old extends javax.swing.JPanel {
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
java.awt.GridBagConstraints gridBagConstraints;
|
||||
|
||||
askBook1 = new gui.AskBook();
|
||||
bidBook1 = new gui.BidBook();
|
||||
quotePanel2 = new gui.QuotePanel();
|
||||
|
||||
setPreferredSize(new java.awt.Dimension(220, 262));
|
||||
java.awt.GridBagLayout layout = new java.awt.GridBagLayout();
|
||||
layout.columnWidths = new int[] {0};
|
||||
layout.rowHeights = new int[] {0, 5, 0, 5, 0};
|
||||
setLayout(layout);
|
||||
|
||||
askBook1.setPreferredSize(new java.awt.Dimension(200, 200));
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 0;
|
||||
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
|
||||
gridBagConstraints.weightx = 1.0;
|
||||
gridBagConstraints.weighty = 1.0;
|
||||
add(askBook1, gridBagConstraints);
|
||||
|
||||
bidBook1.setPreferredSize(new java.awt.Dimension(200, 200));
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 4;
|
||||
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
|
||||
gridBagConstraints.weightx = 1.0;
|
||||
gridBagConstraints.weighty = 1.0;
|
||||
add(bidBook1, gridBagConstraints);
|
||||
|
||||
quotePanel2.setOpaque(false);
|
||||
quotePanel2.setPreferredSize(new java.awt.Dimension(587, 200));
|
||||
gridBagConstraints = new java.awt.GridBagConstraints();
|
||||
gridBagConstraints.gridx = 0;
|
||||
gridBagConstraints.gridy = 2;
|
||||
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
|
||||
gridBagConstraints.weightx = 0.5;
|
||||
gridBagConstraints.weighty = 0.5;
|
||||
add(quotePanel2, gridBagConstraints);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private gui.AskBook askBook1;
|
||||
private gui.BidBook bidBook1;
|
||||
private gui.QuotePanel quotePanel2;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
@ -3,6 +3,10 @@
|
||||
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
|
||||
<Properties>
|
||||
<Property name="defaultCloseOperation" type="int" value="2"/>
|
||||
<Property name="title" type="java.lang.String" value="OpenSeSim Preferences"/>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[551, 343]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<SyntheticProperties>
|
||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
||||
@ -27,17 +31,13 @@
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="80" max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" pref="100" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="28" max="-2" attributes="0"/>
|
||||
<Component id="lafComboBox" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace min="0" pref="201" max="32767" attributes="0"/>
|
||||
<Component id="okButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="applyButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="cancelButton" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel2" max="32767" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="418" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
@ -46,24 +46,54 @@
|
||||
</Group>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
<Component id="okButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="applyButton" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="cancelButton" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Component id="xClassPath" max="32767" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="classPathChoseButton" min="-2" pref="124" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace min="-2" pref="3" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace min="-2" 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"/>
|
||||
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="lafComboBox" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Component id="godmodeCheckBox" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jDevleopmentFeaturesCheckBox" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="188" max="32767" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="28" max="-2" attributes="0"/>
|
||||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="classPathChoseButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="xClassPath" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="68" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="cancelButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="applyButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
@ -72,6 +102,8 @@
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
@ -135,5 +167,20 @@
|
||||
<Property name="text" type="java.lang.String" value="Godmode"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="classPathChoseButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Choose ..."/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="classPathChoseButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Additional Path:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JTextField" name="xClassPath">
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
@ -23,12 +23,17 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package gui;
|
||||
package opensesim.gui.PreferencesEditor;
|
||||
|
||||
import opensesim.gui.Globals;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Window;
|
||||
import java.io.File;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.LookAndFeel;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
@ -38,7 +43,7 @@ import javax.swing.UnsupportedLookAndFeelException;
|
||||
*
|
||||
* @author 7u83 <7u83@mail.ru>
|
||||
*/
|
||||
public class EditPreferencesDialog extends javax.swing.JDialog {
|
||||
public class EditPreferencesDialog extends opensesim.gui.EscDialog {
|
||||
|
||||
UIManager.LookAndFeelInfo[] lafInfo;
|
||||
|
||||
@ -60,7 +65,7 @@ public class EditPreferencesDialog extends javax.swing.JDialog {
|
||||
for (UIManager.LookAndFeelInfo lafInfo1 : lafInfo) {
|
||||
lafComboBox.addItem(lafInfo1.getName());
|
||||
}
|
||||
lafComboBox.setSelectedItem(Globals.prefs.get("laf", "Nimbus"));
|
||||
lafComboBox.setSelectedItem(Globals.prefs.get(Globals.PrefKeys.LAF, "Nimbus"));
|
||||
|
||||
String selstr;
|
||||
selstr = Globals.prefs.get(Globals.DEVELSTATUS, "false");
|
||||
@ -69,7 +74,7 @@ public class EditPreferencesDialog extends javax.swing.JDialog {
|
||||
selstr = Globals.prefs.get(Globals.GODMODE, "false");
|
||||
this.godmodeCheckBox.setSelected(selstr.equals("true"));
|
||||
|
||||
|
||||
xClassPath.setText(Globals.prefs.get(Globals.PrefKeys.XCLASSPATH, ""));
|
||||
|
||||
}
|
||||
|
||||
@ -89,8 +94,13 @@ public class EditPreferencesDialog extends javax.swing.JDialog {
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
jDevleopmentFeaturesCheckBox = new javax.swing.JCheckBox();
|
||||
godmodeCheckBox = new javax.swing.JCheckBox();
|
||||
classPathChoseButton = new javax.swing.JButton();
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
xClassPath = new javax.swing.JTextField();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
setTitle("OpenSeSim Preferences");
|
||||
setMinimumSize(new java.awt.Dimension(551, 343));
|
||||
|
||||
lafComboBox.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
|
||||
lafComboBox.addActionListener(new java.awt.event.ActionListener() {
|
||||
@ -129,6 +139,15 @@ public class EditPreferencesDialog extends javax.swing.JDialog {
|
||||
|
||||
godmodeCheckBox.setText("Godmode");
|
||||
|
||||
classPathChoseButton.setText("Choose ...");
|
||||
classPathChoseButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
classPathChoseButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jLabel2.setText("Additional Path:");
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
@ -137,21 +156,31 @@ public class EditPreferencesDialog extends javax.swing.JDialog {
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(jLabel1)
|
||||
.addGap(80, 80, 80)
|
||||
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(28, 28, 28)
|
||||
.addComponent(lafComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addGap(0, 201, Short.MAX_VALUE)
|
||||
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGap(418, 418, 418))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(godmodeCheckBox)
|
||||
.addComponent(jDevleopmentFeaturesCheckBox))
|
||||
.addGap(0, 0, Short.MAX_VALUE))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(0, 0, Short.MAX_VALUE)
|
||||
.addComponent(okButton)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(applyButton)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(cancelButton))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(godmodeCheckBox)
|
||||
.addComponent(jDevleopmentFeaturesCheckBox))
|
||||
.addGap(0, 0, Short.MAX_VALUE)))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addComponent(xClassPath)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(classPathChoseButton, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addGap(3, 3, 3)))
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
@ -161,16 +190,26 @@ public class EditPreferencesDialog extends javax.swing.JDialog {
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(lafComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel1))
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(godmodeCheckBox)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jDevleopmentFeaturesCheckBox)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 188, Short.MAX_VALUE)
|
||||
.addGap(28, 28, 28)
|
||||
.addComponent(jLabel2)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(classPathChoseButton)
|
||||
.addComponent(xClassPath, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap(68, Short.MAX_VALUE))
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(cancelButton)
|
||||
.addComponent(applyButton)
|
||||
.addComponent(okButton))
|
||||
.addContainerGap())
|
||||
.addContainerGap())))
|
||||
);
|
||||
|
||||
pack();
|
||||
@ -183,6 +222,10 @@ public class EditPreferencesDialog extends javax.swing.JDialog {
|
||||
private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
|
||||
if (old_laf != new_laf) {
|
||||
try {
|
||||
JFrame.setDefaultLookAndFeelDecorated(true);
|
||||
JDialog.setDefaultLookAndFeelDecorated(true);
|
||||
JFrame.setDefaultLookAndFeelDecorated(true);
|
||||
JDialog.setDefaultLookAndFeelDecorated(true);
|
||||
UIManager.setLookAndFeel(old_laf);
|
||||
} catch (UnsupportedLookAndFeelException ex) {
|
||||
Logger.getLogger(EditPreferencesDialog.class.getName()).log(Level.SEVERE, null, ex);
|
||||
@ -202,7 +245,6 @@ public class EditPreferencesDialog extends javax.swing.JDialog {
|
||||
|
||||
private void applyButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_applyButtonActionPerformed
|
||||
|
||||
|
||||
String selected = (String) this.lafComboBox.getSelectedItem();
|
||||
|
||||
Globals.setLookAndFeel(selected);
|
||||
@ -210,7 +252,6 @@ public class EditPreferencesDialog extends javax.swing.JDialog {
|
||||
resetUI();
|
||||
|
||||
|
||||
|
||||
}//GEN-LAST:event_applyButtonActionPerformed
|
||||
|
||||
private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
|
||||
@ -222,10 +263,43 @@ public class EditPreferencesDialog extends javax.swing.JDialog {
|
||||
Globals.prefs.put(Globals.DEVELSTATUS, sel);
|
||||
sel = this.godmodeCheckBox.isSelected() == true ? "true" : "false";
|
||||
Globals.prefs.put(Globals.GODMODE, sel);
|
||||
|
||||
Globals.prefs.put(Globals.PrefKeys.XCLASSPATH, xClassPath.getText());
|
||||
|
||||
Globals.notifyCfgListeners();
|
||||
this.dispose();
|
||||
}//GEN-LAST:event_okButtonActionPerformed
|
||||
|
||||
private void classPathChoseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_classPathChoseButtonActionPerformed
|
||||
|
||||
JFileChooser chooser = new JFileChooser();
|
||||
|
||||
File dir = null;
|
||||
if (!"".equals(xClassPath.getText())) {
|
||||
dir = new File(xClassPath.getText());
|
||||
if (!dir.exists()) {
|
||||
dir = null;
|
||||
}
|
||||
}
|
||||
if (dir == null) {
|
||||
dir = new File(System.getProperty("user.home"));
|
||||
}
|
||||
|
||||
chooser.setCurrentDirectory(dir);
|
||||
|
||||
chooser.setDialogTitle("Chose Directory");
|
||||
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
|
||||
chooser.setAcceptAllFileFilterUsed(false);
|
||||
|
||||
|
||||
int rc = chooser.showOpenDialog(null);
|
||||
if ( rc == JFileChooser.APPROVE_OPTION){
|
||||
xClassPath.setText(chooser.getSelectedFile().getAbsolutePath());
|
||||
}
|
||||
|
||||
|
||||
}//GEN-LAST:event_classPathChoseButtonActionPerformed
|
||||
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
*/
|
||||
@ -271,10 +345,13 @@ public class EditPreferencesDialog extends javax.swing.JDialog {
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JButton applyButton;
|
||||
private javax.swing.JButton cancelButton;
|
||||
private javax.swing.JButton classPathChoseButton;
|
||||
private javax.swing.JCheckBox godmodeCheckBox;
|
||||
private javax.swing.JCheckBox jDevleopmentFeaturesCheckBox;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JComboBox<String> lafComboBox;
|
||||
private javax.swing.JButton okButton;
|
||||
private javax.swing.JTextField xClassPath;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
@ -23,9 +23,9 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package gui;
|
||||
package opensesim.gui;
|
||||
|
||||
import sesim.Quote;
|
||||
import opensesim.old_sesim.Quote;
|
||||
import java.awt.Color;
|
||||
import javax.swing.SwingUtilities;
|
||||
import java.util.*;
|
||||
@ -34,7 +34,7 @@ import java.util.*;
|
||||
*
|
||||
* @author 7u83 <7u83@mail.ru>
|
||||
*/
|
||||
public class QuotePanel extends javax.swing.JPanel implements sesim.Exchange.QuoteReceiver{
|
||||
public class QuotePanel extends javax.swing.JPanel implements opensesim.old_sesim.Exchange.QuoteReceiver{
|
||||
|
||||
/**
|
||||
* Creates new form QuotePanel
|
@ -34,7 +34,7 @@
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="gui.orderbook.OrderBook" name="orderBookNew1">
|
||||
<Component class="opensesim.gui.orderbook.OrderBook" name="orderBookNew1">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
|
||||
<JSplitPaneConstraints position="left"/>
|
||||
@ -141,8 +141,42 @@
|
||||
</MenuItem>
|
||||
<MenuItem class="javax.swing.JPopupMenu$Separator" name="jSeparator1">
|
||||
</MenuItem>
|
||||
<MenuItem class="javax.swing.JMenuItem" name="assetsMenuItem">
|
||||
<Properties>
|
||||
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
|
||||
<KeyStroke key="F2"/>
|
||||
</Property>
|
||||
<Property name="mnemonic" type="int" value="97"/>
|
||||
<Property name="text" type="java.lang.String" value="Assets ..."/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="assetsMenuItemActionPerformed"/>
|
||||
</Events>
|
||||
</MenuItem>
|
||||
<MenuItem class="javax.swing.JMenuItem" name="exchangesMenuItem">
|
||||
<Properties>
|
||||
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
|
||||
<KeyStroke key="F3"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Exchanges ..."/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="exchangesMenuItemActionPerformed"/>
|
||||
</Events>
|
||||
</MenuItem>
|
||||
<MenuItem class="javax.swing.JMenuItem" name="jMenuItem2">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Asset Pairs"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItem2ActionPerformed"/>
|
||||
</Events>
|
||||
</MenuItem>
|
||||
<MenuItem class="javax.swing.JMenuItem" name="pasteMenuItem">
|
||||
<Properties>
|
||||
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
|
||||
<KeyStroke key="S"/>
|
||||
</Property>
|
||||
<Property name="mnemonic" type="int" value="115"/>
|
||||
<Property name="text" type="java.lang.String" value="Strategies ..."/>
|
||||
</Properties>
|
||||
@ -337,7 +371,7 @@
|
||||
<Component class="javax.swing.JButton" name="stopButton">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/resources/icons/stop.gif"/>
|
||||
<Image iconType="3" name="/opensesim/resources/icons/stop.gif"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Stop"/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
@ -356,7 +390,7 @@
|
||||
</FontInfo>
|
||||
</Property>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/resources/icons/run.gif"/>
|
||||
<Image iconType="3" name="/opensesim/resources/icons/run.gif"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Run sim!"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Run the simmulation"/>
|
||||
@ -371,7 +405,7 @@
|
||||
<Component class="javax.swing.JButton" name="jButton2">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/resources/icons/pause.gif"/>
|
||||
<Image iconType="3" name="/opensesim/resources/icons/pause.gif"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="Pause"/>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
@ -396,7 +430,7 @@
|
||||
<AuxValue name="JavaCodeGenerator_SerializeTo" type="java.lang.String" value="NewMDIApplication_accelSpinner"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
<Component class="gui.Clock" name="clock">
|
||||
<Component class="opensesim.gui.Clock" name="clock">
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
||||
<Properties>
|
||||
@ -427,14 +461,14 @@
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="gui.orderbook.OrderBooksHorizontal" name="orderBooksHorizontal1">
|
||||
<Component class="opensesim.gui.orderbook.OrderBooksHorizontal" name="orderBooksHorizontal1">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
|
||||
<JSplitPaneConstraints position="bottom"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="chart.MasterChart" name="chart">
|
||||
<Component class="opensesim.chart.MasterChart" name="chart">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
|
||||
<JSplitPaneConstraints position="left"/>
|
||||
@ -443,7 +477,7 @@
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="gui.orderbook.QuoteVertical" name="quoteVertical1">
|
||||
<Component class="opensesim.gui.orderbook.QuoteVertical" name="quoteVertical1">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
|
||||
<JSplitPaneConstraints position="left"/>
|
||||
@ -462,20 +496,13 @@
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="gui.Statistics" name="statistics1">
|
||||
<Component class="opensesim.gui.Statistics" name="statistics1">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
|
||||
<JSplitPaneConstraints position="top"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="chart.MMChart" name="mMChart2">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
|
||||
<JSplitPaneConstraints position="right"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
@ -23,10 +23,10 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package gui;
|
||||
package opensesim.gui;
|
||||
|
||||
import chart.Help;
|
||||
import chart.SuperDlg;
|
||||
import opensesim.chart.Help;
|
||||
import opensesim.chart.SuperDlg;
|
||||
import java.awt.Dialog;
|
||||
import java.awt.Frame;
|
||||
import java.awt.GraphicsDevice;
|
||||
@ -38,22 +38,36 @@ import java.io.File;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Scanner;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.prefs.Preferences;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.LookAndFeel;
|
||||
import static javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
import javax.swing.filechooser.FileNameExtensionFilter;
|
||||
import opensesim.gui.AssetPairEditor.NewJDialog;
|
||||
import opensesim.gui.exchangeeditor.ExchangeEditorDialog;
|
||||
import opensesim.gui.exchangeeditor.ExchangeListDialog;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import sesim.AutoTraderInterface;
|
||||
import sesim.Exchange;
|
||||
import sesim.Scheduler;
|
||||
import opensesim.old_sesim.AutoTraderInterface;
|
||||
import opensesim.old_sesim.Exchange;
|
||||
import opensesim.old_sesim.Scheduler;
|
||||
import opensesim.util.IDGenerator.Id;
|
||||
import opensesim.util.XClassLoader;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -66,6 +80,9 @@ public class SeSimApplication extends javax.swing.JFrame {
|
||||
*/
|
||||
public SeSimApplication() {
|
||||
|
||||
Globals.setXClassLoader();
|
||||
Globals.setLookAndFeel(Globals.prefs.get(Globals.PrefKeys.LAF, "Nimbus"));
|
||||
// Globals.setLookAndFeel("Metal");
|
||||
initComponents();
|
||||
|
||||
// Get default screen and place our window
|
||||
@ -87,7 +104,6 @@ public class SeSimApplication extends javax.swing.JFrame {
|
||||
}
|
||||
|
||||
// this.chartSrollPane.setVerticalScrollBarPolicy(VERTICAL_SCROLLBAR_NEVER);
|
||||
|
||||
}
|
||||
|
||||
AutoTraderInterface createTrader(Exchange se, long id, String name, double money, double shares, JSONObject cfg) {
|
||||
@ -117,7 +133,15 @@ public class SeSimApplication extends javax.swing.JFrame {
|
||||
for (int i = 0; i < tlist.length(); i++) {
|
||||
JSONObject t = tlist.getJSONObject(i);
|
||||
String strategy_name = t.getString("Strategy");
|
||||
JSONObject strategy = Globals.getStrategy(strategy_name);
|
||||
JSONObject strategy = null;
|
||||
try {
|
||||
strategy = Globals.getStrategy(strategy_name);
|
||||
} catch (Exception ex) {
|
||||
javax.swing.JOptionPane.showMessageDialog(chart, "Strategy not defined:\n\"" + strategy_name + " \"", "Error",
|
||||
javax.swing.JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
|
||||
String base = strategy.getString("base");
|
||||
AutoTraderInterface ac = Globals.tloader.getAutoTraderInterface(base);
|
||||
|
||||
@ -172,22 +196,21 @@ public class SeSimApplication extends javax.swing.JFrame {
|
||||
jTextArea1 = new javax.swing.JTextArea();
|
||||
jSplitPane1 = new javax.swing.JSplitPane();
|
||||
jSplitPane2 = new javax.swing.JSplitPane();
|
||||
orderBookNew1 = new gui.orderbook.OrderBook();
|
||||
orderBookNew1 = new opensesim.gui.orderbook.OrderBook();
|
||||
jPanel2 = new javax.swing.JPanel();
|
||||
stopButton = new javax.swing.JButton();
|
||||
runButton = new javax.swing.JButton();
|
||||
jButton2 = new javax.swing.JButton();
|
||||
accelSpinner = new javax.swing.JSpinner();
|
||||
clock = new gui.Clock();
|
||||
clock = new opensesim.gui.Clock();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
jSplitPane3 = new javax.swing.JSplitPane();
|
||||
jSplitPane4 = new javax.swing.JSplitPane();
|
||||
orderBooksHorizontal1 = new gui.orderbook.OrderBooksHorizontal();
|
||||
chart = new chart.MasterChart();
|
||||
quoteVertical1 = new gui.orderbook.QuoteVertical();
|
||||
orderBooksHorizontal1 = new opensesim.gui.orderbook.OrderBooksHorizontal();
|
||||
chart = new opensesim.chart.MasterChart();
|
||||
quoteVertical1 = new opensesim.gui.orderbook.QuoteVertical();
|
||||
jSplitPane5 = new javax.swing.JSplitPane();
|
||||
statistics1 = new gui.Statistics();
|
||||
mMChart2 = new chart.MMChart();
|
||||
statistics1 = new opensesim.gui.Statistics();
|
||||
menuBar = new javax.swing.JMenuBar();
|
||||
fileMenu = new javax.swing.JMenu();
|
||||
openMenuItem = new javax.swing.JMenuItem();
|
||||
@ -202,6 +225,9 @@ public class SeSimApplication extends javax.swing.JFrame {
|
||||
editMenu = new javax.swing.JMenu();
|
||||
editExchangeMenuItem = new javax.swing.JMenuItem();
|
||||
jSeparator1 = new javax.swing.JPopupMenu.Separator();
|
||||
assetsMenuItem = new javax.swing.JMenuItem();
|
||||
exchangesMenuItem = new javax.swing.JMenuItem();
|
||||
jMenuItem2 = new javax.swing.JMenuItem();
|
||||
pasteMenuItem = new javax.swing.JMenuItem();
|
||||
deleteMenuItem = new javax.swing.JMenuItem();
|
||||
jSeparator2 = new javax.swing.JPopupMenu.Separator();
|
||||
@ -231,7 +257,7 @@ public class SeSimApplication extends javax.swing.JFrame {
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
||||
setMinimumSize(new java.awt.Dimension(640, 480));
|
||||
|
||||
stopButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/icons/stop.gif"))); // NOI18N
|
||||
stopButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/opensesim/resources/icons/stop.gif"))); // NOI18N
|
||||
stopButton.setText("Stop");
|
||||
stopButton.setFocusable(false);
|
||||
stopButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||
@ -243,7 +269,7 @@ public class SeSimApplication extends javax.swing.JFrame {
|
||||
});
|
||||
|
||||
runButton.setFont(runButton.getFont());
|
||||
runButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/icons/run.gif"))); // NOI18N
|
||||
runButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/opensesim/resources/icons/run.gif"))); // NOI18N
|
||||
runButton.setText("Run sim!");
|
||||
runButton.setToolTipText("Run the simmulation");
|
||||
runButton.setFocusable(false);
|
||||
@ -255,7 +281,7 @@ public class SeSimApplication extends javax.swing.JFrame {
|
||||
}
|
||||
});
|
||||
|
||||
jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/icons/pause.gif"))); // NOI18N
|
||||
jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/opensesim/resources/icons/pause.gif"))); // NOI18N
|
||||
jButton2.setText("Pause");
|
||||
jButton2.setFocusable(false);
|
||||
jButton2.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
|
||||
@ -326,7 +352,6 @@ public class SeSimApplication extends javax.swing.JFrame {
|
||||
|
||||
jSplitPane5.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
|
||||
jSplitPane5.setTopComponent(statistics1);
|
||||
jSplitPane5.setRightComponent(mMChart2);
|
||||
|
||||
jSplitPane3.setLeftComponent(jSplitPane5);
|
||||
|
||||
@ -417,6 +442,34 @@ public class SeSimApplication extends javax.swing.JFrame {
|
||||
editMenu.add(editExchangeMenuItem);
|
||||
editMenu.add(jSeparator1);
|
||||
|
||||
assetsMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F2, 0));
|
||||
assetsMenuItem.setMnemonic('a');
|
||||
assetsMenuItem.setText("Assets ...");
|
||||
assetsMenuItem.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
assetsMenuItemActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
editMenu.add(assetsMenuItem);
|
||||
|
||||
exchangesMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F3, 0));
|
||||
exchangesMenuItem.setText("Exchanges ...");
|
||||
exchangesMenuItem.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
exchangesMenuItemActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
editMenu.add(exchangesMenuItem);
|
||||
|
||||
jMenuItem2.setText("Asset Pairs");
|
||||
jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jMenuItem2ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
editMenu.add(jMenuItem2);
|
||||
|
||||
pasteMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, 0));
|
||||
pasteMenuItem.setMnemonic('s');
|
||||
pasteMenuItem.setText("Strategies ...");
|
||||
pasteMenuItem.addActionListener(new java.awt.event.ActionListener() {
|
||||
@ -533,7 +586,7 @@ public class SeSimApplication extends javax.swing.JFrame {
|
||||
}//GEN-LAST:event_exitMenuItemActionPerformed
|
||||
|
||||
private void aboutMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_aboutMenuItemActionPerformed
|
||||
Dialog d = new gui.AboutDialog(this, rootPaneCheckingEnabled);
|
||||
Dialog d = new opensesim.gui.misc.AboutDialog(this, rootPaneCheckingEnabled);
|
||||
d.setVisible(rootPaneCheckingEnabled);
|
||||
|
||||
}//GEN-LAST:event_aboutMenuItemActionPerformed
|
||||
@ -600,7 +653,7 @@ public class SeSimApplication extends javax.swing.JFrame {
|
||||
private void editPreferencesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editPreferencesActionPerformed
|
||||
Globals.LOGGER.info("Edit prefs...");
|
||||
|
||||
Dialog d = new gui.EditPreferencesDialog(this, rootPaneCheckingEnabled);
|
||||
Dialog d = new opensesim.gui.PreferencesEditor.EditPreferencesDialog(this, rootPaneCheckingEnabled);
|
||||
d.setVisible(rootPaneCheckingEnabled);
|
||||
}//GEN-LAST:event_editPreferencesActionPerformed
|
||||
|
||||
@ -745,7 +798,7 @@ public class SeSimApplication extends javax.swing.JFrame {
|
||||
}//GEN-LAST:event_editExchangeMenuItemActionPerformed
|
||||
|
||||
private void resetToDefaults() {
|
||||
InputStream is = getClass().getResourceAsStream("/resources/files/defaultcfg.json");
|
||||
InputStream is = getClass().getResourceAsStream("/opensesim/resources/files/defaultcfg.json");
|
||||
String df = new Scanner(is, "UTF-8").useDelimiter("\\A").next();
|
||||
|
||||
try {
|
||||
@ -799,7 +852,7 @@ public class SeSimApplication extends javax.swing.JFrame {
|
||||
}//GEN-LAST:event_stopButtonActionPerformed
|
||||
|
||||
private void jCheckBoxMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxMenuItem1ActionPerformed
|
||||
JDialog jd = new gui.orderbook.OrderBookDialog(this, false);
|
||||
JDialog jd = new opensesim.gui.orderbook.OrderBookDialog(this, false);
|
||||
jd.setVisible(rootPaneCheckingEnabled);
|
||||
}//GEN-LAST:event_jCheckBoxMenuItem1ActionPerformed
|
||||
|
||||
@ -861,13 +914,33 @@ public class SeSimApplication extends javax.swing.JFrame {
|
||||
|
||||
//Help hs = new Help(this,true);
|
||||
//hs.setVisible(true);
|
||||
|
||||
SeSimHelp h = new SeSimHelp();
|
||||
|
||||
h.setVisible(true);
|
||||
|
||||
}//GEN-LAST:event_jMenuItem1ActionPerformed
|
||||
|
||||
private void assetsMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_assetsMenuItemActionPerformed
|
||||
opensesim.gui.AssetEditor.AssetListDialog dialog;
|
||||
dialog = new opensesim.gui.AssetEditor.AssetListDialog(this,true);
|
||||
dialog.setLocationRelativeTo(this);
|
||||
dialog.setVisible(rootPaneCheckingEnabled);
|
||||
dialog.dispose();
|
||||
}//GEN-LAST:event_assetsMenuItemActionPerformed
|
||||
|
||||
private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
|
||||
JDialog dialog = new NewJDialog(this,true);
|
||||
dialog.setVisible(true);
|
||||
dialog.dispose();
|
||||
|
||||
}//GEN-LAST:event_jMenuItem2ActionPerformed
|
||||
|
||||
private void exchangesMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exchangesMenuItemActionPerformed
|
||||
|
||||
ExchangeListDialog.runDialog(this);
|
||||
|
||||
}//GEN-LAST:event_exchangesMenuItemActionPerformed
|
||||
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
* @throws java.lang.IllegalAccessException
|
||||
@ -875,42 +948,35 @@ public class SeSimApplication extends javax.swing.JFrame {
|
||||
*/
|
||||
public static void main(String args[]) throws IllegalAccessException, InstantiationException {
|
||||
|
||||
// Initialize globals
|
||||
Class<?> c = opensesim.gui.SeSimApplication.class;
|
||||
Globals.initGlobals(c);
|
||||
|
||||
String world_source = Globals.prefs.get("world", "{}");
|
||||
JSONObject world = new org.json.JSONObject(world_source);
|
||||
Globals.world.putConfig(world);
|
||||
|
||||
|
||||
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
|
||||
//Globals.installLookAndFeels();
|
||||
|
||||
// Globals.setLookAndFeel("Metal");
|
||||
|
||||
//JDialog.setDefaultLookAndFeelDecorated(true);
|
||||
|
||||
|
||||
GraphicsDevice[] gs = ge.getScreenDevices();
|
||||
for (GraphicsDevice d : gs) {
|
||||
System.out.printf("ID %s\n", d.getIDstring());
|
||||
|
||||
}
|
||||
//System.exit(0);
|
||||
|
||||
//System.exit(0);
|
||||
Globals.initGlobals();
|
||||
//System.exit(0);
|
||||
Globals.se = new Exchange();
|
||||
|
||||
Class<?> c = sesim.Exchange.class;
|
||||
Globals.prefs = Preferences.userNodeForPackage(c);
|
||||
|
||||
Globals.prefs.put(Globals.PrefKeys.CURRENTFILE, "");
|
||||
|
||||
Globals.setLookAndFeel(Globals.prefs.get("laf", "Nimbus"));
|
||||
|
||||
JDialog.setDefaultLookAndFeelDecorated(true);
|
||||
|
||||
|
||||
java.awt.EventQueue.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
|
||||
|
||||
/* String x = new java.io.File(SeSimApplication.class.getProtectionDomain()
|
||||
.getCodeSource()
|
||||
.getLocation()
|
||||
.getPath()).toString(); //.getName();
|
||||
*/
|
||||
// System.out.printf("Creating Application\n");
|
||||
new SeSimApplication().setVisible(true);
|
||||
}
|
||||
});
|
||||
@ -919,14 +985,16 @@ public class SeSimApplication extends javax.swing.JFrame {
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JMenuItem aboutMenuItem;
|
||||
private javax.swing.JSpinner accelSpinner;
|
||||
private chart.MasterChart chart;
|
||||
private javax.swing.JMenuItem assetsMenuItem;
|
||||
private opensesim.chart.MasterChart chart;
|
||||
private javax.swing.JMenuItem clearMenuItem;
|
||||
private gui.Clock clock;
|
||||
private opensesim.gui.Clock clock;
|
||||
private javax.swing.JMenuItem closeMenuItem;
|
||||
private javax.swing.JMenuItem deleteMenuItem;
|
||||
private javax.swing.JMenuItem editExchangeMenuItem;
|
||||
private javax.swing.JMenu editMenu;
|
||||
private javax.swing.JMenuItem editPreferences;
|
||||
private javax.swing.JMenuItem exchangesMenuItem;
|
||||
private javax.swing.JMenuItem exitMenuItem;
|
||||
private javax.swing.JMenu fileMenu;
|
||||
private javax.swing.JMenu helpMenu;
|
||||
@ -934,6 +1002,7 @@ public class SeSimApplication extends javax.swing.JFrame {
|
||||
private javax.swing.JCheckBoxMenuItem jCheckBoxMenuItem1;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JMenuItem jMenuItem1;
|
||||
private javax.swing.JMenuItem jMenuItem2;
|
||||
private javax.swing.JPanel jPanel2;
|
||||
private javax.swing.JScrollPane jScrollPane2;
|
||||
private javax.swing.JPopupMenu.Separator jSeparator1;
|
||||
@ -946,13 +1015,12 @@ public class SeSimApplication extends javax.swing.JFrame {
|
||||
private javax.swing.JSplitPane jSplitPane4;
|
||||
private javax.swing.JSplitPane jSplitPane5;
|
||||
private javax.swing.JTextArea jTextArea1;
|
||||
private chart.MMChart mMChart2;
|
||||
private javax.swing.JMenuBar menuBar;
|
||||
private javax.swing.JMenuItem openMenuItem;
|
||||
private gui.orderbook.OrderBook orderBookNew1;
|
||||
private gui.orderbook.OrderBooksHorizontal orderBooksHorizontal1;
|
||||
private opensesim.gui.orderbook.OrderBook orderBookNew1;
|
||||
private opensesim.gui.orderbook.OrderBooksHorizontal orderBooksHorizontal1;
|
||||
private javax.swing.JMenuItem pasteMenuItem;
|
||||
private gui.orderbook.QuoteVertical quoteVertical1;
|
||||
private opensesim.gui.orderbook.QuoteVertical quoteVertical1;
|
||||
private javax.swing.JMenuItem resetToDefaultsMenuItem;
|
||||
private javax.swing.JButton runButton;
|
||||
private javax.swing.JMenuItem saveAsMenuItem;
|
||||
@ -961,7 +1029,7 @@ public class SeSimApplication extends javax.swing.JFrame {
|
||||
private javax.swing.JMenuItem simMenuPause;
|
||||
private javax.swing.JMenuItem simMenuStart;
|
||||
private javax.swing.JMenuItem simMenuStop;
|
||||
private gui.Statistics statistics1;
|
||||
private opensesim.gui.Statistics statistics1;
|
||||
private javax.swing.JButton stopButton;
|
||||
private javax.swing.JMenu viewMenu;
|
||||
private javax.swing.JCheckBoxMenuItem viewTraderListCheckBox;
|
@ -23,9 +23,9 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package gui;
|
||||
package opensesim.gui;
|
||||
|
||||
import chart.Help;
|
||||
import opensesim.chart.Help;
|
||||
import java.net.URL;
|
||||
import javax.help.HelpSet;
|
||||
import javax.help.JHelp;
|
@ -23,11 +23,11 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package gui;
|
||||
package opensesim.gui;
|
||||
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import sesim.Exchange;
|
||||
import opensesim.old_sesim.Exchange;
|
||||
|
||||
/**
|
||||
*
|
@ -23,11 +23,11 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package gui;
|
||||
package opensesim.gui;
|
||||
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import sesim.Scheduler;
|
||||
import opensesim.old_sesim.Scheduler;
|
||||
|
||||
/**
|
||||
*
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user