Browse Source

Re-init Git, minor tweaks

master
Skylar Ittner 6 years ago
commit
abe9ec5959
  1. 6
      .gitignore
  2. 58
      LICENSE
  3. 18
      README.md
  4. 121
      build.xml
  5. BIN
      lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar
  6. BIN
      lib/JavaPrettify-1.2.1.jar
  7. BIN
      lib/absolutelayout/AbsoluteLayout.jar
  8. BIN
      lib/autocomplete-2.5.4.jar
  9. BIN
      lib/beautyeye_lnf.jar
  10. BIN
      lib/commons-codec-1.9.jar
  11. BIN
      lib/commons-logging-1.2.jar
  12. BIN
      lib/flamingo-6.3-javadoc.jar
  13. BIN
      lib/flamingo-6.3.jar
  14. BIN
      lib/fluent-hc-4.5.jar
  15. BIN
      lib/htmlcleaner-2.10.jar
  16. BIN
      lib/httpclient-4.5.jar
  17. BIN
      lib/httpclient-cache-4.5.jar
  18. BIN
      lib/httpclient-win-4.5.jar
  19. BIN
      lib/httpcore-4.4.1.jar
  20. BIN
      lib/httpmime-4.5.jar
  21. BIN
      lib/iText-4.2.0-com.itextpdf.jar
  22. BIN
      lib/jmathplot.jar
  23. BIN
      lib/jna-4.1.0.jar
  24. BIN
      lib/jna-platform-4.1.0.jar
  25. BIN
      lib/js-engine.jar
  26. BIN
      lib/js.jar
  27. BIN
      lib/json-simple-1.1.1.jar
  28. BIN
      lib/jython-standalone-2.7-b3.jar
  29. BIN
      lib/jython-standalone-2.7.0.jar
  30. BIN
      lib/log4j-1.2.11.jar
  31. 89
      lib/nblibraries.properties
  32. BIN
      lib/org-netbeans-api-visual.jar
  33. BIN
      lib/org-openide-util.jar
  34. BIN
      lib/rsyntaxtextarea-2.5.6.jar
  35. BIN
      lib/seaglasslookandfeel-0.2.jar
  36. BIN
      lib/symja-2014-11-01.jar
  37. BIN
      lib/trident-6.3.jar
  38. BIN
      lib/ujmp-complete-0.2.5-javadoc.zip
  39. BIN
      lib/ujmp-complete-0.2.5.jar
  40. 3
      manifest.mf
  41. 1421
      nbproject/build-impl.xml
  42. 8
      nbproject/genfiles.properties
  43. 59
      nbproject/licenseheader.txt
  44. 149
      nbproject/project.properties
  45. 16
      nbproject/project.xml
  46. BIN
      src/Ubuntu-R.ttf
  47. 1469
      src/fi/iki/elonen/NanoHTTPD.java
  48. BIN
      src/net/apocalypselabs/symat/128x128.png
  49. BIN
      src/net/apocalypselabs/symat/16x16.png
  50. BIN
      src/net/apocalypselabs/symat/24x24.png
  51. BIN
      src/net/apocalypselabs/symat/256x256.png
  52. BIN
      src/net/apocalypselabs/symat/32x32.png
  53. BIN
      src/net/apocalypselabs/symat/48x48.png
  54. BIN
      src/net/apocalypselabs/symat/512x512.png
  55. BIN
      src/net/apocalypselabs/symat/64x64.png
  56. BIN
      src/net/apocalypselabs/symat/96x96.png
  57. 73
      src/net/apocalypselabs/symat/BadInputException.java
  58. 121
      src/net/apocalypselabs/symat/CodeCompleter.java
  59. 287
      src/net/apocalypselabs/symat/CodeExport.form
  60. 488
      src/net/apocalypselabs/symat/CodeExport.java
  61. 314
      src/net/apocalypselabs/symat/CodeRunner.java
  62. 119
      src/net/apocalypselabs/symat/Debug.java
  63. 439
      src/net/apocalypselabs/symat/Editor.form
  64. 1054
      src/net/apocalypselabs/symat/Editor.java
  65. 156
      src/net/apocalypselabs/symat/FileUtils.java
  66. 66
      src/net/apocalypselabs/symat/FontOptions.form
  67. 145
      src/net/apocalypselabs/symat/FontOptions.java
  68. 1307
      src/net/apocalypselabs/symat/Functions.java
  69. 210
      src/net/apocalypselabs/symat/Globals.form
  70. 327
      src/net/apocalypselabs/symat/Globals.java
  71. 147
      src/net/apocalypselabs/symat/Graph.form
  72. 549
      src/net/apocalypselabs/symat/Graph.java
  73. 124
      src/net/apocalypselabs/symat/Help.form
  74. 311
      src/net/apocalypselabs/symat/Help.java
  75. 198
      src/net/apocalypselabs/symat/InstallPlugin.form
  76. 317
      src/net/apocalypselabs/symat/InstallPlugin.java
  77. 200
      src/net/apocalypselabs/symat/Interpreter.form
  78. 562
      src/net/apocalypselabs/symat/Interpreter.java
  79. 129
      src/net/apocalypselabs/symat/KeyValListItem.java
  80. 166
      src/net/apocalypselabs/symat/License.form
  81. 437
      src/net/apocalypselabs/symat/License.java
  82. 220
      src/net/apocalypselabs/symat/Main.form
  83. 1127
      src/net/apocalypselabs/symat/Main.java
  84. 104
      src/net/apocalypselabs/symat/Notepad.form
  85. 241
      src/net/apocalypselabs/symat/Notepad.java
  86. 408
      src/net/apocalypselabs/symat/PackagePlugin.form
  87. 474
      src/net/apocalypselabs/symat/PackagePlugin.java
  88. 219
      src/net/apocalypselabs/symat/Pads.form
  89. 568
      src/net/apocalypselabs/symat/Pads.java
  90. 134
      src/net/apocalypselabs/symat/PrefStorage.java
  91. 100
      src/net/apocalypselabs/symat/PrettifyToHtml.java
  92. 454
      src/net/apocalypselabs/symat/Settings.form
  93. 458
      src/net/apocalypselabs/symat/Settings.java
  94. 146
      src/net/apocalypselabs/symat/SharePad.form
  95. 289
      src/net/apocalypselabs/symat/SharePad.java
  96. 92
      src/net/apocalypselabs/symat/SingleInstanceClient.java
  97. 113
      src/net/apocalypselabs/symat/SingleInstanceServer.java
  98. 153
      src/net/apocalypselabs/symat/SplashScreen.form
  99. 329
      src/net/apocalypselabs/symat/SplashScreen.java
  100. 83
      src/net/apocalypselabs/symat/SyncLogin.form

6
.gitignore

@ -0,0 +1,6 @@
bin/
dist/
*.exe
/src/padkey
/nbproject/private/
/build/

58
LICENSE

@ -0,0 +1,58 @@
==============================
Code License
==============================
Copyright (c) 2015, Netsyms Technologies
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
4. You adhere to the Media License detailed below. If you do not, this license
is automatically revoked and you must purge all copies of the software you
possess, in source or binary form.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
==============================
Media License
==============================
All images and other graphical files (the "graphics") included with this
software are copyright (c) 2015 Netsyms Technologies. You may not distribute
the graphics or any program, source code repository, or other digital storage
media containing them without written permission from Netsyms Technologies.
This ban on distribution only applies to publicly available systems.
A password-protected network file share, USB drive, or other storage scheme that
cannot be easily accessed by the public is generally allowed. If in doubt,
contact Netsyms Technologies. If Netsyms Technologies allows or denies
you permission, that decision is considered final and binding.
==============================
Other Licenses
==============================
This software contains third-party components. These components may fall under
a different license and have a different copyright holder than the above.
Consult their license information or the Manual system for more information.

18
README.md

@ -0,0 +1,18 @@
SyMAT
=====
SyMAT is a computer science and math system written in Java.
This repository is extremely bleeding-edge, and we won't help you compile it.
We test new features before committing, but there are bugs.
If you want a stable release, download the latest one from our website.
Get SyMAT
------
To get SyMAT for your platform, go to:
http://symatapp.com/
Report a Bug
------
To report bugs, go to: https://github.com/Netsyms/SyMAT/issues

121
build.xml

@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2015, Netsyms Technologies
All rights reserved.
CODE LICENSE ==========
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
4. You adhere to the Media License detailed below. If you do not, this license
is automatically revoked and you must purge all copies of the software you
possess, in source or binary form.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
MEDIA LICENSE ==========
All images and other graphical files ("media") included with this
software are copyright (c) 2015 Netsyms Technologies. You may not distribute
the graphics or any program, source code repository, or other digital storage
media containing them without permission from Netsyms Technologies.
This ban on distribution only applies to publicly available systems.
A password-protected network file share, USB drive, or other storage scheme that
cannot be easily accessed by the public is generally allowed. If in doubt,
contact Netsyms Technologies. If Netsyms Technologies allows or denies
you permission, that decision is considered final and binding.
You may only use the media for personal,
non-commercial, non-educational use unless:
1, You have paid for the software and media via the SyMAT website,
or 2, you are using it as part of the 15-day trial period.
Other uses are prohibited without permission.
If any part of this license is deemed unenforcable, the remainder
of the license remains in full effect.
-->
<project name="SyMAT" default="default" basedir=".">
<description>Builds, tests, and runs the project SyMAT.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar: JAR building
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="SyMAT-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
</project>

BIN
lib/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar

BIN
lib/JavaPrettify-1.2.1.jar

BIN
lib/absolutelayout/AbsoluteLayout.jar

BIN
lib/autocomplete-2.5.4.jar

BIN
lib/beautyeye_lnf.jar

BIN
lib/commons-codec-1.9.jar

BIN
lib/commons-logging-1.2.jar

BIN
lib/flamingo-6.3-javadoc.jar

BIN
lib/flamingo-6.3.jar

BIN
lib/fluent-hc-4.5.jar

BIN
lib/htmlcleaner-2.10.jar

BIN
lib/httpclient-4.5.jar

BIN
lib/httpclient-cache-4.5.jar

BIN
lib/httpclient-win-4.5.jar

BIN
lib/httpcore-4.4.1.jar

BIN
lib/httpmime-4.5.jar

BIN
lib/iText-4.2.0-com.itextpdf.jar

BIN
lib/jmathplot.jar

BIN
lib/jna-4.1.0.jar

BIN
lib/jna-platform-4.1.0.jar

BIN
lib/js-engine.jar

BIN
lib/js.jar

BIN
lib/json-simple-1.1.1.jar

BIN
lib/jython-standalone-2.7-b3.jar

BIN
lib/jython-standalone-2.7.0.jar

BIN
lib/log4j-1.2.11.jar

89
lib/nblibraries.properties

@ -0,0 +1,89 @@
#
# Copyright (c) 2015, Netsyms Technologies
# All rights reserved.
#
#
# CODE LICENSE ==========
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation and/or
# other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its contributors
# may be used to endorse or promote products derived from this software without
# specific prior written permission.
#
# 4. You adhere to the Media License detailed below. If you do not, this license
# is automatically revoked and you must purge all copies of the software you
# possess, in source or binary form.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#
# MEDIA LICENSE ==========
# All images and other graphical files ("media") included with this
# software are copyright (c) 2015 Netsyms Technologies. You may not distribute
# the graphics or any program, source code repository, or other digital storage
# media containing them without permission from Netsyms Technologies.
# This ban on distribution only applies to publicly available systems.
# A password-protected network file share, USB drive, or other storage scheme that
# cannot be easily accessed by the public is generally allowed. If in doubt,
# contact Netsyms Technologies. If Netsyms Technologies allows or denies
# you permission, that decision is considered final and binding.
#
# You may only use the media for personal,
# non-commercial, non-educational use unless:
# 1, You have paid for the software and media via the SyMAT website,
# or 2, you are using it as part of the 15-day trial period.
# Other uses are prohibited without permission.
# If any part of this license is deemed unenforcable, the remainder
# of the license remains in full effect.
#
libs.absolutelayout.classpath=\
${base}/absolutelayout/AbsoluteLayout.jar
libs.absolutelayout.displayName=Absolute Layout
#
# Netsyms Technologies
# Open Source License
#
# Source code can be used for any purpose, as long as:
# - Compiled binaries are rebranded and trademarks are not
# visible by the end user at any time, except to give
# credit to Netsyms Technologies, such as by showing
# "Based on <product> by Netsyms Technologies" or a
# similar notice;
# - You do not use the code for evil;
# - Rebranded compiled applications have significant
# differences in functionality;
# - and you provide your modified source code for download,
# under the terms of the GNU LGPL v3 or a comparable
# license.
#
# Compiled binaries cannot be redistributed or mirrored,
# unless:
# - You have written permission from Netsyms Technologies;
# - Downloads are not available from Netsyms Technologies,
# not even behind a paywall or other blocking mechanism;
# - or you have received a multi-computer license, in which
# case you should take measures to prevent unauthorized
# downloads, such as preventing download access from the
# Internet.
#
libs.CopyLibs.classpath=\
${base}/CopyLibs/org-netbeans-modules-java-j2seproject-copylibstask.jar
libs.CopyLibs.displayName=CopyLibs Task
libs.CopyLibs.prop-version=2.0

BIN
lib/org-netbeans-api-visual.jar

BIN
lib/org-openide-util.jar

BIN
lib/rsyntaxtextarea-2.5.6.jar

BIN
lib/seaglasslookandfeel-0.2.jar

BIN
lib/symja-2014-11-01.jar

BIN
lib/trident-6.3.jar

BIN
lib/ujmp-complete-0.2.5-javadoc.zip

BIN
lib/ujmp-complete-0.2.5.jar

3
manifest.mf

@ -0,0 +1,3 @@
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build

1421
nbproject/build-impl.xml
File diff suppressed because it is too large
View File

8
nbproject/genfiles.properties

@ -0,0 +1,8 @@
build.xml.data.CRC32=70b2413f
build.xml.script.CRC32=cfce77fe
build.xml.stylesheet.CRC32=8064a381@1.75.2.48
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=70b2413f
nbproject/build-impl.xml.script.CRC32=e6773cad
nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48

59
nbproject/licenseheader.txt

@ -0,0 +1,59 @@
<#if licenseFirst??>
${licenseFirst}
</#if>
${licensePrefix}Copyright (c) 2015, Netsyms Technologies
${licensePrefix}All rights reserved.
${licensePrefix}
${licensePrefix}
${licensePrefix}CODE LICENSE ==========
${licensePrefix}Redistribution and use in source and binary forms, with or without modification,
${licensePrefix}are permitted provided that the following conditions are met:
${licensePrefix}
${licensePrefix}1. Redistributions of source code must retain the above copyright notice, this
${licensePrefix}list of conditions and the following disclaimer.
${licensePrefix}
${licensePrefix}2. Redistributions in binary form must reproduce the above copyright notice,
${licensePrefix}this list of conditions and the following disclaimer in the documentation and/or
${licensePrefix}other materials provided with the distribution.
${licensePrefix}
${licensePrefix}3. Neither the name of the copyright holder nor the names of its contributors
${licensePrefix}may be used to endorse or promote products derived from this software without
${licensePrefix}specific prior written permission.
${licensePrefix}
${licensePrefix}4. You adhere to the Media License detailed below. If you do not, this license
${licensePrefix}is automatically revoked and you must purge all copies of the software you
${licensePrefix}possess, in source or binary form.
${licensePrefix}
${licensePrefix}THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
${licensePrefix}ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
${licensePrefix}WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
${licensePrefix}DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
${licensePrefix}ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
${licensePrefix}(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
${licensePrefix}LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
${licensePrefix}ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
${licensePrefix}(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
${licensePrefix}SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
${licensePrefix}
${licensePrefix}
${licensePrefix}MEDIA LICENSE ==========
${licensePrefix}All images and other graphical files ("media") included with this
${licensePrefix}software are copyright (c) 2015 Netsyms Technologies. You may not distribute
${licensePrefix}the graphics or any program, source code repository, or other digital storage
${licensePrefix}media containing them without permission from Netsyms Technologies.
${licensePrefix}This ban on distribution only applies to publicly available systems.
${licensePrefix}A password-protected network file share, USB drive, or other storage scheme that
${licensePrefix}cannot be easily accessed by the public is generally allowed. If in doubt,
${licensePrefix}contact Netsyms Technologies. If Netsyms Technologies allows or denies
${licensePrefix}you permission, that decision is considered final and binding.
${licensePrefix}
${licensePrefix}You may only use the media for personal,
${licensePrefix}non-commercial, non-educational use unless:
${licensePrefix}1, You have paid for the software and media via the SyMAT website,
${licensePrefix}or 2, you are using it as part of the 15-day trial period.
${licensePrefix}Other uses are prohibited without permission.
${licensePrefix}If any part of this license is deemed unenforcable, the remainder
${licensePrefix}of the license remains in full effect.
<#if licenseLast??>
${licenseLast}
</#if>

149
nbproject/project.properties

@ -0,0 +1,149 @@
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
application.desc=Math and Programming for People
application.homepage=https://symatapp.com/
application.splash=C:\\Users\\Skylar\\Documents\\Apocalypse Labs\\appmedia\\SyMAT\\splashscreen.png
application.title=SyMAT
application.vendor=Netsyms Technologies
auxiliary.org-netbeans-spi-editor-hints-projects.perProjectHintSettingsFile=nbproject/cfg_hints.xml
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.test.classpath=\
${run.test.classpath}
# Files in build.classes.dir which should be excluded from distribution jar
dist.archive.excludes=
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/SyMAT.jar
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
file.reference.autocomplete-2.5.4.jar=lib/autocomplete-2.5.4.jar
file.reference.beautyeye_lnf.jar=lib/beautyeye_lnf.jar
file.reference.commons-codec-1.9.jar=lib/commons-codec-1.9.jar
file.reference.commons-logging-1.2.jar=lib/commons-logging-1.2.jar
file.reference.flamingo-6.3.jar=lib/flamingo-6.3.jar
file.reference.htmlcleaner-2.10.jar=lib/htmlcleaner-2.10.jar
file.reference.httpclient-4.5.jar=lib/httpclient-4.5.jar
file.reference.httpclient-cache-4.5.jar=lib/httpclient-cache-4.5.jar
file.reference.httpclient-win-4.5.jar=lib/httpclient-win-4.5.jar
file.reference.httpcore-4.4.1.jar=lib/httpcore-4.4.1.jar
file.reference.httpmime-4.5.jar=lib/httpmime-4.5.jar
file.reference.iText-4.2.0-com.itextpdf.jar=lib/iText-4.2.0-com.itextpdf.jar
file.reference.JavaPrettify-1.2.1.jar=lib\\JavaPrettify-1.2.1.jar
file.reference.jmathplot.jar=lib/jmathplot.jar
file.reference.jna-4.1.0.jar=lib/jna-4.1.0.jar
file.reference.jna-platform-4.1.0.jar=lib/jna-platform-4.1.0.jar
file.reference.js-engine.jar=lib/js-engine.jar
file.reference.js.jar=lib/js.jar
file.reference.json-simple-1.1.1.jar=lib/json-simple-1.1.1.jar
file.reference.jython-standalone-2.7.0.jar=lib/jython-standalone-2.7.0.jar
file.reference.log4j-1.2.11.jar=lib/log4j-1.2.11.jar
file.reference.rsyntaxtextarea-2.5.6.jar=lib/rsyntaxtextarea-2.5.6.jar
file.reference.seaglasslookandfeel-0.2.jar=lib/seaglasslookandfeel-0.2.jar
file.reference.SyMAT-src=src
file.reference.symja-2014-11-01.jar=lib/symja-2014-11-01.jar
file.reference.trident-6.3.jar=lib/trident-6.3.jar
file.reference.ujmp-complete-0.2.5.jar=lib\\ujmp-complete-0.2.5.jar
includes=**
jar.archive.disabled=${jnlp.enabled}
jar.compress=false
jar.index=${jnlp.enabled}
javac.classpath=\
${file.reference.autocomplete-2.5.4.jar}:\
${file.reference.beautyeye_lnf.jar}:\
${file.reference.flamingo-6.3.jar}:\
${file.reference.htmlcleaner-2.10.jar}:\
${file.reference.iText-4.2.0-com.itextpdf.jar}:\
${file.reference.jmathplot.jar}:\
${file.reference.js-engine.jar}:\
${file.reference.js.jar}:\
${file.reference.json-simple-1.1.1.jar}:\
${file.reference.log4j-1.2.11.jar}:\
${file.reference.rsyntaxtextarea-2.5.6.jar}:\
${file.reference.seaglasslookandfeel-0.2.jar}:\
${file.reference.symja-2014-11-01.jar}:\
${file.reference.trident-6.3.jar}:\
${file.reference.JavaPrettify-1.2.1.jar}:\
${file.reference.ujmp-complete-0.2.5.jar}:\
${file.reference.commons-codec-1.9.jar}:\
${file.reference.commons-logging-1.2.jar}:\
${file.reference.httpclient-4.5.jar}:\
${file.reference.httpclient-cache-4.5.jar}:\
${file.reference.httpclient-win-4.5.jar}:\
${file.reference.httpcore-4.4.1.jar}:\
${file.reference.httpmime-4.5.jar}:\
${file.reference.jna-4.1.0.jar}:\
${file.reference.jna-platform-4.1.0.jar}:\
${file.reference.jython-standalone-2.7.0.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.processorpath=\
${javac.classpath}
javac.source=1.8
javac.target=1.8
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.reference.flamingo-6.3.jar=lib/flamingo-6.3-javadoc.jar
javadoc.reference.ujmp-complete-0.2.5.jar=lib\\ujmp-complete-0.2.5-javadoc.zip!/0.2.5/ujmp-core/apidocs/
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=SyMAT Code Docs
jnlp.codebase.type=no.codebase
jnlp.descriptor=application
jnlp.enabled=false
jnlp.mixed.code=default
jnlp.offline-allowed=false
jnlp.signed=false
jnlp.signing=
jnlp.signing.alias=
jnlp.signing.keystore=
main.class=net.apocalypselabs.symat.Main
# Optional override of default Codebase manifest attribute, use to prevent RIAs from being repurposed
manifest.custom.codebase=
# Optional override of default Permissions manifest attribute (supported values: sandbox, all-permissions)
manifest.custom.permissions=
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=default_platform
project.license=licenseheader
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project.
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
# To set system properties for unit tests define test-sys-prop.name=value:
run.jvmargs=
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
source.encoding=UTF-8
src.dir=${file.reference.SyMAT-src}

16
nbproject/project.xml

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.java.j2seproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
<name>SyMAT</name>
<source-roots>
<root id="src.dir"/>
</source-roots>
<test-roots/>
</data>
<libraries xmlns="http://www.netbeans.org/ns/ant-project-libraries/1">
<definitions>.\lib\nblibraries.properties</definitions>
</libraries>
</configuration>
</project>

BIN
src/Ubuntu-R.ttf

1469
src/fi/iki/elonen/NanoHTTPD.java
File diff suppressed because it is too large
View File

BIN
src/net/apocalypselabs/symat/128x128.png

After

Width: 128  |  Height: 128  |  Size: 7.9 KiB

BIN
src/net/apocalypselabs/symat/16x16.png

After

Width: 16  |  Height: 16  |  Size: 759 B

BIN
src/net/apocalypselabs/symat/24x24.png

After

Width: 24  |  Height: 24  |  Size: 1.2 KiB

BIN
src/net/apocalypselabs/symat/256x256.png

After

Width: 256  |  Height: 256  |  Size: 16 KiB

BIN
src/net/apocalypselabs/symat/32x32.png

After

Width: 32  |  Height: 32  |  Size: 1.7 KiB

BIN
src/net/apocalypselabs/symat/48x48.png

After

Width: 48  |  Height: 48  |  Size: 2.8 KiB

BIN
src/net/apocalypselabs/symat/512x512.png

After

Width: 512  |  Height: 512  |  Size: 36 KiB

BIN
src/net/apocalypselabs/symat/64x64.png

After

Width: 64  |  Height: 64  |  Size: 3.8 KiB

BIN
src/net/apocalypselabs/symat/96x96.png

After

Width: 96  |  Height: 96  |  Size: 5.9 KiB

73
src/net/apocalypselabs/symat/BadInputException.java

@ -0,0 +1,73 @@
/*
* Copyright (c) 2015, Netsyms Technologies
* All rights reserved.
*
*
* CODE LICENSE ==========
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* 4. You adhere to the Media License detailed below. If you do not, this license
* is automatically revoked and you must purge all copies of the software you
* possess, in source or binary form.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* MEDIA LICENSE ==========
* All images and other graphical files ("media") included with this
* software are copyright (c) 2015 Netsyms Technologies. You may not distribute
* the graphics or any program, source code repository, or other digital storage
* media containing them without permission from Netsyms Technologies.
* This ban on distribution only applies to publicly available systems.
* A password-protected network file share, USB drive, or other storage scheme that
* cannot be easily accessed by the public is generally allowed. If in doubt,
* contact Netsyms Technologies. If Netsyms Technologies allows or denies
* you permission, that decision is considered final and binding.
*
* You may only use the media for personal,
* non-commercial, non-educational use unless:
* 1, You have paid for the software and media via the SyMAT website,
* or 2, you are using it as part of the 15-day trial period.
* Other uses are prohibited without permission.
* If any part of this license is deemed unenforcable, the remainder
* of the license remains in full effect.
*/
package net.apocalypselabs.symat;
/**
*
* Bad input exception. Useful for throwing errors in user code.
*
* @author Skylar
*/
public class BadInputException extends Exception {
public BadInputException() {
super();
}
public BadInputException(String msg) {
super(msg);
}
}

121
src/net/apocalypselabs/symat/CodeCompleter.java

@ -0,0 +1,121 @@
/*
* Copyright (c) 2015, Netsyms Technologies
* All rights reserved.
*
*
* CODE LICENSE ==========
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* 4. You adhere to the Media License detailed below. If you do not, this license
* is automatically revoked and you must purge all copies of the software you
* possess, in source or binary form.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* MEDIA LICENSE ==========
* All images and other graphical files ("media") included with this
* software are copyright (c) 2015 Netsyms Technologies. You may not distribute
* the graphics or any program, source code repository, or other digital storage
* media containing them without permission from Netsyms Technologies.
* This ban on distribution only applies to publicly available systems.
* A password-protected network file share, USB drive, or other storage scheme that
* cannot be easily accessed by the public is generally allowed. If in doubt,
* contact Netsyms Technologies. If Netsyms Technologies allows or denies
* you permission, that decision is considered final and binding.
*
* You may only use the media for personal,
* non-commercial, non-educational use unless:
* 1, You have paid for the software and media via the SyMAT website,
* or 2, you are using it as part of the 15-day trial period.
* Other uses are prohibited without permission.
* If any part of this license is deemed unenforcable, the remainder
* of the license remains in full effect.
*/
package net.apocalypselabs.symat;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import org.fife.ui.autocomplete.BasicCompletion;
import org.fife.ui.autocomplete.CompletionProvider;
import org.fife.ui.autocomplete.DefaultCompletionProvider;
import org.fife.ui.autocomplete.VariableCompletion;
/**
*
* @author Skylar
*/
public class CodeCompleter {
private final CompletionProvider provider;
private final String lang;
/**
*
* @param language Either js or py.
*/
public CodeCompleter(String language) {
lang = language;
provider = makeCompletions();
}
public CompletionProvider getProvider() {
return provider;
}
private CompletionProvider makeCompletions() {
DefaultCompletionProvider provider = new DefaultCompletionProvider();
try {
String[] files = {"functions", "constants"};
for (String fileid : files) {
BufferedReader reader = new BufferedReader(
new InputStreamReader(
CodeCompleter.class.getResourceAsStream("resources/" + (fileid.equals(files[0]) ? "" : lang) + fileid + ".txt")));
String line;
while ((line = reader.readLine()) != null) {
switch (fileid) {
case "functions":
String[] args = line.split("\\|");
if (args.length == 2) {
provider.addCompletion(new BasicCompletion(provider, args[0], args[1]));
} else if (args.length == 3) {
provider.addCompletion(new BasicCompletion(provider, args[0], args[1], args[2]));
} else {
provider.addCompletion(new BasicCompletion(provider, args[0]));
}
break;
case "constants":
provider.addCompletion(new VariableCompletion(provider, line, "double"));
break;
}
}
}
} catch (IOException ex) {
Debug.printerr(ex.getMessage());
}
return provider;
}
}

287
src/net/apocalypselabs/symat/CodeExport.form

@ -0,0 +1,287 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JInternalFrameFormInfo">
<Properties>
<Property name="closable" type="boolean" value="true"/>
<Property name="iconifiable" type="boolean" value="true"/>
<Property name="maximizable" type="boolean" value="true"/>
<Property name="resizable" type="boolean" value="true"/>
<Property name="title" type="java.lang.String" value="Export Code"/>
<Property name="frameIcon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/net/apocalypselabs/symat/icons/export.png"/>
</Property>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane1" pref="583" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="10" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jScrollPane1" pref="273" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTextPane" name="previewPane">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="contentType" type="java.lang.String" value="text/html" noResource="true"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel1">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="outputPlaceBox" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="titleBox" min="-2" pref="154" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
<Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="authBox" max="32767" attributes="0"/>
<Component id="dateBox" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace type="unrelated" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Group type="102" attributes="0">
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="jScrollPane2" pref="239" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="jPanel2" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="5" pref="5" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="3" attributes="0">
<Component id="titleBox" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton1" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="jScrollPane2" alignment="0" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="authBox" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="dateBox" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="outputPlaceBox" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Component id="jPanel2" max="32767" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JTextField" name="titleBox">
<Properties>
<Property name="text" type="java.lang.String" value="SyMAT Project"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Title:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" value="Author:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="authBox">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="PrefStorage.getSetting(&quot;author&quot;, &quot;&quot;)" type="code"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="dateBox">
</Component>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="text" type="java.lang.String" value="Date:"/>
</Properties>
</Component>
<Container class="javax.swing.JScrollPane" name="jScrollPane2">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTextArea" name="headerBox">
<Properties>
<Property name="columns" type="int" value="20"/>
<Property name="lineWrap" type="boolean" value="true"/>
<Property name="rows" type="int" value="2"/>
<Property name="tabSize" type="int" value="4"/>
<Property name="wrapStyleWord" type="boolean" value="true"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
<Property name="text" type="java.lang.String" value="Header:"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="jButton1">
<Properties>
<Property name="text" type="java.lang.String" value="Update Preview"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
</Events>
</Component>
<Container class="javax.swing.JPanel" name="jPanel2">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Export to:"/>
</Border>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="exPdf" max="32767" attributes="0"/>
<Component id="exHtml" alignment="0" pref="80" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
<Component id="exHtml" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="exPdf" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="exHtml">
<Properties>
<Property name="text" type="java.lang.String" value="HTML"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="exHtmlActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="exPdf">
<Properties>
<Property name="text" type="java.lang.String" value="PDF"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="exPdfActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JComboBox" name="outputPlaceBox">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="3">
<StringItem index="0" value="Below code"/>
<StringItem index="1" value="Above code"/>
<StringItem index="2" value="No"/>
</StringArray>
</Property>
<Property name="selectedIndex" type="int" value="2"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel5">
<Properties>
<Property name="text" type="java.lang.String" value="Include output:"/>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Form>

488
src/net/apocalypselabs/symat/CodeExport.java

@ -0,0 +1,488 @@
/*
* Copyright (c) 2015, Netsyms Technologies
* All rights reserved.
*
*
* CODE LICENSE ==========
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* 4. You adhere to the Media License detailed below. If you do not, this license
* is automatically revoked and you must purge all copies of the software you
* possess, in source or binary form.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* MEDIA LICENSE ==========
* All images and other graphical files ("media") included with this
* software are copyright (c) 2015 Netsyms Technologies. You may not distribute
* the graphics or any program, source code repository, or other digital storage
* media containing them without permission from Netsyms Technologies.
* This ban on distribution only applies to publicly available systems.
* A password-protected network file share, USB drive, or other storage scheme that
* cannot be easily accessed by the public is generally allowed. If in doubt,
* contact Netsyms Technologies. If Netsyms Technologies allows or denies
* you permission, that decision is considered final and binding.
*
* You may only use the media for personal,
* non-commercial, non-educational use unless:
* 1, You have paid for the software and media via the SyMAT website,
* or 2, you are using it as part of the 15-day trial period.
* Other uses are prohibited without permission.
* If any part of this license is deemed unenforcable, the remainder
* of the license remains in full effect.
*/
package net.apocalypselabs.symat;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.html.simpleparser.HTMLWorker;
import com.itextpdf.text.html.simpleparser.StyleSheet;
import com.itextpdf.text.pdf.PdfWriter;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.StringReader;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import javax.swing.filechooser.FileFilter;
import javax.swing.filechooser.FileNameExtensionFilter;
import org.htmlcleaner.CleanerProperties;
import org.htmlcleaner.HtmlCleaner;
import org.htmlcleaner.SimpleHtmlSerializer;
import org.htmlcleaner.TagNode;
import prettify.PrettifyParser;
import syntaxhighlight.ParseResult;
/**
*
* @author Skylar
*/
public class CodeExport extends javax.swing.JInternalFrame {
private String codeLang = "js";
private String html;
private final String origCode;
private String outputTxt = "";
/**
* Creates new form CodeExport
*
* @param code The code.
*/
public CodeExport(String code) {
origCode = code;
initComponents();
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
html = genHtml(code);
}
});
html = genHtml(code);
previewPane.setText(html);
previewPane.setCaretPosition(0);
}
/**
* Create CodeExport window with a set language for syntax highlighting.
*
* @param code The code.
* @param lang Options are "js" or "python".
*/
public CodeExport(String code, String lang) {
this(code);
codeLang = lang;
}
public CodeExport(String code, String lang, String out) {
this(code, lang);
outputTxt = out;
}
private String genHtml(String code) {
String css = "";
BufferedReader reader = new BufferedReader(
new InputStreamReader(
CodeExport.class
.getResourceAsStream("pretty.css")));
String line;
try {
while ((line = reader.readLine()) != null) {
css += line;
}
} catch (IOException ex) {
Logger.getLogger(CodeExport.class.getName()).log(Level.SEVERE, null, ex);
}
html = "<!DOCTYPE html>"
+ "<html><head>"
+ "<meta charset=\"utf-8\">"
+ "<title></title>"
+ "<style type=\"text/css\"><!--" + css + "--></style>"
+ "</head>"
+ "<body>"
+ "<h1>" + titleBox.getText() + "</h1>";
if (!authBox.getText().equals("")) {
html += "<h2>Author: " + authBox.getText() + "</h2>";
}
if (!dateBox.getText().equals("")) {
html += "<h3>Date: " + dateBox.getText() + "</h3>";
}
if (!headerBox.getText().equals("")) {
html += "<p class=\"header\">" + headerBox.getText() + "</p>";
}
if (outputPlaceBox.getSelectedIndex() == 1) {
html += getOutput();
}
PrettifyParser parser = new PrettifyParser();
List<ParseResult> parseResults = parser.parse(codeLang, code);
html += PrettifyToHtml.toHtml(code, parseResults);
if (outputPlaceBox.getSelectedIndex() == 0) {
html += getOutput();
}
html += "</body></html>";
html = html.replace("\t", "<span class=\"tab\">&nbsp;&nbsp;&nbsp;&nbsp;</span>");
html = html.replace("\n", "<br>");
HtmlCleaner cleaner = new HtmlCleaner();
CleanerProperties props = cleaner.getProperties();
TagNode node = cleaner.clean(html);
html = new SimpleHtmlSerializer(props).getAsString(node);
html = html.replace("&apos;", "'");
html = html.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>", "");
Debug.println(html);
return html;
}
private String getOutput() {
return "<p><b>Output:</b></p><pre class=\"plaintxt\">"
+ outputTxt.replace("<", "&lt;").
replace("&", "&amp;").
replace(">", "&gt;").
replace("\"", "''")
+ "\n\n</pre>";
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
previewPane = new javax.swing.JTextPane();
jPanel1 = new javax.swing.JPanel();
titleBox = new javax.swing.JTextField();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
authBox = new javax.swing.JTextField();
dateBox = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
jScrollPane2 = new javax.swing.JScrollPane();
headerBox = new javax.swing.JTextArea();
jLabel4 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
jPanel2 = new javax.swing.JPanel();
exHtml = new javax.swing.JButton();
exPdf = new javax.swing.JButton();
outputPlaceBox = new javax.swing.JComboBox();
jLabel5 = new javax.swing.JLabel();
setClosable(true);
setIconifiable(true);
setMaximizable(true);
setResizable(true);
setTitle("Export Code");
setFrameIcon(new javax.swing.ImageIcon(getClass().getResource("/net/apocalypselabs/symat/icons/export.png"))); // NOI18N
previewPane.setEditable(false);
previewPane.setContentType("text/html"); // NOI18N
jScrollPane1.setViewportView(previewPane);
titleBox.setText("SyMAT Project");
jLabel1.setText("Title:");
jLabel2.setText("Author:");
authBox.setText(PrefStorage.getSetting("author", ""));
jLabel3.setText("Date:");
headerBox.setColumns(20);
headerBox.setLineWrap(true);
headerBox.setRows(2);
headerBox.setTabSize(4);
headerBox.setWrapStyleWord(true);
jScrollPane2.setViewportView(headerBox);
jLabel4.setText("Header:");
jButton1.setText("Update Preview");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Export to:"));
exHtml.setText("HTML");
exHtml.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
exHtmlActionPerformed(evt);
}
});
exPdf.setText("PDF");
exPdf.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
exPdfActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(exPdf, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(exHtml, javax.swing.GroupLayout.DEFAULT_SIZE, 80, Short.MAX_VALUE))
.addContainerGap())
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(18, 18, 18)
.addComponent(exHtml)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(exPdf)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
outputPlaceBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Below code", "Above code", "No" }));
outputPlaceBox.setSelectedIndex(2);
jLabel5.setText("Include output:");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(outputPlaceBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel1)
.addGap(18, 18, 18)
.addComponent(titleBox, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(jLabel3))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(authBox)
.addComponent(dateBox))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jButton1))
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 239, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(5, 5, 5)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(titleBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1)
.addComponent(jLabel4)
.addComponent(jButton1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jScrollPane2)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(authBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(dateBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(outputPlaceBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 0, Short.MAX_VALUE)))
.addGap(0, 0, Short.MAX_VALUE))
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(0, 0, 0))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 583, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 10, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 273, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
html = genHtml(origCode);
previewPane.setText(html);
previewPane.setCaretPosition(0);
}//GEN-LAST:event_jButton1ActionPerformed
private void exHtmlActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exHtmlActionPerformed
doSave("html");
}//GEN-LAST:event_exHtmlActionPerformed
private void exPdfActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exPdfActionPerformed
doSave("pdf");
}//GEN-LAST:event_exPdfActionPerformed
private void doSave(String format) {
html = genHtml(origCode);
JFileChooser fc = new JFileChooser();
FileFilter filter;
switch (format) {
case "pdf":
filter = new FileNameExtensionFilter("Portable Document Format (PDF)", "pdf");
break;
default:
filter = new FileNameExtensionFilter("Web Document (HTML)", "html");
}
fc.setFileFilter(filter);
fc.addChoosableFileFilter(filter);
int r = fc.showSaveDialog(this);
if (r == JFileChooser.APPROVE_OPTION) {
String file = FileUtils.getFileWithExtension(fc).getAbsolutePath();
switch (format) {
case "html":
saveFile(html, file);
break;
case "pdf":
savePdfFile(html, file);
break;
}
}
}
private void savePdfFile(String html, String path) {
try {
String k = html;
try (OutputStream file = new FileOutputStream(new File(path))) {
Document document = new Document();
PdfWriter.getInstance(document, file);
document.open();
HTMLWorker htmlWorker = new HTMLWorker(document);