Compare commits
453 Commits
v0.2.0-bet
...
v0.3.3-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c3f5c1c70e | ||
|
|
188a521770 | ||
|
|
6e352143d2 | ||
|
|
7391265949 | ||
|
|
26b97f09b7 | ||
|
|
1d2d9e8630 | ||
|
|
ee6aeafa84 | ||
|
|
47cc194415 | ||
|
|
9316599dec | ||
|
|
a1535c4157 | ||
|
|
b478068475 | ||
|
|
7286c978da | ||
|
|
628d514462 | ||
|
|
3478702845 | ||
|
|
695d622603 | ||
|
|
e8e47bfb40 | ||
|
|
c1a4425969 | ||
|
|
4fa1a1aa81 | ||
|
|
4e1f9bcf97 | ||
|
|
50bb96b14a | ||
|
|
51ea70f279 | ||
|
|
e15f271a54 | ||
|
|
605475c98b | ||
|
|
86248c511a | ||
|
|
b1e07f762c | ||
|
|
f2d1ac7e48 | ||
|
|
d114282e4b | ||
|
|
0fd20655fa | ||
|
|
181527f54c | ||
|
|
910587bad7 | ||
|
|
1dc9a7fb0e | ||
|
|
eef29d28da | ||
|
|
a3ecb339be | ||
|
|
910a08f7bb | ||
|
|
5a76f31dea | ||
|
|
1b42e64f50 | ||
|
|
1ddc0a33a5 | ||
|
|
88580af436 | ||
|
|
64688a3c20 | ||
|
|
8be3399a6b | ||
|
|
28340809ca | ||
|
|
f3d3a8187a | ||
|
|
8484e837b8 | ||
|
|
01b188ea25 | ||
|
|
108691dc3c | ||
|
|
455aa97286 | ||
|
|
d608834214 | ||
|
|
41660e1881 | ||
|
|
110ccb158c | ||
|
|
64ccacf04a | ||
|
|
f00b9555fe | ||
|
|
85442a9648 | ||
|
|
c67a0b329d | ||
|
|
8035d64fcd | ||
|
|
df2a061a08 | ||
|
|
e430319937 | ||
|
|
724f769771 | ||
|
|
c196cfebed | ||
|
|
e80b5866d4 | ||
|
|
c8994d5593 | ||
|
|
99ef57c90f | ||
|
|
be62ae0459 | ||
|
|
b9be6f43e0 | ||
|
|
d5ad3f807d | ||
|
|
d85ebd018d | ||
|
|
ab4e31ae00 | ||
|
|
5efd89632e | ||
|
|
1dc3863489 | ||
|
|
441286ba13 | ||
|
|
e4323df347 | ||
|
|
a872e0d664 | ||
|
|
fbc92cfe31 | ||
|
|
1a432197ac | ||
|
|
fbc6e508bd | ||
|
|
f9b6e67b00 | ||
|
|
a628800a71 | ||
|
|
25f71a76c4 | ||
|
|
5fe8ccd478 | ||
|
|
069f951a86 | ||
|
|
dab6df7836 | ||
|
|
89da46b63c | ||
|
|
5f2ce2a9f2 | ||
|
|
7a0b377971 | ||
|
|
5dbe0ecce3 | ||
|
|
6647c581a6 | ||
|
|
a2ab5bfa95 | ||
|
|
ed486440b8 | ||
|
|
13464e01fc | ||
|
|
ea46a8b0e8 | ||
|
|
d510c34356 | ||
|
|
ae8a44caed | ||
|
|
1aa85a86ca | ||
|
|
17539d4d55 | ||
|
|
1db1d28390 | ||
|
|
37a941e904 | ||
|
|
57f6655824 | ||
|
|
4cd8f8209f | ||
|
|
61bfef5798 | ||
|
|
ef172a04c6 | ||
|
|
a877afcceb | ||
|
|
980ad72d4d | ||
|
|
9b746cc032 | ||
|
|
f51ae0b5da | ||
|
|
561078e9bf | ||
|
|
e052b01f9b | ||
|
|
09cf4fcfd7 | ||
|
|
5e731d0e9f | ||
|
|
670a02b0ba | ||
|
|
9ef156b061 | ||
|
|
d9cf1b19f3 | ||
|
|
a4a339b505 | ||
|
|
119370c46e | ||
|
|
4eb66e6045 | ||
|
|
8827ecd0e9 | ||
|
|
8660002f93 | ||
|
|
2058fcbc1d | ||
|
|
9515dfa380 | ||
|
|
9e9a604c6a | ||
|
|
234e313b7a | ||
|
|
e1e7169029 | ||
|
|
f3605db0ed | ||
|
|
c0a6d578c7 | ||
|
|
79b4b30ec7 | ||
|
|
17c7466c6b | ||
|
|
8162d6ffd6 | ||
|
|
cd60251337 | ||
|
|
5647879b37 | ||
|
|
6916d95cdf | ||
|
|
a0c32f6fe0 | ||
|
|
c3d60dc174 | ||
|
|
e55a2226a2 | ||
|
|
9f01678b00 | ||
|
|
46425e9cae | ||
|
|
3726401563 | ||
|
|
a3e50acfe3 | ||
|
|
cf0018e6ba | ||
|
|
e8055dcab0 | ||
|
|
fce3d5c4f3 | ||
|
|
9cc0d367a8 | ||
|
|
2ca9e5d5ce | ||
|
|
861203c3a0 | ||
|
|
7c930deefe | ||
|
|
0e0af932eb | ||
|
|
6ba5e91fcb | ||
|
|
34dd2161ef | ||
|
|
2543072e08 | ||
|
|
281be147f8 | ||
|
|
12ecca4555 | ||
|
|
4c27d04120 | ||
|
|
ece202315f | ||
|
|
6afe5dcec9 | ||
|
|
8db47c25bc | ||
|
|
6a340050c6 | ||
|
|
183eb2f7c7 | ||
|
|
6bc92e8b94 | ||
|
|
767b302ed7 | ||
|
|
952d930b5b | ||
|
|
26087c465f | ||
|
|
74c15d530b | ||
|
|
8621d1c8e2 | ||
|
|
1cd45a1b79 | ||
|
|
8215b78a43 | ||
|
|
f53519ad59 | ||
|
|
e6ab615931 | ||
|
|
0c84984fcc | ||
|
|
b3e493989e | ||
|
|
50e838749d | ||
|
|
c097e536e0 | ||
|
|
a228f29a40 | ||
|
|
74aab2cc72 | ||
|
|
3543712fd3 | ||
|
|
4780f00c44 | ||
|
|
7e4acc568c | ||
|
|
a1757686e9 | ||
|
|
960bf975d9 | ||
|
|
57a52a662a | ||
|
|
f7c144ca16 | ||
|
|
f63b05c1e4 | ||
|
|
78a4bfe915 | ||
|
|
3b2ff7144b | ||
|
|
cd9bb5a84d | ||
|
|
37d447066d | ||
|
|
2ec882a87f | ||
|
|
7b9004af08 | ||
|
|
eba9367674 | ||
|
|
8ffe91911b | ||
|
|
a0e0a5ddc0 | ||
|
|
d500346ba2 | ||
|
|
3283b66bdc | ||
|
|
c16416ab14 | ||
|
|
5e46e22721 | ||
|
|
97e2ac31cd | ||
|
|
a302d098de | ||
|
|
b9e1efa92f | ||
|
|
07933831d2 | ||
|
|
e2e00a98d5 | ||
|
|
ea0e1b152f | ||
|
|
afa451a070 | ||
|
|
eaeedc53fc | ||
|
|
1786ffac47 | ||
|
|
8b403e6d87 | ||
|
|
8a8fbc4936 | ||
|
|
3c9c7794c9 | ||
|
|
48d3d7a8c1 | ||
|
|
d81ef8db2a | ||
|
|
3d644c2460 | ||
|
|
6e94d9ce51 | ||
|
|
523ac0314e | ||
|
|
b252159250 | ||
|
|
2168ed112e | ||
|
|
2faaa93785 | ||
|
|
7dc32954bf | ||
|
|
a57183c4cc | ||
|
|
8fb2a66411 | ||
|
|
26837b8a68 | ||
|
|
6b67a74055 | ||
|
|
2d9c3c0aa4 | ||
|
|
ce47d2545d | ||
|
|
5f179c4863 | ||
|
|
acabab35ff | ||
|
|
929fbdb21e | ||
|
|
95a6deaae1 | ||
|
|
bc8873de01 | ||
|
|
16b69d4aef | ||
|
|
7115b4feb1 | ||
|
|
6a9e522d77 | ||
|
|
c39c49b049 | ||
|
|
471685b576 | ||
|
|
2268879cec | ||
|
|
86e4ce817d | ||
|
|
75cb6c27d4 | ||
|
|
1352ef9092 | ||
|
|
8a150451c4 | ||
|
|
5ff3f4169a | ||
|
|
b6498d048a | ||
|
|
488dc9da4c | ||
|
|
4481560c41 | ||
|
|
1dbdede5a2 | ||
|
|
6bfe98dae6 | ||
|
|
de9c51c228 | ||
|
|
7865e813de | ||
|
|
a55296eb45 | ||
|
|
2c558ce929 | ||
|
|
49a1ea04f8 | ||
|
|
2226306de3 | ||
|
|
0cf26da94e | ||
|
|
59671738a2 | ||
|
|
c6f4d6da05 | ||
|
|
2d07734cc5 | ||
|
|
ad377f4006 | ||
|
|
648b12fd16 | ||
|
|
bc430b255f | ||
|
|
4578e45f60 | ||
|
|
42c18341b6 | ||
|
|
e71a1dbeda | ||
|
|
a4e3c53ba8 | ||
|
|
0cebe7e5d9 | ||
|
|
5611f594c7 | ||
|
|
524a76e583 | ||
|
|
c216f56c4f | ||
|
|
5e4cbf2a4e | ||
|
|
1d7354b4a8 | ||
|
|
d085ecc0c9 | ||
|
|
1c8362c1fc | ||
|
|
b65ff17ede | ||
|
|
ebca330730 | ||
|
|
ef373daeef | ||
|
|
4290d8e403 | ||
|
|
293dec8a1c | ||
|
|
f44892c62b | ||
|
|
b71415b82a | ||
|
|
ecfac83eb4 | ||
|
|
357979a5dd | ||
|
|
893cbba277 | ||
|
|
ac23aea602 | ||
|
|
a43ae9ce53 | ||
|
|
02f470cf91 | ||
|
|
6138838d60 | ||
|
|
2537a71375 | ||
|
|
9031fd78c9 | ||
|
|
e75290c42c | ||
|
|
d466ec9f5e | ||
|
|
3af4b953f4 | ||
|
|
cc65d44237 | ||
|
|
ae6ccc5d51 | ||
|
|
77cdcf1862 | ||
|
|
bccd4f0e32 | ||
|
|
a76268b32c | ||
|
|
ba31015423 | ||
|
|
c635dc5d79 | ||
|
|
d57c485450 | ||
|
|
6e1f28917e | ||
|
|
6af24ffa38 | ||
|
|
b19bfb400e | ||
|
|
a56935f92c | ||
|
|
b33c0359ef | ||
|
|
078a6fddce | ||
|
|
bf5ded53e2 | ||
|
|
3c53f864c4 | ||
|
|
61d9698ca5 | ||
|
|
8fec7c7314 | ||
|
|
90324404b2 | ||
|
|
d520f43265 | ||
|
|
192d39294b | ||
|
|
129dba869f | ||
|
|
72390cc62a | ||
|
|
5cd51c3199 | ||
|
|
097884337b | ||
|
|
3231e9828b | ||
|
|
5672182609 | ||
|
|
631ce112bd | ||
|
|
c3d52ff86e | ||
|
|
03e641525c | ||
|
|
64fee2c718 | ||
|
|
55443b42f3 | ||
|
|
3caadf0c90 | ||
|
|
58160d6c6b | ||
|
|
112083a22f | ||
|
|
f2b189ee2b | ||
|
|
3f0581dad1 | ||
|
|
e89e7bd361 | ||
|
|
d93f497b33 | ||
|
|
f32c520cab | ||
|
|
13617e8fe2 | ||
|
|
4adffbdca7 | ||
|
|
7a5dc5ad58 | ||
|
|
d3e8816bb4 | ||
|
|
6bb417f69a | ||
|
|
a4d69ce0aa | ||
|
|
45f0e09d5a | ||
|
|
f518c15a06 | ||
|
|
6eade2b7ea | ||
|
|
86816228c2 | ||
|
|
0605760fcd | ||
|
|
415f95ec89 | ||
|
|
1078bdc4fd | ||
|
|
218eeb1848 | ||
|
|
9d4afb8c1f | ||
|
|
6fa3089bc9 | ||
|
|
9273f679f4 | ||
|
|
b6e4c4e7aa | ||
|
|
2394ac2fa9 | ||
|
|
8aebdd1c26 | ||
|
|
8b11fabf3d | ||
|
|
4ad16296d8 | ||
|
|
e8fd4f363a | ||
|
|
00d2b43c2a | ||
|
|
2c3dbe1b22 | ||
|
|
6d1e7a78cf | ||
|
|
d1ea8656c4 | ||
|
|
e31b6adf52 | ||
|
|
63cea60c42 | ||
|
|
ece555dead | ||
|
|
15716d1270 | ||
|
|
8d10b502ab | ||
|
|
62851351a4 | ||
|
|
daf2b58cf2 | ||
|
|
cf2c0ca07d | ||
|
|
eead22ffad | ||
|
|
1550c62782 | ||
|
|
5f2d8c8fe6 | ||
|
|
22d3871d0b | ||
|
|
455e45269c | ||
|
|
ca8406bdc0 | ||
|
|
399d164bd0 | ||
|
|
6f2a7e89a9 | ||
|
|
a807ff5c07 | ||
|
|
e5004f9fa6 | ||
|
|
bd09911e68 | ||
|
|
ca2b12b868 | ||
|
|
7ff9e9a7ce | ||
|
|
7da541ed06 | ||
|
|
d90684dbdc | ||
|
|
9286fdf42d | ||
|
|
b821588e54 | ||
|
|
62aca27e66 | ||
|
|
cdcc487095 | ||
|
|
d5b6589e36 | ||
|
|
be7ab871d1 | ||
|
|
294a830aaf | ||
|
|
a7da60cd27 | ||
|
|
894ebeb040 | ||
|
|
682fe0c779 | ||
|
|
62c5265bce | ||
|
|
1687ca2c4b | ||
|
|
5ee4a48ab3 | ||
|
|
c8328b3eff | ||
|
|
691e4c3383 | ||
|
|
5573b9a9fb | ||
|
|
f7f6c2fc3e | ||
|
|
88d3088ebc | ||
|
|
dc3390460a | ||
|
|
8db226cd7b | ||
|
|
b7a54598b1 | ||
|
|
dd22397f75 | ||
|
|
e2a0451bfb | ||
|
|
e7d3713791 | ||
|
|
2c6e35c739 | ||
|
|
1f654b5b9c | ||
|
|
1d7f255784 | ||
|
|
3f674c0b8f | ||
|
|
5071205e73 | ||
|
|
37a93c8884 | ||
|
|
12ff5513b7 | ||
|
|
bca39e74ce | ||
|
|
75714072b2 | ||
|
|
15edcdebe6 | ||
|
|
da924e8b3a | ||
|
|
61f68c08e8 | ||
|
|
ec10bb7e62 | ||
|
|
7d1ec344de | ||
|
|
4be63d4b95 | ||
|
|
c405ddad96 | ||
|
|
d8a20b5adb | ||
|
|
c670f1d855 | ||
|
|
1dc0125ef4 | ||
|
|
225e747d6e | ||
|
|
36f9953156 | ||
|
|
47c452e7e6 | ||
|
|
06c8bba97e | ||
|
|
a25bb83dea | ||
|
|
8e11cb4554 | ||
|
|
2892e4609e | ||
|
|
d6e161f3e9 | ||
|
|
ba952af721 | ||
|
|
d9be346d7f | ||
|
|
133adec27a | ||
|
|
981a8fec55 | ||
|
|
9c94266adb | ||
|
|
4460f1ee30 | ||
|
|
ddfefe4b85 | ||
|
|
debdc39a5f | ||
|
|
6f76f6fca4 | ||
|
|
1290b8c4d3 | ||
|
|
b95b3ff415 | ||
|
|
3e8db5b216 | ||
|
|
f0c11f2590 | ||
|
|
99a5fc9bcf | ||
|
|
f5fadc5004 | ||
|
|
c922029233 | ||
|
|
94d85f636d | ||
|
|
1db6779dec | ||
|
|
676d26f4d8 | ||
|
|
abca4ebbd7 | ||
|
|
cffc6b6eed | ||
|
|
39ebec78a8 | ||
|
|
4066a4b3c3 | ||
|
|
c12f535f3c | ||
|
|
810bb7384e | ||
|
|
0c5692cb1e | ||
|
|
663378ad20 | ||
|
|
5807bb191e | ||
|
|
ab9ef2d8cc |
29
.classpath
@@ -1,29 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<classpath>
|
|
||||||
<classpathentry kind="src" path="src"/>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
|
||||||
<classpathentry kind="lib" path="imports/commons-lang3-3.2.1.jar"/>
|
|
||||||
<classpathentry kind="lib" path="imports/jide-oss-3.5.15.jar"/>
|
|
||||||
<classpathentry kind="lib" path="imports/jsr80-1.0.1.jar"/>
|
|
||||||
<classpathentry kind="lib" path="imports/libusb4java-1.2.0-linux-arm.jar"/>
|
|
||||||
<classpathentry kind="lib" path="imports/libusb4java-1.2.0-linux-x86_64.jar"/>
|
|
||||||
<classpathentry kind="lib" path="imports/libusb4java-1.2.0-linux-x86.jar"/>
|
|
||||||
<classpathentry kind="lib" path="imports/libusb4java-1.2.0-osx-x86_64.jar"/>
|
|
||||||
<classpathentry kind="lib" path="imports/libusb4java-1.2.0-osx-x86.jar"/>
|
|
||||||
<classpathentry kind="lib" path="imports/libusb4java-1.2.0-windows-x86_64.jar"/>
|
|
||||||
<classpathentry kind="lib" path="imports/libusb4java-1.2.0-windows-x86.jar"/>
|
|
||||||
<classpathentry kind="lib" path="imports/miglayout-4.0-swing.jar"/>
|
|
||||||
<classpathentry kind="lib" path="imports/usb-api-1.0.2.jar"/>
|
|
||||||
<classpathentry kind="lib" path="imports/usb4java-1.2.0.jar"/>
|
|
||||||
<classpathentry kind="lib" path="imports/usb4java-javax-1.2.0.jar"/>
|
|
||||||
<classpathentry kind="lib" path="config"/>
|
|
||||||
<classpathentry kind="lib" path="imports/JTransforms-3.0.jar" sourcepath="/home/denny/.m2/repository/com/github/wendykierp/JTransforms/3.0/JTransforms-3.0-sources.jar"/>
|
|
||||||
<classpathentry kind="lib" path="imports/libusb4java-1.2.0-linux-ppc.jar"/>
|
|
||||||
<classpathentry kind="lib" path="imports/JLargeArrays-1.2.jar"/>
|
|
||||||
<classpathentry kind="lib" path="imports/slf4j-api-1.7.7.jar"/>
|
|
||||||
<classpathentry kind="lib" path="imports/logback-classic-1.1.2.jar"/>
|
|
||||||
<classpathentry kind="lib" path="imports/logback-core-1.1.2.jar"/>
|
|
||||||
<classpathentry kind="lib" path="imports/commons-io-2.4.jar"/>
|
|
||||||
<classpathentry kind="lib" path="imports/jmbe-interface-0.3.2.jar"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
|
||||||
</classpath>
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
[Dolphin]
|
|
||||||
Timestamp=2015,9,8,20,39,49
|
|
||||||
Version=3
|
|
||||||
ViewMode=1
|
|
||||||
34
.gitignore
vendored
@@ -1,3 +1,35 @@
|
|||||||
/*.class
|
### JetBrains template
|
||||||
|
.idea/
|
||||||
/classes*
|
/classes*
|
||||||
/product*
|
/product*
|
||||||
|
out/
|
||||||
|
.directory
|
||||||
|
.settings
|
||||||
|
|
||||||
|
## File-based project format:
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
|
||||||
|
# mpeltonen/sbt-idea plugin
|
||||||
|
.idea_modules/
|
||||||
|
|
||||||
|
### Java template
|
||||||
|
*.class
|
||||||
|
*.log
|
||||||
|
# Package Files #
|
||||||
|
*.jar
|
||||||
|
|
||||||
|
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||||
|
hs_err_pid*
|
||||||
|
### Gradle template
|
||||||
|
.gradle
|
||||||
|
/build/
|
||||||
|
|
||||||
|
# Ignore Gradle GUI config
|
||||||
|
gradle-app.setting
|
||||||
|
|
||||||
|
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
|
||||||
|
!gradle-wrapper.jar
|
||||||
|
|
||||||
|
# Cache of project
|
||||||
|
.gradletasknamecache
|
||||||
|
|||||||
9
.idea/compiler.xml
generated
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CompilerConfiguration">
|
||||||
|
<bytecodeTargetLevel>
|
||||||
|
<module name="sdr-trunk_main" target="1.8" />
|
||||||
|
<module name="sdr-trunk_test" target="1.8" />
|
||||||
|
</bytecodeTargetLevel>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
10
.idea/modules.xml
generated
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/modules/sdr-trunk.iml" filepath="$PROJECT_DIR$/.idea/modules/sdr-trunk.iml" />
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/modules/sdr-trunk_main.iml" filepath="$PROJECT_DIR$/.idea/modules/sdr-trunk_main.iml" group="sdr-trunk" />
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/modules/sdr-trunk_test.iml" filepath="$PROJECT_DIR$/.idea/modules/sdr-trunk_test.iml" group="sdr-trunk" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
17
.project
@@ -1,17 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<projectDescription>
|
|
||||||
<name>sdrtrunk</name>
|
|
||||||
<comment></comment>
|
|
||||||
<projects>
|
|
||||||
</projects>
|
|
||||||
<buildSpec>
|
|
||||||
<buildCommand>
|
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
||||||
<arguments>
|
|
||||||
</arguments>
|
|
||||||
</buildCommand>
|
|
||||||
</buildSpec>
|
|
||||||
<natures>
|
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
||||||
</natures>
|
|
||||||
</projectDescription>
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
eclipse.preferences.version=1
|
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
|
||||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
|
||||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
|
||||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
|
||||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
|
||||||
org.eclipse.jdt.core.compiler.source=1.7
|
|
||||||
43
CHANGELOG
@@ -1,13 +1,48 @@
|
|||||||
|
0.4.0 ........ (in progress)
|
||||||
|
- Changes build system from ant to gradle. Thanks to: Roman Tsypuk https://github.com/tsypuk
|
||||||
|
|
||||||
0.2.0 2015xxxx
|
0.3.2 20171105
|
||||||
|
- Resolves issue with tuner frequency adjustments that was causing channel processing
|
||||||
|
to lockup and show persistent 'overflow' state in each channel status
|
||||||
|
- Resolves issue with broadcastify 'mountpoint-in-use' error handling and updates
|
||||||
|
memory usage logging
|
||||||
|
- Resolves issue with Shoutcast 2 login error
|
||||||
|
|
||||||
|
0.3.1 20171009
|
||||||
|
- Resolves Java 9 incompatibility issues
|
||||||
|
|
||||||
|
0.3.0 20170922
|
||||||
|
- REQUIRES: Java 8 (or newer) for compatibility and eventual changeover to JavaFX
|
||||||
|
- FEATURE: audio streaming - adds capability to stream to multiple remote broadcast
|
||||||
|
servers (Broadcastify, Icecast v2.3 and v2.4+, and Shoutcast V1 and V2). Each
|
||||||
|
stream can be independently configured with a delay. Audio calls are directed
|
||||||
|
to one or more streams by attaching one or more stream identifiers to each alias.
|
||||||
|
- Extensive GUI updates for tuner, channel and alias management. Includes new
|
||||||
|
'Now Playing' channel view and 'Detail' view.
|
||||||
|
- Updated alias list management of alias id values and wildcards. Weighting is now
|
||||||
|
applied to each wildcard so that they can be ordered from most specific to least
|
||||||
|
specific for lookup value matching purposes.
|
||||||
|
- Added handling for Motorola-specific P25 patch messages and auto-generation of
|
||||||
|
patch group aliases that roll-up aliases from each patched talkgroup to support
|
||||||
|
audio recording and streaming of patch calls according to the identifiers and
|
||||||
|
actions defined for each of the patched talkgroups.
|
||||||
|
- Implemented bounded queues for both tuner and individual channel IQ sample
|
||||||
|
buffers. Bounded queues have ability to enter/exit overflow state when queue
|
||||||
|
size reaches overflow threshold and reset when queue size falls below the reset
|
||||||
|
threshold. Channel state will show OVERFLOW in red/yellow.
|
||||||
|
- Improves handling of P25 TDMA channels (NO Phase 2 decoder support yet)
|
||||||
|
- Updated airspy controller for airspy-mini specific sample rate handling.
|
||||||
|
- New developer remez filter designer tool and internal usage
|
||||||
|
|
||||||
|
0.2.0 20160329
|
||||||
- Major overhaul of underlying processing chain and extensive updates to all
|
- Major overhaul of underlying processing chain and extensive updates to all
|
||||||
decoders and filters
|
decoders and filters
|
||||||
- New audio playback interface with global mute and support for one or two
|
- New audio playback interface with global mute and support for one or two
|
||||||
audio channels
|
audio channels
|
||||||
- Audio playback is prioritized using a new Call Priority alias action
|
- Audio playback is prioritized using a new Call Priority name action
|
||||||
with selected channels having the highest priority and any audio without
|
with selected channels having the highest priority and any audio without
|
||||||
an alias identifier having the lowest priority.
|
an name identifier having the lowest priority.
|
||||||
- Updated Audio recording per call with new 'Non-Recordable' alias action
|
- Updated Audio recording per call with new 'Non-Recordable' name action
|
||||||
- Updated Baseband (I/Q) recording at 48 kHz
|
- Updated Baseband (I/Q) recording at 48 kHz
|
||||||
- Added Airspy tuner support
|
- Added Airspy tuner support
|
||||||
- New traffic channel pool manager for trunked call following
|
- New traffic channel pool manager for trunked call following
|
||||||
|
|||||||
@@ -631,8 +631,8 @@ to attach them to the start of each source file to most effectively
|
|||||||
state the exclusion of warranty; and each file should have at least
|
state the exclusion of warranty; and each file should have at least
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
<one line to give the program's name and a brief idea of what it does.>
|
{one line to give the program's name and a brief idea of what it does.}
|
||||||
Copyright (C) <year> <name of author>
|
Copyright (C) {year} {name of author}
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
|
|||||||
If the program does terminal interaction, make it output a short
|
If the program does terminal interaction, make it output a short
|
||||||
notice like this when it starts in an interactive mode:
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
<program> Copyright (C) <year> <name of author>
|
{project} Copyright (C) {year} {fullname}
|
||||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
This is free software, and you are welcome to redistribute it
|
This is free software, and you are welcome to redistribute it
|
||||||
under certain conditions; type `show c' for details.
|
under certain conditions; type `show c' for details.
|
||||||
57
README.md
@@ -2,18 +2,53 @@
|
|||||||
A cross-platform java application for decoding, monitoring, recording and streaming trunked mobile and related radio protocols using Software Defined Radios (SDR).
|
A cross-platform java application for decoding, monitoring, recording and streaming trunked mobile and related radio protocols using Software Defined Radios (SDR).
|
||||||
|
|
||||||
* [Getting Started](https://github.com/DSheirer/sdrtrunk/wiki/GettingStarted)
|
* [Getting Started](https://github.com/DSheirer/sdrtrunk/wiki/GettingStarted)
|
||||||
* [User's Manual](https://github.com/DSheirer/sdrtrunk/wiki/UserManual)
|
* [User's Manual Version 0.3.0](https://github.com/DSheirer/sdrtrunk/wiki/UserManual_Version0.3.0)
|
||||||
* [Download](https://drive.google.com/folderview?id=0B7BHsssXUq8eOHBTNndCczZTd0k&usp=sharing)
|
* [Download](https://github.com/DSheirer/sdrtrunk/releases)
|
||||||
* [Support](https://groups.google.com/forum/#!forum/sdrtrunk)
|
* [Support](https://groups.google.com/forum/#!forum/sdrtrunk)
|
||||||
|
|
||||||

|

|
||||||
<script>
|
**Figure 1:** sdrtrunk **Version 0.3.0** Application Screenshot
|
||||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
|
||||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
|
||||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
|
||||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
|
||||||
|
|
||||||
ga('create', 'UA-67489234-1', 'auto');
|
# Instructions:
|
||||||
ga('send', 'pageview');
|
## Build the project
|
||||||
|
Project uses gradle as build system. You can build it with locally installed gradle or if you do not have/want install gradle you can use preconfigured linux/windows wrapper.
|
||||||
|
### Build with locally installed gradle 4.3.1
|
||||||
|
```
|
||||||
|
gradle clean buildSdr
|
||||||
|
```
|
||||||
|
### Build with preconfigured wrapper for linux/windows
|
||||||
|
Linux
|
||||||
|
```
|
||||||
|
./gradlew clean buildSdr
|
||||||
|
```
|
||||||
|
Windows
|
||||||
|
```
|
||||||
|
gradle.bat clean buildSdr
|
||||||
|
```
|
||||||
|
This would add gradle, download all project dependencies and build JAR
|
||||||
|
|
||||||
</script>
|
## Development
|
||||||
|
All dependencies/versions are controlled from build.gradle.
|
||||||
|
To change the new release version tag of artifact - change property:
|
||||||
|
```
|
||||||
|
version = '0.3.2'
|
||||||
|
```
|
||||||
|
|
||||||
|
## Run SDRTrunk
|
||||||
|
SDRTrunk is packed into single uber-jar file. There is need to have folders with dependecies and
|
||||||
|
adding them with classpath. Just run with java.
|
||||||
|
### Use Java8
|
||||||
|
```
|
||||||
|
java -jar build/libs/sdr-trunk-all-0.3.2.jar
|
||||||
|
```
|
||||||
|
|
||||||
|
## TODO ITEMS
|
||||||
|
|
||||||
|
- [x] Move project to gradle build
|
||||||
|
- [x] Changed folders structure, based on java project
|
||||||
|
- [x] Dependencies are moved to gradle and versions are updated
|
||||||
|
- [x] Create uberJAR with all dependencies
|
||||||
|
- [ ] Some dependencies left in imports folder. Find them and include into gradle
|
||||||
|
- [ ] Move images into resources of project
|
||||||
|
- [ ] Add tests to project. This would guarantee that after refactoring part of functionality is not broken
|
||||||
|
- [ ] Create modular OOP system (radio-module, gui, web-ui, etc). This would allow to use RADIO modules to call from CLI, GUI or Web UI. And use SDRTrunk as dependency for other projects.
|
||||||
73
build.gradle
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
apply plugin: 'java'
|
||||||
|
apply plugin: 'idea'
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
version = '0.3.2'
|
||||||
|
sourceCompatibility = 1.8
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
main.java.srcDirs 'src/main'
|
||||||
|
test.java.srcDirs 'src/test'
|
||||||
|
}
|
||||||
|
|
||||||
|
idea {
|
||||||
|
module {
|
||||||
|
downloadJavadoc = true
|
||||||
|
downloadSources = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
testCompile 'junit:junit:4.12'
|
||||||
|
testCompile 'org.assertj:assertj-core:3.8.0'
|
||||||
|
compile fileTree(dir: 'imports', include: '*.jar')
|
||||||
|
compile 'org.apache.commons:commons-lang3:3.7'
|
||||||
|
compile 'org.apache.commons:commons-io:1.3.2'
|
||||||
|
compile 'org.slf4j:slf4j-api:1.7.25'
|
||||||
|
compile 'ch.qos.logback:logback-core:1.2.3'
|
||||||
|
compile 'ch.qos.logback:logback-classic:1.2.3'
|
||||||
|
compile 'com.miglayout:miglayout-swing:5.0'
|
||||||
|
|
||||||
|
compile 'org.usb4java:usb4java-javax:1.2.0'
|
||||||
|
compile 'org.usb4java:usb4java:1.2.0'
|
||||||
|
compile 'org.usb4java:libusb4java:1.2.0'
|
||||||
|
compile 'javax.usb:usb-api:1.0.2'
|
||||||
|
compile 'com.github.wendykierp:JTransforms:3.1'
|
||||||
|
compile 'pl.edu.icm:JLargeArrays:1.6'
|
||||||
|
compile 'net.coderazzi:tablefilter-swing:5.3.1'
|
||||||
|
compile 'com.jidesoft:jide-oss:3.4.3'
|
||||||
|
compile 'org.apache.mina:mina-core:2.0.16'
|
||||||
|
compile 'org.apache.mina:mina-http:2.0.16'
|
||||||
|
compile 'org.apache.axis:axis-jaxrpc:1.4'
|
||||||
|
compile 'org.apache.axis:axis:1.4'
|
||||||
|
compile 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.9.3'
|
||||||
|
}
|
||||||
|
|
||||||
|
task wrapper(type: Wrapper) {
|
||||||
|
gradleVersion = '4.3.1'
|
||||||
|
}
|
||||||
|
|
||||||
|
task buildSdr(type: Jar) {
|
||||||
|
manifest {
|
||||||
|
attributes 'Implementation-Title': 'SdrTrunk project',
|
||||||
|
'Implementation-Version': version,
|
||||||
|
'Main-Class': 'io.github.dsheirer.gui.SDRTrunk',
|
||||||
|
'Class-Path': 'jmbe-0.3.2.jar jmbe-0.3.3.jar'
|
||||||
|
}
|
||||||
|
baseName = project.name + '-all'
|
||||||
|
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
|
||||||
|
with jar
|
||||||
|
}
|
||||||
119
build/build.xml
@@ -1,119 +0,0 @@
|
|||||||
<project name="SDRTrunk" default="SDRTrunk" basedir=".">
|
|
||||||
<description>
|
|
||||||
Ant build script for SDRTrunk Decoder Application
|
|
||||||
</description>
|
|
||||||
|
|
||||||
<!-- version properties -->
|
|
||||||
<property name="major" value="0"/>
|
|
||||||
<property name="minor" value="2"/>
|
|
||||||
<property name="build" value="0"/>
|
|
||||||
<property name="release" value="beta.2"/>
|
|
||||||
|
|
||||||
<!-- Build properties -->
|
|
||||||
<property name="classes" location="../classes"/>
|
|
||||||
<property name="configs" location="../config"/>
|
|
||||||
<property name="images" location="../images"/>
|
|
||||||
<property name="libs" location="../imports"/>
|
|
||||||
<property name="license" location="../license"/>
|
|
||||||
<property name="product" location="../product"/>
|
|
||||||
<property name="scripts" location="../scripts"/>
|
|
||||||
<property name="src" location="../src"/>
|
|
||||||
|
|
||||||
<path id="classpath">
|
|
||||||
<fileset dir="${libs}" includes="*.jar" />
|
|
||||||
</path>
|
|
||||||
|
|
||||||
<target name="init">
|
|
||||||
<!-- Create the classes folder to contain the compiled java classes -->
|
|
||||||
<mkdir dir="${classes}"/>
|
|
||||||
|
|
||||||
<!-- Create version file -->
|
|
||||||
<echo message="${major}.${minor}.${build}-${release}" file="${classes}/sdrtrunk-version"/>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="compile" depends="clean,init"
|
|
||||||
description="Compile java classes" >
|
|
||||||
<!-- Compile the java code from ${src} into ${classes} -->
|
|
||||||
<javac srcdir="${src}"
|
|
||||||
destdir="${classes}"
|
|
||||||
classpathref="classpath"
|
|
||||||
includeantruntime="false" />
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="SDRTrunk" depends="compile" description="Create SDRTrunk application" >
|
|
||||||
<!-- Create the distribution directory -->
|
|
||||||
<mkdir dir="${product}"/>
|
|
||||||
|
|
||||||
<!-- Create jar file -->
|
|
||||||
<jar jarfile="${product}/SDRTrunk.jar" basedir="${classes}">
|
|
||||||
<manifest>
|
|
||||||
<attribute name="Main-Class" value="gui.SDRTrunk"/>
|
|
||||||
</manifest>
|
|
||||||
<fileset dir="${configs}">
|
|
||||||
<exclude name="*.rules"/>
|
|
||||||
</fileset>
|
|
||||||
|
|
||||||
<fileset dir="${license}">
|
|
||||||
<include name="license.txt"/>
|
|
||||||
</fileset>
|
|
||||||
</jar>
|
|
||||||
|
|
||||||
<!-- Copy third-party libraries -->
|
|
||||||
<mkdir dir="${product}/libs"/>
|
|
||||||
<copy todir="${product}/libs">
|
|
||||||
<fileset dir="${libs}" includes="*.jar" />
|
|
||||||
</copy>
|
|
||||||
|
|
||||||
<!-- Copy config files -->
|
|
||||||
<mkdir dir="${product}/config"/>
|
|
||||||
|
|
||||||
<copy todir="${product}/config">
|
|
||||||
<fileset dir="${configs}">
|
|
||||||
<include name="*.rules"/>
|
|
||||||
</fileset>
|
|
||||||
</copy>
|
|
||||||
|
|
||||||
<!-- Copy image files -->
|
|
||||||
<mkdir dir="${product}/images"/>
|
|
||||||
<copy todir="${product}/images">
|
|
||||||
<fileset dir="${images}" />
|
|
||||||
</copy>
|
|
||||||
|
|
||||||
<!-- Copy license file -->
|
|
||||||
<copy todir="${product}">
|
|
||||||
<fileset dir="${license}" />
|
|
||||||
</copy>
|
|
||||||
|
|
||||||
<!-- Copy program scripts -->
|
|
||||||
<copy todir="${product}">
|
|
||||||
<fileset dir="${scripts}" />
|
|
||||||
</copy>
|
|
||||||
|
|
||||||
<!-- Set linux permissions on start script -->
|
|
||||||
<chmod file="${product}/run_sdrtrunk_linux.sh" perm="777" />
|
|
||||||
|
|
||||||
<tstamp prefix="build" />
|
|
||||||
|
|
||||||
<property name="filename" value="sdrtrunk_${build.DSTAMP}_${build.TSTAMP}_${major}.${minor}.${build}-${release}"/>
|
|
||||||
|
|
||||||
<!-- Bundle the files into .zip -->
|
|
||||||
<zip destfile="${product}/${filename}.zip" basedir="${product}" />
|
|
||||||
|
|
||||||
<!-- Bundle the files into .tar.gz to preserve linux script permissions -->
|
|
||||||
<tar destfile="${product}/${filename}.tar.gz" compression="gzip">
|
|
||||||
<tarfileset dir="${product}" filemode="777">
|
|
||||||
<include name="*.sh"/>
|
|
||||||
</tarfileset>
|
|
||||||
<tarfileset dir="${product}">
|
|
||||||
<exclude name="*.sh"/>
|
|
||||||
<exclude name="${filename}.zip"/>
|
|
||||||
</tarfileset>
|
|
||||||
</tar>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
<target name="clean" description="Clean previous build artifacts" >
|
|
||||||
<delete dir="${classes}"/>
|
|
||||||
<delete dir="${product}"/>
|
|
||||||
</target>
|
|
||||||
|
|
||||||
</project>
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
<configuration>
|
|
||||||
<timestamp key="appstart" datePattern="HHmmss"/>
|
|
||||||
|
|
||||||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
||||||
<file>${user.home}/SDRTrunk/logs/sdrtrunk_app.log</file>
|
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
|
||||||
<!-- daily log rollover -->
|
|
||||||
<fileNamePattern>${user.home}/SDRTrunk/logs/%d{yyyyMMdd}_sdrtrunk_app.log</fileNamePattern>
|
|
||||||
<maxHistory>10</maxHistory>
|
|
||||||
</rollingPolicy>
|
|
||||||
<encoder>
|
|
||||||
<pattern>%-25(%d{yyyyMMdd HHmmss.SSS} [%thread]) %-5level %logger{30} - %msg%n</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<root level="DEBUG">
|
|
||||||
<appender-ref ref="FILE" />
|
|
||||||
</root>
|
|
||||||
|
|
||||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
|
||||||
<encoder>
|
|
||||||
<pattern>%-12(%d{HH:mm:ss.SSS}) %-5level %logger{25} - %msg%n</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<root level="DEBUG">
|
|
||||||
<appender-ref ref="STDOUT" />
|
|
||||||
</root>
|
|
||||||
|
|
||||||
</configuration>
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SDR Trunk
|
* SDR Trunk
|
||||||
* Copyright (C) 2015 Dennis Sheirer
|
* Copyright (C) 2014-2016 Dennis Sheirer
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
5
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3.1-bin.zip
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
172
gradlew
vendored
Executable file
@@ -0,0 +1,172 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
##
|
||||||
|
## Gradle start up script for UN*X
|
||||||
|
##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
PRG="$0"
|
||||||
|
# Need this for relative symlinks.
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >/dev/null
|
||||||
|
|
||||||
|
APP_NAME="Gradle"
|
||||||
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS=""
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD="maximum"
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN* )
|
||||||
|
cygwin=true
|
||||||
|
;;
|
||||||
|
Darwin* )
|
||||||
|
darwin=true
|
||||||
|
;;
|
||||||
|
MINGW* )
|
||||||
|
msys=true
|
||||||
|
;;
|
||||||
|
NONSTOP* )
|
||||||
|
nonstop=true
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="java"
|
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||||
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
ulimit -n $MAX_FD
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
|
if $darwin; then
|
||||||
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin, switch paths to Windows format before running java
|
||||||
|
if $cygwin ; then
|
||||||
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
|
|
||||||
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
SEP=""
|
||||||
|
for dir in $ROOTDIRSRAW ; do
|
||||||
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
|
SEP="|"
|
||||||
|
done
|
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
|
fi
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
i=0
|
||||||
|
for arg in "$@" ; do
|
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
|
else
|
||||||
|
eval `echo args$i`="\"$arg\""
|
||||||
|
fi
|
||||||
|
i=$((i+1))
|
||||||
|
done
|
||||||
|
case $i in
|
||||||
|
(0) set -- ;;
|
||||||
|
(1) set -- "$args0" ;;
|
||||||
|
(2) set -- "$args0" "$args1" ;;
|
||||||
|
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
|
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
|
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
|
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
|
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
|
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
|
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Escape application args
|
||||||
|
save () {
|
||||||
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
|
echo " "
|
||||||
|
}
|
||||||
|
APP_ARGS=$(save "$@")
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||||
|
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||||
|
|
||||||
|
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||||
|
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
||||||
84
gradlew.bat
vendored
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS=
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:init
|
||||||
|
@rem Get command-line arguments, handling Windows variants
|
||||||
|
|
||||||
|
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||||
|
|
||||||
|
:win9xME_args
|
||||||
|
@rem Slurp the command line arguments.
|
||||||
|
set CMD_LINE_ARGS=
|
||||||
|
set _SKIP=2
|
||||||
|
|
||||||
|
:win9xME_args_slurp
|
||||||
|
if "x%~1" == "x" goto execute
|
||||||
|
|
||||||
|
set CMD_LINE_ARGS=%*
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
[Dolphin]
|
|
||||||
PreviewsShown=true
|
|
||||||
Timestamp=2013,9,20,8,54,21
|
|
||||||
Version=3
|
|
||||||
BIN
images/Curve-fitted-background.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
images/Curve-fitted-chart-background.png
Normal file
|
After Width: | Height: | Size: 90 KiB |
BIN
images/Curve-fitted-graph-gridlines.png
Normal file
|
After Width: | Height: | Size: 152 B |
BIN
images/broadcastify.png
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
images/control_play.png
Normal file
|
After Width: | Height: | Size: 592 B |
BIN
images/control_stop.png
Normal file
|
After Width: | Height: | Size: 403 B |
BIN
images/icecast.png
Normal file
|
After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 688 B After Width: | Height: | Size: 743 B |
BIN
images/shoutcast.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
@@ -1,4 +0,0 @@
|
|||||||
[Dolphin]
|
|
||||||
Timestamp=2013,4,7,10,12,39
|
|
||||||
Version=3
|
|
||||||
ViewMode=1
|
|
||||||
BIN
imports/java-lame-3.98.4.jar
Normal file
BIN
imports/radioreference-14.jar
Normal file
BIN
imports/wsdl4j-1.5.1.jar
Normal file
@@ -1,2 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
java -XX:+UseG1GC -cp "*:libs/*" gui.SDRTrunk&
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
java -XX:+UseG1GC -cp "SDRTrunk.jar;*;libs/*;config/*;images/*" gui.SDRTrunk
|
|
||||||
1
settings.gradle
Normal file
@@ -0,0 +1 @@
|
|||||||
|
rootProject.name = 'sdr-trunk'
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
[Dolphin]
|
|
||||||
Timestamp=2015,9,1,6,42,59
|
|
||||||
Version=3
|
|
||||||
ViewMode=1
|
|
||||||
@@ -1,200 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* SDR Trunk
|
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
******************************************************************************/
|
|
||||||
package alias;
|
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAttribute;
|
|
||||||
|
|
||||||
import alias.action.AliasAction;
|
|
||||||
import alias.priority.Priority;
|
|
||||||
import audio.inverted.AudioType;
|
|
||||||
|
|
||||||
public class Alias
|
|
||||||
{
|
|
||||||
private String mName;
|
|
||||||
private int mColor;
|
|
||||||
private String mIconName;
|
|
||||||
private ArrayList<AliasID> mAliasIDs = new ArrayList<AliasID>();
|
|
||||||
private List<AliasAction> mAliasActions = new ArrayList<AliasAction>();
|
|
||||||
|
|
||||||
public Alias()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
return getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@XmlAttribute
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return mName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName( String name )
|
|
||||||
{
|
|
||||||
mName = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@XmlAttribute
|
|
||||||
public int getColor()
|
|
||||||
{
|
|
||||||
return mColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setColor( int color )
|
|
||||||
{
|
|
||||||
mColor = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Color getMapColor()
|
|
||||||
{
|
|
||||||
return new Color( mColor );
|
|
||||||
}
|
|
||||||
|
|
||||||
@XmlAttribute
|
|
||||||
public String getIconName()
|
|
||||||
{
|
|
||||||
return mIconName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIconName( String iconName )
|
|
||||||
{
|
|
||||||
mIconName = iconName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ArrayList<AliasID> getId()
|
|
||||||
{
|
|
||||||
return mAliasIDs;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId( ArrayList<AliasID> id )
|
|
||||||
{
|
|
||||||
mAliasIDs = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addAliasID( AliasID id )
|
|
||||||
{
|
|
||||||
mAliasIDs.add( id );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeAliasID( AliasID id )
|
|
||||||
{
|
|
||||||
mAliasIDs.remove( id );
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<AliasAction> getAction()
|
|
||||||
{
|
|
||||||
return mAliasActions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAction( List<AliasAction> actions )
|
|
||||||
{
|
|
||||||
mAliasActions = actions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addAliasAction( AliasAction action )
|
|
||||||
{
|
|
||||||
mAliasActions.add( action );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeAliasAction( AliasAction action )
|
|
||||||
{
|
|
||||||
mAliasActions.remove( action );
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasActions()
|
|
||||||
{
|
|
||||||
return !mAliasActions.isEmpty();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasAudioType()
|
|
||||||
{
|
|
||||||
for( AliasID id: mAliasIDs )
|
|
||||||
{
|
|
||||||
if( id.hasAudioType() )
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AudioType getAudioType()
|
|
||||||
{
|
|
||||||
for( AliasID id: mAliasIDs )
|
|
||||||
{
|
|
||||||
if( id.hasAudioType() )
|
|
||||||
{
|
|
||||||
return id.getAudioType();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return AudioType.NORMAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the priority level of this alias, if defined, or the default priority
|
|
||||||
*/
|
|
||||||
public int getCallPriority()
|
|
||||||
{
|
|
||||||
for( AliasID id: mAliasIDs )
|
|
||||||
{
|
|
||||||
if( id.getType() == AliasIDType.Priority )
|
|
||||||
{
|
|
||||||
return ((Priority)id).getPriority();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Priority.DEFAULT_PRIORITY;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean hasPriority()
|
|
||||||
{
|
|
||||||
for( AliasID id: mAliasIDs )
|
|
||||||
{
|
|
||||||
if( id.getType() == AliasIDType.Priority )
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Inspects the alias for a non-recordable alias id. Default is true;
|
|
||||||
*/
|
|
||||||
public boolean isRecordable()
|
|
||||||
{
|
|
||||||
for( AliasID id: getId() )
|
|
||||||
{
|
|
||||||
if( id.getType() == AliasIDType.NonRecordable )
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* SDR Trunk
|
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
******************************************************************************/
|
|
||||||
package alias;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
import javax.xml.bind.annotation.XmlSeeAlso;
|
|
||||||
|
|
||||||
@XmlSeeAlso( { AliasList.class} )
|
|
||||||
@XmlRootElement( name = "alias_directory" )
|
|
||||||
public class AliasDirectory
|
|
||||||
{
|
|
||||||
private ArrayList<AliasList> mAliasList = new ArrayList<AliasList>();
|
|
||||||
|
|
||||||
public AliasDirectory()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void refresh()
|
|
||||||
{
|
|
||||||
for( AliasList list: mAliasList )
|
|
||||||
{
|
|
||||||
list.update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@XmlElement( name = "alias_list" )
|
|
||||||
public ArrayList<AliasList> getAliasList()
|
|
||||||
{
|
|
||||||
return mAliasList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAliasList( ArrayList<AliasList> lists )
|
|
||||||
{
|
|
||||||
mAliasList = lists;
|
|
||||||
|
|
||||||
if( mAliasList == null )
|
|
||||||
{
|
|
||||||
mAliasList = new ArrayList<AliasList>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addAliasList( AliasList list )
|
|
||||||
{
|
|
||||||
mAliasList.add( list );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeAliasList( AliasList list )
|
|
||||||
{
|
|
||||||
mAliasList.remove( list );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the named alias list, or returns an empty alias list
|
|
||||||
*/
|
|
||||||
public AliasList getAliasList( String name )
|
|
||||||
{
|
|
||||||
AliasList retVal = new AliasList();
|
|
||||||
|
|
||||||
for( AliasList list: mAliasList )
|
|
||||||
{
|
|
||||||
if( list.getName().equalsIgnoreCase( name ) )
|
|
||||||
{
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return retVal;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* SDR Trunk
|
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
******************************************************************************/
|
|
||||||
package alias;
|
|
||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
|
|
||||||
import javax.swing.JMenuItem;
|
|
||||||
import javax.swing.JPopupMenu;
|
|
||||||
|
|
||||||
import controller.ConfigurableNode;
|
|
||||||
|
|
||||||
public class AliasDirectoryNode extends ConfigurableNode
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public AliasDirectoryNode( AliasDirectory directory )
|
|
||||||
{
|
|
||||||
super( directory );
|
|
||||||
}
|
|
||||||
|
|
||||||
public AliasDirectory getAliasDirectory()
|
|
||||||
{
|
|
||||||
return (AliasDirectory)getUserObject();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void init()
|
|
||||||
{
|
|
||||||
for( AliasList list: getAliasDirectory().getAliasList() )
|
|
||||||
{
|
|
||||||
AliasListNode node = new AliasListNode( list );
|
|
||||||
|
|
||||||
getModel().addNode( node, AliasDirectoryNode.this, getChildCount() );
|
|
||||||
|
|
||||||
node.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
sort();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
return "Alias Lists [" + this.getChildCount() + "]";
|
|
||||||
}
|
|
||||||
|
|
||||||
public JPopupMenu getContextMenu()
|
|
||||||
{
|
|
||||||
JPopupMenu retVal = new JPopupMenu();
|
|
||||||
|
|
||||||
JMenuItem addItem = new JMenuItem( "Add Alias List" );
|
|
||||||
addItem.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
AliasList list = new AliasList();
|
|
||||||
|
|
||||||
getAliasDirectory().addAliasList( list );
|
|
||||||
|
|
||||||
AliasListNode node = new AliasListNode( list );
|
|
||||||
|
|
||||||
getModel().addNode( node,
|
|
||||||
AliasDirectoryNode.this,
|
|
||||||
AliasDirectoryNode.this.getChildCount() );
|
|
||||||
|
|
||||||
sort();
|
|
||||||
|
|
||||||
getModel().showNode( node );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
retVal.add( addItem );
|
|
||||||
|
|
||||||
return retVal;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,205 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* SDR Trunk
|
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
******************************************************************************/
|
|
||||||
package alias;
|
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Dimension;
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
|
|
||||||
import javax.swing.BorderFactory;
|
|
||||||
import javax.swing.JButton;
|
|
||||||
import javax.swing.JColorChooser;
|
|
||||||
import javax.swing.JComboBox;
|
|
||||||
import javax.swing.JLabel;
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JTextField;
|
|
||||||
import javax.swing.tree.TreePath;
|
|
||||||
|
|
||||||
import map.MapIcon;
|
|
||||||
import map.MapIconListCellRenderer;
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
import settings.SettingsManager;
|
|
||||||
import controller.ConfigurableNode;
|
|
||||||
import controller.ResourceManager;
|
|
||||||
|
|
||||||
public class AliasEditor extends JPanel implements ActionListener
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private AliasNode mAliasNode;
|
|
||||||
private ResourceManager mResourceManager;
|
|
||||||
|
|
||||||
private JLabel mLabelName;
|
|
||||||
private JTextField mTextAlias;
|
|
||||||
|
|
||||||
private JLabel mLabelMapColor;
|
|
||||||
private JButton mButtonColor;
|
|
||||||
private JComboBox<MapIcon> mComboMapIcon;
|
|
||||||
private JButton mBtnIconManager;
|
|
||||||
|
|
||||||
public AliasEditor( AliasNode aliasNode, ResourceManager resourceManager )
|
|
||||||
{
|
|
||||||
mAliasNode = aliasNode;
|
|
||||||
mResourceManager = resourceManager;
|
|
||||||
|
|
||||||
initGUI();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initGUI()
|
|
||||||
{
|
|
||||||
setLayout( new MigLayout( "", "[right][grow,fill]", "[][][][][][grow][]" ) );
|
|
||||||
|
|
||||||
setBorder( BorderFactory.createTitledBorder( "Alias" ) );
|
|
||||||
|
|
||||||
mLabelName = new JLabel( "Name:" );
|
|
||||||
add( mLabelName );
|
|
||||||
|
|
||||||
mTextAlias = new JTextField( mAliasNode.getAlias().getName() );
|
|
||||||
add( mTextAlias, "wrap" );
|
|
||||||
|
|
||||||
mLabelMapColor = new JLabel( "Map Color:" );
|
|
||||||
add( mLabelMapColor );
|
|
||||||
|
|
||||||
mButtonColor = new JButton( "Map Color" );
|
|
||||||
mButtonColor.setBackground( mAliasNode.getAlias().getMapColor() );
|
|
||||||
mButtonColor.setForeground( mAliasNode.getAlias().getMapColor() );
|
|
||||||
mButtonColor.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
Color newColor = JColorChooser.showDialog(
|
|
||||||
AliasEditor.this,
|
|
||||||
"Choose color for map labels and routes",
|
|
||||||
mAliasNode.getAlias().getMapColor() );
|
|
||||||
|
|
||||||
mButtonColor.setForeground( newColor );
|
|
||||||
mButtonColor.setBackground( newColor );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
add( mButtonColor, "wrap" );
|
|
||||||
|
|
||||||
add( new JLabel( "Icon:" ) );
|
|
||||||
|
|
||||||
mComboMapIcon = new JComboBox<MapIcon>(
|
|
||||||
mResourceManager.getSettingsManager().getMapIcons() );
|
|
||||||
|
|
||||||
MapIconListCellRenderer renderer = new MapIconListCellRenderer();
|
|
||||||
renderer.setPreferredSize( new Dimension( 200, 30 ) );
|
|
||||||
mComboMapIcon.setRenderer( renderer );
|
|
||||||
|
|
||||||
String iconName = mAliasNode.getAlias().getIconName();
|
|
||||||
|
|
||||||
if( iconName == null )
|
|
||||||
{
|
|
||||||
iconName = SettingsManager.DEFAULT_ICON;
|
|
||||||
}
|
|
||||||
|
|
||||||
MapIcon savedIcon = mResourceManager.getSettingsManager()
|
|
||||||
.getMapIcon( iconName );
|
|
||||||
|
|
||||||
if( savedIcon != null )
|
|
||||||
{
|
|
||||||
mComboMapIcon.setSelectedItem( savedIcon );
|
|
||||||
}
|
|
||||||
|
|
||||||
add( mComboMapIcon, "wrap" );
|
|
||||||
|
|
||||||
//Dummy place holder
|
|
||||||
add( new JLabel() );
|
|
||||||
|
|
||||||
mBtnIconManager = new JButton( "Icon Manager" );
|
|
||||||
mBtnIconManager.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent arg0 )
|
|
||||||
{
|
|
||||||
mResourceManager.getController().showIconManager();
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
add( mBtnIconManager, "span 2,wrap" );
|
|
||||||
|
|
||||||
JButton btnSave = new JButton( "Save" );
|
|
||||||
btnSave.addActionListener( AliasEditor.this );
|
|
||||||
add( btnSave );
|
|
||||||
|
|
||||||
JButton btnReset = new JButton( "Reset" );
|
|
||||||
btnReset.addActionListener( AliasEditor.this );
|
|
||||||
add( btnReset, "wrap" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
String command = e.getActionCommand();
|
|
||||||
|
|
||||||
if( command.contentEquals( "Save" ) )
|
|
||||||
{
|
|
||||||
String alias = mTextAlias.getText();
|
|
||||||
|
|
||||||
if( alias != null )
|
|
||||||
{
|
|
||||||
boolean expanded = mAliasNode.getModel().getTree()
|
|
||||||
.isExpanded( new TreePath( mAliasNode ) );
|
|
||||||
|
|
||||||
mAliasNode.getAlias().setName( alias );
|
|
||||||
((ConfigurableNode)mAliasNode.getParent()).sort();
|
|
||||||
|
|
||||||
mAliasNode.getAlias().setColor(
|
|
||||||
mButtonColor.getBackground().getRGB() );
|
|
||||||
|
|
||||||
MapIcon selectedIcon = (MapIcon)mComboMapIcon.getSelectedItem();
|
|
||||||
|
|
||||||
if( selectedIcon != null )
|
|
||||||
{
|
|
||||||
mAliasNode.getAlias().setIconName( selectedIcon.getName() );
|
|
||||||
}
|
|
||||||
|
|
||||||
mAliasNode.save();
|
|
||||||
|
|
||||||
mAliasNode.show();
|
|
||||||
|
|
||||||
if( expanded )
|
|
||||||
{
|
|
||||||
mAliasNode.getModel().getTree()
|
|
||||||
.expandPath( new TreePath( mAliasNode ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
JOptionPane.showMessageDialog( AliasEditor.this, "Please enter an alias name" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if( command.contentEquals( "Reset" ) )
|
|
||||||
{
|
|
||||||
mTextAlias.setText( mAliasNode.getAlias().getName() );
|
|
||||||
|
|
||||||
mButtonColor.setBackground( mAliasNode.getAlias().getMapColor() );
|
|
||||||
mButtonColor.setForeground( mAliasNode.getAlias().getMapColor() );
|
|
||||||
|
|
||||||
MapIcon savedIcon = mResourceManager.getSettingsManager()
|
|
||||||
.getMapIcon( mAliasNode.getAlias().getIconName() );
|
|
||||||
|
|
||||||
mComboMapIcon.setSelectedItem( savedIcon );
|
|
||||||
}
|
|
||||||
|
|
||||||
mAliasNode.refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* SDR Trunk
|
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
******************************************************************************/
|
|
||||||
package alias;
|
|
||||||
|
|
||||||
import audio.inverted.AudioType;
|
|
||||||
|
|
||||||
public abstract class AliasID
|
|
||||||
{
|
|
||||||
public AliasID()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract AliasIDType getType();
|
|
||||||
|
|
||||||
public boolean hasAudioType()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AudioType getAudioType()
|
|
||||||
{
|
|
||||||
return AudioType.NORMAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract boolean matches( AliasID id );
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* SDR Trunk
|
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
******************************************************************************/
|
|
||||||
package alias;
|
|
||||||
|
|
||||||
import controller.ConfigurableNode;
|
|
||||||
|
|
||||||
public class AliasIDNode extends ConfigurableNode
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public AliasIDNode( AliasID id )
|
|
||||||
{
|
|
||||||
super( id );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void save()
|
|
||||||
{
|
|
||||||
getModel().getResourceManager().getPlaylistManager().save();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,580 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* SDR Trunk
|
|
||||||
* Copyright (C) 2014,2015 Dennis Sheirer
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
******************************************************************************/
|
|
||||||
package alias;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAttribute;
|
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
|
||||||
import javax.xml.bind.annotation.XmlSeeAlso;
|
|
||||||
|
|
||||||
import module.decode.lj1200.LJ1200Message.Function;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import alias.action.AliasAction;
|
|
||||||
import alias.action.beep.BeepAction;
|
|
||||||
import alias.action.clip.ClipAction;
|
|
||||||
import alias.action.script.ScriptAction;
|
|
||||||
import alias.id.esn.Esn;
|
|
||||||
import alias.id.fleetsync.FleetsyncID;
|
|
||||||
import alias.id.fleetsync.StatusID;
|
|
||||||
import alias.id.lojack.LoJackFunctionAndID;
|
|
||||||
import alias.id.mdc.MDC1200ID;
|
|
||||||
import alias.id.mobileID.Min;
|
|
||||||
import alias.id.mpt1327.MPT1327ID;
|
|
||||||
import alias.id.siteID.SiteID;
|
|
||||||
import alias.id.talkgroup.TalkgroupID;
|
|
||||||
import alias.id.uniqueID.UniqueID;
|
|
||||||
import alias.priority.Priority;
|
|
||||||
import alias.record.NonRecordable;
|
|
||||||
import audio.metadata.MetadataType;
|
|
||||||
|
|
||||||
@XmlSeeAlso( { Alias.class,
|
|
||||||
|
|
||||||
/* Alias ID's */
|
|
||||||
AliasID.class,
|
|
||||||
FleetsyncID.class,
|
|
||||||
Esn.class,
|
|
||||||
Group.class,
|
|
||||||
LoJackFunctionAndID.class,
|
|
||||||
MDC1200ID.class,
|
|
||||||
Min.class,
|
|
||||||
MPT1327ID.class,
|
|
||||||
UniqueID.class,
|
|
||||||
SiteID.class,
|
|
||||||
StatusID.class,
|
|
||||||
TalkgroupID.class,
|
|
||||||
|
|
||||||
/* Alias Attributes */
|
|
||||||
NonRecordable.class,
|
|
||||||
Priority.class,
|
|
||||||
|
|
||||||
/* Alias Actions */
|
|
||||||
AliasAction.class,
|
|
||||||
BeepAction.class,
|
|
||||||
ClipAction.class,
|
|
||||||
ScriptAction.class } )
|
|
||||||
|
|
||||||
@XmlRootElement( name = "alias_list" )
|
|
||||||
public class AliasList implements Comparable<AliasList>
|
|
||||||
{
|
|
||||||
private final static Logger mLog = LoggerFactory.getLogger( AliasList.class );
|
|
||||||
|
|
||||||
private String mName;
|
|
||||||
private ArrayList<Group> mGroups = new ArrayList<Group>();
|
|
||||||
|
|
||||||
private Map<String,Alias> mESN = new HashMap<>();
|
|
||||||
private Map<String,Alias> mFleetsync = new HashMap<>();
|
|
||||||
private Map<LoJackFunctionAndID,Alias> mLoJack = new HashMap<>();
|
|
||||||
private Map<String,Alias> mMDC1200 = new HashMap<>();
|
|
||||||
private Map<String,Alias> mMobileID = new HashMap<>();
|
|
||||||
private Map<String,Alias> mMPT1327 = new HashMap<>();
|
|
||||||
private Map<String, Alias> mSiteID = new HashMap<>();
|
|
||||||
private Map<Integer, Alias> mStatus = new HashMap<>();
|
|
||||||
private Map<String,Alias> mTalkgroup = new HashMap<>();
|
|
||||||
private Map<Integer,Alias> mUniqueID = new HashMap<>();
|
|
||||||
|
|
||||||
private boolean mESNWildcard = false;
|
|
||||||
private boolean mMobileIDWildcard = false;
|
|
||||||
private boolean mFleetsyncWildcard = false;
|
|
||||||
private boolean mMDC1200Wildcard = false;
|
|
||||||
private boolean mMPT1327Wildcard = false;
|
|
||||||
private boolean mSiteWildcard = false;
|
|
||||||
private boolean mTalkgroupWildcard = false;
|
|
||||||
|
|
||||||
public AliasList()
|
|
||||||
{
|
|
||||||
this( null );
|
|
||||||
}
|
|
||||||
|
|
||||||
public AliasList( String name )
|
|
||||||
{
|
|
||||||
mName = name;
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Load/Reload all lookup hashmaps
|
|
||||||
*/
|
|
||||||
public void update()
|
|
||||||
{
|
|
||||||
//Clear hashmaps
|
|
||||||
mESN.clear();
|
|
||||||
mFleetsync.clear();
|
|
||||||
mLoJack.clear();
|
|
||||||
mMDC1200.clear();
|
|
||||||
mMobileID.clear();
|
|
||||||
mMPT1327.clear();
|
|
||||||
mSiteID.clear();
|
|
||||||
mStatus.clear();
|
|
||||||
mTalkgroup.clear();
|
|
||||||
mUniqueID.clear();
|
|
||||||
|
|
||||||
for( Group group: mGroups )
|
|
||||||
{
|
|
||||||
for( Alias alias: group.getAlias() )
|
|
||||||
{
|
|
||||||
for( AliasID id: alias.getId() )
|
|
||||||
{
|
|
||||||
switch( id.getType() )
|
|
||||||
{
|
|
||||||
case ESN:
|
|
||||||
Esn esn = (Esn)id;
|
|
||||||
if( esn.getEsn().contains( "*" ) )
|
|
||||||
{
|
|
||||||
mESNWildcard = true;
|
|
||||||
|
|
||||||
mESN.put( fixWildcard( esn.getEsn() ), alias );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mESN.put( esn.getEsn(), alias );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Fleetsync:
|
|
||||||
FleetsyncID fs = (FleetsyncID)id;
|
|
||||||
|
|
||||||
if( fs.getIdent().contains( "*" ) )
|
|
||||||
{
|
|
||||||
mFleetsyncWildcard = true;
|
|
||||||
|
|
||||||
mFleetsync.put( fixWildcard( fs.getIdent() ), alias );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mFleetsync.put( fs.getIdent(), alias );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case LoJack:
|
|
||||||
mLoJack.put( (LoJackFunctionAndID)id, alias );
|
|
||||||
break;
|
|
||||||
case MDC1200:
|
|
||||||
MDC1200ID mdc = (MDC1200ID)id;
|
|
||||||
|
|
||||||
if( mdc.getIdent().contains( "*" ) )
|
|
||||||
{
|
|
||||||
mMDC1200Wildcard = true;
|
|
||||||
|
|
||||||
//Replace (*) wildcard with regex wildcard (.)
|
|
||||||
mMDC1200.put( fixWildcard( mdc.getIdent() ), alias );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mMDC1200.put( mdc.getIdent(), alias );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case MPT1327:
|
|
||||||
MPT1327ID mpt = (MPT1327ID)id;
|
|
||||||
|
|
||||||
String ident = mpt.getIdent();
|
|
||||||
|
|
||||||
if( ident != null )
|
|
||||||
{
|
|
||||||
if( ident.contains( "*" ) )
|
|
||||||
{
|
|
||||||
mMPT1327Wildcard = true;
|
|
||||||
|
|
||||||
//Replace (*) wildcard with regex wildcard (.)
|
|
||||||
mMPT1327.put( fixWildcard( ident ), alias );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mMPT1327.put( ident, alias );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case MIN:
|
|
||||||
Min min = (Min)id;
|
|
||||||
|
|
||||||
if( min.getMin().contains( "*" ) )
|
|
||||||
{
|
|
||||||
mMobileIDWildcard = true;
|
|
||||||
mMobileID.put( fixWildcard( min.getMin() ), alias );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mMobileID.put( min.getMin(), alias );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case LTRNetUID:
|
|
||||||
UniqueID uid = (UniqueID)id;
|
|
||||||
|
|
||||||
mUniqueID.put( uid.getUid(), alias );
|
|
||||||
break;
|
|
||||||
case Site:
|
|
||||||
SiteID siteID = (SiteID)id;
|
|
||||||
|
|
||||||
if( siteID.getSite().contains( "*" ) )
|
|
||||||
{
|
|
||||||
mSiteWildcard = true;
|
|
||||||
mSiteID.put( fixWildcard( siteID.getSite() ), alias );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mSiteID.put( siteID.getSite(), alias );
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
case Status:
|
|
||||||
mStatus.put( ((StatusID)id).getStatus(), alias );
|
|
||||||
break;
|
|
||||||
case Talkgroup:
|
|
||||||
TalkgroupID tgid = (TalkgroupID)id;
|
|
||||||
|
|
||||||
if( tgid.getTalkgroup().contains( "*" ) )
|
|
||||||
{
|
|
||||||
mTalkgroupWildcard = true;
|
|
||||||
|
|
||||||
//Replace (*) wildcard with regex wildcard (.)
|
|
||||||
mTalkgroup.put( fixWildcard( tgid.getTalkgroup() ), alias );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mTalkgroup.put( tgid.getTalkgroup(), alias );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case NonRecordable:
|
|
||||||
case Priority:
|
|
||||||
//We don't maintain lookups for these items
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
mLog.warn( "Unrecognized Alias ID Type:" + id.getType().name() );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts user wildcard character (*) to regex single character wildcard (.)
|
|
||||||
* but ignores a regex multi-character wildcard (.*)
|
|
||||||
*/
|
|
||||||
private String fixWildcard( String value )
|
|
||||||
{
|
|
||||||
if( value.contains( "*" ) && !value.contains( ".*" ) )
|
|
||||||
{
|
|
||||||
return value.replace( "*", "." );
|
|
||||||
}
|
|
||||||
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Alias getSiteID( String siteID )
|
|
||||||
{
|
|
||||||
if( siteID != null )
|
|
||||||
{
|
|
||||||
if( mSiteWildcard )
|
|
||||||
{
|
|
||||||
for( String regex: mSiteID.keySet() )
|
|
||||||
{
|
|
||||||
if( siteID.matches( regex ) )
|
|
||||||
{
|
|
||||||
return mSiteID.get( regex );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return mSiteID.get( siteID );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Alias getStatus( int status )
|
|
||||||
{
|
|
||||||
return mStatus.get( status );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Alias getUniqueID( int uniqueID )
|
|
||||||
{
|
|
||||||
return mUniqueID.get( uniqueID );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Alias getESNAlias( String esn )
|
|
||||||
{
|
|
||||||
if( esn != null )
|
|
||||||
{
|
|
||||||
if( mESNWildcard )
|
|
||||||
{
|
|
||||||
for( String regex: mESN.keySet() )
|
|
||||||
{
|
|
||||||
if( esn.matches( regex ) )
|
|
||||||
{
|
|
||||||
return mESN.get( regex );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return mESN.get( esn );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public Alias getFleetsyncAlias( String ident )
|
|
||||||
{
|
|
||||||
if( ident != null )
|
|
||||||
{
|
|
||||||
if( mFleetsyncWildcard )
|
|
||||||
{
|
|
||||||
for( String regex: mFleetsync.keySet() )
|
|
||||||
{
|
|
||||||
if( ident.matches( regex ) )
|
|
||||||
{
|
|
||||||
return mFleetsync.get( regex );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return mFleetsync.get( ident );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Alias getLoJackAlias( Function function, String id )
|
|
||||||
{
|
|
||||||
if( id != null )
|
|
||||||
{
|
|
||||||
for( LoJackFunctionAndID lojack: mLoJack.keySet() )
|
|
||||||
{
|
|
||||||
if( lojack.matches( function, id ) )
|
|
||||||
{
|
|
||||||
return mLoJack.get( lojack );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Alias getMDC1200Alias( String ident )
|
|
||||||
{
|
|
||||||
if( ident != null )
|
|
||||||
{
|
|
||||||
if( mMDC1200Wildcard )
|
|
||||||
{
|
|
||||||
for( String regex: mMDC1200.keySet() )
|
|
||||||
{
|
|
||||||
if( ident.matches( regex ) )
|
|
||||||
{
|
|
||||||
return mMDC1200.get( regex );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return mMDC1200.get( ident );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Alias getMPT1327Alias( String ident )
|
|
||||||
{
|
|
||||||
if( ident != null )
|
|
||||||
{
|
|
||||||
if( mMPT1327Wildcard )
|
|
||||||
{
|
|
||||||
for( String regex: mMPT1327.keySet() )
|
|
||||||
{
|
|
||||||
if( ident.matches( regex ) )
|
|
||||||
{
|
|
||||||
return mMPT1327.get( regex );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return mMPT1327.get( ident );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Group getGroup( Alias alias )
|
|
||||||
{
|
|
||||||
if( alias != null )
|
|
||||||
{
|
|
||||||
for( Group group: mGroups )
|
|
||||||
{
|
|
||||||
if( group.contains( alias ) )
|
|
||||||
{
|
|
||||||
return group;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Alias getMobileIDNumberAlias( String ident )
|
|
||||||
{
|
|
||||||
if( ident != null )
|
|
||||||
{
|
|
||||||
if( mMobileIDWildcard )
|
|
||||||
{
|
|
||||||
for( String regex: mMobileID.keySet() )
|
|
||||||
{
|
|
||||||
if( ident.matches( regex ) )
|
|
||||||
{
|
|
||||||
return mMobileID.get( regex );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return mMobileID.get( ident );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Alias getTalkgroupAlias( String tgid )
|
|
||||||
{
|
|
||||||
if( tgid != null )
|
|
||||||
{
|
|
||||||
if( mTalkgroupWildcard )
|
|
||||||
{
|
|
||||||
for( String regex: mTalkgroup.keySet() )
|
|
||||||
{
|
|
||||||
if( tgid.matches( regex ) )
|
|
||||||
{
|
|
||||||
return mTalkgroup.get( regex );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return mTalkgroup.get( tgid );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
return mName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@XmlAttribute
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return mName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName( String name )
|
|
||||||
{
|
|
||||||
mName = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ArrayList<Group> getGroup()
|
|
||||||
{
|
|
||||||
return mGroups;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGroup( ArrayList<Group> groups )
|
|
||||||
{
|
|
||||||
mGroups = groups;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addGroup( Group group )
|
|
||||||
{
|
|
||||||
mGroups.add( group );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeGroup( Group group )
|
|
||||||
{
|
|
||||||
mGroups.remove( group );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compareTo( AliasList otherAliasList )
|
|
||||||
{
|
|
||||||
return getName().compareTo( otherAliasList.getName() );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Alias getAlias( String value, MetadataType type )
|
|
||||||
{
|
|
||||||
switch( type )
|
|
||||||
{
|
|
||||||
case ESN:
|
|
||||||
return getESNAlias( value );
|
|
||||||
case FLEETSYNC:
|
|
||||||
return getFleetsyncAlias( value );
|
|
||||||
case MDC1200:
|
|
||||||
return getMDC1200Alias( value );
|
|
||||||
case MOBILE_ID:
|
|
||||||
return getMobileIDNumberAlias( value );
|
|
||||||
case MPT1327:
|
|
||||||
return getMPT1327Alias( value );
|
|
||||||
case SITE_ID:
|
|
||||||
return getSiteID( value );
|
|
||||||
case STATUS:
|
|
||||||
if( value != null )
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return getStatus( Integer.valueOf( value ) );
|
|
||||||
}
|
|
||||||
catch( Exception e )
|
|
||||||
{
|
|
||||||
//do nothing, we couldn't parse the int value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case FROM:
|
|
||||||
case TO:
|
|
||||||
return getTalkgroupAlias( value );
|
|
||||||
case UNIQUE_ID:
|
|
||||||
if( value != null )
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return getUniqueID( Integer.valueOf( value ) );
|
|
||||||
}
|
|
||||||
catch( Exception e )
|
|
||||||
{
|
|
||||||
//do nothing, we couldn't parse the int value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,126 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* SDR Trunk
|
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
******************************************************************************/
|
|
||||||
package alias;
|
|
||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
|
|
||||||
import javax.swing.JMenuItem;
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JPopupMenu;
|
|
||||||
import javax.swing.JSeparator;
|
|
||||||
|
|
||||||
import controller.ConfigurableNode;
|
|
||||||
|
|
||||||
public class AliasListNode extends ConfigurableNode
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public AliasListNode( AliasList list )
|
|
||||||
{
|
|
||||||
super( list );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JPanel getEditor()
|
|
||||||
{
|
|
||||||
return new ListEditor( this );
|
|
||||||
}
|
|
||||||
|
|
||||||
public AliasList getList()
|
|
||||||
{
|
|
||||||
return (AliasList)getUserObject();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void init()
|
|
||||||
{
|
|
||||||
for( Group group: getList().getGroup() )
|
|
||||||
{
|
|
||||||
GroupNode node = new GroupNode( group );
|
|
||||||
|
|
||||||
getModel().addNode( node, AliasListNode.this, getChildCount() );
|
|
||||||
|
|
||||||
node.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
sort();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
return getList().getName() + " [" + this.getChildCount() + "]";
|
|
||||||
}
|
|
||||||
|
|
||||||
public JPopupMenu getContextMenu()
|
|
||||||
{
|
|
||||||
JPopupMenu retVal = new JPopupMenu();
|
|
||||||
|
|
||||||
JMenuItem addItem = new JMenuItem( "Add Group" );
|
|
||||||
addItem.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
Group group = new Group();
|
|
||||||
|
|
||||||
getList().addGroup( group );
|
|
||||||
|
|
||||||
GroupNode node = new GroupNode( group );
|
|
||||||
|
|
||||||
getModel().addNode( node,
|
|
||||||
AliasListNode.this,
|
|
||||||
AliasListNode.this.getChildCount() );
|
|
||||||
|
|
||||||
sort();
|
|
||||||
|
|
||||||
getModel().showNode( node );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
retVal.add( addItem );
|
|
||||||
|
|
||||||
retVal.add( new JSeparator() );
|
|
||||||
|
|
||||||
JMenuItem deleteItem = new JMenuItem( "Delete" );
|
|
||||||
deleteItem.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
int n = JOptionPane.showConfirmDialog( getModel().getTree(),
|
|
||||||
"Are you sure you want to permanently delete this node?" );
|
|
||||||
|
|
||||||
if( n == JOptionPane.YES_OPTION )
|
|
||||||
{
|
|
||||||
AliasDirectoryNode parent = (AliasDirectoryNode)getParent();
|
|
||||||
|
|
||||||
parent.getAliasDirectory().removeAliasList( getList() );
|
|
||||||
|
|
||||||
save();
|
|
||||||
|
|
||||||
getModel().removeNodeFromParent( AliasListNode.this );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
retVal.add( deleteItem );
|
|
||||||
|
|
||||||
return retVal;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,562 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* SDR Trunk
|
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
******************************************************************************/
|
|
||||||
package alias;
|
|
||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
|
|
||||||
import javax.swing.JMenu;
|
|
||||||
import javax.swing.JMenuItem;
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JPopupMenu;
|
|
||||||
|
|
||||||
import map.MapIcon;
|
|
||||||
import alias.action.AliasAction;
|
|
||||||
import alias.action.beep.BeepAction;
|
|
||||||
import alias.action.beep.BeepActionNode;
|
|
||||||
import alias.action.clip.ClipAction;
|
|
||||||
import alias.action.clip.ClipActionNode;
|
|
||||||
import alias.action.script.ScriptAction;
|
|
||||||
import alias.action.script.ScriptActionNode;
|
|
||||||
import alias.id.esn.ESNNode;
|
|
||||||
import alias.id.esn.Esn;
|
|
||||||
import alias.id.fleetsync.FleetsyncID;
|
|
||||||
import alias.id.fleetsync.FleetsyncIDNode;
|
|
||||||
import alias.id.fleetsync.StatusID;
|
|
||||||
import alias.id.fleetsync.StatusIDNode;
|
|
||||||
import alias.id.lojack.LoJackFunctionAndID;
|
|
||||||
import alias.id.lojack.LoJackIDNode;
|
|
||||||
import alias.id.mdc.MDC1200ID;
|
|
||||||
import alias.id.mdc.MDC1200IDNode;
|
|
||||||
import alias.id.mobileID.MINNode;
|
|
||||||
import alias.id.mobileID.Min;
|
|
||||||
import alias.id.mpt1327.MPT1327ID;
|
|
||||||
import alias.id.mpt1327.MPT1327IDNode;
|
|
||||||
import alias.id.siteID.SiteID;
|
|
||||||
import alias.id.siteID.SiteIDNode;
|
|
||||||
import alias.id.talkgroup.TalkgroupID;
|
|
||||||
import alias.id.talkgroup.TalkgroupIDNode;
|
|
||||||
import alias.id.uniqueID.UniqueID;
|
|
||||||
import alias.id.uniqueID.UniqueIDNode;
|
|
||||||
import alias.priority.Priority;
|
|
||||||
import alias.priority.PriorityNode;
|
|
||||||
import alias.record.NonRecordable;
|
|
||||||
import alias.record.NonRecordableNode;
|
|
||||||
import controller.ConfigurableNode;
|
|
||||||
|
|
||||||
public class AliasNode extends ConfigurableNode
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public AliasNode( Alias alias )
|
|
||||||
{
|
|
||||||
super( alias );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JPanel getEditor()
|
|
||||||
{
|
|
||||||
return new AliasEditor( this, getModel().getResourceManager() );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Alias getAlias()
|
|
||||||
{
|
|
||||||
return (Alias)getUserObject();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getIconPath()
|
|
||||||
{
|
|
||||||
String icon = getAlias().getIconName();
|
|
||||||
|
|
||||||
MapIcon mapIcon = getModel().getResourceManager()
|
|
||||||
.getSettingsManager().getMapIcon( icon );
|
|
||||||
|
|
||||||
if( mapIcon != null )
|
|
||||||
{
|
|
||||||
return mapIcon.getPath();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void init()
|
|
||||||
{
|
|
||||||
for( AliasID aliasID: getAlias().getId() )
|
|
||||||
{
|
|
||||||
switch( aliasID.getType() )
|
|
||||||
{
|
|
||||||
case ESN:
|
|
||||||
getModel().addNode( new ESNNode( (Esn)aliasID ),
|
|
||||||
AliasNode.this, getChildCount() );
|
|
||||||
break;
|
|
||||||
case Fleetsync:
|
|
||||||
getModel().addNode( new FleetsyncIDNode( (FleetsyncID)aliasID ),
|
|
||||||
AliasNode.this, getChildCount() );
|
|
||||||
break;
|
|
||||||
case LoJack:
|
|
||||||
getModel().addNode( new LoJackIDNode( (LoJackFunctionAndID)aliasID ),
|
|
||||||
AliasNode.this, getChildCount() );
|
|
||||||
break;
|
|
||||||
case LTRNetUID:
|
|
||||||
getModel().addNode( new UniqueIDNode( (UniqueID)aliasID ),
|
|
||||||
AliasNode.this, getChildCount() );
|
|
||||||
break;
|
|
||||||
case MDC1200:
|
|
||||||
getModel().addNode( new MDC1200IDNode( (MDC1200ID)aliasID ),
|
|
||||||
AliasNode.this, getChildCount() );
|
|
||||||
break;
|
|
||||||
case MIN:
|
|
||||||
getModel().addNode( new MINNode( (Min)aliasID ),
|
|
||||||
AliasNode.this, getChildCount() );
|
|
||||||
break;
|
|
||||||
case MPT1327:
|
|
||||||
getModel().addNode( new MPT1327IDNode( (MPT1327ID)aliasID ),
|
|
||||||
AliasNode.this, getChildCount() );
|
|
||||||
break;
|
|
||||||
case NonRecordable:
|
|
||||||
getModel().addNode( new NonRecordableNode( (NonRecordable)aliasID ),
|
|
||||||
AliasNode.this, getChildCount() );
|
|
||||||
break;
|
|
||||||
case Priority:
|
|
||||||
getModel().addNode( new PriorityNode( (Priority)aliasID ),
|
|
||||||
AliasNode.this, getChildCount() );
|
|
||||||
break;
|
|
||||||
case Site:
|
|
||||||
getModel().addNode( new SiteIDNode( (SiteID)aliasID ),
|
|
||||||
AliasNode.this, getChildCount() );
|
|
||||||
break;
|
|
||||||
case Status:
|
|
||||||
getModel().addNode( new StatusIDNode( (StatusID)aliasID ),
|
|
||||||
AliasNode.this, getChildCount() );
|
|
||||||
break;
|
|
||||||
case Talkgroup:
|
|
||||||
getModel().addNode( new TalkgroupIDNode( (TalkgroupID)aliasID ),
|
|
||||||
AliasNode.this, getChildCount() );
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new IllegalArgumentException( "Unrecognized alias ID [" +
|
|
||||||
aliasID.getType() + "]");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for( AliasAction action: getAlias().getAction() )
|
|
||||||
{
|
|
||||||
if( action instanceof BeepAction )
|
|
||||||
{
|
|
||||||
getModel().addNode( new BeepActionNode( (BeepAction)action ),
|
|
||||||
AliasNode.this, getChildCount() );
|
|
||||||
}
|
|
||||||
else if( action instanceof ClipAction )
|
|
||||||
{
|
|
||||||
getModel().addNode( new ClipActionNode( (ClipAction)action ),
|
|
||||||
AliasNode.this, getChildCount() );
|
|
||||||
}
|
|
||||||
else if( action instanceof ScriptAction )
|
|
||||||
{
|
|
||||||
getModel().addNode( new ScriptActionNode( (ScriptAction)action ),
|
|
||||||
AliasNode.this, getChildCount() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sort();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
return getAlias().getName() + " [" + this.getChildCount() + "]";
|
|
||||||
}
|
|
||||||
|
|
||||||
public JPopupMenu getContextMenu()
|
|
||||||
{
|
|
||||||
JPopupMenu retVal = new JPopupMenu();
|
|
||||||
|
|
||||||
JMenu addIDMenu = new JMenu( "Add ID" );
|
|
||||||
|
|
||||||
JMenuItem addESNItem = new JMenuItem( "ESN" );
|
|
||||||
addESNItem.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
Esn esn = new Esn();
|
|
||||||
|
|
||||||
getAlias().addAliasID( esn );
|
|
||||||
|
|
||||||
ESNNode node = new ESNNode( esn );
|
|
||||||
|
|
||||||
getModel().addNode( node,
|
|
||||||
AliasNode.this,
|
|
||||||
AliasNode.this.getChildCount() );
|
|
||||||
|
|
||||||
node.show();
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
addIDMenu.add( addESNItem );
|
|
||||||
|
|
||||||
JMenuItem addFleetsyncItem = new JMenuItem( "Fleetsync" );
|
|
||||||
addFleetsyncItem.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
FleetsyncID fs = new FleetsyncID();
|
|
||||||
|
|
||||||
getAlias().addAliasID( fs );
|
|
||||||
|
|
||||||
FleetsyncIDNode node = new FleetsyncIDNode( fs );
|
|
||||||
|
|
||||||
getModel().addNode( node,
|
|
||||||
AliasNode.this,
|
|
||||||
AliasNode.this.getChildCount() );
|
|
||||||
|
|
||||||
node.show();
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
addIDMenu.add( addFleetsyncItem );
|
|
||||||
|
|
||||||
JMenuItem addLoJackItem = new JMenuItem( "LoJack" );
|
|
||||||
addLoJackItem.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
LoJackFunctionAndID lj = new LoJackFunctionAndID();
|
|
||||||
|
|
||||||
getAlias().addAliasID( lj );
|
|
||||||
|
|
||||||
LoJackIDNode node = new LoJackIDNode( lj );
|
|
||||||
|
|
||||||
getModel().addNode( node,
|
|
||||||
AliasNode.this,
|
|
||||||
AliasNode.this.getChildCount() );
|
|
||||||
|
|
||||||
node.show();
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
addIDMenu.add( addLoJackItem );
|
|
||||||
|
|
||||||
JMenuItem addMDCItem = new JMenuItem( "MDC-1200" );
|
|
||||||
addMDCItem.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
MDC1200ID mdc = new MDC1200ID();
|
|
||||||
|
|
||||||
getAlias().addAliasID( mdc );
|
|
||||||
|
|
||||||
MDC1200IDNode node = new MDC1200IDNode( mdc );
|
|
||||||
|
|
||||||
getModel().addNode( node,
|
|
||||||
AliasNode.this,
|
|
||||||
AliasNode.this.getChildCount() );
|
|
||||||
|
|
||||||
node.show();
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
addIDMenu.add( addMDCItem );
|
|
||||||
|
|
||||||
JMenuItem addMINItem = new JMenuItem( "MIN" );
|
|
||||||
addMINItem.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
Min min = new Min();
|
|
||||||
|
|
||||||
getAlias().addAliasID( min );
|
|
||||||
|
|
||||||
MINNode node = new MINNode( min );
|
|
||||||
|
|
||||||
getModel().addNode( node,
|
|
||||||
AliasNode.this,
|
|
||||||
AliasNode.this.getChildCount() );
|
|
||||||
|
|
||||||
node.show();
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
addIDMenu.add( addMINItem );
|
|
||||||
|
|
||||||
JMenuItem addMPTItem = new JMenuItem( "MPT-1327" );
|
|
||||||
addMPTItem.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
MPT1327ID mpt = new MPT1327ID();
|
|
||||||
|
|
||||||
getAlias().addAliasID( mpt );
|
|
||||||
|
|
||||||
MPT1327IDNode node = new MPT1327IDNode( mpt );
|
|
||||||
|
|
||||||
getModel().addNode( node,
|
|
||||||
AliasNode.this,
|
|
||||||
AliasNode.this.getChildCount() );
|
|
||||||
|
|
||||||
node.show();
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
addIDMenu.add( addMPTItem );
|
|
||||||
|
|
||||||
JMenuItem addSiteItem = new JMenuItem( "Site" );
|
|
||||||
addSiteItem.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
SiteID siteID = new SiteID();
|
|
||||||
|
|
||||||
getAlias().addAliasID( siteID );
|
|
||||||
|
|
||||||
SiteIDNode node = new SiteIDNode( siteID );
|
|
||||||
|
|
||||||
getModel().addNode( node,
|
|
||||||
AliasNode.this,
|
|
||||||
AliasNode.this.getChildCount() );
|
|
||||||
|
|
||||||
node.show();
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
addIDMenu.add( addSiteItem );
|
|
||||||
|
|
||||||
JMenuItem addStatusItem = new JMenuItem( "Status" );
|
|
||||||
addStatusItem.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
StatusID statusID = new StatusID();
|
|
||||||
|
|
||||||
getAlias().addAliasID( statusID );
|
|
||||||
|
|
||||||
StatusIDNode node = new StatusIDNode( statusID );
|
|
||||||
|
|
||||||
getModel().addNode( node,
|
|
||||||
AliasNode.this,
|
|
||||||
AliasNode.this.getChildCount() );
|
|
||||||
|
|
||||||
node.show();
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
addIDMenu.add( addStatusItem );
|
|
||||||
|
|
||||||
JMenuItem addTalkgroupItem = new JMenuItem( "Talkgroup" );
|
|
||||||
addTalkgroupItem.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
TalkgroupID tg = new TalkgroupID();
|
|
||||||
|
|
||||||
getAlias().addAliasID( tg );
|
|
||||||
|
|
||||||
TalkgroupIDNode node = new TalkgroupIDNode( tg );
|
|
||||||
|
|
||||||
getModel().addNode( node,
|
|
||||||
AliasNode.this,
|
|
||||||
AliasNode.this.getChildCount() );
|
|
||||||
|
|
||||||
node.show();
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
addIDMenu.add( addTalkgroupItem );
|
|
||||||
|
|
||||||
JMenuItem addUniqueIDItem = new JMenuItem( "Unique ID" );
|
|
||||||
addUniqueIDItem.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
UniqueID uid = new UniqueID();
|
|
||||||
|
|
||||||
getAlias().addAliasID( uid );
|
|
||||||
|
|
||||||
UniqueIDNode node = new UniqueIDNode( uid );
|
|
||||||
|
|
||||||
getModel().addNode( node,
|
|
||||||
AliasNode.this,
|
|
||||||
AliasNode.this.getChildCount() );
|
|
||||||
|
|
||||||
node.show();
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
addIDMenu.add( addUniqueIDItem );
|
|
||||||
|
|
||||||
retVal.add( addIDMenu );
|
|
||||||
|
|
||||||
JMenu addActionMenu = new JMenu( "Add Action" );
|
|
||||||
|
|
||||||
JMenuItem addClipItem = new JMenuItem( "Audio Clip" );
|
|
||||||
|
|
||||||
addClipItem.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
ClipAction clipAction = new ClipAction();
|
|
||||||
|
|
||||||
getAlias().addAliasAction( clipAction );
|
|
||||||
|
|
||||||
ClipActionNode node = new ClipActionNode( clipAction );
|
|
||||||
|
|
||||||
getModel().addNode( node,
|
|
||||||
AliasNode.this,
|
|
||||||
AliasNode.this.getChildCount() );
|
|
||||||
|
|
||||||
node.show();
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
addActionMenu.add( addClipItem );
|
|
||||||
|
|
||||||
JMenuItem addBeepItem = new JMenuItem( "Beep" );
|
|
||||||
|
|
||||||
addBeepItem.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
BeepAction beepAction = new BeepAction();
|
|
||||||
|
|
||||||
getAlias().addAliasAction( beepAction );
|
|
||||||
|
|
||||||
BeepActionNode node = new BeepActionNode( beepAction );
|
|
||||||
|
|
||||||
getModel().addNode( node,
|
|
||||||
AliasNode.this,
|
|
||||||
AliasNode.this.getChildCount() );
|
|
||||||
|
|
||||||
node.show();
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
addActionMenu.add( addBeepItem );
|
|
||||||
|
|
||||||
JMenuItem addScriptItem = new JMenuItem( "Script" );
|
|
||||||
|
|
||||||
addScriptItem.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
ScriptAction scriptAction = new ScriptAction();
|
|
||||||
|
|
||||||
getAlias().addAliasAction( scriptAction );
|
|
||||||
|
|
||||||
ScriptActionNode node = new ScriptActionNode( scriptAction );
|
|
||||||
|
|
||||||
getModel().addNode( node,
|
|
||||||
AliasNode.this,
|
|
||||||
AliasNode.this.getChildCount() );
|
|
||||||
|
|
||||||
node.show();
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
addActionMenu.add( addScriptItem );
|
|
||||||
|
|
||||||
retVal.add( addActionMenu );
|
|
||||||
|
|
||||||
retVal.addSeparator();
|
|
||||||
|
|
||||||
if( getAlias().isRecordable() )
|
|
||||||
{
|
|
||||||
JMenuItem nonRecordableItem = new JMenuItem( "Set Non-Recordable" );
|
|
||||||
|
|
||||||
nonRecordableItem.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
NonRecordable non = new NonRecordable();
|
|
||||||
|
|
||||||
getAlias().addAliasID( non );
|
|
||||||
|
|
||||||
NonRecordableNode node = new NonRecordableNode( non );
|
|
||||||
|
|
||||||
getModel().addNode( node,
|
|
||||||
AliasNode.this,
|
|
||||||
AliasNode.this.getChildCount() );
|
|
||||||
|
|
||||||
node.show();
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
retVal.add( nonRecordableItem );
|
|
||||||
retVal.addSeparator();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !getAlias().hasPriority() )
|
|
||||||
{
|
|
||||||
JMenuItem priorityItem = new JMenuItem( "Set Call Priority" );
|
|
||||||
|
|
||||||
priorityItem.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
Priority priority = new Priority();
|
|
||||||
|
|
||||||
getAlias().addAliasID( priority );
|
|
||||||
|
|
||||||
PriorityNode node = new PriorityNode( priority );
|
|
||||||
|
|
||||||
getModel().addNode( node,
|
|
||||||
AliasNode.this,
|
|
||||||
AliasNode.this.getChildCount() );
|
|
||||||
|
|
||||||
node.show();
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
retVal.add( priorityItem );
|
|
||||||
retVal.addSeparator();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
JMenuItem deleteItem = new JMenuItem( "Delete" );
|
|
||||||
deleteItem.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
int n = JOptionPane.showConfirmDialog( getModel().getTree(),
|
|
||||||
"Are you sure you want to permanently delete this node?" );
|
|
||||||
|
|
||||||
if( n == JOptionPane.YES_OPTION )
|
|
||||||
{
|
|
||||||
GroupNode parent = (GroupNode)getParent();
|
|
||||||
|
|
||||||
parent.getGroup().removeAlias( getAlias() );
|
|
||||||
|
|
||||||
save();
|
|
||||||
|
|
||||||
getModel().removeNodeFromParent( AliasNode.this );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
retVal.add( deleteItem );
|
|
||||||
|
|
||||||
return retVal;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* SDR Trunk
|
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
******************************************************************************/
|
|
||||||
package alias;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAttribute;
|
|
||||||
|
|
||||||
public class Group
|
|
||||||
{
|
|
||||||
private String mName;
|
|
||||||
private ArrayList<Alias> mAliases = new ArrayList<Alias>();
|
|
||||||
|
|
||||||
public Group()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
return "Group: " + mName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@XmlAttribute
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return mName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName( String name )
|
|
||||||
{
|
|
||||||
mName = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ArrayList<Alias> getAlias()
|
|
||||||
{
|
|
||||||
return mAliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAlias( ArrayList<Alias> aliases )
|
|
||||||
{
|
|
||||||
mAliases = aliases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addAlias( Alias alias )
|
|
||||||
{
|
|
||||||
mAliases.add( alias );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeAlias( Alias alias )
|
|
||||||
{
|
|
||||||
mAliases.remove( alias );
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean contains( Alias alias )
|
|
||||||
{
|
|
||||||
return mAliases.contains( alias );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,110 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* SDR Trunk
|
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
******************************************************************************/
|
|
||||||
package alias;
|
|
||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
|
|
||||||
import javax.swing.BorderFactory;
|
|
||||||
import javax.swing.JButton;
|
|
||||||
import javax.swing.JLabel;
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JTextField;
|
|
||||||
import javax.swing.tree.TreePath;
|
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
import controller.ConfigurableNode;
|
|
||||||
|
|
||||||
public class GroupEditor extends JPanel implements ActionListener
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
private GroupNode mGroupNode;
|
|
||||||
|
|
||||||
private JLabel mLabelName;
|
|
||||||
private JTextField mTextGroup;
|
|
||||||
|
|
||||||
public GroupEditor( GroupNode groupNode )
|
|
||||||
{
|
|
||||||
mGroupNode = groupNode;
|
|
||||||
|
|
||||||
initGUI();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initGUI()
|
|
||||||
{
|
|
||||||
setLayout( new MigLayout( "", "[right][grow,fill]", "[][][grow]" ) );
|
|
||||||
|
|
||||||
setBorder( BorderFactory.createTitledBorder( "Group" ) );
|
|
||||||
|
|
||||||
mLabelName = new JLabel( "Name:" );
|
|
||||||
add( mLabelName, "align right" );
|
|
||||||
|
|
||||||
mTextGroup = new JTextField( mGroupNode.getGroup().getName() );
|
|
||||||
add( mTextGroup, "wrap" );
|
|
||||||
|
|
||||||
JButton btnSave = new JButton( "Save" );
|
|
||||||
btnSave.addActionListener( GroupEditor.this );
|
|
||||||
add( btnSave );
|
|
||||||
|
|
||||||
JButton btnReset = new JButton( "Reset" );
|
|
||||||
btnReset.addActionListener( GroupEditor.this );
|
|
||||||
add( btnReset, "wrap" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
String command = e.getActionCommand();
|
|
||||||
|
|
||||||
if( command.contentEquals( "Save" ) )
|
|
||||||
{
|
|
||||||
String group = mTextGroup.getText();
|
|
||||||
|
|
||||||
if( group != null )
|
|
||||||
{
|
|
||||||
boolean expanded = mGroupNode.getModel().getTree()
|
|
||||||
.isExpanded( new TreePath( mGroupNode ) );
|
|
||||||
|
|
||||||
mGroupNode.getGroup().setName( group );
|
|
||||||
|
|
||||||
((ConfigurableNode)mGroupNode.getParent()).sort();
|
|
||||||
|
|
||||||
mGroupNode.save();
|
|
||||||
|
|
||||||
mGroupNode.show();
|
|
||||||
|
|
||||||
if( expanded )
|
|
||||||
{
|
|
||||||
mGroupNode.getModel().getTree()
|
|
||||||
.expandPath( new TreePath( mGroupNode ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
JOptionPane.showMessageDialog( GroupEditor.this, "Please enter a group name" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if( command.contentEquals( "Reset" ) )
|
|
||||||
{
|
|
||||||
mTextGroup.setText( mGroupNode.getGroup().getName() );
|
|
||||||
}
|
|
||||||
|
|
||||||
mGroupNode.refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,126 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* SDR Trunk
|
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
******************************************************************************/
|
|
||||||
package alias;
|
|
||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
|
|
||||||
import javax.swing.JMenuItem;
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JPopupMenu;
|
|
||||||
import javax.swing.JSeparator;
|
|
||||||
|
|
||||||
import controller.ConfigurableNode;
|
|
||||||
|
|
||||||
public class GroupNode extends ConfigurableNode
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public GroupNode( Group group )
|
|
||||||
{
|
|
||||||
super( group );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JPanel getEditor()
|
|
||||||
{
|
|
||||||
return new GroupEditor( this );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Group getGroup()
|
|
||||||
{
|
|
||||||
return (Group)getUserObject();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void init()
|
|
||||||
{
|
|
||||||
for( Alias alias: getGroup().getAlias() )
|
|
||||||
{
|
|
||||||
AliasNode node = new AliasNode( alias );
|
|
||||||
|
|
||||||
getModel().addNode( node, GroupNode.this, getChildCount() );
|
|
||||||
|
|
||||||
node.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
sort();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
return getGroup().getName() + " [" + this.getChildCount() + "]";
|
|
||||||
}
|
|
||||||
|
|
||||||
public JPopupMenu getContextMenu()
|
|
||||||
{
|
|
||||||
JPopupMenu retVal = new JPopupMenu();
|
|
||||||
|
|
||||||
JMenuItem addItem = new JMenuItem( "Add Alias" );
|
|
||||||
addItem.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
Alias alias = new Alias();
|
|
||||||
|
|
||||||
getGroup().addAlias( alias );
|
|
||||||
|
|
||||||
AliasNode node = new AliasNode( alias );
|
|
||||||
|
|
||||||
getModel().addNode( node,
|
|
||||||
GroupNode.this,
|
|
||||||
GroupNode.this.getChildCount() );
|
|
||||||
|
|
||||||
sort();
|
|
||||||
|
|
||||||
getModel().showNode( node );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
retVal.add( addItem );
|
|
||||||
|
|
||||||
retVal.add( new JSeparator() );
|
|
||||||
|
|
||||||
JMenuItem deleteItem = new JMenuItem( "Delete" );
|
|
||||||
deleteItem.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
int n = JOptionPane.showConfirmDialog( getModel().getTree(),
|
|
||||||
"Are you sure you want to permanently delete this node?" );
|
|
||||||
|
|
||||||
if( n == JOptionPane.YES_OPTION )
|
|
||||||
{
|
|
||||||
AliasListNode parent = (AliasListNode)getParent();
|
|
||||||
|
|
||||||
parent.getList().removeGroup( getGroup() );
|
|
||||||
|
|
||||||
save();
|
|
||||||
|
|
||||||
getModel().removeNodeFromParent( GroupNode.this );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
retVal.add( deleteItem );
|
|
||||||
|
|
||||||
return retVal;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,107 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* SDR Trunk
|
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
******************************************************************************/
|
|
||||||
package alias;
|
|
||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
|
|
||||||
import javax.swing.BorderFactory;
|
|
||||||
import javax.swing.JButton;
|
|
||||||
import javax.swing.JLabel;
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JTextField;
|
|
||||||
import javax.swing.tree.TreePath;
|
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
import controller.ConfigurableNode;
|
|
||||||
|
|
||||||
public class ListEditor extends JPanel implements ActionListener
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
private AliasListNode mListNode;
|
|
||||||
|
|
||||||
private JLabel mLabelName;
|
|
||||||
private JTextField mTextGroup;
|
|
||||||
|
|
||||||
public ListEditor( AliasListNode listNode )
|
|
||||||
{
|
|
||||||
mListNode = listNode;
|
|
||||||
|
|
||||||
initGUI();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initGUI()
|
|
||||||
{
|
|
||||||
setLayout( new MigLayout( "", "[right][grow,fill]", "[][][grow]" ) );
|
|
||||||
|
|
||||||
setBorder( BorderFactory.createTitledBorder( "List" ) );
|
|
||||||
|
|
||||||
mLabelName = new JLabel( "Name:" );
|
|
||||||
add( mLabelName, "align right" );
|
|
||||||
|
|
||||||
mTextGroup = new JTextField( mListNode.getList().getName() );
|
|
||||||
add( mTextGroup, "grow, wrap" );
|
|
||||||
|
|
||||||
JButton btnSave = new JButton( "Save" );
|
|
||||||
btnSave.addActionListener( ListEditor.this );
|
|
||||||
add( btnSave );
|
|
||||||
|
|
||||||
JButton btnReset = new JButton( "Reset" );
|
|
||||||
btnReset.addActionListener( ListEditor.this );
|
|
||||||
add( btnReset, "wrap" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
String command = e.getActionCommand();
|
|
||||||
|
|
||||||
if( command.contentEquals( "Save" ) )
|
|
||||||
{
|
|
||||||
String group = mTextGroup.getText();
|
|
||||||
|
|
||||||
if( group != null )
|
|
||||||
{
|
|
||||||
boolean expanded = mListNode.getModel().getTree()
|
|
||||||
.isExpanded( new TreePath( mListNode ) );
|
|
||||||
|
|
||||||
mListNode.getList().setName( group );
|
|
||||||
((ConfigurableNode)mListNode.getParent()).sort();
|
|
||||||
mListNode.save();
|
|
||||||
|
|
||||||
mListNode.show();
|
|
||||||
|
|
||||||
if( expanded )
|
|
||||||
{
|
|
||||||
mListNode.getModel().getTree().expandPath( new TreePath( mListNode ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
JOptionPane.showMessageDialog( ListEditor.this, "Please enter a list name" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if( command.contentEquals( "Reset" ) )
|
|
||||||
{
|
|
||||||
mTextGroup.setText( mListNode.getList().getName() );
|
|
||||||
}
|
|
||||||
|
|
||||||
mListNode.refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
package alias.action;
|
|
||||||
|
|
||||||
import message.Message;
|
|
||||||
import alias.Alias;
|
|
||||||
import controller.ThreadPoolManager;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Alias action defines an action to execute when an alias is detected active.
|
|
||||||
*/
|
|
||||||
public abstract class AliasAction
|
|
||||||
{
|
|
||||||
public AliasAction()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Task to execute when an alias action is defined. The message argument is
|
|
||||||
* the original message containing one or more aliases that have an alias
|
|
||||||
* action attached. The alias argument is the parent alias containing the
|
|
||||||
* alias action.
|
|
||||||
*/
|
|
||||||
public abstract void execute( ThreadPoolManager threadPoolManager,
|
|
||||||
Alias alias,
|
|
||||||
Message message );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Dismiss a persistent alias action
|
|
||||||
*/
|
|
||||||
public abstract void dismiss( boolean reset );
|
|
||||||
}
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
package alias.action;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import message.Message;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import sample.Listener;
|
|
||||||
import alias.Alias;
|
|
||||||
import controller.ResourceManager;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Manages all alias action events. Each received message is interrogated for
|
|
||||||
* any alias entries and then each alias is interrogated for any alias actions.
|
|
||||||
*
|
|
||||||
* Each alias action is executed and provided a copy of the source message so
|
|
||||||
* that the contents of the message can be used as part of the action.
|
|
||||||
*/
|
|
||||||
public class AliasActionManager implements Listener<Message>
|
|
||||||
{
|
|
||||||
private final static Logger mLog =
|
|
||||||
LoggerFactory.getLogger( AliasActionManager.class );
|
|
||||||
|
|
||||||
private ResourceManager mResourceManager;
|
|
||||||
|
|
||||||
public AliasActionManager( ResourceManager resourceManager )
|
|
||||||
{
|
|
||||||
mResourceManager = resourceManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void receive( Message message )
|
|
||||||
{
|
|
||||||
if( message.isValid() )
|
|
||||||
{
|
|
||||||
List<Alias> aliases = message.getAliases();
|
|
||||||
|
|
||||||
if( aliases != null )
|
|
||||||
{
|
|
||||||
for( Alias alias: aliases )
|
|
||||||
{
|
|
||||||
if( alias.hasActions() )
|
|
||||||
{
|
|
||||||
List<AliasAction> actions = alias.getAction();
|
|
||||||
|
|
||||||
for( AliasAction action: actions )
|
|
||||||
{
|
|
||||||
/* Provide access to the thread pool manager in case the
|
|
||||||
* action needs to setup a timer, and provide the original
|
|
||||||
* message to be used as part of the action (e.g. sending
|
|
||||||
* the message as a text message to a cell phone */
|
|
||||||
action.execute( mResourceManager.getThreadPoolManager(),
|
|
||||||
alias, message );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* SDR Trunk
|
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
******************************************************************************/
|
|
||||||
package alias.action;
|
|
||||||
|
|
||||||
import controller.ConfigurableNode;
|
|
||||||
|
|
||||||
public class AliasActionNode extends ConfigurableNode
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public AliasActionNode( AliasAction action )
|
|
||||||
{
|
|
||||||
super( action );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void save()
|
|
||||||
{
|
|
||||||
getModel().getResourceManager().getPlaylistManager().save();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getIconPath()
|
|
||||||
{
|
|
||||||
return "images/action.png";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,188 +0,0 @@
|
|||||||
package alias.action;
|
|
||||||
|
|
||||||
import java.awt.EventQueue;
|
|
||||||
import java.util.concurrent.ScheduledFuture;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.xml.bind.annotation.XmlAttribute;
|
|
||||||
import javax.xml.bind.annotation.XmlTransient;
|
|
||||||
|
|
||||||
import message.Message;
|
|
||||||
import alias.Alias;
|
|
||||||
import controller.ThreadPoolManager;
|
|
||||||
import controller.ThreadPoolManager.ThreadType;
|
|
||||||
|
|
||||||
public abstract class RecurringAction extends AliasAction
|
|
||||||
{
|
|
||||||
@XmlTransient
|
|
||||||
protected AtomicBoolean mRunning = new AtomicBoolean( false );
|
|
||||||
@XmlTransient
|
|
||||||
private ScheduledFuture<?> mPerpetualAction;
|
|
||||||
|
|
||||||
protected Interval mInterval = Interval.ONCE;
|
|
||||||
protected int mPeriod = 5;
|
|
||||||
|
|
||||||
protected ThreadPoolManager mThreadPoolManager;
|
|
||||||
|
|
||||||
public abstract void performAction( Alias alias, Message message );
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void execute( ThreadPoolManager threadPoolManager,
|
|
||||||
Alias alias,
|
|
||||||
Message message )
|
|
||||||
{
|
|
||||||
mThreadPoolManager = threadPoolManager;
|
|
||||||
|
|
||||||
if( mRunning.compareAndSet( false, true ) )
|
|
||||||
{
|
|
||||||
switch( mInterval )
|
|
||||||
{
|
|
||||||
case ONCE:
|
|
||||||
performThreadedAction( alias, message );
|
|
||||||
/* Don't reset */
|
|
||||||
break;
|
|
||||||
case DELAYED_RESET:
|
|
||||||
performThreadedAction( alias, message );
|
|
||||||
mThreadPoolManager.scheduleOnce( new ResetTask(),
|
|
||||||
mPeriod, TimeUnit.SECONDS );
|
|
||||||
break;
|
|
||||||
case UNTIL_DISMISSED:
|
|
||||||
mPerpetualAction = mThreadPoolManager
|
|
||||||
.scheduleFixedRate( ThreadType.DECODER,
|
|
||||||
new PerformActionTask( alias, message ),
|
|
||||||
mPeriod, TimeUnit.SECONDS );
|
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append( "<html><div width='250'>Alias [" );
|
|
||||||
sb.append( alias.getName() );
|
|
||||||
sb.append( "] is active in message [" );
|
|
||||||
sb.append( message.toString() );
|
|
||||||
sb.append( "]</div></html>" );
|
|
||||||
|
|
||||||
final String text = sb.toString();
|
|
||||||
|
|
||||||
EventQueue.invokeLater( new Runnable()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
JOptionPane.showMessageDialog( null, text,
|
|
||||||
"Alias Alert", JOptionPane.INFORMATION_MESSAGE );
|
|
||||||
|
|
||||||
dismiss( false );
|
|
||||||
|
|
||||||
mThreadPoolManager.scheduleOnce( new ResetTask(),
|
|
||||||
15, TimeUnit.SECONDS );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Spawns the performAction() event into a new thread so that it doesn't
|
|
||||||
* delay any decoder actions.
|
|
||||||
*/
|
|
||||||
private void performThreadedAction( final Alias alias, final Message message )
|
|
||||||
{
|
|
||||||
mThreadPoolManager.scheduleOnce( new Runnable() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
performAction( alias, message );
|
|
||||||
}}, 0, TimeUnit.SECONDS );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void dismiss( boolean reset )
|
|
||||||
{
|
|
||||||
if( mPerpetualAction != null )
|
|
||||||
{
|
|
||||||
mPerpetualAction.cancel( true );
|
|
||||||
|
|
||||||
mPerpetualAction = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( reset )
|
|
||||||
{
|
|
||||||
mRunning.set( false );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@XmlAttribute
|
|
||||||
public int getPeriod()
|
|
||||||
{
|
|
||||||
return mPeriod;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPeriod( int period )
|
|
||||||
{
|
|
||||||
mPeriod = period;
|
|
||||||
}
|
|
||||||
|
|
||||||
@XmlAttribute
|
|
||||||
public Interval getInterval()
|
|
||||||
{
|
|
||||||
return mInterval;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setInterval( Interval interval )
|
|
||||||
{
|
|
||||||
mInterval = interval;
|
|
||||||
|
|
||||||
mRunning.set( false );
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum Interval
|
|
||||||
{
|
|
||||||
ONCE( "Once" ),
|
|
||||||
DELAYED_RESET( "Once, Reset After Delay" ),
|
|
||||||
UNTIL_DISMISSED( "Until Dismissed" );
|
|
||||||
|
|
||||||
private String mLabel;
|
|
||||||
|
|
||||||
private Interval( String label )
|
|
||||||
{
|
|
||||||
mLabel = label;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
return mLabel;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class PerformActionTask implements Runnable
|
|
||||||
{
|
|
||||||
private Alias mAlias;
|
|
||||||
private Message mMessage;
|
|
||||||
|
|
||||||
public PerformActionTask( Alias alias, Message message )
|
|
||||||
{
|
|
||||||
mAlias = alias;
|
|
||||||
mMessage = message;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
/* Don't use the performThreadedAction() method, since this is
|
|
||||||
* already running in a separate thread */
|
|
||||||
performAction( mAlias, mMessage );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ResetTask implements Runnable
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
mRunning.set( false );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
package alias.action.beep;
|
|
||||||
|
|
||||||
import message.Message;
|
|
||||||
import alias.Alias;
|
|
||||||
import alias.action.RecurringAction;
|
|
||||||
|
|
||||||
public class BeepAction extends RecurringAction
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void performAction( Alias alias, Message message )
|
|
||||||
{
|
|
||||||
System.out.println( "\007" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,151 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* SDR Trunk
|
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
******************************************************************************/
|
|
||||||
package alias.action.beep;
|
|
||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
|
|
||||||
import javax.swing.JButton;
|
|
||||||
import javax.swing.JComboBox;
|
|
||||||
import javax.swing.JLabel;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JSpinner;
|
|
||||||
import javax.swing.JTextArea;
|
|
||||||
import javax.swing.JTextField;
|
|
||||||
import javax.swing.SpinnerModel;
|
|
||||||
import javax.swing.SpinnerNumberModel;
|
|
||||||
import javax.swing.event.ChangeEvent;
|
|
||||||
import javax.swing.event.ChangeListener;
|
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import alias.action.RecurringAction.Interval;
|
|
||||||
|
|
||||||
public class BeepActionEditor extends JPanel implements ActionListener
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private final static Logger mLog =
|
|
||||||
LoggerFactory.getLogger( BeepActionEditor.class );
|
|
||||||
|
|
||||||
private BeepActionNode mBeepActionNode;
|
|
||||||
private JTextField mTextSiteID;
|
|
||||||
private JComboBox<Interval> mComboInterval;
|
|
||||||
private JSpinner mSpinnerPeriod;
|
|
||||||
|
|
||||||
public BeepActionEditor( BeepActionNode beepActionNode )
|
|
||||||
{
|
|
||||||
mBeepActionNode = beepActionNode;
|
|
||||||
|
|
||||||
initGUI();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initGUI()
|
|
||||||
{
|
|
||||||
setLayout( new MigLayout( "fill,wrap 2", "[right][left]", "[][][][][][grow]" ) );
|
|
||||||
|
|
||||||
add( new JLabel( "Action: Beep" ), "span,align center" );
|
|
||||||
|
|
||||||
add( new JLabel( "Interval:" ) );
|
|
||||||
|
|
||||||
mComboInterval = new JComboBox<Interval>( Interval.values() );
|
|
||||||
|
|
||||||
mComboInterval.setSelectedItem( mBeepActionNode.getBeepAction().getInterval() );
|
|
||||||
|
|
||||||
mComboInterval.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
Interval selected = mComboInterval
|
|
||||||
.getItemAt( mComboInterval.getSelectedIndex() );
|
|
||||||
|
|
||||||
if( selected != null )
|
|
||||||
{
|
|
||||||
/* Enable/disable period spinner based on selection */
|
|
||||||
mSpinnerPeriod.setEnabled( selected != Interval.ONCE );
|
|
||||||
|
|
||||||
mBeepActionNode.getBeepAction().setInterval( selected );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
add( mComboInterval, "wrap" );
|
|
||||||
|
|
||||||
final SpinnerModel model = new SpinnerNumberModel(
|
|
||||||
mBeepActionNode.getBeepAction().getPeriod(), 1, 30, 1 );
|
|
||||||
|
|
||||||
model.addChangeListener( new ChangeListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void stateChanged( ChangeEvent e )
|
|
||||||
{
|
|
||||||
mBeepActionNode.getBeepAction().setPeriod( (int)model.getValue() );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
mSpinnerPeriod = new JSpinner( model );
|
|
||||||
|
|
||||||
if( mBeepActionNode.getBeepAction().getInterval() == Interval.ONCE )
|
|
||||||
{
|
|
||||||
mSpinnerPeriod.setEnabled( false );
|
|
||||||
}
|
|
||||||
|
|
||||||
add( new JLabel( "Period:" ) );
|
|
||||||
add( mSpinnerPeriod, "wrap" );
|
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
|
|
||||||
sb.append( "This action will sound a beep according to the interval that you select.\n\n" );
|
|
||||||
sb.append( "Once - Beep the first time the alias is active and never again.\n\n" );
|
|
||||||
sb.append( "Once, Reset After Delay - Beep once and suppress subsequent beeps for the specified period in seconds. After the reset period, it will beep again when the alias is active.\n\n" );
|
|
||||||
sb.append( "Until Dismissed - Beep every period seconds until you click OK on the dialog that appears. Alerting is suppressed for 15 seconds after you click OK." );
|
|
||||||
|
|
||||||
JTextArea description = new JTextArea( sb.toString() );
|
|
||||||
|
|
||||||
description.setLineWrap( true );
|
|
||||||
description.setBackground( getBackground() );
|
|
||||||
|
|
||||||
add( description, "growx,span" );
|
|
||||||
|
|
||||||
JButton btnSave = new JButton( "Save" );
|
|
||||||
btnSave.addActionListener( BeepActionEditor.this );
|
|
||||||
add( btnSave, "growx,push" );
|
|
||||||
|
|
||||||
JButton btnReset = new JButton( "Reset" );
|
|
||||||
btnReset.addActionListener( BeepActionEditor.this );
|
|
||||||
add( btnReset, "growx,push" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
String command = e.getActionCommand();
|
|
||||||
|
|
||||||
if( command.contentEquals( "Save" ) )
|
|
||||||
{
|
|
||||||
mBeepActionNode.save();
|
|
||||||
mBeepActionNode.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
mBeepActionNode.refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* SDR Trunk
|
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
******************************************************************************/
|
|
||||||
package alias.action.beep;
|
|
||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
|
|
||||||
import javax.swing.JMenuItem;
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JPopupMenu;
|
|
||||||
|
|
||||||
import alias.AliasNode;
|
|
||||||
import alias.action.AliasActionNode;
|
|
||||||
|
|
||||||
public class BeepActionNode extends AliasActionNode
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public BeepActionNode( BeepAction beepAction )
|
|
||||||
{
|
|
||||||
super( beepAction );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JPanel getEditor()
|
|
||||||
{
|
|
||||||
return new BeepActionEditor( this );
|
|
||||||
}
|
|
||||||
|
|
||||||
public BeepAction getBeepAction()
|
|
||||||
{
|
|
||||||
return (BeepAction)getUserObject();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
return "Action: Beep";
|
|
||||||
}
|
|
||||||
|
|
||||||
public JPopupMenu getContextMenu()
|
|
||||||
{
|
|
||||||
JPopupMenu retVal = new JPopupMenu();
|
|
||||||
|
|
||||||
JMenuItem deleteItem = new JMenuItem( "Delete" );
|
|
||||||
deleteItem.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
int n = JOptionPane.showConfirmDialog( getModel().getTree(),
|
|
||||||
"Are you sure you want to permanently delete this node?" );
|
|
||||||
|
|
||||||
if( n == JOptionPane.YES_OPTION )
|
|
||||||
{
|
|
||||||
AliasNode parent = (AliasNode)getParent();
|
|
||||||
|
|
||||||
parent.getAlias().removeAliasAction( getBeepAction() );
|
|
||||||
|
|
||||||
/* Save before removing the node ... so that we still have
|
|
||||||
* a reference to the parent's resources */
|
|
||||||
save();
|
|
||||||
|
|
||||||
getModel().removeNodeFromParent( BeepActionNode.this );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
retVal.add( deleteItem );
|
|
||||||
|
|
||||||
return retVal;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
package alias.action.clip;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
import javax.sound.sampled.AudioInputStream;
|
|
||||||
import javax.sound.sampled.AudioSystem;
|
|
||||||
import javax.sound.sampled.Clip;
|
|
||||||
import javax.xml.bind.annotation.XmlTransient;
|
|
||||||
|
|
||||||
import message.Message;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import alias.Alias;
|
|
||||||
import alias.action.RecurringAction;
|
|
||||||
|
|
||||||
public class ClipAction extends RecurringAction
|
|
||||||
{
|
|
||||||
private final static Logger mLog = LoggerFactory.getLogger( ClipAction.class );
|
|
||||||
|
|
||||||
private String mFilePath;
|
|
||||||
|
|
||||||
@XmlTransient
|
|
||||||
private Clip mClip;
|
|
||||||
|
|
||||||
public ClipAction()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPath()
|
|
||||||
{
|
|
||||||
|
|
||||||
return mFilePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPath( String path )
|
|
||||||
{
|
|
||||||
mFilePath = path;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void performAction( Alias alias, Message message )
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
play();
|
|
||||||
}
|
|
||||||
catch( Exception e )
|
|
||||||
{
|
|
||||||
mLog.error( "Couldn't play audio clip", e );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void play() throws Exception
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if( mFilePath != null )
|
|
||||||
{
|
|
||||||
if( mClip == null )
|
|
||||||
{
|
|
||||||
mClip = AudioSystem.getClip();
|
|
||||||
|
|
||||||
AudioInputStream ais =
|
|
||||||
AudioSystem.getAudioInputStream( new File( mFilePath ) );
|
|
||||||
|
|
||||||
mClip.open( ais );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( mClip.isRunning() )
|
|
||||||
{
|
|
||||||
mClip.stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
mClip.setFramePosition( 0 );
|
|
||||||
|
|
||||||
mClip.start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch( Exception e )
|
|
||||||
{
|
|
||||||
mClip = null;
|
|
||||||
|
|
||||||
mLog.error( "Error playing sound clip [" + mFilePath + "] - " + e.getMessage() );
|
|
||||||
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,218 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* SDR Trunk
|
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
******************************************************************************/
|
|
||||||
package alias.action.clip;
|
|
||||||
|
|
||||||
import java.awt.EventQueue;
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
import javax.swing.JButton;
|
|
||||||
import javax.swing.JComboBox;
|
|
||||||
import javax.swing.JFileChooser;
|
|
||||||
import javax.swing.JLabel;
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JSpinner;
|
|
||||||
import javax.swing.JTextArea;
|
|
||||||
import javax.swing.JTextField;
|
|
||||||
import javax.swing.SpinnerModel;
|
|
||||||
import javax.swing.SpinnerNumberModel;
|
|
||||||
import javax.swing.event.ChangeEvent;
|
|
||||||
import javax.swing.event.ChangeListener;
|
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import alias.action.RecurringAction.Interval;
|
|
||||||
|
|
||||||
public class ClipActionEditor extends JPanel implements ActionListener
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private final static Logger mLog =
|
|
||||||
LoggerFactory.getLogger( ClipActionEditor.class );
|
|
||||||
|
|
||||||
private ClipActionNode mClipActionNode;
|
|
||||||
private JComboBox<Interval> mComboInterval;
|
|
||||||
private JSpinner mSpinnerPeriod;
|
|
||||||
private JTextField mTextFilePath;
|
|
||||||
|
|
||||||
public ClipActionEditor( ClipActionNode clipActionNode )
|
|
||||||
{
|
|
||||||
mClipActionNode = clipActionNode;
|
|
||||||
|
|
||||||
initGUI();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initGUI()
|
|
||||||
{
|
|
||||||
setLayout( new MigLayout( "fill,wrap 2", "[right][left]", "[][][][][][grow]" ) );
|
|
||||||
|
|
||||||
add( new JLabel( "Action: Audio Clip" ), "span,align center" );
|
|
||||||
|
|
||||||
add( new JLabel( "Interval:" ) );
|
|
||||||
|
|
||||||
mComboInterval = new JComboBox<Interval>( Interval.values() );
|
|
||||||
|
|
||||||
mComboInterval.setSelectedItem( mClipActionNode.getClipAction().getInterval() );
|
|
||||||
|
|
||||||
mComboInterval.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
Interval selected = mComboInterval
|
|
||||||
.getItemAt( mComboInterval.getSelectedIndex() );
|
|
||||||
|
|
||||||
if( selected != null )
|
|
||||||
{
|
|
||||||
/* Enable/disable period spinner based on selection */
|
|
||||||
mSpinnerPeriod.setEnabled( selected != Interval.ONCE );
|
|
||||||
|
|
||||||
mClipActionNode.getClipAction().setInterval( selected );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
add( mComboInterval, "wrap" );
|
|
||||||
|
|
||||||
final SpinnerModel model = new SpinnerNumberModel(
|
|
||||||
mClipActionNode.getClipAction().getPeriod(), 1, 30, 1 );
|
|
||||||
|
|
||||||
model.addChangeListener( new ChangeListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void stateChanged( ChangeEvent e )
|
|
||||||
{
|
|
||||||
mClipActionNode.getClipAction().setPeriod( (int)model.getValue() );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
mSpinnerPeriod = new JSpinner( model );
|
|
||||||
|
|
||||||
if( mClipActionNode.getClipAction().getInterval() == Interval.ONCE )
|
|
||||||
{
|
|
||||||
mSpinnerPeriod.setEnabled( false );
|
|
||||||
}
|
|
||||||
|
|
||||||
add( new JLabel( "Period:" ) );
|
|
||||||
add( mSpinnerPeriod, "wrap" );
|
|
||||||
|
|
||||||
JButton fileButton = new JButton( "File" );
|
|
||||||
|
|
||||||
fileButton.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
final JFileChooser chooser = new JFileChooser();
|
|
||||||
|
|
||||||
int value = chooser.showOpenDialog( ClipActionEditor.this );
|
|
||||||
|
|
||||||
if( value == JFileChooser.APPROVE_OPTION )
|
|
||||||
{
|
|
||||||
File file = chooser.getSelectedFile();
|
|
||||||
|
|
||||||
mClipActionNode.getClipAction().setPath( file.getAbsolutePath() );
|
|
||||||
mTextFilePath.setText( file.getAbsolutePath() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
add( fileButton );
|
|
||||||
|
|
||||||
JButton testButton = new JButton( "Test" );
|
|
||||||
testButton.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent actionEvent )
|
|
||||||
{
|
|
||||||
String path = mClipActionNode.getClipAction().getPath();
|
|
||||||
|
|
||||||
if( path == null || path.trim().isEmpty() )
|
|
||||||
{
|
|
||||||
JOptionPane.showMessageDialog( ClipActionEditor.this,
|
|
||||||
"Please select an audio file", "Please select file",
|
|
||||||
JOptionPane.ERROR_MESSAGE );
|
|
||||||
}
|
|
||||||
|
|
||||||
EventQueue.invokeLater( new Runnable()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
mClipActionNode.getClipAction().play();
|
|
||||||
}
|
|
||||||
catch( Exception e )
|
|
||||||
{
|
|
||||||
JOptionPane.showMessageDialog( ClipActionEditor.this,
|
|
||||||
"Couldn't play audio clip [" + e.getMessage() + "]",
|
|
||||||
"Error", JOptionPane.ERROR_MESSAGE );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
add( testButton, "wrap" );
|
|
||||||
|
|
||||||
mTextFilePath = new JTextField( mClipActionNode.getClipAction().getPath() );
|
|
||||||
add( mTextFilePath, "growx,span" );
|
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
|
|
||||||
sb.append( "This action will play the audio clip according to the interval that you select.\n\n" );
|
|
||||||
sb.append( "Once - Play the first time the alias is active and never again.\n\n" );
|
|
||||||
sb.append( "Once, Reset After Delay - Play once and suppress subsequent plays for the specified period in seconds. After the reset period, it will play again when the alias is active.\n\n" );
|
|
||||||
sb.append( "Until Dismissed - Play audio clip every period seconds until you click OK on the dialog that appears. Alerting is suppressed for 15 seconds after you click OK." );
|
|
||||||
|
|
||||||
JTextArea description = new JTextArea( sb.toString() );
|
|
||||||
|
|
||||||
description.setLineWrap( true );
|
|
||||||
description.setBackground( getBackground() );
|
|
||||||
|
|
||||||
add( description, "growx,span" );
|
|
||||||
|
|
||||||
JButton btnSave = new JButton( "Save" );
|
|
||||||
btnSave.addActionListener( ClipActionEditor.this );
|
|
||||||
add( btnSave, "growx,push" );
|
|
||||||
|
|
||||||
JButton btnReset = new JButton( "Reset" );
|
|
||||||
btnReset.addActionListener( ClipActionEditor.this );
|
|
||||||
add( btnReset, "growx,push" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
String command = e.getActionCommand();
|
|
||||||
|
|
||||||
if( command.contentEquals( "Save" ) )
|
|
||||||
{
|
|
||||||
mClipActionNode.save();
|
|
||||||
mClipActionNode.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
mClipActionNode.refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* SDR Trunk
|
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
******************************************************************************/
|
|
||||||
package alias.action.clip;
|
|
||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
|
|
||||||
import javax.swing.JMenuItem;
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JPopupMenu;
|
|
||||||
|
|
||||||
import alias.AliasNode;
|
|
||||||
import alias.action.AliasActionNode;
|
|
||||||
|
|
||||||
public class ClipActionNode extends AliasActionNode
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public ClipActionNode( ClipAction clipAction )
|
|
||||||
{
|
|
||||||
super( clipAction );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JPanel getEditor()
|
|
||||||
{
|
|
||||||
return new ClipActionEditor( this );
|
|
||||||
}
|
|
||||||
|
|
||||||
public ClipAction getClipAction()
|
|
||||||
{
|
|
||||||
return (ClipAction)getUserObject();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
return "Action: Audio Clip";
|
|
||||||
}
|
|
||||||
|
|
||||||
public JPopupMenu getContextMenu()
|
|
||||||
{
|
|
||||||
JPopupMenu retVal = new JPopupMenu();
|
|
||||||
|
|
||||||
JMenuItem deleteItem = new JMenuItem( "Delete" );
|
|
||||||
deleteItem.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
int n = JOptionPane.showConfirmDialog( getModel().getTree(),
|
|
||||||
"Are you sure you want to permanently delete this node?" );
|
|
||||||
|
|
||||||
if( n == JOptionPane.YES_OPTION )
|
|
||||||
{
|
|
||||||
AliasNode parent = (AliasNode)getParent();
|
|
||||||
|
|
||||||
parent.getAlias().removeAliasAction( getClipAction() );
|
|
||||||
|
|
||||||
/* Save before removing the node ... so that we still have
|
|
||||||
* a reference to the parent's resources */
|
|
||||||
save();
|
|
||||||
|
|
||||||
getModel().removeNodeFromParent( ClipActionNode.this );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
retVal.add( deleteItem );
|
|
||||||
|
|
||||||
return retVal;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,78 +0,0 @@
|
|||||||
package alias.action.script;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
|
|
||||||
import message.Message;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import alias.Alias;
|
|
||||||
import alias.action.RecurringAction;
|
|
||||||
|
|
||||||
public class ScriptAction extends RecurringAction
|
|
||||||
{
|
|
||||||
private final static Logger mLog = LoggerFactory.getLogger( ScriptAction.class );
|
|
||||||
|
|
||||||
private String mScript;
|
|
||||||
|
|
||||||
public ScriptAction()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getScript()
|
|
||||||
{
|
|
||||||
return mScript;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setScript( String script )
|
|
||||||
{
|
|
||||||
mScript = script;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void performAction( Alias alias, Message message )
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
play();
|
|
||||||
}
|
|
||||||
catch( Exception e )
|
|
||||||
{
|
|
||||||
mLog.error( "Couldn't execute script [" + mScript + "]", e );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void play() throws Exception
|
|
||||||
{
|
|
||||||
if( mScript != null )
|
|
||||||
{
|
|
||||||
ProcessBuilder pb = new ProcessBuilder( mScript );
|
|
||||||
|
|
||||||
pb.redirectErrorStream( true );
|
|
||||||
|
|
||||||
Process p = pb.start();
|
|
||||||
|
|
||||||
int exitCode = p.waitFor();
|
|
||||||
|
|
||||||
BufferedReader reader = new BufferedReader(
|
|
||||||
new InputStreamReader( p.getInputStream() ) );
|
|
||||||
|
|
||||||
String line = "";
|
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
|
|
||||||
while( ( line = reader.readLine() ) != null )
|
|
||||||
{
|
|
||||||
sb.append(line + "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if( exitCode != 0 )
|
|
||||||
{
|
|
||||||
throw new RuntimeException( "Exit Code: " + exitCode +
|
|
||||||
" Console:" + sb.toString() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,218 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* SDR Trunk
|
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
******************************************************************************/
|
|
||||||
package alias.action.script;
|
|
||||||
|
|
||||||
import java.awt.EventQueue;
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
import javax.swing.JButton;
|
|
||||||
import javax.swing.JComboBox;
|
|
||||||
import javax.swing.JFileChooser;
|
|
||||||
import javax.swing.JLabel;
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JSpinner;
|
|
||||||
import javax.swing.JTextArea;
|
|
||||||
import javax.swing.JTextField;
|
|
||||||
import javax.swing.SpinnerModel;
|
|
||||||
import javax.swing.SpinnerNumberModel;
|
|
||||||
import javax.swing.event.ChangeEvent;
|
|
||||||
import javax.swing.event.ChangeListener;
|
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import alias.action.RecurringAction.Interval;
|
|
||||||
|
|
||||||
public class ScriptActionEditor extends JPanel implements ActionListener
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private final static Logger mLog =
|
|
||||||
LoggerFactory.getLogger( ScriptActionEditor.class );
|
|
||||||
|
|
||||||
private ScriptActionNode mScriptActionNode;
|
|
||||||
private JComboBox<Interval> mComboInterval;
|
|
||||||
private JSpinner mSpinnerPeriod;
|
|
||||||
private JTextField mTextFilePath;
|
|
||||||
|
|
||||||
public ScriptActionEditor( ScriptActionNode clipActionNode )
|
|
||||||
{
|
|
||||||
mScriptActionNode = clipActionNode;
|
|
||||||
|
|
||||||
initGUI();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initGUI()
|
|
||||||
{
|
|
||||||
setLayout( new MigLayout( "fill,wrap 2", "[right][left]", "[][][][][][grow]" ) );
|
|
||||||
|
|
||||||
add( new JLabel( "Action: Script" ), "span,align center" );
|
|
||||||
|
|
||||||
add( new JLabel( "Interval:" ) );
|
|
||||||
|
|
||||||
mComboInterval = new JComboBox<Interval>( Interval.values() );
|
|
||||||
|
|
||||||
mComboInterval.setSelectedItem( mScriptActionNode.getScriptAction().getInterval() );
|
|
||||||
|
|
||||||
mComboInterval.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
Interval selected = mComboInterval
|
|
||||||
.getItemAt( mComboInterval.getSelectedIndex() );
|
|
||||||
|
|
||||||
if( selected != null )
|
|
||||||
{
|
|
||||||
/* Enable/disable period spinner based on selection */
|
|
||||||
mSpinnerPeriod.setEnabled( selected != Interval.ONCE );
|
|
||||||
|
|
||||||
mScriptActionNode.getScriptAction().setInterval( selected );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
add( mComboInterval, "wrap" );
|
|
||||||
|
|
||||||
final SpinnerModel model = new SpinnerNumberModel(
|
|
||||||
mScriptActionNode.getScriptAction().getPeriod(), 1, 30, 1 );
|
|
||||||
|
|
||||||
model.addChangeListener( new ChangeListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void stateChanged( ChangeEvent e )
|
|
||||||
{
|
|
||||||
mScriptActionNode.getScriptAction().setPeriod( (int)model.getValue() );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
mSpinnerPeriod = new JSpinner( model );
|
|
||||||
|
|
||||||
if( mScriptActionNode.getScriptAction().getInterval() == Interval.ONCE )
|
|
||||||
{
|
|
||||||
mSpinnerPeriod.setEnabled( false );
|
|
||||||
}
|
|
||||||
|
|
||||||
add( new JLabel( "Period:" ) );
|
|
||||||
add( mSpinnerPeriod, "wrap" );
|
|
||||||
|
|
||||||
JButton fileButton = new JButton( "File" );
|
|
||||||
|
|
||||||
fileButton.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
final JFileChooser chooser = new JFileChooser();
|
|
||||||
|
|
||||||
int value = chooser.showOpenDialog( ScriptActionEditor.this );
|
|
||||||
|
|
||||||
if( value == JFileChooser.APPROVE_OPTION )
|
|
||||||
{
|
|
||||||
File file = chooser.getSelectedFile();
|
|
||||||
|
|
||||||
mScriptActionNode.getScriptAction().setScript( file.getAbsolutePath() );
|
|
||||||
mTextFilePath.setText( file.getAbsolutePath() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
add( fileButton );
|
|
||||||
|
|
||||||
JButton testButton = new JButton( "Test" );
|
|
||||||
testButton.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent actionEvent )
|
|
||||||
{
|
|
||||||
String script = mScriptActionNode.getScriptAction().getScript();
|
|
||||||
|
|
||||||
if( script == null || script.trim().isEmpty() )
|
|
||||||
{
|
|
||||||
JOptionPane.showMessageDialog( ScriptActionEditor.this,
|
|
||||||
"Please select a script file", "Please select file",
|
|
||||||
JOptionPane.ERROR_MESSAGE );
|
|
||||||
}
|
|
||||||
|
|
||||||
EventQueue.invokeLater( new Runnable()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
mScriptActionNode.getScriptAction().play();
|
|
||||||
}
|
|
||||||
catch( Exception e )
|
|
||||||
{
|
|
||||||
JOptionPane.showMessageDialog( ScriptActionEditor.this,
|
|
||||||
"Couldn't run script [" + e.getMessage() + "]",
|
|
||||||
"Error", JOptionPane.ERROR_MESSAGE );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
add( testButton, "wrap" );
|
|
||||||
|
|
||||||
mTextFilePath = new JTextField( mScriptActionNode.getScriptAction().getScript() );
|
|
||||||
add( mTextFilePath, "growx,span" );
|
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
|
|
||||||
sb.append( "This action will run the script according to the interval that you select.\n\n" );
|
|
||||||
sb.append( "Once - Run script the first time the alias is active and never again.\n\n" );
|
|
||||||
sb.append( "Once, Reset After Delay - Run once and suppress subsequent runs for the specified period in seconds. After the reset period, it will play again when the alias is active.\n\n" );
|
|
||||||
sb.append( "Until Dismissed - Run script every period seconds until you click OK on the dialog that appears. Alerting is suppressed for 15 seconds after you click OK." );
|
|
||||||
|
|
||||||
JTextArea description = new JTextArea( sb.toString() );
|
|
||||||
|
|
||||||
description.setLineWrap( true );
|
|
||||||
description.setBackground( getBackground() );
|
|
||||||
|
|
||||||
add( description, "growx,span" );
|
|
||||||
|
|
||||||
JButton btnSave = new JButton( "Save" );
|
|
||||||
btnSave.addActionListener( ScriptActionEditor.this );
|
|
||||||
add( btnSave, "growx,push" );
|
|
||||||
|
|
||||||
JButton btnReset = new JButton( "Reset" );
|
|
||||||
btnReset.addActionListener( ScriptActionEditor.this );
|
|
||||||
add( btnReset, "growx,push" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
String command = e.getActionCommand();
|
|
||||||
|
|
||||||
if( command.contentEquals( "Save" ) )
|
|
||||||
{
|
|
||||||
mScriptActionNode.save();
|
|
||||||
mScriptActionNode.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
mScriptActionNode.refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* SDR Trunk
|
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
******************************************************************************/
|
|
||||||
package alias.action.script;
|
|
||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
|
|
||||||
import javax.swing.JMenuItem;
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JPopupMenu;
|
|
||||||
|
|
||||||
import alias.AliasNode;
|
|
||||||
import alias.action.AliasActionNode;
|
|
||||||
|
|
||||||
public class ScriptActionNode extends AliasActionNode
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public ScriptActionNode( ScriptAction scriptAction )
|
|
||||||
{
|
|
||||||
super( scriptAction );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JPanel getEditor()
|
|
||||||
{
|
|
||||||
return new ScriptActionEditor( this );
|
|
||||||
}
|
|
||||||
|
|
||||||
public ScriptAction getScriptAction()
|
|
||||||
{
|
|
||||||
return (ScriptAction)getUserObject();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
return "Action: Script";
|
|
||||||
}
|
|
||||||
|
|
||||||
public JPopupMenu getContextMenu()
|
|
||||||
{
|
|
||||||
JPopupMenu retVal = new JPopupMenu();
|
|
||||||
|
|
||||||
JMenuItem deleteItem = new JMenuItem( "Delete" );
|
|
||||||
deleteItem.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
int n = JOptionPane.showConfirmDialog( getModel().getTree(),
|
|
||||||
"Are you sure you want to permanently delete this node?" );
|
|
||||||
|
|
||||||
if( n == JOptionPane.YES_OPTION )
|
|
||||||
{
|
|
||||||
AliasNode parent = (AliasNode)getParent();
|
|
||||||
|
|
||||||
parent.getAlias().removeAliasAction( getScriptAction() );
|
|
||||||
|
|
||||||
/* Save before removing the node ... so that we still have
|
|
||||||
* a reference to the parent's resources */
|
|
||||||
save();
|
|
||||||
|
|
||||||
getModel().removeNodeFromParent( ScriptActionNode.this );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
retVal.add( deleteItem );
|
|
||||||
|
|
||||||
return retVal;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,95 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* SDR Trunk
|
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
******************************************************************************/
|
|
||||||
package alias.id.esn;
|
|
||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
|
|
||||||
import javax.swing.JButton;
|
|
||||||
import javax.swing.JLabel;
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JTextField;
|
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
import controller.ConfigurableNode;
|
|
||||||
|
|
||||||
public class ESNEditor extends JPanel implements ActionListener
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
private ESNNode mESNNode;
|
|
||||||
private JTextField mTextESN;
|
|
||||||
|
|
||||||
public ESNEditor( ESNNode esnNode )
|
|
||||||
{
|
|
||||||
mESNNode = esnNode;
|
|
||||||
|
|
||||||
initGUI();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initGUI()
|
|
||||||
{
|
|
||||||
setLayout( new MigLayout( "fill,wrap 2", "[right][left]", "[][][][grow]" ) );
|
|
||||||
|
|
||||||
add( new JLabel( "Electronic Serial Number ID" ), "span,align center" );
|
|
||||||
|
|
||||||
add( new JLabel( "ESN:" ) );
|
|
||||||
mTextESN = new JTextField( mESNNode.getESN().getEsn() );
|
|
||||||
add( mTextESN, "growx,push" );
|
|
||||||
|
|
||||||
JButton btnSave = new JButton( "Save" );
|
|
||||||
btnSave.addActionListener( ESNEditor.this );
|
|
||||||
add( btnSave, "growx,push" );
|
|
||||||
|
|
||||||
JButton btnReset = new JButton( "Reset" );
|
|
||||||
btnReset.addActionListener( ESNEditor.this );
|
|
||||||
add( btnReset, "growx,push" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
String command = e.getActionCommand();
|
|
||||||
|
|
||||||
if( command.contentEquals( "Save" ) )
|
|
||||||
{
|
|
||||||
String esn = mTextESN.getText();
|
|
||||||
|
|
||||||
if( esn != null )
|
|
||||||
{
|
|
||||||
mESNNode.getESN().setEsn( esn );
|
|
||||||
|
|
||||||
((ConfigurableNode)mESNNode.getParent()).sort();
|
|
||||||
|
|
||||||
mESNNode.save();
|
|
||||||
|
|
||||||
mESNNode.show();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
JOptionPane.showMessageDialog( ESNEditor.this, "Please enter an ESN" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if( command.contentEquals( "Reset" ) )
|
|
||||||
{
|
|
||||||
mTextESN.setText( mESNNode.getESN().getEsn() );
|
|
||||||
}
|
|
||||||
|
|
||||||
mESNNode.refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* SDR Trunk
|
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
******************************************************************************/
|
|
||||||
package alias.id.esn;
|
|
||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
|
|
||||||
import javax.swing.JMenuItem;
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JPopupMenu;
|
|
||||||
|
|
||||||
import alias.AliasIDNode;
|
|
||||||
import alias.AliasNode;
|
|
||||||
|
|
||||||
public class ESNNode extends AliasIDNode
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public ESNNode( Esn esn )
|
|
||||||
{
|
|
||||||
super( esn );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JPanel getEditor()
|
|
||||||
{
|
|
||||||
return new ESNEditor( this );
|
|
||||||
}
|
|
||||||
|
|
||||||
public Esn getESN()
|
|
||||||
{
|
|
||||||
return (Esn)getUserObject();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
return "ESN " + getESN().getEsn();
|
|
||||||
}
|
|
||||||
|
|
||||||
public JPopupMenu getContextMenu()
|
|
||||||
{
|
|
||||||
JPopupMenu retVal = new JPopupMenu();
|
|
||||||
|
|
||||||
JMenuItem addSystemItem = new JMenuItem( "Delete" );
|
|
||||||
addSystemItem.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
int n = JOptionPane.showConfirmDialog( getModel().getTree(),
|
|
||||||
"Are you sure you want to permanently delete this node?" );
|
|
||||||
|
|
||||||
if( n == JOptionPane.YES_OPTION )
|
|
||||||
{
|
|
||||||
AliasNode parent = (AliasNode)getParent();
|
|
||||||
|
|
||||||
parent.getAlias().removeAliasID( getESN() );
|
|
||||||
|
|
||||||
save();
|
|
||||||
|
|
||||||
getModel().removeNodeFromParent( ESNNode.this );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
retVal.add( addSystemItem );
|
|
||||||
|
|
||||||
return retVal;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,108 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* SDR Trunk
|
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
******************************************************************************/
|
|
||||||
package alias.id.fleetsync;
|
|
||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
|
|
||||||
import javax.swing.JButton;
|
|
||||||
import javax.swing.JLabel;
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JTextArea;
|
|
||||||
import javax.swing.JTextField;
|
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
import controller.ConfigurableNode;
|
|
||||||
|
|
||||||
public class FleetsyncIDEditor extends JPanel implements ActionListener
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
private FleetsyncIDNode mFleetsyncIDNode;
|
|
||||||
|
|
||||||
private JLabel mLabelName;
|
|
||||||
private JTextField mTextIdent;
|
|
||||||
|
|
||||||
private String mHelpText = "Enter a formatted fleetsync identifier.\n\n"
|
|
||||||
+ "Format: PPP-IIII (P=Prefix, I=Identifier)\n\n"
|
|
||||||
+ "Wildcard: use one or more asterisks (*) for any talkgroup "
|
|
||||||
+ "digits.\n\n";
|
|
||||||
|
|
||||||
public FleetsyncIDEditor( FleetsyncIDNode fsNode )
|
|
||||||
{
|
|
||||||
mFleetsyncIDNode = fsNode;
|
|
||||||
initGUI();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initGUI()
|
|
||||||
{
|
|
||||||
setLayout( new MigLayout( "fill,wrap 2", "[right][left]", "[][][][grow]" ) );
|
|
||||||
|
|
||||||
add( new JLabel( "Fleetsync ID" ), "span,align center" );
|
|
||||||
|
|
||||||
add( new JLabel( "Ident:" ) );
|
|
||||||
mTextIdent = new JTextField( mFleetsyncIDNode.getFleetsyncID().getIdent() );
|
|
||||||
|
|
||||||
add( mTextIdent, "grow, wrap" );
|
|
||||||
|
|
||||||
JButton btnSave = new JButton( "Save" );
|
|
||||||
btnSave.addActionListener( FleetsyncIDEditor.this );
|
|
||||||
add( btnSave, "growx,push" );
|
|
||||||
|
|
||||||
JButton btnReset = new JButton( "Reset" );
|
|
||||||
btnReset.addActionListener( FleetsyncIDEditor.this );
|
|
||||||
add( btnReset, "growx,push" );
|
|
||||||
|
|
||||||
JTextArea helpText = new JTextArea( mHelpText );
|
|
||||||
helpText.setLineWrap( true );
|
|
||||||
helpText.setBackground( getBackground() );
|
|
||||||
add( helpText, "span,grow,push" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
String command = e.getActionCommand();
|
|
||||||
|
|
||||||
if( command.contentEquals( "Save" ) )
|
|
||||||
{
|
|
||||||
String ident = mTextIdent.getText();
|
|
||||||
|
|
||||||
if( ident != null )
|
|
||||||
{
|
|
||||||
mFleetsyncIDNode.getFleetsyncID().setIdent( ident );
|
|
||||||
|
|
||||||
((ConfigurableNode)mFleetsyncIDNode.getParent()).sort();
|
|
||||||
|
|
||||||
mFleetsyncIDNode.save();
|
|
||||||
|
|
||||||
mFleetsyncIDNode.show();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
JOptionPane.showMessageDialog( FleetsyncIDEditor.this, "Please enter an ident" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if( command.contentEquals( "Reset" ) )
|
|
||||||
{
|
|
||||||
mTextIdent.setText( mFleetsyncIDNode.getFleetsyncID().getIdent() );
|
|
||||||
}
|
|
||||||
|
|
||||||
mFleetsyncIDNode.refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,97 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* SDR Trunk
|
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
******************************************************************************/
|
|
||||||
package alias.id.fleetsync;
|
|
||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
|
|
||||||
import javax.swing.JMenuItem;
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JPopupMenu;
|
|
||||||
|
|
||||||
import alias.AliasIDNode;
|
|
||||||
import alias.AliasNode;
|
|
||||||
|
|
||||||
public class FleetsyncIDNode extends AliasIDNode
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public FleetsyncIDNode( FleetsyncID id )
|
|
||||||
{
|
|
||||||
super( id );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JPanel getEditor()
|
|
||||||
{
|
|
||||||
return new FleetsyncIDEditor( this );
|
|
||||||
}
|
|
||||||
|
|
||||||
public FleetsyncID getFleetsyncID()
|
|
||||||
{
|
|
||||||
return (FleetsyncID)getUserObject();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
|
|
||||||
sb.append( "Fleetsync " );
|
|
||||||
|
|
||||||
String ident = getFleetsyncID().getIdent();
|
|
||||||
|
|
||||||
if( ident != null )
|
|
||||||
{
|
|
||||||
sb.append( ident );
|
|
||||||
}
|
|
||||||
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public JPopupMenu getContextMenu()
|
|
||||||
{
|
|
||||||
JPopupMenu retVal = new JPopupMenu();
|
|
||||||
|
|
||||||
JMenuItem deleteItem = new JMenuItem( "Delete" );
|
|
||||||
deleteItem.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
int n = JOptionPane.showConfirmDialog( getModel().getTree(),
|
|
||||||
"Are you sure you want to permanently delete this node?" );
|
|
||||||
|
|
||||||
if( n == JOptionPane.YES_OPTION )
|
|
||||||
{
|
|
||||||
AliasNode parent = (AliasNode)getParent();
|
|
||||||
|
|
||||||
parent.getAlias().removeAliasID( getFleetsyncID() );
|
|
||||||
|
|
||||||
save();
|
|
||||||
|
|
||||||
getModel().removeNodeFromParent( FleetsyncIDNode.this );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
retVal.add( deleteItem );
|
|
||||||
|
|
||||||
return retVal;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* SDR Trunk
|
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
******************************************************************************/
|
|
||||||
package alias.id.fleetsync;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAttribute;
|
|
||||||
|
|
||||||
import alias.AliasID;
|
|
||||||
import alias.AliasIDType;
|
|
||||||
|
|
||||||
public class StatusID extends AliasID
|
|
||||||
{
|
|
||||||
private int mStatus;
|
|
||||||
|
|
||||||
public StatusID()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@XmlAttribute
|
|
||||||
public int getStatus()
|
|
||||||
{
|
|
||||||
return mStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus( int status )
|
|
||||||
{
|
|
||||||
this.mStatus = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
return "Status: " + mStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean matches( AliasID id )
|
|
||||||
{
|
|
||||||
boolean retVal = false;
|
|
||||||
|
|
||||||
if( id instanceof StatusID )
|
|
||||||
{
|
|
||||||
StatusID statusId = (StatusID)id;
|
|
||||||
|
|
||||||
retVal = ( mStatus == statusId.getStatus() );
|
|
||||||
}
|
|
||||||
|
|
||||||
return retVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AliasIDType getType()
|
|
||||||
{
|
|
||||||
return AliasIDType.Status;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,120 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* SDR Trunk
|
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
******************************************************************************/
|
|
||||||
package alias.id.fleetsync;
|
|
||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
|
|
||||||
import javax.swing.BorderFactory;
|
|
||||||
import javax.swing.JButton;
|
|
||||||
import javax.swing.JLabel;
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JTextField;
|
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import controller.ConfigurableNode;
|
|
||||||
|
|
||||||
public class StatusIDEditor extends JPanel implements ActionListener
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
private final static Logger mLog =
|
|
||||||
LoggerFactory.getLogger( StatusIDEditor.class );
|
|
||||||
|
|
||||||
private StatusIDNode mStatusIDNode;
|
|
||||||
|
|
||||||
private JLabel mLabelName;
|
|
||||||
private JTextField mTextStatusID;
|
|
||||||
|
|
||||||
public StatusIDEditor( StatusIDNode statusIDNode )
|
|
||||||
{
|
|
||||||
mStatusIDNode = statusIDNode;
|
|
||||||
|
|
||||||
initGUI();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initGUI()
|
|
||||||
{
|
|
||||||
setLayout( new MigLayout() );
|
|
||||||
|
|
||||||
setBorder( BorderFactory.createTitledBorder( "Status Code" ) );
|
|
||||||
|
|
||||||
mLabelName = new JLabel( "Status Code:" );
|
|
||||||
add( mLabelName, "align right" );
|
|
||||||
|
|
||||||
mTextStatusID = new JTextField(
|
|
||||||
String.valueOf( mStatusIDNode.getStatusID().getStatus() ) );
|
|
||||||
add( mTextStatusID, "grow, wrap" );
|
|
||||||
|
|
||||||
JButton btnSave = new JButton( "Save" );
|
|
||||||
btnSave.addActionListener( StatusIDEditor.this );
|
|
||||||
add( btnSave );
|
|
||||||
|
|
||||||
JButton btnReset = new JButton( "Reset" );
|
|
||||||
btnReset.addActionListener( StatusIDEditor.this );
|
|
||||||
add( btnReset, "wrap" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
String command = e.getActionCommand();
|
|
||||||
|
|
||||||
if( command.contentEquals( "Save" ) )
|
|
||||||
{
|
|
||||||
String statusIDString = mTextStatusID.getText();
|
|
||||||
|
|
||||||
if( statusIDString != null )
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
int id = Integer.parseInt( statusIDString );
|
|
||||||
|
|
||||||
mStatusIDNode.getStatusID().setStatus( id );
|
|
||||||
|
|
||||||
((ConfigurableNode)mStatusIDNode.getParent()).sort();
|
|
||||||
|
|
||||||
mStatusIDNode.save();
|
|
||||||
|
|
||||||
mStatusIDNode.show();
|
|
||||||
}
|
|
||||||
catch( Exception ex )
|
|
||||||
{
|
|
||||||
mLog.error( "StatusIDEditor - error parsing int status " +
|
|
||||||
"id from [" + statusIDString + "]" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
JOptionPane.showMessageDialog( StatusIDEditor.this,
|
|
||||||
"Please enter a status ID code" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if( command.contentEquals( "Reset" ) )
|
|
||||||
{
|
|
||||||
mTextStatusID.setText(
|
|
||||||
String.valueOf( mStatusIDNode.getStatusID().getStatus() ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
mStatusIDNode.refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* SDR Trunk
|
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
******************************************************************************/
|
|
||||||
package alias.id.fleetsync;
|
|
||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
|
|
||||||
import javax.swing.JMenuItem;
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JPopupMenu;
|
|
||||||
|
|
||||||
import alias.AliasIDNode;
|
|
||||||
import alias.AliasNode;
|
|
||||||
|
|
||||||
public class StatusIDNode extends AliasIDNode
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public StatusIDNode( StatusID id )
|
|
||||||
{
|
|
||||||
super( id );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JPanel getEditor()
|
|
||||||
{
|
|
||||||
return new StatusIDEditor( this );
|
|
||||||
}
|
|
||||||
|
|
||||||
public StatusID getStatusID()
|
|
||||||
{
|
|
||||||
return (StatusID)getUserObject();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
return "Status Code " + getStatusID().getStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
public JPopupMenu getContextMenu()
|
|
||||||
{
|
|
||||||
JPopupMenu retVal = new JPopupMenu();
|
|
||||||
|
|
||||||
JMenuItem addSystemItem = new JMenuItem( "Delete" );
|
|
||||||
addSystemItem.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
int n = JOptionPane.showConfirmDialog( getModel().getTree(),
|
|
||||||
"Are you sure you want to permanently delete this node?" );
|
|
||||||
|
|
||||||
if( n == JOptionPane.YES_OPTION )
|
|
||||||
{
|
|
||||||
AliasNode parent = (AliasNode)getParent();
|
|
||||||
|
|
||||||
parent.getAlias().removeAliasID( getStatusID() );
|
|
||||||
|
|
||||||
save();
|
|
||||||
|
|
||||||
getModel().removeNodeFromParent( StatusIDNode.this );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
retVal.add( addSystemItem );
|
|
||||||
|
|
||||||
return retVal;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,132 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* SDR Trunk
|
|
||||||
* Copyright (C) 2015 Dennis Sheirer
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
******************************************************************************/
|
|
||||||
package alias.id.lojack;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAttribute;
|
|
||||||
|
|
||||||
import module.decode.lj1200.LJ1200Message;
|
|
||||||
import module.decode.lj1200.LJ1200Message.Function;
|
|
||||||
import alias.AliasID;
|
|
||||||
import alias.AliasIDType;
|
|
||||||
|
|
||||||
public class LoJackFunctionAndID extends AliasID
|
|
||||||
{
|
|
||||||
private LJ1200Message.Function mFunction = Function.F0_UNKNOWN;
|
|
||||||
private String mID = "*****";
|
|
||||||
|
|
||||||
public LoJackFunctionAndID()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@XmlAttribute( name="id" )
|
|
||||||
public String getID()
|
|
||||||
{
|
|
||||||
return mID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setID( String id )
|
|
||||||
{
|
|
||||||
mID = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@XmlAttribute( name="function" )
|
|
||||||
public Function getFunction()
|
|
||||||
{
|
|
||||||
return mFunction;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFunction( Function function )
|
|
||||||
{
|
|
||||||
mFunction = function;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
return "LoJack FUNC: " + mFunction.getLabel() + " ID:" + ( mID == null ? "" : mID );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicates if the function and id combination match this alias id
|
|
||||||
*/
|
|
||||||
public boolean matches( Function function, String id )
|
|
||||||
{
|
|
||||||
return mFunction == function &&
|
|
||||||
mID != null &&
|
|
||||||
id != null &&
|
|
||||||
id.matches( mID.replace( "*", ".?" ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean matches( AliasID id )
|
|
||||||
{
|
|
||||||
boolean retVal = false;
|
|
||||||
|
|
||||||
if( mID != null && id instanceof LoJackFunctionAndID )
|
|
||||||
{
|
|
||||||
LoJackFunctionAndID otherLojack = (LoJackFunctionAndID)id;
|
|
||||||
|
|
||||||
if( otherLojack.getFunction() == mFunction )
|
|
||||||
{
|
|
||||||
//Create a pattern - replace * wildcards with regex single-char wildcard
|
|
||||||
String pattern = mID.replace( "*", ".?" );
|
|
||||||
|
|
||||||
retVal = otherLojack.getID().matches( pattern );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return retVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AliasIDType getType()
|
|
||||||
{
|
|
||||||
return AliasIDType.LoJack;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode()
|
|
||||||
{
|
|
||||||
final int prime = 31;
|
|
||||||
int result = 1;
|
|
||||||
result = prime * result
|
|
||||||
+ ( ( mFunction == null ) ? 0 : mFunction.hashCode() );
|
|
||||||
result = prime * result + ( ( mID == null ) ? 0 : mID.hashCode() );
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals( Object obj )
|
|
||||||
{
|
|
||||||
if ( this == obj )
|
|
||||||
return true;
|
|
||||||
if ( obj == null )
|
|
||||||
return false;
|
|
||||||
if ( getClass() != obj.getClass() )
|
|
||||||
return false;
|
|
||||||
LoJackFunctionAndID other = (LoJackFunctionAndID) obj;
|
|
||||||
if ( mFunction != other.mFunction )
|
|
||||||
return false;
|
|
||||||
if ( mID == null )
|
|
||||||
{
|
|
||||||
if ( other.mID != null )
|
|
||||||
return false;
|
|
||||||
} else if ( !mID.equals( other.mID ) )
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,128 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* SDR Trunk
|
|
||||||
* Copyright (C) 2015 Dennis Sheirer
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
******************************************************************************/
|
|
||||||
package alias.id.lojack;
|
|
||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
|
|
||||||
import javax.swing.JButton;
|
|
||||||
import javax.swing.JComboBox;
|
|
||||||
import javax.swing.JLabel;
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JTextArea;
|
|
||||||
import javax.swing.JTextField;
|
|
||||||
|
|
||||||
import module.decode.lj1200.LJ1200Message;
|
|
||||||
import module.decode.lj1200.LJ1200Message.Function;
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
import controller.ConfigurableNode;
|
|
||||||
|
|
||||||
public class LoJackIDEditor extends JPanel implements ActionListener
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
private LoJackIDNode mLoJackIDNode;
|
|
||||||
|
|
||||||
private JComboBox<LJ1200Message.Function> mFunctionCombo;
|
|
||||||
private JTextField mTextIdent;
|
|
||||||
|
|
||||||
private String mHelpText = "Select a LoJack message function code and enter"
|
|
||||||
+ " a five character reply code/identifier in the ID field.\n\n"
|
|
||||||
+ "Wildcard: use an asterisk (*) to wildcard any character in the "
|
|
||||||
+ "five character reply code (e.g. AB*CD or ***12 or *****)\n\n"
|
|
||||||
+ "Reply codes are five characters where the middle character"
|
|
||||||
+ " identifies the entity (tower/site or transponder) as follows:\n"
|
|
||||||
+ "X,Y\t\tTower\n"
|
|
||||||
+ "0-9,A,C-H,J-N,P-W\tTransponder\n"
|
|
||||||
+ "B,I,O,Z\t\tNot Used";
|
|
||||||
|
|
||||||
public LoJackIDEditor( LoJackIDNode lojackNode )
|
|
||||||
{
|
|
||||||
mLoJackIDNode = lojackNode;
|
|
||||||
initGUI();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initGUI()
|
|
||||||
{
|
|
||||||
setLayout( new MigLayout( "fill,wrap 2", "[right][left]", "[][][][grow]" ) );
|
|
||||||
|
|
||||||
add( new JLabel( "LoJack Function and ID" ), "span,align center" );
|
|
||||||
|
|
||||||
LoJackFunctionAndID lojack = mLoJackIDNode.getLoJackID();
|
|
||||||
|
|
||||||
add( new JLabel( "Function:" ) );
|
|
||||||
mFunctionCombo = new JComboBox<LJ1200Message.Function>( Function.values() );
|
|
||||||
mFunctionCombo.setSelectedItem( lojack.getFunction() );
|
|
||||||
add( mFunctionCombo, "grow, wrap" );
|
|
||||||
|
|
||||||
add( new JLabel( "ID:" ) );
|
|
||||||
mTextIdent = new JTextField( lojack.getID() );
|
|
||||||
|
|
||||||
add( mTextIdent, "grow, wrap" );
|
|
||||||
|
|
||||||
JButton btnSave = new JButton( "Save" );
|
|
||||||
btnSave.addActionListener( LoJackIDEditor.this );
|
|
||||||
add( btnSave, "growx,push" );
|
|
||||||
|
|
||||||
JButton btnReset = new JButton( "Reset" );
|
|
||||||
btnReset.addActionListener( LoJackIDEditor.this );
|
|
||||||
add( btnReset, "growx,push" );
|
|
||||||
|
|
||||||
JTextArea helpText = new JTextArea( mHelpText );
|
|
||||||
helpText.setLineWrap( true );
|
|
||||||
helpText.setBackground( getBackground() );
|
|
||||||
add( helpText, "span,grow,push" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
String command = e.getActionCommand();
|
|
||||||
|
|
||||||
final LoJackFunctionAndID lojack = mLoJackIDNode.getLoJackID();
|
|
||||||
|
|
||||||
if( command.contentEquals( "Save" ) )
|
|
||||||
{
|
|
||||||
String id = mTextIdent.getText();
|
|
||||||
|
|
||||||
if( id != null )
|
|
||||||
{
|
|
||||||
|
|
||||||
lojack.setID( id );
|
|
||||||
lojack.setFunction( (Function)mFunctionCombo.getSelectedItem() );
|
|
||||||
|
|
||||||
((ConfigurableNode)mLoJackIDNode.getParent()).sort();
|
|
||||||
|
|
||||||
mLoJackIDNode.save();
|
|
||||||
|
|
||||||
mLoJackIDNode.show();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
JOptionPane.showMessageDialog( LoJackIDEditor.this, "Please enter an ident" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if( command.contentEquals( "Reset" ) )
|
|
||||||
{
|
|
||||||
mFunctionCombo.setSelectedItem( lojack.getFunction() );
|
|
||||||
mTextIdent.setText( lojack.getID() );
|
|
||||||
}
|
|
||||||
|
|
||||||
mLoJackIDNode.refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* SDR Trunk
|
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
******************************************************************************/
|
|
||||||
package alias.id.lojack;
|
|
||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
|
|
||||||
import javax.swing.JMenuItem;
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JPopupMenu;
|
|
||||||
|
|
||||||
import alias.AliasIDNode;
|
|
||||||
import alias.AliasNode;
|
|
||||||
|
|
||||||
public class LoJackIDNode extends AliasIDNode
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public LoJackIDNode( LoJackFunctionAndID id )
|
|
||||||
{
|
|
||||||
super( id );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JPanel getEditor()
|
|
||||||
{
|
|
||||||
return new LoJackIDEditor( this );
|
|
||||||
}
|
|
||||||
|
|
||||||
public LoJackFunctionAndID getLoJackID()
|
|
||||||
{
|
|
||||||
return (LoJackFunctionAndID)getUserObject();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
return getLoJackID().toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public JPopupMenu getContextMenu()
|
|
||||||
{
|
|
||||||
JPopupMenu retVal = new JPopupMenu();
|
|
||||||
|
|
||||||
JMenuItem deleteItem = new JMenuItem( "Delete" );
|
|
||||||
deleteItem.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
int n = JOptionPane.showConfirmDialog( getModel().getTree(),
|
|
||||||
"Are you sure you want to permanently delete this node?" );
|
|
||||||
|
|
||||||
if( n == JOptionPane.YES_OPTION )
|
|
||||||
{
|
|
||||||
AliasNode parent = (AliasNode)getParent();
|
|
||||||
|
|
||||||
parent.getAlias().removeAliasID( getLoJackID() );
|
|
||||||
|
|
||||||
save();
|
|
||||||
|
|
||||||
getModel().removeNodeFromParent( LoJackIDNode.this );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
retVal.add( deleteItem );
|
|
||||||
|
|
||||||
return retVal;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,73 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* SDR Trunk
|
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
******************************************************************************/
|
|
||||||
package alias.id.mdc;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAttribute;
|
|
||||||
|
|
||||||
import alias.AliasID;
|
|
||||||
import alias.AliasIDType;
|
|
||||||
|
|
||||||
|
|
||||||
public class MDC1200ID extends AliasID
|
|
||||||
{
|
|
||||||
private String mID;
|
|
||||||
|
|
||||||
public MDC1200ID()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@XmlAttribute
|
|
||||||
public String getIdent()
|
|
||||||
{
|
|
||||||
return mID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIdent( String ident )
|
|
||||||
{
|
|
||||||
mID = ident;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
return "MDC-1200: " + mID;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean matches( AliasID id )
|
|
||||||
{
|
|
||||||
boolean retVal = false;
|
|
||||||
|
|
||||||
if( mID != null && id instanceof MDC1200ID )
|
|
||||||
{
|
|
||||||
MDC1200ID tgid = (MDC1200ID)id;
|
|
||||||
|
|
||||||
//Create a pattern - replace * wildcards with regex single-char wildcard
|
|
||||||
String pattern = mID.replace( "*", ".?" );
|
|
||||||
|
|
||||||
retVal = tgid.getIdent().matches( pattern );
|
|
||||||
}
|
|
||||||
|
|
||||||
return retVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AliasIDType getType()
|
|
||||||
{
|
|
||||||
return AliasIDType.MDC1200;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,95 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* SDR Trunk
|
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
******************************************************************************/
|
|
||||||
package alias.id.mdc;
|
|
||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
|
|
||||||
import javax.swing.JButton;
|
|
||||||
import javax.swing.JLabel;
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JTextField;
|
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
import controller.ConfigurableNode;
|
|
||||||
|
|
||||||
public class MDC1200IDEditor extends JPanel implements ActionListener
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
private MDC1200IDNode mMDC1200IDNode;
|
|
||||||
|
|
||||||
private JTextField mTextIdent;
|
|
||||||
|
|
||||||
public MDC1200IDEditor( MDC1200IDNode fsNode )
|
|
||||||
{
|
|
||||||
mMDC1200IDNode = fsNode;
|
|
||||||
initGUI();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initGUI()
|
|
||||||
{
|
|
||||||
setLayout( new MigLayout( "fill,wrap 2", "[right][left]", "[][][][grow]" ) );
|
|
||||||
|
|
||||||
add( new JLabel( "MDC-1200 " ), "span,align center" );
|
|
||||||
|
|
||||||
add( new JLabel( "Unit ID:" ) );
|
|
||||||
mTextIdent = new JTextField( mMDC1200IDNode.getMDC1200ID().getIdent() );
|
|
||||||
add( mTextIdent, "growx,push" );
|
|
||||||
|
|
||||||
JButton btnSave = new JButton( "Save" );
|
|
||||||
btnSave.addActionListener( MDC1200IDEditor.this );
|
|
||||||
add( btnSave, "growx,push" );
|
|
||||||
|
|
||||||
JButton btnReset = new JButton( "Reset" );
|
|
||||||
btnReset.addActionListener( MDC1200IDEditor.this );
|
|
||||||
add( btnReset, "growx,push" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
String command = e.getActionCommand();
|
|
||||||
|
|
||||||
if( command.contentEquals( "Save" ) )
|
|
||||||
{
|
|
||||||
String ident = mTextIdent.getText();
|
|
||||||
|
|
||||||
if( ident != null )
|
|
||||||
{
|
|
||||||
mMDC1200IDNode.getMDC1200ID().setIdent( ident );
|
|
||||||
|
|
||||||
((ConfigurableNode)mMDC1200IDNode.getParent()).sort();
|
|
||||||
|
|
||||||
mMDC1200IDNode.save();
|
|
||||||
|
|
||||||
mMDC1200IDNode.show();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
JOptionPane.showMessageDialog( MDC1200IDEditor.this, "Please enter a unit ID" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if( command.contentEquals( "Reset" ) )
|
|
||||||
{
|
|
||||||
mTextIdent.setText( mMDC1200IDNode.getMDC1200ID().getIdent() );
|
|
||||||
}
|
|
||||||
|
|
||||||
mMDC1200IDNode.refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* SDR Trunk
|
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
******************************************************************************/
|
|
||||||
package alias.id.mdc;
|
|
||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
|
|
||||||
import javax.swing.JMenuItem;
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JPopupMenu;
|
|
||||||
|
|
||||||
import alias.AliasIDNode;
|
|
||||||
import alias.AliasNode;
|
|
||||||
|
|
||||||
public class MDC1200IDNode extends AliasIDNode
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public MDC1200IDNode( MDC1200ID id )
|
|
||||||
{
|
|
||||||
super( id );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JPanel getEditor()
|
|
||||||
{
|
|
||||||
return new MDC1200IDEditor( this );
|
|
||||||
}
|
|
||||||
|
|
||||||
public MDC1200ID getMDC1200ID()
|
|
||||||
{
|
|
||||||
return (MDC1200ID)getUserObject();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
|
|
||||||
sb.append( "MDC-1200 " );
|
|
||||||
sb.append( getMDC1200ID().getIdent() );
|
|
||||||
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public JPopupMenu getContextMenu()
|
|
||||||
{
|
|
||||||
JPopupMenu retVal = new JPopupMenu();
|
|
||||||
|
|
||||||
JMenuItem deleteItem = new JMenuItem( "Delete" );
|
|
||||||
deleteItem.addActionListener( new ActionListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
int n = JOptionPane.showConfirmDialog( getModel().getTree(),
|
|
||||||
"Are you sure you want to permanently delete this node?" );
|
|
||||||
|
|
||||||
if( n == JOptionPane.YES_OPTION )
|
|
||||||
{
|
|
||||||
AliasNode parent = (AliasNode)getParent();
|
|
||||||
|
|
||||||
parent.getAlias().removeAliasID( getMDC1200ID() );
|
|
||||||
|
|
||||||
save();
|
|
||||||
|
|
||||||
getModel().removeNodeFromParent( MDC1200IDNode.this );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
|
|
||||||
retVal.add( deleteItem );
|
|
||||||
|
|
||||||
return retVal;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,98 +0,0 @@
|
|||||||
/*******************************************************************************
|
|
||||||
* SDR Trunk
|
|
||||||
* Copyright (C) 2014 Dennis Sheirer
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
||||||
******************************************************************************/
|
|
||||||
package alias.id.mobileID;
|
|
||||||
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
|
|
||||||
import javax.swing.JButton;
|
|
||||||
import javax.swing.JLabel;
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JTextField;
|
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
|
||||||
import controller.ConfigurableNode;
|
|
||||||
|
|
||||||
public class MINEditor extends JPanel implements ActionListener
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
private MINNode mMINNode;
|
|
||||||
|
|
||||||
private JLabel mLabelName;
|
|
||||||
private JTextField mTextMIN;
|
|
||||||
|
|
||||||
public MINEditor( MINNode minNode )
|
|
||||||
{
|
|
||||||
mMINNode = minNode;
|
|
||||||
|
|
||||||
initGUI();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initGUI()
|
|
||||||
{
|
|
||||||
setLayout( new MigLayout( "fill,wrap 2", "[right][left]", "[][][][grow]" ) );
|
|
||||||
|
|
||||||
add( new JLabel( "Mobile ID Number (MIN)" ), "span,align center" );
|
|
||||||
|
|
||||||
add( new JLabel( "MIN:" ) );
|
|
||||||
|
|
||||||
mTextMIN = new JTextField( mMINNode.getMIN().getMin() );
|
|
||||||
add( mTextMIN, "growx,push" );
|
|
||||||
|
|
||||||
JButton btnSave = new JButton( "Save" );
|
|
||||||
btnSave.addActionListener( MINEditor.this );
|
|
||||||
add( btnSave, "growx,push" );
|
|
||||||
|
|
||||||
JButton btnReset = new JButton( "Reset" );
|
|
||||||
btnReset.addActionListener( MINEditor.this );
|
|
||||||
add( btnReset, "growx,push" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void actionPerformed( ActionEvent e )
|
|
||||||
{
|
|
||||||
String command = e.getActionCommand();
|
|
||||||
|
|
||||||
if( command.contentEquals( "Save" ) )
|
|
||||||
{
|
|
||||||
String esn = mTextMIN.getText();
|
|
||||||
|
|
||||||
if( esn != null )
|
|
||||||
{
|
|
||||||
mMINNode.getMIN().setMin( esn );
|
|
||||||
|
|
||||||
((ConfigurableNode)mMINNode.getParent()).sort();
|
|
||||||
|
|
||||||
mMINNode.save();
|
|
||||||
|
|
||||||
mMINNode.show();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
JOptionPane.showMessageDialog( MINEditor.this, "Please enter an ESN" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if( command.contentEquals( "Reset" ) )
|
|
||||||
{
|
|
||||||
mTextMIN.setText( mMINNode.getMIN().getMin() );
|
|
||||||
}
|
|
||||||
|
|
||||||
mMINNode.refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||