Compare commits
194 Commits
v0.01-pre-
...
master
Author | SHA1 | Date | |
---|---|---|---|
bc5ccd6356 | |||
8279033d74 | |||
2e1a53789f | |||
b084e0a156 | |||
2241822b26 | |||
d63ee05b5d | |||
27c08eee39 | |||
2443b984cf | |||
7359e15a54 | |||
8ab7c51101 | |||
9a4548ab35 | |||
9e1f1b8580 | |||
54ec792c13 | |||
97366b8335 | |||
9a88f42b7e | |||
|
f5552c7b5b | ||
|
703fe209b2 | ||
|
236138a822 | ||
|
8f35e767bd | ||
|
2d7feed929 | ||
a2e5143c64 | |||
|
b5c6d45f66 | ||
b193d69f52 | |||
fcdae01a8b | |||
|
0cedbbc3d4 | ||
|
3f43ff6f29 | ||
|
a1c1196ba1 | ||
|
0b62def911 | ||
|
0177510961 | ||
|
641285fafb | ||
|
215fb5e074 | ||
|
22e77665ee | ||
|
f7c2b6266e | ||
|
3a01f672eb | ||
|
3853beac19 | ||
|
d661de2892 | ||
|
6eb9ab8ff9 | ||
|
a9ad772112 | ||
|
e99aa62c59 | ||
|
401b6ce2f9 | ||
|
904b4a1016 | ||
|
844a57df27 | ||
|
b5cf77abbd | ||
|
ed07bd5819 | ||
|
cb01b886dc | ||
|
882c84adf2 | ||
|
54d4b5baee | ||
|
38901681ce | ||
|
6e86a45389 | ||
|
9fac7e41b7 | ||
|
9d5f60291f | ||
|
9f829b0554 | ||
|
3bbcd63da9 | ||
|
bebb0c1f12 | ||
|
500204819c | ||
|
0c5b7d5a02 | ||
|
f7601aea3a | ||
|
cadc910f99 | ||
|
7b73b8b836 | ||
|
ad83e00fd3 | ||
|
451c064268 | ||
|
5310b14863 | ||
|
f0c4d4f19c | ||
|
7f40700cc0 | ||
|
341a888d6f | ||
|
1336a7dbc5 | ||
|
20ed896486 | ||
|
361a4788a0 | ||
|
59e285a138 | ||
|
4b2f9dd378 | ||
|
370af3cf9e | ||
|
c9721ac5f5 | ||
|
b813d7ca2f | ||
|
3ae48deee6 | ||
|
ac22bc0870 | ||
|
3cc7940658 | ||
|
2eb3be4ce2 | ||
|
ab4a1035d2 | ||
|
bec4aa59a6 | ||
|
f02b887b8b | ||
|
bd2ec97f74 | ||
|
6a8c4c3404 | ||
|
cf3c810b7e | ||
|
d4e85d1410 | ||
|
55a583c147 | ||
|
4c6cc8d922 | ||
|
c208092452 | ||
|
974c1cb81e | ||
|
99fea69520 | ||
|
0397dc44a9 | ||
|
e2c15eff1c | ||
|
9009b8fd54 | ||
|
75443ebc79 | ||
|
51831c1f18 | ||
|
01c34d5cbb | ||
|
0c5e75a7a1 | ||
|
c56ed5abcd | ||
|
79fc3f303e | ||
|
17f6718659 | ||
|
5023b2ad7a | ||
|
ba03d4d292 | ||
|
2250a1e4eb | ||
|
06727072e4 | ||
|
6194018dbb | ||
|
1f07ccd611 | ||
|
e0fb0921e4 | ||
|
8d2ff5bb80 | ||
|
dca661c8f2 | ||
|
d127b99372 | ||
|
01a5551e69 | ||
|
830084d8f6 | ||
|
e1d04b23bd | ||
|
381940ecd3 | ||
|
bc687c9b88 | ||
|
36171e0872 | ||
d17d09df31 | |||
989643d7b1 | |||
57a4089051 | |||
9e80146597 | |||
e646b2f5de | |||
593169f77c | |||
12476c4021 | |||
102e80537c | |||
|
4b35c32845 | ||
|
e77f832045 | ||
2cf4780909 | |||
f22f8e2679 | |||
7e8aea627a | |||
14e80945fb | |||
89bd269b5e | |||
2e269b42d8 | |||
ad7ba1be01 | |||
0424dba1b6 | |||
4f17d06ee9 | |||
fb8295d3b1 | |||
648e9d5863 | |||
998dad7e66 | |||
918bc91e16 | |||
9008eed00b | |||
4011aa4846 | |||
fe7af043b7 | |||
254d57d834 | |||
f62a385eab | |||
70661d6711 | |||
df2c535bd4 | |||
8232759f8c | |||
f9fbc63763 | |||
571b8be7ee | |||
8dbe6cfe6d | |||
6d24eb67b9 | |||
137c6af75d | |||
98c42fb28a | |||
87f4d08155 | |||
f2bfaee5d7 | |||
e516770fca | |||
53bc93a15c | |||
ee5527a3de | |||
84c6718c8e | |||
5a30e4fde2 | |||
160dcb6b21 | |||
03fbd9cd25 | |||
6bb6d88371 | |||
5a19f801b3 | |||
5174e1d0c8 | |||
c30524b388 | |||
59998baa08 | |||
![]() |
6a964bcb5e | ||
7a707cd10c | |||
c426a5bb3e | |||
3fece7c044 | |||
0065490872 | |||
8766b5ab9d | |||
80df79cbd8 | |||
14f3db9b74 | |||
16ae53023f | |||
fdf09d651d | |||
1a7012ef66 | |||
cb555e6ec8 | |||
9694a0a5a2 | |||
8b2d383aba | |||
5c2921fa82 | |||
bdb7ae4992 | |||
abee1a8d36 | |||
f9949fa5ad | |||
044f23b338 | |||
aa8f17dcf4 | |||
e657777d56 | |||
22f96431fa | |||
ad697c39c9 | |||
c551988714 | |||
61a87f3a4d | |||
cde8670e97 | |||
bb18f7cf03 | |||
45684a9d0e |
3
.gitignore
vendored
3
.gitignore
vendored
@ -15,3 +15,6 @@ hs_err_pid*
|
||||
/target/
|
||||
/store/
|
||||
/nbproject/private
|
||||
|
||||
# Backup files
|
||||
*~
|
||||
|
@ -1,3 +1,3 @@
|
||||
# SeSim
|
||||
# OpenSeSim
|
||||
|
||||
SeSim - Sock Exchange Simulator
|
||||
OpenSeSim - Open Source Sock Exchange Simulator
|
54
build.xml
54
build.xml
@ -109,30 +109,30 @@
|
||||
-->
|
||||
|
||||
|
||||
<target name="single-jar" depends="jar">
|
||||
<property name="store.jar.name" value="SeSim"/>
|
||||
<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}"/>
|
||||
<delete dir="${store.dir}"/>
|
||||
<mkdir dir="${store.dir}"/>
|
||||
<jar destfile="${store.dir}/temp_final.jar" filesetmanifest="skip">
|
||||
<zipgroupfileset dir="dist" includes="*.jar"/>
|
||||
<zipgroupfileset dir="dist/lib" includes="*.jar"/>
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="${main.class}"/>
|
||||
</manifest>
|
||||
</jar>
|
||||
<zip destfile="${store.jar}">
|
||||
<zipfileset src="${store.dir}/temp_final.jar"
|
||||
excludes="META-INF/*.SF, META-INF/*.DSA, META-INF/*.RSA"/>
|
||||
</zip>
|
||||
<delete file="${store.dir}/temp_final.jar"/>
|
||||
</target>
|
||||
<target name="single-jar" depends="jar">
|
||||
<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}"/>
|
||||
<delete dir="${store.dir}"/>
|
||||
<mkdir dir="${store.dir}"/>
|
||||
<jar destfile="${store.dir}/temp_final.jar" filesetmanifest="skip">
|
||||
<zipgroupfileset dir="dist" includes="*.jar"/>
|
||||
<zipgroupfileset dir="dist/lib" includes="*.jar"/>
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="${main.class}"/>
|
||||
</manifest>
|
||||
</jar>
|
||||
<zip destfile="${store.jar}">
|
||||
<zipfileset src="${store.dir}/temp_final.jar"
|
||||
excludes="META-INF/*.SF, META-INF/*.DSA, META-INF/*.RSA"/>
|
||||
</zip>
|
||||
<delete file="${store.dir}/temp_final.jar"/>
|
||||
</target>
|
||||
|
||||
<property name="ivy.install.version" value="2.1.0-rc2" />
|
||||
<property name="ivy.install.version" value="2.5.0" />
|
||||
<condition property="ivy.home" value="${env.IVY_HOME}">
|
||||
<isset property="env.IVY_HOME" />
|
||||
<isset property="env.IVY_HOME" />
|
||||
</condition>
|
||||
<property name="ivy.home" value="${user.home}/.ant" />
|
||||
<property name="ivy.jar.dir" value="${ivy.home}/lib" />
|
||||
@ -142,15 +142,15 @@
|
||||
|
||||
<mkdir dir="${ivy.jar.dir}"/>
|
||||
<!-- download Ivy from web site so that it can be used even without any special installation -->
|
||||
<get src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
|
||||
<get src="https://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
|
||||
dest="${ivy.jar.file}" usetimestamp="true"/>
|
||||
</target>
|
||||
|
||||
<target name="init-ivy" depends="download-ivy">
|
||||
<!-- try to load ivy here from ivy home, in case the user has not already dropped
|
||||
it into ant's lib dir (note that the latter copy will always take precedence).
|
||||
We will not fail as long as local lib dir exists (it may be empty) and
|
||||
ivy is in at least one of ant's lib dir or the local lib dir. -->
|
||||
<!-- try to load ivy here from ivy home, in case the user has not already dropped
|
||||
it into ant's lib dir (note that the latter copy will always take precedence).
|
||||
We will not fail as long as local lib dir exists (it may be empty) and
|
||||
ivy is in at least one of ant's lib dir or the local lib dir. -->
|
||||
<path id="ivy.lib.path">
|
||||
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
|
||||
|
||||
|
8
ivy.xml
8
ivy.xml
@ -1,16 +1,18 @@
|
||||
<ivy-module version="2.0">
|
||||
|
||||
<info organisation="sesim" module="NewMDIApplication"/>
|
||||
<info organisation="opensesim" module="NewMDIApplication"/>
|
||||
<dependencies>
|
||||
<dependency org="commons-lang" name="commons-lang" rev="2.0"/>
|
||||
<dependency org="commons-cli" name="commons-cli" rev="1.0"/>
|
||||
<!-- <dependency org="commons-lang" name="commons-lang" rev="2.0"/> -->
|
||||
<!-- <dependency org="commons-cli" name="commons-cli" rev="1.0"/>-->
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.json/json -->
|
||||
<dependency org="org.json" name="json" rev="20160810"/>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/javax.help/javahelp -->
|
||||
<dependency org="javax.help" name="javahelp" rev="2.0.05"/>
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
</ivy-module>
|
||||
|
@ -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>
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +0,0 @@
|
||||
$label=Web Start
|
||||
$target.debug=jws-debug
|
||||
$target.run=jws-run
|
||||
compile.on.save.unsupported.javawebstart=true
|
@ -1,8 +1,8 @@
|
||||
build.xml.data.CRC32=fc4f97ad
|
||||
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
|
||||
build.xml.data.CRC32=fc4f97ad
|
||||
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=65c6cbee
|
||||
nbproject/build-impl.xml.script.CRC32=afd0a16a
|
||||
nbproject/build-impl.xml.stylesheet.CRC32=f89f7d21@1.95.0.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
|
||||
#Sat, 25 Jul 2020 03:07:19 +0200
|
||||
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,14 +52,18 @@ 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
|
||||
javadoc.encoding=${source.encoding}
|
||||
javadoc.html5=false
|
||||
javadoc.noindex=false
|
||||
javadoc.nonavbar=false
|
||||
javadoc.notree=false
|
||||
@ -57,10 +72,13 @@ javadoc.splitindex=true
|
||||
javadoc.use=true
|
||||
javadoc.version=false
|
||||
javadoc.windowtitle=
|
||||
jlink.launcher=false
|
||||
jlink.launcher.name=OpenSeSim
|
||||
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 +87,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,9 +107,11 @@ 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
|
||||
ivy.home=/usr/share/java
|
||||
ivy.classpath=lib/commons-cli-1.0-javadoc.jar\:lib/commons-cli-1.0-sources.jar\:lib/commons-cli-1.0.jar\:lib/commons-lang-2.0-javadoc.jar\:lib/commons-lang-2.0-sources.jar\:lib/commons-lang-2.0.jar\:lib/commons-logging-1.0.jar\:lib/javahelp-2.0.05-javadoc.jar\:lib/javahelp-2.0.05-sources.jar\:lib/javahelp-2.0.05.jar\:lib/json-20160810-javadoc.jar\:lib/json-20160810-sources.jar\:lib/json-20160810.jar
|
||||
ivy.classpath=lib/accessors-smart-1.1.jar\:lib/asm-5.0.3.jar\:lib/hamcrest-core-1.3.jar\:lib/javahelp-2.0.05-javadoc.jar\:lib/javahelp-2.0.05-sources.jar\:lib/javahelp-2.0.05.jar\:lib/json-20160810-javadoc.jar\:lib/json-20160810-sources.jar\:lib/json-20160810.jar\:lib/json-path-2.1.0.jar\:lib/json-smart-2.2.jar\:lib/junit-4.12.jar\:lib/mockito-core-1.9.5.jar\:lib/objenesis-1.0.jar\:lib/slf4j-api-1.7.13.jar
|
||||
|
@ -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,268 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 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 gui;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.nio.file.Files;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.TreeMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.prefs.Preferences;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.UIManager;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
import sesim.AutoTraderInterface;
|
||||
import sesim.AutoTraderLoader;
|
||||
import sesim.Indicator;
|
||||
import sesim.IndicatorLoader;
|
||||
import sesim.SeSimClassLoader;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 7u83 <7u83@mail.ru>
|
||||
*/
|
||||
public class Globals {
|
||||
|
||||
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 interface CfgListener {
|
||||
|
||||
void cfgChanged();
|
||||
}
|
||||
|
||||
static ArrayList<CfgListener> cfg_listeners = new ArrayList<>();
|
||||
|
||||
public static void notifyCfgListeners() {
|
||||
for (CfgListener l : cfg_listeners) {
|
||||
l.cfgChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public static void addCfgListener(CfgListener l) {
|
||||
cfg_listeners.add(l);
|
||||
}
|
||||
|
||||
public static JFrame frame;
|
||||
|
||||
// static final String STRATEGYPREFS = "Strategies";
|
||||
// static final String TRADERPREFS = "Traders";
|
||||
static final String DEVELSTATUS = "devel_status";
|
||||
public static final String GODMODE = "godmode";
|
||||
|
||||
static public sesim.Exchange se;
|
||||
|
||||
/**
|
||||
* Defines keys for preferences
|
||||
*/
|
||||
public static final class PrefKeys {
|
||||
|
||||
public static String WORKDIR = "workdir";
|
||||
public static final String CURRENTFILE = "currentfile";
|
||||
|
||||
public static final String SESIMVERSION = "version";
|
||||
public static final String STRATEGIES = "strategies";
|
||||
public static final String TRADERS = "traders";
|
||||
|
||||
}
|
||||
|
||||
static public Preferences prefs;
|
||||
|
||||
public static class CfgStrings {
|
||||
|
||||
public static final String GODMODE = "godmode";
|
||||
}
|
||||
|
||||
public static String DEFAULT_EXCHANGE_CFG
|
||||
= "{"
|
||||
+ " money_decimals: 2,"
|
||||
+ " 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) {
|
||||
}
|
||||
|
||||
UIManager.LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels();
|
||||
for (UIManager.LookAndFeelInfo lafInfo1 : lafInfo) {
|
||||
if (lafInfo1.getName().equals(selected)) {
|
||||
String lafClassName = lafInfo1.getClassName();
|
||||
try {
|
||||
UIManager.setLookAndFeel(lafClassName);
|
||||
// UIManager.setLookAndFeel("com.seaglasslookandfeel.SeaGlassLookAndFeel");
|
||||
break;
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static AutoTraderLoader tloader;
|
||||
static IndicatorLoader iloader;
|
||||
|
||||
static void initGlobals() {
|
||||
ArrayList default_pathlist = new ArrayList<>();
|
||||
String default_path = new java.io.File(SeSimApplication.class.getProtectionDomain()
|
||||
.getCodeSource()
|
||||
.getLocation()
|
||||
.getPath()).toString();
|
||||
|
||||
default_pathlist.add(default_path);
|
||||
tloader = new AutoTraderLoader(default_pathlist);
|
||||
|
||||
iloader = new IndicatorLoader(default_pathlist);
|
||||
|
||||
iloader.getNames();
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
static public final JSONObject getStrategies() {
|
||||
String cfglist = Globals.prefs.get(PrefKeys.STRATEGIES, "{}");
|
||||
JSONObject cfgs = new JSONObject(cfglist);
|
||||
return cfgs;
|
||||
}
|
||||
|
||||
static public final void putStrategies(JSONObject strategies) {
|
||||
Globals.prefs.put(Globals.PrefKeys.STRATEGIES, strategies.toString());
|
||||
}
|
||||
|
||||
static public final void putTraders(JSONArray traders) {
|
||||
Globals.prefs.put(Globals.PrefKeys.TRADERS, traders.toString());
|
||||
}
|
||||
|
||||
static public JSONObject getStrategy(String name) {
|
||||
return getStrategies().getJSONObject(name);
|
||||
}
|
||||
|
||||
static public void getStrategiesIntoComboBox(JComboBox comboBox) {
|
||||
TreeMap stm = getStrategiesAsTreeMap();
|
||||
comboBox.removeAllItems();
|
||||
|
||||
Iterator<String> i = stm.keySet().iterator();
|
||||
while (i.hasNext()) {
|
||||
comboBox.addItem(i.next());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static public TreeMap getStrategiesAsTreeMap() {
|
||||
TreeMap strategies = new TreeMap();
|
||||
JSONObject cfgs = Globals.getStrategies();
|
||||
|
||||
Iterator<String> i = cfgs.keys();
|
||||
while (i.hasNext()) {
|
||||
String k = i.next();
|
||||
JSONObject o = cfgs.getJSONObject(k);
|
||||
strategies.put(k, o);
|
||||
}
|
||||
return strategies;
|
||||
}
|
||||
|
||||
static public final void saveStrategy(String name, JSONObject cfg) {
|
||||
JSONObject cfgs = getStrategies();
|
||||
cfgs.put(name, cfg);
|
||||
prefs.put(PrefKeys.STRATEGIES, cfgs.toString());
|
||||
}
|
||||
|
||||
public static void saveFile(File f) throws FileNotFoundException {
|
||||
|
||||
JSONObject sobj = new JSONObject();
|
||||
|
||||
JSONArray traders = getTraders();
|
||||
JSONObject strategies = getStrategies();
|
||||
|
||||
sobj.put(PrefKeys.SESIMVERSION, SESIM_FILEVERSION);
|
||||
sobj.put(PrefKeys.STRATEGIES, strategies);
|
||||
sobj.put(PrefKeys.TRADERS, traders);
|
||||
|
||||
PrintWriter out;
|
||||
out = new PrintWriter(f.getAbsolutePath());
|
||||
out.print(sobj.toString(4));
|
||||
out.close();
|
||||
|
||||
}
|
||||
|
||||
public static void loadString(String s) throws IOException {
|
||||
JSONObject sobj = new JSONObject(s);
|
||||
|
||||
Double version = sobj.getDouble(PrefKeys.SESIMVERSION);
|
||||
if (version > SESIM_FILEVERSION) {
|
||||
throw new IOException("File has wrong version.");
|
||||
}
|
||||
|
||||
JSONArray traders = sobj.getJSONArray(PrefKeys.TRADERS);
|
||||
JSONObject strategies = sobj.getJSONObject(PrefKeys.STRATEGIES);
|
||||
|
||||
putStrategies(strategies);
|
||||
putTraders(traders);
|
||||
|
||||
}
|
||||
|
||||
public static void clearAll() {
|
||||
putStrategies(new JSONObject());
|
||||
putTraders(new JSONArray());
|
||||
}
|
||||
|
||||
public static void loadFile(File f) throws IOException {
|
||||
|
||||
f.getAbsoluteFile();
|
||||
String s;
|
||||
s = new String(Files.readAllBytes(f.toPath()));
|
||||
|
||||
loadString(s);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -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>
|
@ -1,69 +0,0 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package gui;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 7u83 <7u83@mail.ru>
|
||||
*/
|
||||
public class jp99 extends javax.swing.JPanel {
|
||||
|
||||
/**
|
||||
* Creates new form jp99
|
||||
*/
|
||||
public jp99() {
|
||||
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() {
|
||||
|
||||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
chart11 = new sesim.ChartPanel();
|
||||
|
||||
javax.swing.GroupLayout chart11Layout = new javax.swing.GroupLayout(chart11);
|
||||
chart11.setLayout(chart11Layout);
|
||||
chart11Layout.setHorizontalGroup(
|
||||
chart11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 382, Short.MAX_VALUE)
|
||||
);
|
||||
chart11Layout.setVerticalGroup(
|
||||
chart11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 282, Short.MAX_VALUE)
|
||||
);
|
||||
|
||||
jScrollPane1.setViewportView(chart11);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 388, Short.MAX_VALUE)
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 288, Short.MAX_VALUE)
|
||||
.addContainerGap())
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private sesim.ChartPanel chart11;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
@ -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">
|
||||
@ -142,4 +142,4 @@
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
</Form>
|
@ -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");
|
||||
@ -363,19 +363,19 @@ public class MasterChart extends javax.swing.JPanel implements QuoteReceiver {
|
||||
}//GEN-LAST:event_chartMouseMoved
|
||||
|
||||
private void chartMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_chartMousePressed
|
||||
System.out.printf("Mauspress\n");
|
||||
// System.out.printf("Mauspress\n");
|
||||
this.formMousePressed(evt);
|
||||
}//GEN-LAST:event_chartMousePressed
|
||||
|
||||
|
||||
// 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,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;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -49,7 +49,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 +115,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;
|
||||
|
||||
/**
|
||||
*
|
54
src/opensesim/cli/Main.java
Normal file
54
src/opensesim/cli/Main.java
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2020, tube
|
||||
* 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.cli;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Scanner;
|
||||
import opensesim.world.GodWorld;
|
||||
import opensesim.world.World;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author tube
|
||||
*/
|
||||
public class Main {
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
System.out.println("OpenSeSim Cli");
|
||||
|
||||
InputStream is;
|
||||
is = Main.class.getResourceAsStream(
|
||||
"/opensesim/resources/files/example.json"
|
||||
);
|
||||
|
||||
// We have to bootstrap with a god world because
|
||||
// there whould be no way to initialize the world
|
||||
GodWorld godworld = new GodWorld(is);
|
||||
|
||||
System.out.println("finished");
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
||||
|
||||
/**
|
78
src/opensesim/gui/AssetEditor/AssetEditorDialog.form
Normal file
78
src/opensesim/gui/AssetEditor/AssetEditorDialog.form
Normal file
@ -0,0 +1,78 @@
|
||||
<?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 Asset"/>
|
||||
<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="0" 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" 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" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="73" max="32767" 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>
|
336
src/opensesim/gui/AssetEditor/AssetEditorDialog.java
Normal file
336
src/opensesim/gui/AssetEditor/AssetEditorDialog.java
Normal file
@ -0,0 +1,336 @@
|
||||
/*
|
||||
* 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.Window;
|
||||
|
||||
import opensesim.world.AbstractAsset;
|
||||
|
||||
import opensesim.gui.util.EscDialog;
|
||||
import opensesim.gui.util.Json;
|
||||
import opensesim.world.GodWorld;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 7u83 <7u83@mail.ru>
|
||||
*/
|
||||
public class AssetEditorDialog extends EscDialog {
|
||||
|
||||
GodWorld godworld;
|
||||
|
||||
|
||||
/**
|
||||
* Creates new form CreateAssetDialog
|
||||
*/
|
||||
public AssetEditorDialog(Dialog parent, AbstractAsset asset) {
|
||||
|
||||
super(parent, true);
|
||||
initComponents();
|
||||
|
||||
}
|
||||
|
||||
public AssetEditorDialog(Window parent) {
|
||||
super(parent, true);
|
||||
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() {
|
||||
|
||||
cancelButton = new javax.swing.JButton();
|
||||
okButton = new javax.swing.JButton();
|
||||
assetEditorPanel = new opensesim.gui.AssetEditor.AssetEditorPanel();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
setTitle("Edit Asset");
|
||||
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(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, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(assetEditorPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 73, Short.MAX_VALUE)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(cancelButton)
|
||||
.addComponent(okButton))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
|
||||
private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
|
||||
|
||||
if (assetEditorPanel.save(godworld)){
|
||||
dispose();
|
||||
}
|
||||
godworld.notifyUpdateListeners();
|
||||
return;
|
||||
|
||||
|
||||
/*
|
||||
JSONObject result = Json.get(assetEditorPanel);
|
||||
System.out.printf("JSON: %s\n", result.toString(5));
|
||||
JSONObject all = Globals.getAssets();
|
||||
all.put(result.getString("symbol"), result);
|
||||
Globals.putAssets(all);
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* 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());
|
||||
|
||||
|
||||
} 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());
|
||||
*/
|
||||
|
||||
}//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 boolean runDialog(Window parent, GodWorld worldadm, JSONObject o, JSONObject old) {
|
||||
|
||||
AssetEditorDialog d = new AssetEditorDialog(parent);
|
||||
d.godworld = worldadm;
|
||||
|
||||
|
||||
if (o!=null)
|
||||
Json.put(d.assetEditorPanel, o);
|
||||
d.pack();
|
||||
d.revalidate();
|
||||
d.setLocationRelativeTo(parent);
|
||||
d.setVisible(true);
|
||||
d.dispose();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
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);
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
// disable auto detection
|
||||
mapper.disable(MapperFeature.AUTO_DETECT_CREATORS,
|
||||
MapperFeature.AUTO_DETECT_FIELDS,
|
||||
MapperFeature.AUTO_DETECT_GETTERS,
|
||||
MapperFeature.AUTO_DETECT_IS_GETTERS);
|
||||
// if you want to prevent an exception when classes have no annotated properties
|
||||
mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
|
||||
|
||||
String vs;
|
||||
try {
|
||||
|
||||
vs = mapper.writeValueAsString(dialog.assetEditorPanel);
|
||||
System.out.print(vs);
|
||||
} catch (JsonProcessingException ex) {
|
||||
Logger.getLogger(AssetEditorDialog.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
ObjectNode n = mapper.valueToTree(dialog.assetEditorPanel);
|
||||
|
||||
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
|
||||
}
|
171
src/opensesim/gui/AssetEditor/AssetEditorPanel.form
Normal file
171
src/opensesim/gui/AssetEditor/AssetEditorPanel.form
Normal file
@ -0,0 +1,171 @@
|
||||
<?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>
|
||||
<Property name="enabled" type="boolean" value="false"/>
|
||||
</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">
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="symFieldActionPerformed"/>
|
||||
</Events>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_DeclarationPre" type="java.lang.String" value="@Export("symbol")
@Import("symbol")"/>
|
||||
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
|
||||
</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_DeclarationPre" type="java.lang.String" value="@Import("name")
@Export("name")"/>
|
||||
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="1"/>
|
||||
</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>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<EmptySpace min="0" pref="25" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
340
src/opensesim/gui/AssetEditor/AssetEditorPanel.java
Normal file
340
src/opensesim/gui/AssetEditor/AssetEditorPanel.java
Normal file
@ -0,0 +1,340 @@
|
||||
/*
|
||||
* 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.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
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.world.AbstractAsset;
|
||||
import opensesim.gui.Globals;
|
||||
import static opensesim.gui.Globals.world;
|
||||
import opensesim.gui.util.Json;
|
||||
import opensesim.gui.util.Json.Export;
|
||||
import opensesim.gui.util.Json.Import;
|
||||
import opensesim.util.SeSimException;
|
||||
import opensesim.world.GodWorld;
|
||||
import opensesim.world.RealWorld;
|
||||
import opensesim.world.World;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 7u83 <7u83@mail.ru>
|
||||
*/
|
||||
public class AssetEditorPanel extends javax.swing.JPanel {
|
||||
|
||||
ArrayList<Class<AbstractAsset>> asset_types;
|
||||
|
||||
/**
|
||||
* Creates new form AssetEditor
|
||||
*/
|
||||
public AssetEditorPanel() {
|
||||
super();
|
||||
asset_types = Globals.getAvailableAssetsTypes(true);
|
||||
|
||||
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());
|
||||
decimalsField.getModel().setValue(asset.getDecimals());
|
||||
|
||||
}
|
||||
|
||||
/* public String getNameField() {
|
||||
return nameField.getText();
|
||||
}
|
||||
|
||||
public String getSymField() {
|
||||
return symField.getText();
|
||||
}
|
||||
|
||||
public void putType(String type) {
|
||||
System.out.printf("Here we have a type: %s\n", type);
|
||||
}
|
||||
*/
|
||||
public JDialog dialog;
|
||||
|
||||
ComboBoxModel getComboBoxModel() {
|
||||
ArrayList vector = new ArrayList();
|
||||
int i;
|
||||
for (i = 0; i < asset_types.size(); i++) {
|
||||
AbstractAsset ait;
|
||||
Class<AbstractAsset> asset_type = asset_types.get(i);
|
||||
|
||||
// try {
|
||||
// ait = asset_type.newInstance();
|
||||
// vector.add(i, ait.getTypeName());
|
||||
|
||||
vector.add(i,GodWorld.getTypeName(asset_type));
|
||||
|
||||
// } 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();
|
||||
|
||||
jLabel1.setText("Symbol:");
|
||||
|
||||
assetTypesComboBox.setModel(getComboBoxModel());
|
||||
assetTypesComboBox.setEnabled(false);
|
||||
assetTypesComboBox.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
assetTypesComboBoxActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jLabel2.setText("Type:");
|
||||
|
||||
symField.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
symFieldActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
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));
|
||||
|
||||
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)
|
||||
);
|
||||
defaultGuiPanelLayout.setVerticalGroup(
|
||||
defaultGuiPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGap(0, 25, 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
|
||||
|
||||
@Export("decimals")
|
||||
public String getDecimals() {
|
||||
return decimalsField.getValue().toString();
|
||||
}
|
||||
|
||||
@Import("decimals")
|
||||
public void setDecimals(String d) {
|
||||
decimalsField.setValue(Integer.parseInt(d));
|
||||
}
|
||||
|
||||
@Export(GodWorld.JKEYS.ASSET_TYPE)
|
||||
public String getType() {
|
||||
int selected = assetTypesComboBox.getSelectedIndex();
|
||||
//return asset_types.get(selected).getName();
|
||||
return this.type;
|
||||
}
|
||||
|
||||
String type;
|
||||
|
||||
@Import(GodWorld.JKEYS.ASSET_TYPE)
|
||||
public void setType(String type) {
|
||||
this.type=type;
|
||||
|
||||
Class<AbstractAsset> ac = (Class<AbstractAsset>) Globals.getClassByName(type);
|
||||
if (ac == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
AbstractAsset a;
|
||||
|
||||
try {
|
||||
a = ac.getConstructor(GodWorld.class, JSONObject.class).newInstance(null, null);
|
||||
} catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException 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);
|
||||
}
|
||||
|
||||
for (int i = 0; i < asset_types.size(); i++) {
|
||||
if (asset_types.get(i).getName().equals(type)) {
|
||||
assetTypesComboBox.setSelectedIndex(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean save(GodWorld worldadm ){
|
||||
JSONObject jo = Json.get(this);
|
||||
|
||||
|
||||
|
||||
if (jo.getString(GodWorld.JKEYS.ASSET_SYMBOL).length()==0){
|
||||
javax.swing.JOptionPane.showMessageDialog(this, "Symbol must not be empty.",
|
||||
"Error",
|
||||
javax.swing.JOptionPane.ERROR_MESSAGE);
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
worldadm.createAsset(jo);
|
||||
} catch (SeSimException ex) {
|
||||
javax.swing.JOptionPane.showMessageDialog(this, ex.getMessage(),
|
||||
"Error",
|
||||
javax.swing.JOptionPane.ERROR_MESSAGE);
|
||||
return false;
|
||||
}
|
||||
|
||||
System.out.printf("JO: %s\n",jo);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void assetTypesComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_assetTypesComboBoxActionPerformed
|
||||
|
||||
int i = this.assetTypesComboBox.getSelectedIndex();
|
||||
setType(asset_types.get(i).getName());
|
||||
revalidate();
|
||||
repaint();
|
||||
return;
|
||||
|
||||
}//GEN-LAST:event_assetTypesComboBoxActionPerformed
|
||||
|
||||
private void symFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_symFieldActionPerformed
|
||||
// TODO add your handling code here:
|
||||
}//GEN-LAST:event_symFieldActionPerformed
|
||||
|
||||
|
||||
// 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;
|
||||
@Import("name")
|
||||
@Export("name")
|
||||
public opensesim.gui.util.JTextFieldLimit nameField;
|
||||
@Export("symbol")
|
||||
@Import("symbol")
|
||||
public opensesim.gui.util.JTextFieldLimit symField;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
106
src/opensesim/gui/AssetEditor/AssetListDialog.form
Normal file
106
src/opensesim/gui/AssetEditor/AssetListDialog.form
Normal file
@ -0,0 +1,106 @@
|
||||
<?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="0" max="32767" attributes="0"/>
|
||||
<Component id="deleteButton" 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="doneButton" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="assetListPanel" 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="assetListPanel" 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="doneButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="deleteButton" 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="doneButton">
|
||||
<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="doneButtonActionPerformed"/>
|
||||
</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="deleteButton">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Delete"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="deleteButtonActionPerformed"/>
|
||||
</Events>
|
||||
</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="assetListPanel">
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new opensesim.gui.AssetEditor.AssetListPanel(worldadm)"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
262
src/opensesim/gui/AssetEditor/AssetListDialog.java
Normal file
262
src/opensesim/gui/AssetEditor/AssetListDialog.java
Normal file
@ -0,0 +1,262 @@
|
||||
/*
|
||||
* 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.Window;
|
||||
import java.awt.event.MouseEvent;
|
||||
import opensesim.gui.Globals;
|
||||
import opensesim.gui.util.EscDialog;
|
||||
import opensesim.world.GodWorld;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 7u83 <7u83@mail.ru>
|
||||
*/
|
||||
public class AssetListDialog extends EscDialog {
|
||||
|
||||
GodWorld worldadm;
|
||||
|
||||
/**
|
||||
* Creates new form EditAssetsDialog
|
||||
*/
|
||||
public AssetListDialog(Window parent, boolean modal) {
|
||||
super(parent, modal);
|
||||
initComponents();
|
||||
|
||||
java.awt.event.MouseAdapter l = new java.awt.event.MouseAdapter() {
|
||||
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
if (e.getClickCount() == 2) {
|
||||
doEdit();
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
this.assetListPanel.assetTable.addMouseListener(l);
|
||||
}
|
||||
|
||||
public AssetListDialog(GodWorld worldadm, Window parent, boolean modal) {
|
||||
super(parent, modal);
|
||||
this.worldadm = worldadm;
|
||||
|
||||
initComponents();
|
||||
|
||||
java.awt.event.MouseAdapter l = new java.awt.event.MouseAdapter() {
|
||||
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
if (e.getClickCount() == 2) {
|
||||
doEdit();
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
this.assetListPanel.assetTable.addMouseListener(l);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 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() {
|
||||
|
||||
doneButton = new javax.swing.JButton();
|
||||
newButton = new javax.swing.JButton();
|
||||
deleteButton = new javax.swing.JButton();
|
||||
editButton = new javax.swing.JButton();
|
||||
assetListPanel = new opensesim.gui.AssetEditor.AssetListPanel(worldadm);
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
setTitle("Edit Assets");
|
||||
setModal(true);
|
||||
|
||||
doneButton.setText("Done");
|
||||
doneButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
doneButtonActionPerformed(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);
|
||||
}
|
||||
});
|
||||
|
||||
deleteButton.setText("Delete");
|
||||
deleteButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
deleteButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
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, 0, Short.MAX_VALUE)
|
||||
.addComponent(deleteButton)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(editButton)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(newButton)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(doneButton))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(assetListPanel, 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(assetListPanel, 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(doneButton)
|
||||
.addComponent(deleteButton)
|
||||
.addComponent(editButton))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void newButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newButtonActionPerformed
|
||||
String type = SelectAssetTypeDialog.runDialog(this);
|
||||
if (type == null) {
|
||||
return;
|
||||
}
|
||||
JSONObject o = new JSONObject();
|
||||
o.put(GodWorld.JKEYS.ASSET_TYPE, type);
|
||||
|
||||
AssetEditorDialog.runDialog(this, worldadm, o, null);
|
||||
assetListPanel.reload();
|
||||
|
||||
|
||||
|
||||
}//GEN-LAST:event_newButtonActionPerformed
|
||||
|
||||
private void doneButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_doneButtonActionPerformed
|
||||
dispose();
|
||||
|
||||
JSONObject o = worldadm.getJson();
|
||||
Globals.prefs.put("world", o.toString());
|
||||
}//GEN-LAST:event_doneButtonActionPerformed
|
||||
|
||||
private void doEdit() {
|
||||
JSONObject o = assetListPanel.getSelectedObject();
|
||||
AssetEditorDialog.runDialog(this, worldadm, o, o);
|
||||
assetListPanel.reload();
|
||||
}
|
||||
|
||||
private void editButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editButtonActionPerformed
|
||||
|
||||
doEdit();
|
||||
|
||||
|
||||
}//GEN-LAST:event_editButtonActionPerformed
|
||||
|
||||
private void deleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteButtonActionPerformed
|
||||
JSONObject o = assetListPanel.getSelectedObject();
|
||||
JSONObject ass = Globals.getAssets();
|
||||
ass.remove(o.getString(GodWorld.JKEYS.ASSET_SYMBOL));
|
||||
Globals.putAssets(ass);
|
||||
assetListPanel.reload();
|
||||
}//GEN-LAST:event_deleteButtonActionPerformed
|
||||
|
||||
/**
|
||||
* @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 assetListPanel;
|
||||
private javax.swing.JButton deleteButton;
|
||||
private javax.swing.JButton doneButton;
|
||||
private javax.swing.JButton editButton;
|
||||
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="assetTable">
|
||||
<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>
|
175
src/opensesim/gui/AssetEditor/AssetListPanel.java
Normal file
175
src/opensesim/gui/AssetEditor/AssetListPanel.java
Normal file
@ -0,0 +1,175 @@
|
||||
/*
|
||||
* 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.lang.reflect.InvocationTargetException;
|
||||
import java.util.Collection;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import javax.swing.table.TableModel;
|
||||
import opensesim.world.AbstractAsset;
|
||||
import opensesim.world.RealWorld;
|
||||
import opensesim.gui.Globals;
|
||||
import opensesim.world.GodWorld;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 7u83 <7u83@mail.ru>
|
||||
*/
|
||||
public class AssetListPanel extends javax.swing.JPanel implements GuiSelectionList {
|
||||
|
||||
GodWorld worldadm;
|
||||
|
||||
/**
|
||||
* Creates new form AssetList
|
||||
*/
|
||||
public AssetListPanel() {
|
||||
|
||||
initComponents();
|
||||
|
||||
if (Globals.prefs == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
assetTable.setRowSelectionAllowed(true);
|
||||
|
||||
assetTable.getColumnModel().getColumn(0).setPreferredWidth(30);
|
||||
assetTable.getColumnModel().getColumn(1).setPreferredWidth(250);
|
||||
assetTable.getColumnModel().getColumn(2).setPreferredWidth(80);
|
||||
}
|
||||
|
||||
public AssetListPanel(GodWorld worldadm) {
|
||||
|
||||
this();
|
||||
this.worldadm = worldadm;
|
||||
reload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getSelectedObject() {
|
||||
int row = assetTable.getSelectedRow();
|
||||
String symbol = (String) assetTable.getValueAt(row, 0);
|
||||
return worldadm.getAssetBySymbol(symbol).getJson();
|
||||
}
|
||||
|
||||
final void reload() {
|
||||
|
||||
Collection<AbstractAsset> assets;
|
||||
assets = worldadm.getAssetCollection();
|
||||
DefaultTableModel m = (DefaultTableModel) assetTable.getModel();
|
||||
m.setRowCount(0);
|
||||
for (AbstractAsset asset : assets) {
|
||||
JSONObject o;
|
||||
o = asset.getJson();
|
||||
if (o == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Class<AbstractAsset> a = Globals.getClassByName(o.optString("type"));
|
||||
String type_name;
|
||||
|
||||
try {
|
||||
type_name = a.getConstructor(GodWorld.class, JSONObject.class).newInstance(null, null).getTypeName();
|
||||
|
||||
} catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
|
||||
Logger.getLogger(AssetListPanel.class.getName()).log(Level.SEVERE, null, ex);
|
||||
continue;
|
||||
}
|
||||
m.addRow(new Object[]{
|
||||
o.opt("symbol"),
|
||||
o.opt("name"),
|
||||
type_name
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private 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[]{"Symbol", "Name", "Type"}, 0
|
||||
);
|
||||
|
||||
assetTable.setAutoCreateRowSorter(true);
|
||||
assetTable.getTableHeader().setReorderingAllowed(false);
|
||||
return model;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 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();
|
||||
assetTable = new javax.swing.JTable();
|
||||
|
||||
assetTable.setModel(getModel());
|
||||
assetTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
|
||||
jScrollPane1.setViewportView(assetTable);
|
||||
|
||||
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 assetTable;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
36
src/opensesim/gui/AssetEditor/GuiSelectionList.java
Normal file
36
src/opensesim/gui/AssetEditor/GuiSelectionList.java
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* 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 org.json.JSONObject;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 7u83 <7u83@mail.ru>
|
||||
*/
|
||||
public interface GuiSelectionList {
|
||||
JSONObject getSelectedObject();
|
||||
}
|
@ -3,6 +3,7 @@
|
||||
<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="Select Asset Type to create"/>
|
||||
</Properties>
|
||||
<SyntheticProperties>
|
||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
||||
@ -26,25 +27,16 @@
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="80" 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"/>
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="0" pref="158" 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" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="godmodeCheckBox" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jDevleopmentFeaturesCheckBox" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="assetTypeComboBox" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
@ -53,20 +45,15 @@
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="lafComboBox" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="assetTypeComboBox" 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"/>
|
||||
<Component id="godmodeCheckBox" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jDevleopmentFeaturesCheckBox" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="188" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="31" 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"/>
|
||||
<Component id="okButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
@ -75,64 +62,35 @@
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JComboBox" name="lafComboBox">
|
||||
<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>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="lafComboBoxActionPerformed"/>
|
||||
</Events>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="cancelButton">
|
||||
<Properties>
|
||||
<Property name="mnemonic" type="int" value="99"/>
|
||||
<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="applyButton">
|
||||
<Properties>
|
||||
<Property name="mnemonic" type="int" value="97"/>
|
||||
<Property name="text" type="java.lang.String" value="Apply"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="applyButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="okButton">
|
||||
<Properties>
|
||||
<Property name="mnemonic" type="int" value="111"/>
|
||||
<Property name="text" type="java.lang.String" value="Ok"/>
|
||||
<Property name="text" type="java.lang.String" value="Create ..."/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="okButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JComboBox" name="assetTypeComboBox">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||
<Connection code="getComboBoxModel()" type="code"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Look and Feel:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JCheckBox" name="jDevleopmentFeaturesCheckBox">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Develeopment"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JCheckBox" name="godmodeCheckBox">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Godmode"/>
|
||||
<Property name="text" type="java.lang.String" value="Type:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
214
src/opensesim/gui/AssetEditor/SelectAssetTypeDialog.java
Normal file
214
src/opensesim/gui/AssetEditor/SelectAssetTypeDialog.java
Normal file
@ -0,0 +1,214 @@
|
||||
/*
|
||||
* 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.Window;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.ComboBoxModel;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import opensesim.world.AbstractAsset;
|
||||
import opensesim.gui.Globals;
|
||||
import opensesim.gui.util.EscDialog;
|
||||
import opensesim.world.GodWorld;
|
||||
import opensesim.world.RealWorld;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 7u83 <7u83@mail.ru>
|
||||
*/
|
||||
public class SelectAssetTypeDialog extends EscDialog {
|
||||
|
||||
ArrayList<Class<AbstractAsset>> asset_types;
|
||||
|
||||
/**
|
||||
* Creates new form SelectAssetTypeDialog
|
||||
*/
|
||||
public SelectAssetTypeDialog(Window parent, boolean modal) {
|
||||
super(parent, modal);
|
||||
asset_types = Globals.getAvailableAssetsTypes(true);
|
||||
initComponents();
|
||||
|
||||
}
|
||||
|
||||
ComboBoxModel getComboBoxModel() {
|
||||
ArrayList vector = new ArrayList(asset_types.size()+1);
|
||||
int i;
|
||||
for (i = 0; i < asset_types.size(); i++) {
|
||||
AbstractAsset ait;
|
||||
Class<AbstractAsset> asset_type = asset_types.get(i);
|
||||
System.out.printf("ACL: %s\n", asset_type.getName());
|
||||
|
||||
String tn = GodWorld.getTypeName(asset_type);
|
||||
vector.add(i, tn);
|
||||
|
||||
}
|
||||
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() {
|
||||
|
||||
cancelButton = new javax.swing.JButton();
|
||||
okButton = new javax.swing.JButton();
|
||||
assetTypeComboBox = new javax.swing.JComboBox<>();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
setTitle("Select Asset Type to create");
|
||||
|
||||
cancelButton.setText("Cancel");
|
||||
cancelButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
cancelButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
okButton.setText("Create ...");
|
||||
okButton.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
okButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
assetTypeComboBox.setModel(getComboBoxModel());
|
||||
|
||||
jLabel1.setText("Type:");
|
||||
|
||||
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(layout.createSequentialGroup()
|
||||
.addGap(0, 158, Short.MAX_VALUE)
|
||||
.addComponent(okButton)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(cancelButton))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(jLabel1)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(assetTypeComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(assetTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel1))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 31, Short.MAX_VALUE)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(cancelButton)
|
||||
.addComponent(okButton))
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
String selected = null;
|
||||
|
||||
private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
|
||||
int i = this.assetTypeComboBox.getSelectedIndex();
|
||||
selected = asset_types.get(i).getName();
|
||||
dispose();
|
||||
}//GEN-LAST:event_okButtonActionPerformed
|
||||
|
||||
private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
|
||||
dispose();
|
||||
}//GEN-LAST:event_cancelButtonActionPerformed
|
||||
|
||||
public static String runDialog(Window parent) {
|
||||
SelectAssetTypeDialog dialog;
|
||||
dialog = new SelectAssetTypeDialog(parent, true);
|
||||
dialog.setLocationRelativeTo(parent);
|
||||
dialog.setVisible(true);
|
||||
return dialog.selected;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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(SelectAssetTypeDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (InstantiationException ex) {
|
||||
java.util.logging.Logger.getLogger(SelectAssetTypeDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (IllegalAccessException ex) {
|
||||
java.util.logging.Logger.getLogger(SelectAssetTypeDialog.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
||||
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
|
||||
java.util.logging.Logger.getLogger(SelectAssetTypeDialog.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() {
|
||||
SelectAssetTypeDialog dialog = new SelectAssetTypeDialog(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 javax.swing.JComboBox<String> assetTypeComboBox;
|
||||
private javax.swing.JButton cancelButton;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JButton okButton;
|
||||
// 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.world.AbstractAsset;
|
||||
import opensesim.world.RealWorld;
|
||||
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 {
|
||||
|
||||
RealWorld 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.RealWorld;
|
||||
import opensesim.gui.util.EscDialog;
|
||||
import opensesim.gui.Globals;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author tohe
|
||||
*/
|
||||
public class NewJDialog extends EscDialog /*javax.swing.JDialog*/ {
|
||||
RealWorld 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,8 +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 opensesim.gui.util.EscDialog;
|
||||
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;
|
||||
|
||||
/**
|
||||
*
|
451
src/opensesim/gui/Globals.java
Normal file
451
src/opensesim/gui/Globals.java
Normal file
@ -0,0 +1,451 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 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;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.nio.file.Files;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.TreeMap;
|
||||
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.UIManager;
|
||||
import opensesim.world.AbstractAsset;
|
||||
import opensesim.world.RealWorld;
|
||||
import opensesim.gui.AssetEditor.AssetEditorPanel;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
import opensesim.old_sesim.AutoTraderLoader;
|
||||
import opensesim.old_sesim.IndicatorLoader;
|
||||
import opensesim.util.XClassLoader.ClassCache;
|
||||
import opensesim.world.GodWorld;
|
||||
import opensesim.world.Trader;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 7u83 <7u83@mail.ru>
|
||||
*/
|
||||
public class Globals {
|
||||
|
||||
public static RealWorld world;
|
||||
|
||||
public static final String SESIM_FILEEXTENSION = "sesim";
|
||||
public static final Double SESIM_FILEVERSION = 0.1;
|
||||
|
||||
public static final String SESIM_APPTITLE = "OpenSeSim - Stock Exchange Simulator";
|
||||
|
||||
public interface CfgListener {
|
||||
|
||||
void cfgChanged();
|
||||
}
|
||||
|
||||
static ArrayList<CfgListener> cfg_listeners = new ArrayList<>();
|
||||
|
||||
public static void notifyCfgListeners() {
|
||||
for (CfgListener l : cfg_listeners) {
|
||||
l.cfgChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public static void addCfgListener(CfgListener l) {
|
||||
cfg_listeners.add(l);
|
||||
}
|
||||
|
||||
public static JFrame frame;
|
||||
|
||||
// static final String STRATEGYPREFS = "Strategies";
|
||||
// static final String TRADERPREFS = "Traders";
|
||||
public static final String DEVELSTATUS = "devel_status";
|
||||
public static final String GODMODE = "godmode";
|
||||
|
||||
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";
|
||||
|
||||
public static final String SESIMVERSION = "version";
|
||||
public static final String STRATEGIES = "strategies";
|
||||
public static final String TRADERS = "traders";
|
||||
public static final String ASSETS = "assets";
|
||||
public static final String EXCHANGES = "exchanges";
|
||||
|
||||
}
|
||||
|
||||
public static final class MAX {
|
||||
|
||||
public static final int SYMLEN = 16;
|
||||
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
|
||||
= "{"
|
||||
+ " money_decimals: 2,"
|
||||
+ " shares_decimals: 0"
|
||||
+ "}";
|
||||
|
||||
/**
|
||||
*
|
||||
* @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);
|
||||
break;
|
||||
} catch (Exception e) {
|
||||
Logger.getLogger(Globals.class.getName()).log(Level.SEVERE, null, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Globals.unsetXClassLoader(old);
|
||||
}
|
||||
|
||||
static AutoTraderLoader tloader;
|
||||
static IndicatorLoader iloader;
|
||||
|
||||
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()).toURI().toURL();
|
||||
urllist.add(url);
|
||||
} catch (MalformedURLException ex) {
|
||||
Logger.getLogger(Globals.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
|
||||
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(boolean sort) {
|
||||
|
||||
// if class_cache is not initialized return an empty list
|
||||
if (class_cache == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
Collection<Class> asset_types_raw;
|
||||
asset_types_raw = class_cache.getClassCollection(AbstractAsset.class);
|
||||
|
||||
ArrayList<Class<AbstractAsset>> asset_types = new ArrayList<>();
|
||||
asset_types_raw.forEach((a) -> {
|
||||
asset_types.add(a);
|
||||
});
|
||||
|
||||
if (!sort) {
|
||||
return asset_types;
|
||||
}
|
||||
|
||||
asset_types.sort(new Comparator<Class<AbstractAsset>>() {
|
||||
@Override
|
||||
public int compare(Class<AbstractAsset> o1, Class<AbstractAsset> o2) {
|
||||
String t1, t2;
|
||||
t1 = GodWorld.getTypeName(o1);
|
||||
t2 = GodWorld.getTypeName(o2);
|
||||
return t1.compareToIgnoreCase(t2);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return asset_types;
|
||||
}
|
||||
|
||||
static public ArrayList<Class<AbstractAsset>> getAvailableAssetsTypes() {
|
||||
return getAvailableAssetsTypes(false);
|
||||
}
|
||||
|
||||
static public Class getClassByName(String name) {
|
||||
return class_cache.getClassByName(name);
|
||||
}
|
||||
|
||||
static private void installLookAndFeels() {
|
||||
Collection<Class> lafs;
|
||||
lafs = class_cache.getClassCollection(LookAndFeel.class);
|
||||
if (lafs == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
Class<LookAndFeel> lafc;
|
||||
lafc = (Class<LookAndFeel>) cls;
|
||||
LookAndFeel laf;
|
||||
|
||||
try {
|
||||
laf = lafc.getConstructor().newInstance();
|
||||
} catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
|
||||
//Logger.getLogger(Globals.class.getName()).log(Level.SEVERE, null, ex);
|
||||
continue;
|
||||
}
|
||||
|
||||
UIManager.installLookAndFeel(laf.getName() + " - " + laf.getDescription(), lafc.getName());
|
||||
|
||||
}
|
||||
|
||||
Thread.currentThread().setContextClassLoader(currentThreadClassLoader);
|
||||
|
||||
}
|
||||
|
||||
private static ClassCache class_cache;
|
||||
|
||||
/**
|
||||
* Initialize Globals object.
|
||||
*
|
||||
* This function initializes a Preferences object where preferences are
|
||||
* stored. Furthermore a search trough all class paths is performed to find
|
||||
* available LookAndFeels, Traders and Assets.
|
||||
*
|
||||
* @param c The class which uses this Globals object
|
||||
*/
|
||||
static void initGlobals(Class<?> c) {
|
||||
|
||||
prefs = Preferences.userNodeForPackage(c);
|
||||
|
||||
// initialize urllist used by class loader
|
||||
updateUrlList();
|
||||
|
||||
class_cache = new ClassCache(urllist, new Class[]{
|
||||
LookAndFeel.class,
|
||||
AbstractAsset.class,
|
||||
Trader.class
|
||||
});
|
||||
|
||||
installLookAndFeels();
|
||||
|
||||
}
|
||||
|
||||
static public final Logger LOGGER = Logger.getLogger("com.cauwersin.sesim");
|
||||
|
||||
static public final JSONObject getAssets() {
|
||||
String assets_json = prefs.get(PrefKeys.ASSETS, "{}");
|
||||
return new JSONObject(assets_json);
|
||||
}
|
||||
|
||||
static public final void putAssets(JSONObject assets) {
|
||||
prefs.put(PrefKeys.ASSETS, assets.toString());
|
||||
}
|
||||
|
||||
static public final JSONObject getExchanges() {
|
||||
String json = prefs.get(PrefKeys.EXCHANGES, "{}");
|
||||
return new JSONObject(json);
|
||||
}
|
||||
|
||||
static public final void putExchanges(JSONObject e) {
|
||||
prefs.put(PrefKeys.EXCHANGES, e.toString());
|
||||
}
|
||||
|
||||
static public final JSONArray getTraders() {
|
||||
|
||||
String traders_json = Globals.prefs.get(PrefKeys.TRADERS, "[]");
|
||||
JSONArray traders = new JSONArray(traders_json);
|
||||
return traders;
|
||||
}
|
||||
|
||||
static public final JSONObject getStrategies() {
|
||||
String cfglist = Globals.prefs.get(PrefKeys.STRATEGIES, "{}");
|
||||
JSONObject cfgs = new JSONObject(cfglist);
|
||||
return cfgs;
|
||||
}
|
||||
|
||||
static public final void putStrategies(JSONObject strategies) {
|
||||
Globals.prefs.put(Globals.PrefKeys.STRATEGIES, strategies.toString());
|
||||
}
|
||||
|
||||
static public final void putTraders(JSONArray traders) {
|
||||
Globals.prefs.put(Globals.PrefKeys.TRADERS, traders.toString());
|
||||
}
|
||||
|
||||
static public JSONObject getStrategy(String name) {
|
||||
return getStrategies().getJSONObject(name);
|
||||
}
|
||||
|
||||
static public void getStrategiesIntoComboBox(JComboBox comboBox) {
|
||||
TreeMap stm = getStrategiesAsTreeMap();
|
||||
comboBox.removeAllItems();
|
||||
|
||||
Iterator<String> i = stm.keySet().iterator();
|
||||
while (i.hasNext()) {
|
||||
comboBox.addItem(i.next());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static public TreeMap getStrategiesAsTreeMap() {
|
||||
TreeMap strategies = new TreeMap();
|
||||
JSONObject cfgs = Globals.getStrategies();
|
||||
|
||||
Iterator<String> i = cfgs.keys();
|
||||
while (i.hasNext()) {
|
||||
String k = i.next();
|
||||
JSONObject o = cfgs.getJSONObject(k);
|
||||
strategies.put(k, o);
|
||||
}
|
||||
return strategies;
|
||||
}
|
||||
|
||||
static public final void saveStrategy(String name, JSONObject cfg) {
|
||||
JSONObject cfgs = getStrategies();
|
||||
cfgs.put(name, cfg);
|
||||
prefs.put(PrefKeys.STRATEGIES, cfgs.toString());
|
||||
}
|
||||
|
||||
public static void saveFile(File f) throws FileNotFoundException {
|
||||
|
||||
/* JSONObject sobj = new JSONObject();
|
||||
|
||||
JSONArray traders = getTraders();
|
||||
JSONObject strategies = getStrategies();
|
||||
|
||||
sobj.put(PrefKeys.SESIMVERSION, SESIM_FILEVERSION);
|
||||
sobj.put(PrefKeys.STRATEGIES, strategies);
|
||||
sobj.put(PrefKeys.TRADERS, traders);
|
||||
*/
|
||||
JSONObject sobj = Globals.getWorld();
|
||||
|
||||
PrintWriter out;
|
||||
out = new PrintWriter(f.getAbsolutePath());
|
||||
out.print(sobj.toString(4));
|
||||
out.close();
|
||||
|
||||
}
|
||||
|
||||
public static void loadString(String s) throws IOException {
|
||||
JSONObject sobj = new JSONObject(s);
|
||||
|
||||
Double version = sobj.getDouble(PrefKeys.SESIMVERSION);
|
||||
if (version > SESIM_FILEVERSION) {
|
||||
throw new IOException("File has wrong version.");
|
||||
}
|
||||
|
||||
JSONArray traders = sobj.getJSONArray(PrefKeys.TRADERS);
|
||||
JSONObject strategies = sobj.getJSONObject(PrefKeys.STRATEGIES);
|
||||
|
||||
putStrategies(strategies);
|
||||
putTraders(traders);
|
||||
|
||||
}
|
||||
|
||||
public static void clearAll() {
|
||||
putStrategies(new JSONObject());
|
||||
putTraders(new JSONArray());
|
||||
}
|
||||
|
||||
public static void loadFile(File f) throws IOException {
|
||||
|
||||
f.getAbsoluteFile();
|
||||
String s;
|
||||
s = new String(Files.readAllBytes(f.toPath()));
|
||||
|
||||
loadString(s);
|
||||
|
||||
}
|
||||
|
||||
public static JSONObject getWorld() {
|
||||
JSONObject cfg = new JSONObject();
|
||||
cfg.put(GodWorld.JKEYS.ASSETS, getAssets());
|
||||
cfg.put(GodWorld.JKEYS.EXCHANGES, getExchanges());
|
||||
return cfg;
|
||||
}
|
||||
|
||||
}
|
@ -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,8 +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 opensesim.gui.util.EscDialog;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
@ -18,48 +18,22 @@
|
||||
<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">
|
||||
<Component id="filler1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="quotePanel1" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="orderBookNew3" alignment="1" pref="585" max="32767" attributes="0"/>
|
||||
<Component id="orderBookNew4" alignment="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="filler1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="597" 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="orderBookNew3" min="-2" pref="156" max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace min="-2" pref="70" max="-2" attributes="0"/>
|
||||
<Component id="filler1" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace min="-2" pref="30" max="-2" attributes="0"/>
|
||||
<Component id="quotePanel1" min="-2" pref="91" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="orderBookNew4" min="-2" pref="176" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="238" max="-2" attributes="0"/>
|
||||
<Component id="filler1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="245" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="gui.QuotePanel" name="quotePanel1">
|
||||
</Component>
|
||||
<Component class="gui.orderbook.OrderBook" name="orderBookNew3">
|
||||
</Component>
|
||||
<Component class="gui.orderbook.OrderBook" name="orderBookNew4">
|
||||
</Component>
|
||||
<Component class="javax.swing.Box$Filler" name="filler1">
|
||||
<Properties>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
@ -71,4 +45,4 @@
|
||||
</AuxValues>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
</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;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -47,9 +47,6 @@ 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();
|
||||
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);
|
||||
@ -58,38 +55,20 @@ public class OderBookPanelNew extends javax.swing.JPanel {
|
||||
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()
|
||||
.addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(quotePanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addComponent(orderBookNew3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 585, Short.MAX_VALUE)
|
||||
.addComponent(orderBookNew4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addContainerGap())
|
||||
.addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(597, Short.MAX_VALUE))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(orderBookNew3, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(70, 70, 70)
|
||||
.addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGap(30, 30, 30)
|
||||
.addComponent(quotePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(orderBookNew4, javax.swing.GroupLayout.PREFERRED_SIZE, 176, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap())
|
||||
.addGap(238, 238, 238)
|
||||
.addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(245, Short.MAX_VALUE))
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
|
||||
// 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;
|
||||
// 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.trader.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;
|
||||
|
||||
/**
|
||||
*
|
@ -22,12 +22,4 @@
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="gui.orderbook.OrderBook" name="orderBookNew1">
|
||||
</Component>
|
||||
<Component class="gui.QuotePanel" name="quotePanel1">
|
||||
</Component>
|
||||
<Component class="gui.orderbook.OrderBook" name="orderBookNew2">
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
</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;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -48,15 +48,8 @@ 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();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
getContentPane().setLayout(new java.awt.FlowLayout());
|
||||
getContentPane().add(orderBookNew1);
|
||||
getContentPane().add(quotePanel1);
|
||||
getContentPane().add(orderBookNew2);
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
@ -104,8 +97,5 @@ 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;
|
||||
// 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
|
||||
}
|
208
src/opensesim/gui/PreferencesEditor/EditPreferencesDialog.form
Normal file
208
src/opensesim/gui/PreferencesEditor/EditPreferencesDialog.form
Normal file
@ -0,0 +1,208 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.5" 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"/>
|
||||
<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">
|
||||
<Component id="jLabel2" max="32767" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="418" max="-2" attributes="0"/>
|
||||
</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 type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="godmodeCheckBox" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jDevleopmentFeaturesCheckBox" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jSpinner1" min="-2" pref="51" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jLabel1" min="-2" pref="127" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="lafComboBox" 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 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>
|
||||
<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 min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jDevleopmentFeaturesCheckBox" min="-2" max="-2" 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 max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jSpinner1" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace pref="42" 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"/>
|
||||
<Component id="okButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JComboBox" name="lafComboBox">
|
||||
<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>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="lafComboBoxActionPerformed"/>
|
||||
</Events>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="cancelButton">
|
||||
<Properties>
|
||||
<Property name="mnemonic" type="int" value="99"/>
|
||||
<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="applyButton">
|
||||
<Properties>
|
||||
<Property name="mnemonic" type="int" value="97"/>
|
||||
<Property name="text" type="java.lang.String" value="Apply"/>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="applyButtonActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="okButton">
|
||||
<Properties>
|
||||
<Property name="mnemonic" type="int" value="111"/>
|
||||
<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="javax.swing.JLabel" name="jLabel1">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Look and Feel:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JCheckBox" name="jDevleopmentFeaturesCheckBox">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Develeopment"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JCheckBox" name="godmodeCheckBox">
|
||||
<Properties>
|
||||
<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>
|
||||
<Component class="javax.swing.JSpinner" name="jSpinner1">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
|
||||
<SpinnerModel initial="1" minimum="1" numberType="java.lang.Integer" stepSize="1" type="number"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel3">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Number of threads:"/>
|
||||
</Properties>
|
||||
</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.util.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");
|
||||
@ -68,8 +73,8 @@ 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,15 @@ 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();
|
||||
jSpinner1 = new javax.swing.JSpinner();
|
||||
jLabel3 = new javax.swing.JLabel();
|
||||
|
||||
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 +141,19 @@ 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:");
|
||||
|
||||
jSpinner1.setModel(new javax.swing.SpinnerNumberModel(1, 1, null, 1));
|
||||
|
||||
jLabel3.setText("Number of threads:");
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
@ -136,22 +161,36 @@ public class EditPreferencesDialog extends javax.swing.JDialog {
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(jLabel1)
|
||||
.addGap(80, 80, 80)
|
||||
.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(okButton)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(applyButton)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(cancelButton))
|
||||
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGap(418, 418, 418))
|
||||
.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(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))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(godmodeCheckBox)
|
||||
.addComponent(jDevleopmentFeaturesCheckBox))
|
||||
.addGap(0, 0, Short.MAX_VALUE)))
|
||||
.addComponent(jDevleopmentFeaturesCheckBox)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(jLabel3)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jSpinner1, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
||||
.addGap(0, 0, Short.MAX_VALUE))
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lafComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
|
||||
.addContainerGap())
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
@ -161,16 +200,30 @@ 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))
|
||||
.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)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(cancelButton)
|
||||
.addComponent(applyButton)
|
||||
.addComponent(okButton))
|
||||
.addContainerGap())
|
||||
.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)
|
||||
.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))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jSpinner1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel3))
|
||||
.addContainerGap(42, 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())))
|
||||
);
|
||||
|
||||
pack();
|
||||
@ -183,6 +236,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);
|
||||
@ -201,15 +258,13 @@ 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);
|
||||
new_laf = UIManager.getLookAndFeel();
|
||||
resetUI();
|
||||
|
||||
|
||||
|
||||
|
||||
}//GEN-LAST:event_applyButtonActionPerformed
|
||||
|
||||
@ -222,10 +277,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.notifyCfgListeners();
|
||||
|
||||
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 +359,15 @@ 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.JLabel jLabel3;
|
||||
private javax.swing.JSpinner jSpinner1;
|
||||
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
|
@ -33,15 +33,6 @@
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="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"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
@ -141,8 +132,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>
|
||||
@ -271,6 +296,9 @@
|
||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
||||
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
|
||||
</SyntheticProperties>
|
||||
<Events>
|
||||
<EventHandler event="windowClosing" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="formWindowClosing"/>
|
||||
</Events>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
@ -337,7 +365,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 +384,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 +399,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 +424,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 +455,7 @@
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="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,13 +464,6 @@
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="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"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Container class="javax.swing.JSplitPane" name="jSplitPane5">
|
||||
<Properties>
|
||||
<Property name="orientation" type="int" value="0"/>
|
||||
@ -461,22 +475,6 @@
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="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>
|
||||
</Container>
|
@ -23,10 +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 chart.SuperDlg;
|
||||
import java.awt.Dialog;
|
||||
import java.awt.Frame;
|
||||
import java.awt.GraphicsDevice;
|
||||
@ -38,22 +37,40 @@ import java.io.File;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.HashSet;
|
||||
import java.util.Scanner;
|
||||
import java.util.prefs.Preferences;
|
||||
import java.util.Set;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JOptionPane;
|
||||
import static javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER;
|
||||
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
import javax.swing.filechooser.FileNameExtensionFilter;
|
||||
import opensesim.gui.AssetPairEditor.NewJDialog;
|
||||
import static opensesim.gui.Globals.getWorld;
|
||||
import opensesim.gui.account.AccountDialog;
|
||||
|
||||
import opensesim.gui.exchangeeditor.ExchangeListDialog;
|
||||
import opensesim.gui.history.HistoryDialog;
|
||||
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.old_sesim.Scheduler.TimerTaskDef;
|
||||
import opensesim.world.AbstractAsset;
|
||||
import opensesim.world.AssetPair;
|
||||
|
||||
import opensesim.world.GodWorld;
|
||||
import opensesim.world.Order;
|
||||
import opensesim.world.Trader;
|
||||
import opensesim.world.TradingAPI;
|
||||
import opensesim.world.World;
|
||||
import opensesim.util.scheduler.Event;
|
||||
import opensesim.util.scheduler.FiringEvent;
|
||||
import opensesim.util.scheduler.EventListener;
|
||||
import opensesim.world.SimpleTrader;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -61,13 +78,24 @@ import sesim.Scheduler;
|
||||
*/
|
||||
public class SeSimApplication extends javax.swing.JFrame {
|
||||
|
||||
GodWorld godworld;
|
||||
|
||||
/**
|
||||
* Creates new form NewMDIApplication
|
||||
*/
|
||||
public SeSimApplication() {
|
||||
|
||||
Globals.setXClassLoader();
|
||||
Globals.setLookAndFeel(Globals.prefs.get(Globals.PrefKeys.LAF, "Nimbus"));
|
||||
// Globals.setLookAndFeel("Metal");
|
||||
initComponents();
|
||||
|
||||
JSONObject cfg;
|
||||
cfg = new JSONObject(Globals.prefs.get("world", "{}"));
|
||||
godworld = new GodWorld(cfg);
|
||||
godworld.addAssetPair("AAPL", "EUR");
|
||||
godworld.addAssetPair("MSFT", "EUR");
|
||||
|
||||
// Get default screen and place our window
|
||||
// to the center of this screen
|
||||
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
|
||||
@ -87,7 +115,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 +144,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 +207,17 @@ 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();
|
||||
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();
|
||||
chart = new opensesim.chart.MasterChart();
|
||||
jSplitPane5 = new javax.swing.JSplitPane();
|
||||
statistics1 = new gui.Statistics();
|
||||
mMChart2 = new chart.MMChart();
|
||||
menuBar = new javax.swing.JMenuBar();
|
||||
fileMenu = new javax.swing.JMenu();
|
||||
openMenuItem = new javax.swing.JMenuItem();
|
||||
@ -202,6 +232,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();
|
||||
@ -223,15 +256,17 @@ public class SeSimApplication extends javax.swing.JFrame {
|
||||
jScrollPane2.setViewportView(jTextArea1);
|
||||
|
||||
jSplitPane1.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
|
||||
|
||||
jSplitPane2.setLeftComponent(orderBookNew1);
|
||||
|
||||
jSplitPane1.setTopComponent(jSplitPane2);
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
||||
setMinimumSize(new java.awt.Dimension(640, 480));
|
||||
addWindowListener(new java.awt.event.WindowAdapter() {
|
||||
public void windowClosing(java.awt.event.WindowEvent evt) {
|
||||
formWindowClosing(evt);
|
||||
}
|
||||
});
|
||||
|
||||
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 +278,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 +290,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);
|
||||
@ -318,16 +353,11 @@ public class SeSimApplication extends javax.swing.JFrame {
|
||||
|
||||
jSplitPane4.setDividerLocation(300);
|
||||
jSplitPane4.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
|
||||
jSplitPane4.setBottomComponent(orderBooksHorizontal1);
|
||||
jSplitPane4.setLeftComponent(chart);
|
||||
|
||||
jSplitPane3.setRightComponent(jSplitPane4);
|
||||
jSplitPane3.setLeftComponent(quoteVertical1);
|
||||
|
||||
jSplitPane5.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
|
||||
jSplitPane5.setTopComponent(statistics1);
|
||||
jSplitPane5.setRightComponent(mMChart2);
|
||||
|
||||
jSplitPane3.setLeftComponent(jSplitPane5);
|
||||
|
||||
getContentPane().add(jSplitPane3, java.awt.BorderLayout.CENTER);
|
||||
@ -417,6 +447,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() {
|
||||
@ -529,11 +587,12 @@ public class SeSimApplication extends javax.swing.JFrame {
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitMenuItemActionPerformed
|
||||
dispose();
|
||||
System.exit(0);
|
||||
}//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
|
||||
@ -544,6 +603,52 @@ public class SeSimApplication extends javax.swing.JFrame {
|
||||
|
||||
void startSim() {
|
||||
|
||||
JSONObject cfg = new JSONObject("{"
|
||||
+ "strategy: opensesim.world.SimpleTrader"
|
||||
+ "}");
|
||||
Trader t = godworld.createTrader(cfg);
|
||||
|
||||
t.start();
|
||||
AccountDialog.runDialog(this, ((SimpleTrader)t).account_1);
|
||||
AccountDialog.runDialog(this, ((SimpleTrader)t).account_b);
|
||||
|
||||
|
||||
updateGodWorld(godworld);
|
||||
|
||||
AssetPair p = godworld.getDefaultAssetPair();
|
||||
|
||||
opensesim.world.Exchange ex = godworld.getDefaultExchange();
|
||||
TradingAPI api = ex.getAPI(p);
|
||||
|
||||
HistoryDialog.runDialog(this, api);
|
||||
|
||||
opensesim.util.scheduler.Scheduler s = godworld.getScheduler();
|
||||
|
||||
class MyListener implements EventListener {
|
||||
|
||||
World world;
|
||||
|
||||
MyListener(World world) {
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long receive(opensesim.util.scheduler.Event task) {
|
||||
|
||||
System.out.printf("Received an Event %d\n", Thread.currentThread().getId());
|
||||
// e.count++;
|
||||
world.schedule(this, 1000);
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MyListener listener = new MyListener(godworld.getWorld());
|
||||
// MyEvent arg = new MyEvent();
|
||||
// s.startTimerTask(listener, 1000);
|
||||
|
||||
/*
|
||||
|
||||
resetSim();
|
||||
JSONObject jo = new JSONObject(Globals.prefs.get("Exchange", "{}"));
|
||||
Globals.se.putConfig(jo);
|
||||
@ -576,7 +681,7 @@ public class SeSimApplication extends javax.swing.JFrame {
|
||||
|
||||
};
|
||||
// Globals.se.timer.startTimerTask(tt, 0);
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
void stopSim() {
|
||||
@ -600,7 +705,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 +850,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 {
|
||||
@ -798,9 +903,39 @@ public class SeSimApplication extends javax.swing.JFrame {
|
||||
stopSim();
|
||||
}//GEN-LAST:event_stopButtonActionPerformed
|
||||
|
||||
public class GodWorldEvent extends Event {
|
||||
|
||||
public GodWorld goworld;
|
||||
|
||||
public GodWorldEvent(GodWorld world) {
|
||||
this.goworld = world;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
HashSet<EventListener> gwlisteners = new HashSet<>();
|
||||
|
||||
void updateGodWorld(GodWorld godworld) {
|
||||
GodWorldEvent e = new GodWorldEvent(null);
|
||||
for (EventListener el : gwlisteners) {
|
||||
el.receive(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void jCheckBoxMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxMenuItem1ActionPerformed
|
||||
JDialog jd = new gui.orderbook.OrderBookDialog(this, false);
|
||||
jd.setVisible(rootPaneCheckingEnabled);
|
||||
// JDialog jd = new opensesim.gui.orderbook.OrderBookDialog(this, false);
|
||||
// jd.setVisible(rootPaneCheckingEnabled);
|
||||
//EventListener e = opensesim.gui.orderbook.OrderBookDialog.runDialog(this, godworld);
|
||||
//gwlisteners.add(e);
|
||||
|
||||
AssetPair ap = godworld.getDefaultAssetPair();
|
||||
opensesim.world.Exchange ex = godworld.getDefaultExchange();
|
||||
opensesim.gui.orderbook.OrderBookDialog.runDialog(this, godworld, ex, ap);
|
||||
|
||||
AbstractAsset eu = godworld.getAssetBySymbol("EUR");
|
||||
AssetPair ap2 = godworld.getAssetPair(godworld.getAssetBySymbol("MSFT"), eu);
|
||||
opensesim.gui.orderbook.OrderBookDialog.runDialog(this, godworld, ex, ap2);
|
||||
|
||||
}//GEN-LAST:event_jCheckBoxMenuItem1ActionPerformed
|
||||
|
||||
TraderListDialog tld = null;
|
||||
@ -848,7 +983,7 @@ public class SeSimApplication extends javax.swing.JFrame {
|
||||
|
||||
private void clearMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_clearMenuItemActionPerformed
|
||||
|
||||
int dialogResult = JOptionPane.showConfirmDialog(this, "Are you sure?", "Warning", JOptionPane.YES_NO_OPTION);
|
||||
int dialogResult = JOptionPane.showConfirmDialog(this, "Are you sure you want to clear all data?", "Warning", JOptionPane.YES_NO_OPTION);
|
||||
if (dialogResult != JOptionPane.YES_OPTION) {
|
||||
return;
|
||||
}
|
||||
@ -858,59 +993,94 @@ public class SeSimApplication extends javax.swing.JFrame {
|
||||
private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
|
||||
//SuperDlg d = new SuperDlg(this, false);
|
||||
//d.setVisible(true);
|
||||
|
||||
|
||||
//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(godworld, 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,this.godworld);
|
||||
ExchangeListDialog.runDialog(this, godworld);
|
||||
|
||||
}//GEN-LAST:event_exchangesMenuItemActionPerformed
|
||||
|
||||
private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
|
||||
// TODO add your handling code here:
|
||||
System.out.printf("Closing Windows\n");
|
||||
}//GEN-LAST:event_formWindowClosing
|
||||
public static class Pojo {
|
||||
|
||||
public String getSymbol() {
|
||||
return symbol;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public String symbol = "EUR";
|
||||
public String name = "Euro";
|
||||
};
|
||||
|
||||
/**
|
||||
* @param args the command line arguments
|
||||
* @throws java.lang.IllegalAccessException
|
||||
* @throws java.lang.InstantiationException
|
||||
*/
|
||||
public static void main(String args[]) throws IllegalAccessException, InstantiationException {
|
||||
|
||||
|
||||
|
||||
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
|
||||
|
||||
GraphicsDevice[] gs = ge.getScreenDevices();
|
||||
for (GraphicsDevice d : gs) {
|
||||
System.out.printf("ID %s\n", d.getIDstring());
|
||||
//opensesim.world.World.MasterApi mapi = new opensesim.world.World.MasterApi();
|
||||
// testing
|
||||
Pojo p = new Pojo();
|
||||
|
||||
}
|
||||
//System.exit(0);
|
||||
// Gson g = new Gson();
|
||||
// String r = g.toJson(p);
|
||||
|
||||
//System.exit(0);
|
||||
Globals.initGlobals();
|
||||
//System.exit(0);
|
||||
// System.out.printf("GSON: %s\n", r);
|
||||
|
||||
JSONObject o = new JSONObject(p, new String[]{"name", "symbol"});
|
||||
System.out.printf("OJSON: %s\n", o.toString(8));
|
||||
|
||||
// System.exit(0);
|
||||
// end testing
|
||||
// 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);
|
||||
*/
|
||||
//Globals.installLookAndFeels();
|
||||
// Globals.setLookAndFeel("Metal");
|
||||
//JDialog.setDefaultLookAndFeelDecorated(true);
|
||||
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 +1089,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 +1106,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 +1119,9 @@ 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 javax.swing.JMenuItem pasteMenuItem;
|
||||
private gui.orderbook.QuoteVertical quoteVertical1;
|
||||
private javax.swing.JMenuItem resetToDefaultsMenuItem;
|
||||
private javax.swing.JButton runButton;
|
||||
private javax.swing.JMenuItem saveAsMenuItem;
|
||||
@ -961,7 +1130,6 @@ 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 javax.swing.JButton stopButton;
|
||||
private javax.swing.JMenu viewMenu;
|
||||
private javax.swing.JCheckBoxMenuItem viewTraderListCheckBox;
|
@ -18,6 +18,7 @@
|
||||
<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,125,0,0,1,-3"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
|
@ -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;
|
||||
@ -42,30 +42,28 @@ public class SeSimHelp extends javax.swing.JFrame {
|
||||
*/
|
||||
public SeSimHelp() {
|
||||
initComponents();
|
||||
String helpHS = "resources/helpset.hs";
|
||||
ClassLoader cl = Help.class.getClassLoader();
|
||||
HelpSet hs;
|
||||
JHelp helpViewer = null;
|
||||
try {
|
||||
URL url = HelpSet.findHelpSet(null, helpHS); //, "xml", Locale.ENGLISH);
|
||||
// URL hsURL = HelpSet.findHelpSet(cl, helpHS);
|
||||
//hs = new HelpSet(null, hsURL);
|
||||
helpViewer = new JHelp(new HelpSet(cl, url));
|
||||
} catch (Exception ee) {
|
||||
// Say what the exception really is
|
||||
System.out.println( "HelpSet " + ee.getMessage());
|
||||
String helpHS = "opensesim/resources/help/helpset.hs";
|
||||
ClassLoader cl = Help.class.getClassLoader();
|
||||
HelpSet hs;
|
||||
JHelp helpViewer = null;
|
||||
try {
|
||||
URL url = HelpSet.findHelpSet(null, helpHS); //, "xml", Locale.ENGLISH);
|
||||
// URL hsURL = HelpSet.findHelpSet(cl, helpHS);
|
||||
hs = new HelpSet(null, url);
|
||||
//helpViewer = new JHelp(new HelpSet(cl, url));
|
||||
helpViewer = new javax.help.JHelp(hs);
|
||||
} catch (Exception ee) {
|
||||
// Say what the exception really is
|
||||
// System.out.println("HelpSet " + ee.getMessage());
|
||||
// System.out.println("HelpSet "+ helpHS +" not found")
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
setTitle("Help");
|
||||
setSize(800,600);
|
||||
getContentPane().add(helpViewer);
|
||||
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
//setVisible(true);
|
||||
return;
|
||||
}
|
||||
|
||||
setTitle("Help");
|
||||
setSize(800, 600);
|
||||
getContentPane().add(helpViewer);
|
||||
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
//setVisible(true);
|
||||
}
|
||||
|
||||
/**
|
@ -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;
|
||||
|
||||
/**
|
||||
*
|
@ -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.event.KeyEvent;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user