Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merging '5.0.x' into 'master'...

  • Loading branch information...
commit 43dfb3dd78173fc0935fd76f2611877ef09ecf9e 2 parents bc099eb + 5bedf75
@TheBizzle TheBizzle authored
Showing with 3,652 additions and 72 deletions.
  1. +207 −3 .idea/codeStyleSettings.xml
  2. +5 −1 .idea/compiler.xml
  3. +68 −9 .idea/libraries/all.xml
  4. +2 −23 .idea/misc.xml
  5. +1 −0  .idea/runConfigurations/App_3D.xml
  6. +2 −1  .idea/runConfigurations/App_English.xml
  7. +1 −0  .idea/runConfigurations/App_Spanish.xml
  8. +1 −0  .idea/runConfigurations/HubNet_Client.xml
  9. +2 −2 .idea/scala_compiler.xml
  10. +2 −2 LICENSE
  11. +26 −5 NetLogo.iml
  12. +2 −0  bin/htmldoc.sh
  13. +2 −2 bin/issues.scala
  14. +4 −1 build.sbt
  15. +2 −2 docs/copyright.html
  16. +3 −0  docs/headings.html
  17. BIN  docs/images/modelingcommons/childmodel.jpg
  18. BIN  docs/images/modelingcommons/childmodel.tiff
  19. BIN  docs/images/modelingcommons/createuser.jpg
  20. BIN  docs/images/modelingcommons/login.jpg
  21. BIN  docs/images/modelingcommons/modelingcommons.jpg
  22. BIN  docs/images/modelingcommons/newmodel.jpg
  23. +13 −0 docs/interface.html
  24. +175 −0 docs/modelingcommons.html
  25. +78 −4 docs/netlogolab.html
  26. +1 −1  extensions/gogo
  27. +28 −3 headless/resources/system/about.txt
  28. +2 −0  headless/src/main/org/nlogo/api/TrailDrawerInterface.scala
  29. +14 −8 headless/src/main/org/nlogo/render/TrailDrawer.java
  30. +1 −0  project/Depend.scala
  31. +9 −0 src/main/org/nlogo/api/ModelingCommonsInterface.java
  32. +1 −1  src/main/org/nlogo/app/AboutWindow.scala
  33. +63 −4 src/main/org/nlogo/app/App.scala
  34. +15 −0 src/main/org/nlogo/app/FileMenu.java
  35. +110 −0 src/main/org/nlogo/mc/CreateUserRequest.java
  36. +92 −0 src/main/org/nlogo/mc/DisableableComboBox.java
  37. +59 −0 src/main/org/nlogo/mc/DownloadGroupsRequest.java
  38. +65 −0 src/main/org/nlogo/mc/DownloadNewUserParametersRequest.java
  39. +32 −0 src/main/org/nlogo/mc/FileImage.java
  40. +111 −0 src/main/org/nlogo/mc/FileSelector.java
  41. +27 −0 src/main/org/nlogo/mc/Group.java
  42. +11 −0 src/main/org/nlogo/mc/Image.java
  43. +21 −0 src/main/org/nlogo/mc/ImageException.java
  44. +59 −0 src/main/org/nlogo/mc/LoadingDialog.java
  45. +198 −0 src/main/org/nlogo/mc/LoginDialog.java
  46. +62 −0 src/main/org/nlogo/mc/LoginRequest.java
  47. +52 −0 src/main/org/nlogo/mc/LogoutRequest.java
  48. +27 −0 src/main/org/nlogo/mc/Model.java
  49. +214 −0 src/main/org/nlogo/mc/ModelingCommons.java
  50. +43 −0 src/main/org/nlogo/mc/Month.java
  51. +59 −0 src/main/org/nlogo/mc/MultiPartPostRequest.java
  52. +33 −0 src/main/org/nlogo/mc/NewModelType.java
  53. +402 −0 src/main/org/nlogo/mc/NewUserDialog.java
  54. +43 −0 src/main/org/nlogo/mc/Permission.java
  55. +41 −0 src/main/org/nlogo/mc/Person.java
  56. +34 −0 src/main/org/nlogo/mc/PostRequest.java
  57. +60 −0 src/main/org/nlogo/mc/Request.java
  58. +52 −0 src/main/org/nlogo/mc/SearchForModelsRequest.java
  59. +20 −0 src/main/org/nlogo/mc/SexOfPerson.java
  60. +75 −0 src/main/org/nlogo/mc/UpdateModelRequest.java
  61. +688 −0 src/main/org/nlogo/mc/UploadDialog.java
  62. +90 −0 src/main/org/nlogo/mc/UploadModelRequest.java
  63. +136 −0 src/main/org/nlogo/mc/UploadSuccessDialog.java
  64. +6 −0 src/main/org/nlogo/window/GUIWorkspaceJ.java
View
210 .idea/codeStyleSettings.xml
@@ -8,12 +8,216 @@
<option name="PACKAGES_TO_USE_IMPORT_ON_DEMAND">
<value />
</option>
- <ScalaCodeStyleSettings>
- <option name="IMPORTS_MEMBERS_USING_UNDERSCORE" value="false" />
- </ScalaCodeStyleSettings>
<XML>
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
</XML>
+ <codeStyleSettings language="JAVA">
+ <indentOptions>
+ <option name="INDENT_SIZE" value="2" />
+ <option name="CONTINUATION_INDENT_SIZE" value="4" />
+ <option name="TAB_SIZE" value="2" />
+ </indentOptions>
+ <arrangement>
+ <groups>
+ <group>
+ <type>GETTERS_AND_SETTERS</type>
+ <order>KEEP</order>
+ </group>
+ </groups>
+ <rules>
+ <rule>
+ <match>
+ <AND>
+ <TYPE>FIELD</TYPE>
+ <MODIFIER>PUBLIC</MODIFIER>
+ <MODIFIER>STATIC</MODIFIER>
+ <MODIFIER>FINAL</MODIFIER>
+ </AND>
+ </match>
+ </rule>
+ <rule>
+ <match>
+ <AND>
+ <TYPE>FIELD</TYPE>
+ <MODIFIER>PROTECTED</MODIFIER>
+ <MODIFIER>STATIC</MODIFIER>
+ <MODIFIER>FINAL</MODIFIER>
+ </AND>
+ </match>
+ </rule>
+ <rule>
+ <match>
+ <AND>
+ <TYPE>FIELD</TYPE>
+ <MODIFIER>PACKAGE_PRIVATE</MODIFIER>
+ <MODIFIER>STATIC</MODIFIER>
+ <MODIFIER>FINAL</MODIFIER>
+ </AND>
+ </match>
+ </rule>
+ <rule>
+ <match>
+ <AND>
+ <TYPE>FIELD</TYPE>
+ <MODIFIER>PRIVATE</MODIFIER>
+ <MODIFIER>STATIC</MODIFIER>
+ <MODIFIER>FINAL</MODIFIER>
+ </AND>
+ </match>
+ </rule>
+ <rule>
+ <match>
+ <AND>
+ <TYPE>FIELD</TYPE>
+ <MODIFIER>PUBLIC</MODIFIER>
+ <MODIFIER>STATIC</MODIFIER>
+ </AND>
+ </match>
+ </rule>
+ <rule>
+ <match>
+ <AND>
+ <TYPE>FIELD</TYPE>
+ <MODIFIER>PROTECTED</MODIFIER>
+ <MODIFIER>STATIC</MODIFIER>
+ </AND>
+ </match>
+ </rule>
+ <rule>
+ <match>
+ <AND>
+ <TYPE>FIELD</TYPE>
+ <MODIFIER>PACKAGE_PRIVATE</MODIFIER>
+ <MODIFIER>STATIC</MODIFIER>
+ </AND>
+ </match>
+ </rule>
+ <rule>
+ <match>
+ <AND>
+ <TYPE>FIELD</TYPE>
+ <MODIFIER>PRIVATE</MODIFIER>
+ <MODIFIER>STATIC</MODIFIER>
+ </AND>
+ </match>
+ </rule>
+ <rule>
+ <match>
+ <AND>
+ <TYPE>FIELD</TYPE>
+ <MODIFIER>PUBLIC</MODIFIER>
+ <MODIFIER>FINAL</MODIFIER>
+ </AND>
+ </match>
+ </rule>
+ <rule>
+ <match>
+ <AND>
+ <TYPE>FIELD</TYPE>
+ <MODIFIER>PROTECTED</MODIFIER>
+ <MODIFIER>FINAL</MODIFIER>
+ </AND>
+ </match>
+ </rule>
+ <rule>
+ <match>
+ <AND>
+ <TYPE>FIELD</TYPE>
+ <MODIFIER>PACKAGE_PRIVATE</MODIFIER>
+ <MODIFIER>FINAL</MODIFIER>
+ </AND>
+ </match>
+ </rule>
+ <rule>
+ <match>
+ <AND>
+ <TYPE>FIELD</TYPE>
+ <MODIFIER>PRIVATE</MODIFIER>
+ <MODIFIER>FINAL</MODIFIER>
+ </AND>
+ </match>
+ </rule>
+ <rule>
+ <match>
+ <AND>
+ <TYPE>FIELD</TYPE>
+ <MODIFIER>PUBLIC</MODIFIER>
+ </AND>
+ </match>
+ </rule>
+ <rule>
+ <match>
+ <AND>
+ <TYPE>FIELD</TYPE>
+ <MODIFIER>PROTECTED</MODIFIER>
+ </AND>
+ </match>
+ </rule>
+ <rule>
+ <match>
+ <AND>
+ <TYPE>FIELD</TYPE>
+ <MODIFIER>PACKAGE_PRIVATE</MODIFIER>
+ </AND>
+ </match>
+ </rule>
+ <rule>
+ <match>
+ <AND>
+ <TYPE>FIELD</TYPE>
+ <MODIFIER>PRIVATE</MODIFIER>
+ </AND>
+ </match>
+ </rule>
+ <rule>
+ <match>
+ <TYPE>FIELD</TYPE>
+ </match>
+ </rule>
+ <rule>
+ <match>
+ <TYPE>CONSTRUCTOR</TYPE>
+ </match>
+ </rule>
+ <rule>
+ <match>
+ <AND>
+ <TYPE>METHOD</TYPE>
+ <MODIFIER>STATIC</MODIFIER>
+ </AND>
+ </match>
+ </rule>
+ <rule>
+ <match>
+ <TYPE>METHOD</TYPE>
+ </match>
+ </rule>
+ <rule>
+ <match>
+ <TYPE>ENUM</TYPE>
+ </match>
+ </rule>
+ <rule>
+ <match>
+ <TYPE>INTERFACE</TYPE>
+ </match>
+ </rule>
+ <rule>
+ <match>
+ <AND>
+ <TYPE>CLASS</TYPE>
+ <MODIFIER>STATIC</MODIFIER>
+ </AND>
+ </match>
+ </rule>
+ <rule>
+ <match>
+ <TYPE>CLASS</TYPE>
+ </match>
+ </rule>
+ </rules>
+ </arrangement>
+ </codeStyleSettings>
<codeStyleSettings language="Scala">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="8" />
View
6 .idea/compiler.xml
@@ -21,7 +21,11 @@
<entry name="?*.tld" />
<entry name="?*.ftl" />
</wildcardResourcePatterns>
- <annotationProcessing enabled="false" useClasspath="true" />
+ <annotationProcessing>
+ <profile default="true" name="Default" enabled="false">
+ <processorPath useClasspath="true" />
+ </profile>
+ </annotationProcessing>
</component>
<component name="EclipseCompilerSettings">
<option name="GENERATE_NO_WARNINGS" value="true" />
View
77 .idea/libraries/all.xml
@@ -1,16 +1,75 @@
<component name="libraryTable">
<library name="all">
<CLASSES>
- <root url="file://$PROJECT_DIR$/lib_managed/scala_2.9.2/test" />
- <root url="file://$PROJECT_DIR$/lib_managed/scala_2.9.2/compile" />
- <root url="file://$PROJECT_DIR$/project/boot/scala-2.9.2/lib" />
- <root url="file://$PROJECT_DIR$/lib" />
+ <root url="file://$PROJECT_DIR$/lib_managed/jars/steveroy/mrjadapter" />
+ <root url="file://$PROJECT_DIR$/lib_managed/jars/org.scalatest/scalatest_2.9.2" />
+ <root url="file://$PROJECT_DIR$/lib_managed/jars/org.scalacheck/scalacheck_2.9.2" />
+ <root url="file://$PROJECT_DIR$/lib_managed/jars/org.scala-tools.testing/test-interface" />
+ <root url="file://$PROJECT_DIR$/lib_managed/jars/org.picocontainer/picocontainer" />
+ <root url="file://$PROJECT_DIR$/lib_managed/jars/org.pegdown/pegdown" />
+ <root url="file://$PROJECT_DIR$/lib_managed/jars/org.parboiled/parboiled-java" />
+ <root url="file://$PROJECT_DIR$/lib_managed/jars/org.parboiled/parboiled-core" />
+ <root url="file://$PROJECT_DIR$/lib_managed/jars/org.objenesis/objenesis" />
+ <root url="file://$PROJECT_DIR$/lib_managed/jars/org.jogl/jogl" />
+ <root url="file://$PROJECT_DIR$/lib_managed/jars/org.jmock/jmock-legacy" />
+ <root url="file://$PROJECT_DIR$/lib_managed/jars/org.jmock/jmock-junit4" />
+ <root url="file://$PROJECT_DIR$/lib_managed/jars/org.jmock/jmock" />
+ <root url="file://$PROJECT_DIR$/lib_managed/jars/org.jhotdraw/jhotdraw" />
+ <root url="file://$PROJECT_DIR$/lib_managed/jars/org.hamcrest/hamcrest-library" />
+ <root url="file://$PROJECT_DIR$/lib_managed/jars/org.hamcrest/hamcrest-core" />
+ <root url="file://$PROJECT_DIR$/lib_managed/jars/org.gluegen-rt/gluegen-rt" />
+ <root url="file://$PROJECT_DIR$/lib_managed/jars/junit/junit-dep" />
+ <root url="file://$PROJECT_DIR$/lib_managed/jars/javax.media/jmf" />
+ <root url="file://$PROJECT_DIR$/lib_managed/jars/ch.randelshofer/swing-layout" />
+ <root url="file://$PROJECT_DIR$/lib_managed/jars/ch.randelshofer/quaqua" />
+ <root url="file://$PROJECT_DIR$/lib_managed/jars/cglib/cglib-nodep" />
+ <root url="file://$PROJECT_DIR$/lib_managed/jars/asm/asm-util" />
+ <root url="file://$PROJECT_DIR$/lib_managed/jars/asm/asm-tree" />
+ <root url="file://$PROJECT_DIR$/lib_managed/jars/asm/asm-analysis" />
+ <root url="file://$PROJECT_DIR$/lib_managed/jars/asm/asm-all" />
+ <root url="file://$PROJECT_DIR$/lib_managed/jars/asm/asm" />
+ <root url="file://$PROJECT_DIR$/lib_managed/bundles/log4j/log4j" />
+ <root url="jar://$PROJECT_DIR$/lib_managed/jars/org.apache.httpcomponents/httpmime/httpmime-4.2.jar!/" />
+ <root url="jar://$PROJECT_DIR$/lib_managed/jars/org.apache.httpcomponents/httpcore/httpcore-4.2.jar!/" />
+ <root url="jar://$PROJECT_DIR$/lib_managed/jars/org.apache.httpcomponents/httpclient/httpclient-4.2.jar!/" />
+ <root url="jar://$PROJECT_DIR$/lib_managed/jars/commons-logging/commons-logging/commons-logging-1.1.1.jar!/" />
+ <root url="jar://$PROJECT_DIR$/lib_managed/jars/commons-codec/commons-codec/commons-codec-1.6.jar!/" />
+ <root url="jar://$PROJECT_DIR$/lib_managed/bundles/com.googlecode.json-simple/json-simple/json-simple-1.1.1.jar!/" />
</CLASSES>
<JAVADOC />
- <SOURCES />
- <jarDirectory url="file://$PROJECT_DIR$/lib" recursive="false" />
- <jarDirectory url="file://$PROJECT_DIR$/lib_managed/scala_2.9.2/compile" recursive="false" />
- <jarDirectory url="file://$PROJECT_DIR$/lib_managed/scala_2.9.2/test" recursive="false" />
- <jarDirectory url="file://$PROJECT_DIR$/project/boot/scala-2.9.2/lib" recursive="false" />
+ <SOURCES>
+ <root url="file://$PROJECT_DIR$/lib_managed/jars/org.hamcrest/hamcrest-library" />
+ <root url="file://$PROJECT_DIR$/lib_managed/jars/org.hamcrest/hamcrest-core" />
+ </SOURCES>
+ <jarDirectory url="file://$PROJECT_DIR$/lib_managed/bundles/log4j/log4j" recursive="false" />
+ <jarDirectory url="file://$PROJECT_DIR$/lib_managed/jars/asm/asm" recursive="false" />
+ <jarDirectory url="file://$PROJECT_DIR$/lib_managed/jars/asm/asm-all" recursive="false" />
+ <jarDirectory url="file://$PROJECT_DIR$/lib_managed/jars/asm/asm-analysis" recursive="false" />
+ <jarDirectory url="file://$PROJECT_DIR$/lib_managed/jars/asm/asm-tree" recursive="false" />
+ <jarDirectory url="file://$PROJECT_DIR$/lib_managed/jars/asm/asm-util" recursive="false" />
+ <jarDirectory url="file://$PROJECT_DIR$/lib_managed/jars/cglib/cglib-nodep" recursive="false" />
+ <jarDirectory url="file://$PROJECT_DIR$/lib_managed/jars/ch.randelshofer/quaqua" recursive="false" />
+ <jarDirectory url="file://$PROJECT_DIR$/lib_managed/jars/ch.randelshofer/swing-layout" recursive="false" />
+ <jarDirectory url="file://$PROJECT_DIR$/lib_managed/jars/javax.media/jmf" recursive="false" />
+ <jarDirectory url="file://$PROJECT_DIR$/lib_managed/jars/junit/junit-dep" recursive="false" />
+ <jarDirectory url="file://$PROJECT_DIR$/lib_managed/jars/org.gluegen-rt/gluegen-rt" recursive="false" />
+ <jarDirectory url="file://$PROJECT_DIR$/lib_managed/jars/org.hamcrest/hamcrest-core" recursive="false" />
+ <jarDirectory url="file://$PROJECT_DIR$/lib_managed/jars/org.hamcrest/hamcrest-library" recursive="false" />
+ <jarDirectory url="file://$PROJECT_DIR$/lib_managed/jars/org.jhotdraw/jhotdraw" recursive="false" />
+ <jarDirectory url="file://$PROJECT_DIR$/lib_managed/jars/org.jmock/jmock" recursive="false" />
+ <jarDirectory url="file://$PROJECT_DIR$/lib_managed/jars/org.jmock/jmock-junit4" recursive="false" />
+ <jarDirectory url="file://$PROJECT_DIR$/lib_managed/jars/org.jmock/jmock-legacy" recursive="false" />
+ <jarDirectory url="file://$PROJECT_DIR$/lib_managed/jars/org.jogl/jogl" recursive="false" />
+ <jarDirectory url="file://$PROJECT_DIR$/lib_managed/jars/org.objenesis/objenesis" recursive="false" />
+ <jarDirectory url="file://$PROJECT_DIR$/lib_managed/jars/org.parboiled/parboiled-core" recursive="false" />
+ <jarDirectory url="file://$PROJECT_DIR$/lib_managed/jars/org.parboiled/parboiled-java" recursive="false" />
+ <jarDirectory url="file://$PROJECT_DIR$/lib_managed/jars/org.pegdown/pegdown" recursive="false" />
+ <jarDirectory url="file://$PROJECT_DIR$/lib_managed/jars/org.picocontainer/picocontainer" recursive="false" />
+ <jarDirectory url="file://$PROJECT_DIR$/lib_managed/jars/org.scala-tools.testing/test-interface" recursive="false" />
+ <jarDirectory url="file://$PROJECT_DIR$/lib_managed/jars/org.scalacheck/scalacheck_2.9.2" recursive="false" />
+ <jarDirectory url="file://$PROJECT_DIR$/lib_managed/jars/org.scalatest/scalatest_2.9.2" recursive="false" />
+ <jarDirectory url="file://$PROJECT_DIR$/lib_managed/jars/steveroy/mrjadapter" recursive="false" />
+ <jarDirectory url="file://$PROJECT_DIR$/lib_managed/jars/org.hamcrest/hamcrest-core" recursive="false" type="SOURCES" />
+ <jarDirectory url="file://$PROJECT_DIR$/lib_managed/jars/org.hamcrest/hamcrest-library" recursive="false" type="SOURCES" />
</library>
</component>
View
25 .idea/misc.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
+ <component name="IdProvider" IDEtalkID="646DA3A331C20A984697A72AC0836D89" />
<component name="JavadocGenerationManager">
<option name="OUTPUT_DIRECTORY" />
<option name="OPTION_SCOPE" value="protected" />
@@ -17,35 +18,13 @@
<option name="LOCALE" />
<option name="OPEN_IN_BROWSER" value="true" />
</component>
- <component name="NullableNotNullManager">
- <option name="myDefaultNullable" value="org.jetbrains.annotations.Nullable" />
- <option name="myDefaultNotNull" value="org.jetbrains.annotations.NotNull" />
- <option name="myNullables">
- <value>
- <list size="3">
- <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
- <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
- <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
- </list>
- </value>
- </option>
- <option name="myNotNulls">
- <value>
- <list size="3">
- <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
- <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
- <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
- </list>
- </value>
- </option>
- </component>
<component name="ProjectDetails">
<option name="projectName" value="NetLogo" />
</component>
<component name="ProjectResources">
<default-html-doctype>http://www.w3.org/1999/xhtml</default-html-doctype>
</component>
- <component name="ProjectRootManager" version="2" languageLevel="JDK_1_5" assert-keyword="true" jdk-15="true" project-jdk-name="1.6" project-jdk-type="JavaSDK">
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_1_5" assert-keyword="true" jdk-15="true" project-jdk-name="1.6 (Oracle)" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
View
1  .idea/runConfigurations/App_3D.xml
@@ -1,5 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="App 3D" type="Application" factoryName="Application">
+ <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" value="org.nlogo.app.App" />
<option name="VM_PARAMETERS" value="-Duser.language=en -Duser.region=US -Dorg.nlogo.is3d=true -Dorg.nlogo.noGenerator=true -Dfile.encoding=UTF-8" />
<option name="PROGRAM_PARAMETERS" value="" />
View
3  .idea/runConfigurations/App_English.xml
@@ -1,5 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="App English" type="Application" factoryName="Application">
+ <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" value="org.nlogo.app.App" />
<option name="VM_PARAMETERS" value="-Duser.language=en -Duser.region=US -Dorg.nlogo.noGenerator=true -Dfile.encoding=UTF-8" />
<option name="PROGRAM_PARAMETERS" value="" />
@@ -12,7 +13,7 @@
<module name="NetLogo" />
<envs />
<RunnerSettings RunnerId="Debug">
- <option name="DEBUG_PORT" value="59252" />
+ <option name="DEBUG_PORT" value="" />
<option name="TRANSPORT" value="0" />
<option name="LOCAL" value="true" />
</RunnerSettings>
View
1  .idea/runConfigurations/App_Spanish.xml
@@ -1,5 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="App Spanish" type="Application" factoryName="Application">
+ <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" value="org.nlogo.app.App" />
<option name="VM_PARAMETERS" value="-Duser.language=es -Duser.region=ES -Dfile.encoding=UTF-8" />
<option name="PROGRAM_PARAMETERS" value="" />
View
1  .idea/runConfigurations/HubNet_Client.xml
@@ -1,5 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="HubNet Client" type="Application" factoryName="Application">
+ <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" value="org.nlogo.hubnet.client.App" />
<option name="VM_PARAMETERS" value="-Dfile.encoding=UTF-8" />
<option name="PROGRAM_PARAMETERS" value="" />
View
4 .idea/scala_compiler.xml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ScalacSettings">
- <option name="COMPILER_LIBRARY_NAME" value="all" />
- <option name="COMPILER_LIBRARY_LEVEL" value="Project" />
+ <option name="COMPILER_LIBRARY_NAME" value="Scala 2.9.2" />
+ <option name="COMPILER_LIBRARY_LEVEL" value="Global" />
</component>
</project>
View
4 LICENSE
@@ -1,5 +1,5 @@
NetLogo
-Copyright (C) 1999-2012 Uri Wilensky
+Copyright (C) 1999-2013 Uri Wilensky
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -24,7 +24,7 @@ licenses, please contact Uri Wilensky at uri@northwestern.edu .
===
NetLogo User Manual
-Copyright (C) 1999-2012 Uri Wilensky
+Copyright (C) 1999-2013 Uri Wilensky
This work is licensed under the Creative Commons
Attribution-ShareAlike 3.0 Unported License. To view a copy of this
View
31 NetLogo.iml
@@ -3,14 +3,16 @@
<component name="FacetManager">
<facet type="scala" name="Scala">
<configuration>
- <option name="compilerLibraryLevel" value="Project" />
- <option name="compilerLibraryName" value="all" />
- <option name="compilerOptions" value="-unchecked -Xfatal-warnings -encoding us-ascii -Xcheckinit -deprecation" />
+ <option name="compilerLibraryLevel" value="Global" />
+ <option name="compilerLibraryName" value="Scala 2.9.2" />
+ <option name="compilerOptions" value="-deprecation -unchecked -Xfatal-warnings -Xcheckinit -encoding us-ascii" />
<option name="fsc" value="true" />
+ <option name="languageLevel" value="Scala 2.9" />
+ <option name="maximumHeapSize" value="1024" />
</configuration>
</facet>
</component>
- <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="false">
+ <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/out/production" />
<output-test url="file://$MODULE_DIR$/out/test" />
<exclude-output />
@@ -28,11 +30,30 @@
<excludeFolder url="file://$MODULE_DIR$/project/build/target" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
- <orderEntry type="inheritedJdk" />
+ <orderEntry type="jdk" jdkName="1.6 (Oracle)" jdkType="JavaSDK" />
+ <orderEntry type="library" name="Scala 2.9.2" level="application" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library">
<library>
<CLASSES>
+ <root url="file://$MODULE_DIR$/target/resource_managed" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="file://$MODULE_DIR$/dist/i18n" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
<root url="file://$MODULE_DIR$/resources" />
</CLASSES>
<JAVADOC />
View
2  bin/htmldoc.sh
@@ -1,4 +1,5 @@
#!/bin/sh
+cd ../docs/
htmldoc \
--strict \
--duplex \
@@ -27,6 +28,7 @@ htmldoc \
systemdynamics.html \
hubnet.html \
hubnet-authoring.html \
+ modelingcommons.html \
logging.html \
controlling.html \
mathematica.html \
View
4 bin/issues.scala
@@ -9,8 +9,8 @@
// - install conscript if you don't have it already:
// curl https://raw.github.com/n8han/conscript/master/setup.sh | sh
// - install sbt (and the scalas script) through conscript:
-// cs harrah/xsbt --branch v0.12.0
-// - edit ~/.conscript/harrah/xsbt/scalas/launchconfig
+// cs sbt/sbt --branch 0.12.0
+// - edit ~/.conscript/sbt/sbt/scalas/launchconfig
// and change the Scala version from `auto` to `2.9.2`
// and change the cross-versioned settings from `true` to `false`
// - ensure that ~/bin is included in your `PATH` environment variable
View
5 build.sbt
@@ -85,7 +85,10 @@ libraryDependencies ++= Seq(
"ch.randelshofer" % "quaqua" % "7.3.4" from "http://ccl.northwestern.edu/devel/quaqua-7.3.4.jar",
"ch.randelshofer" % "swing-layout" % "7.3.4" from "http://ccl.northwestern.edu/devel/swing-layout-7.3.4.jar",
"org.jogl" % "jogl" % "1.1.1" from "http://ccl.northwestern.edu/devel/jogl-1.1.1.jar",
- "org.gluegen-rt" % "gluegen-rt" % "1.1.1" from "http://ccl.northwestern.edu/devel/gluegen-rt-1.1.1.jar"
+ "org.gluegen-rt" % "gluegen-rt" % "1.1.1" from "http://ccl.northwestern.edu/devel/gluegen-rt-1.1.1.jar",
+ "org.apache.httpcomponents" % "httpclient" % "4.2",
+ "org.apache.httpcomponents" % "httpmime" % "4.2",
+ "com.googlecode.json-simple" % "json-simple" % "1.1.1"
)
all <<= (baseDirectory, streams) map { (base, s) =>
View
4 docs/copyright.html
@@ -46,7 +46,7 @@
NetLogo license
</h2>
<p>
- Copyright 1999-2012 by Uri Wilensky.
+ Copyright 1999-2013 by Uri Wilensky.
<p>
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
@@ -73,7 +73,7 @@
NetLogo User Manual license
</h2>
<p>
- Copyright 1999-2012 by Uri Wilensky.
+ Copyright 1999-2013 by Uri Wilensky.
<p>
<a rel="license" href=
"http://creativecommons.org/licenses/by-sa/3.0/"><img alt=
View
3  docs/headings.html
@@ -103,6 +103,9 @@
<br>
&nbsp;&nbsp;&nbsp;<b><a href="3d.html" target="entry">NetLogo
3D</a></b>
+ <br>
+ &nbsp;&nbsp;&nbsp;<b><a href="modelingcommons.html" target="entry">Save
+ to Modeling Commons</a></b>
<p class="headings">
<b>Extensions</b>
<br>
View
BIN  docs/images/modelingcommons/childmodel.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  docs/images/modelingcommons/childmodel.tiff
Binary file not shown
View
BIN  docs/images/modelingcommons/createuser.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  docs/images/modelingcommons/login.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  docs/images/modelingcommons/modelingcommons.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  docs/images/modelingcommons/newmodel.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
13 docs/interface.html
@@ -149,6 +149,19 @@
<td valign="top" style=
'border-top:none;border-left: none;border-bottom:solid windowtext .5pt;border-right:solid windowtext .5pt; padding:0in 5.4pt 0in 5.4pt'>
<p>
+ Upload to Modeling Commons
+ <td valign="top" style=
+ 'border-top:none;border-left: none;border-bottom:solid windowtext .5pt;border-right:double windowtext 4.5pt; padding:0in 5.4pt 0in 5.4pt'>
+ <p>
+ Uploads the model to Modeling Commons. See <a href="modelingcommons.html">Modeling Commons</a>
+ <tr>
+ <td valign="top" style=
+ 'border-top:none;border-left:double windowtext 4.5pt; border-bottom:solid windowtext .5pt;border-right:solid windowtext .5pt; padding:0in 5.4pt 0in 5.4pt'>
+ <p>
+ &nbsp;
+ <td valign="top" style=
+ 'border-top:none;border-left: none;border-bottom:solid windowtext .5pt;border-right:solid windowtext .5pt; padding:0in 5.4pt 0in 5.4pt'>
+ <p>
Print
<td valign="top" style=
'border-top:none;border-left: none;border-bottom:solid windowtext .5pt;border-right:double windowtext 4.5pt; padding:0in 5.4pt 0in 5.4pt'>
View
175 docs/modelingcommons.html
@@ -0,0 +1,175 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
+ "http://www.w3.org/TR/html4/strict.dtd">
+<title>
+ NetLogo User Manual: Modeling Commons Guide
+</title>
+<link rel="stylesheet" href="netlogo.css" type="text/css">
+<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
+<h1>
+ Modeling Commons Guide
+</h1>
+<div class="version">
+ NetLogo User Manual&nbsp;&nbsp;&nbsp;
+</div>
+
+<h2>
+ <a name="introduction" id="introduction">Introduction</a>
+</h2>
+
+<p>
+ <img src="images/modelingcommons/modelingcommons.jpg" alt="Modeling Commons">
+
+<p>The Modeling Commons
+ (<a href="http://modelingcommons.org/">http://modelingcommons.org/</a>)
+ is a Web-based collaboration system for NetLogo modelers. Users of
+ the Modeling Commons can share, download, modify, create variations
+ of, comment on, and run NetLogo models &mdash; both those that are a
+ part of the NetLogo models library, and also those that have been
+ uploaded by other NetLogo users.</p>
+
+<p>By uploading your NetLogo models to the Modeling Commons, you make
+ it easy for others to see, review, and comment on your work. You
+ can optionally keep the model private, either to yourself or to a
+ group of your choice, if you aren't comfortable with letting
+ everyone see the model. You can always change the permissions
+ associated with a model, if you change your mind later on.</p>
+
+<p>NetLogo now makes it possible to save models to the Modeling
+ Commons, just as you can save them to <code>.nlogo</code> files on
+ your own computer. You can access this functionality by selecting
+ "Save to Modeling Commons" from the "File" menu, underneath the
+ "Save as" option.</p>
+
+<p>Use of the Modeling Commons is free of charge. You may use it for
+ your own personal work, for your research group or company, or for a
+ class in which you are a student or teacher. The Modeling Commons
+ is sponsored by the CCL, the same group that develops and
+ distributes NetLogo.</p>
+
+<h2>
+ <a name="accounts" id="accounts">Modeling Commons Accounts</a>
+</h2>
+
+<p><img src="images/modelingcommons/login.jpg" alt="Log in to Modeling Commons"></p>
+
+<p>In order to upload models to the Modeling Commons, you must first
+ be a registered user. Unregistered users can view and download
+ models, but cannot upload, edit, or comment on them.</p>
+
+<p>The first time that you invoke "Save to Modeling Commons" in
+ NetLogo, you will be prompted to enter your e-mail address and
+ password. If you already have an account, then you can enter this
+ information and click on the "Login" button.</p>
+
+<p>If you don't yet have an account with the Modeling Commons, then
+ you will need to create one. Click on the "Create Account" button,
+ and enter the requested information. Once you have done so, click
+ on the "Create Account" button. If there are no errors, then you
+ will be prompted to upload a NetLogo model.</p>
+
+<h2>
+ <a name="upload" id="upload">Uploading Models</a>
+</h2>
+
+<p>There are three ways to upload a model to the Modeling Commons:
+ Uploading, updating, and creating a child ("forking"). The
+ following sections describe these in detail.</p>
+
+<h3>
+ <a name="new_model" id="new_model">Upload A New Model</a>
+</h3>
+
+
+<p>A new model will be created in the Modeling Commons, with its own
+ page, description, and forum. You should use this function the
+ first time that you save a model to the Modeling Commons.</p>
+
+
+<p>
+ <img src="images/modelingcommons/newmodel.jpg" alt="Uploading a new model">
+
+<p>
+ You must give your model a name. Model names are not required
+ to be unique; you could have 2 or more models with the same
+ name, though we recommend that you not do this.</p>
+
+<p>By default, anyone can view, fork, and update your model. You can
+ restrict the ability to view and fork your model by changing the
+ visibility permission. You can restrict the ability to update your
+ model by changing the changeability permission. In order to set
+ permissions for multiple people, assign your model to a group, and
+ then restrict visibility or changeability to members of that group.
+ Groups can be created from the
+ <a href="http://modelingcommons.org/account/groups#group_tabs_new_group">Modeling
+ Commons</a>. Once you have uploaded your
+ model, you can edit the permissions from the model's
+ Modeling Commons page.</p>
+
+<p>You can optionally upload a preview image to your model. The
+ preview image will be displayed alongside your model whenever it is
+ shown on the Modeling Commons. While uploading a preview image is
+ optional, we highly recommend that you do so, in one of the
+ following three ways:</p>
+
+<ul>
+
+<li>The "Use current image" option tells Netlogo to use the current
+ view as your preview. We recommend that you run the model, such
+ that it shows off the key visual features.</li>
+
+<li>The "Auto-generate image" feature auto-generates a preview image
+ by running <code>random-seed 0 setup repeat 75 [ go ]</code>. This
+ option will only be enabled if you have defined <code>setup</code>
+ and <code>go</code> procedures for Netlogo to run.</li>
+
+<li>The "Image from file" feature allows you to upload any PNG image.
+ Preview images work best when they are square.</li>
+
+</ul>
+
+<h3>
+ <a name="child_model" id="child_model">Upload A Child Of An Existing
+ Model ("forking")</a>
+</h3>
+
+<p>Saving a model in this way, sometimes known as "forking," does not
+ change or overwrite the original model. Rather, it creates a new
+ model on the Modeling Commons, much as a plain "save" would do,
+ simultaneously creating a parent-child relationship between the old
+ model and the new one. This relationship can be seen on the
+ "family" tab for a given model. You may fork any model, including
+ one that you cannot update.</p>
+
+<p>
+ <img src="images/modelingcommons/childmodel.jpg" alt="Uploading a child of an existing model">
+
+<p>To fork a model, you must give your new child a name, as well as
+ select an existing model to fork. To indicate the existing model,
+ start typing the name of the model that you would like to fork; if
+ the model exists in the Modeling Commons, select its name from among
+ the search results. You may fork any model for which you have
+ visibility permission.</p>
+
+<p>Finally, you must enter a description about what you are changing
+ in your child model, and how it relates to its parent.</p>
+
+ <h3>
+ <a name="new_version_of_model" id="new_version_of_model">Updating An Existing Model</a>
+ </h3>
+
+<p>To update a model that already exists in the Modeling Commons, then
+ you will likely want to use this option. Existing attachments,
+ discussions, and social tags will be preserved, but the model that
+ users can display, run, and download will be updated. You may only
+ update a model for which you have "write" permissions.</p>
+
+<p>You may only update models you have created or for which you have
+ been granted changeability permissions. All previous versions are
+ saved; you can revert to an old version from the model page, via the
+ "history" tab. To indicate which model should be updated, start
+ typing the name of the model. If that model has been uploaded to
+ the Modeling Commons, select the name that pops up with the search
+ results. Finally, enter a description about what you are changing
+ in your new version.</p>
+
+</h2>
View
82 docs/netlogolab.html
@@ -501,9 +501,11 @@
Primitives
</h2>
<p>
- <a href="#gogo:burst-value">gogo:burst-value</a> <a href=
- "#gogo:close">gogo:close</a> <a href="#gogo:open">gogo:open</a>
- <a href="#gogo:openp">gogo:open?</a> <a href=
+ <a href="#gogo:beep">gogo:beep</a> <a href="#gogo:burst-value">gogo:burst-value</a> <a href=
+ "#gogo:close">gogo:close</a> <a href="#gogo:install">gogo:install</a> <a href=
+ "#gogo:led-off">gogo:led-off</a> <a href= "#gogo:led-on">gogo:led-on</a> <a href=
+ "#gogo:open">gogo:open</a> <a href=
+ "#gogo:openp">gogo:open?</a> <a href=
"#gogo:ports">gogo:ports</a> <a href=
"#gogo:output-port-coast">gogo:output-port-coast</a> <a href=
"#gogo:output-port-off">gogo:output-port-off</a> <a href=
@@ -513,10 +515,24 @@
<!-- <a href="#read-sensors">read-sensors</a> -->
<a href="#gogo:sensor">gogo:sensor</a> <a href=
"#gogo:set-burst-mode">gogo:set-burst-mode</a> <a href=
- "#gogo:set-output-port-power">gogo:set-output-port-power</a> <a href=
+ "#gogo:set-output-port-power">gogo:set-output-port-power</a>
+ <a href="#gogo:set-servo">gogo:set-servo</a> <a href=
"#gogo:stop-burst-mode">gogo:stop-burst-mode</a> <a href=
"#gogo:talk-to-output-ports">gogo:talk-to-output-ports</a>
<h3>
+ <a name="gogo:beep" id="gogo:beep">gogo:beep</a>
+ </h3>
+ <h4>
+ gogo:beep
+ </h4>
+ <p>
+ Sends a signal to the GoGo Board to make it emit an audible beep. Useful for a testing purposes.
+ <p>
+ Example:
+ <pre>
+gogo:beep
+</pre>
+ <h3>
<a name="gogo:burst-value" id="gogo:burst-value">gogo:burst-value</a>
</h3>
<h4>
@@ -540,6 +556,49 @@
See also <a href="gogo:open"><tt>gogo:open</tt></a> and <a href=
"gogo:openp"><tt>gogo:open?</tt></a>.
<h3>
+ <a name="gogo:install" id="gogo:install">gogo:install</a>
+ </h3>
+ <h4>
+ gogo:install
+ </h4>
+ <p>
+ If on a Windows system, attempt to force-run the Windows driver installer.
+ <p>
+ Example:
+ <pre>
+gogo:install
+</pre>
+ <h3>
+ <a name="gogo:led-off" id="gogo:led-off">gogo:led-off</a>
+ </h3>
+ <h4>
+ gogo:led-off
+ </h4>
+ <p>
+ Sends the signal to the GoGo Board to turn off the LED.
+ <p>
+ Example:
+ <pre>
+gogo:led-off
+</pre>
+ <p>
+ See also <a href="gogo:led-on"><tt>gogo:led-on</tt></a>.
+ <h3>
+ <a name="gogo:led-on" id="gogo:led-on">gogo:led-on</a>
+ </h3>
+ <h4>
+ gogo:led-on
+ </h4>
+ <p>
+ Sends the signal to the GoGo Board to turn on the LED.
+ <p>
+ Example:
+ <pre>
+gogo:led-on
+</pre>
+ <p>
+ See also <a href="gogo:led-off"><tt>gogo:led-off</tt></a>.
+ <h3>
<a name="gogo:open" id="gogo:open">gogo:open</a>
</h3>
<h4>
@@ -797,6 +856,21 @@
;; will lower the power of all output ports by half of the full power .
</pre>
<h3>
+ <a name="gogo:set-servo" id="gogo:set-servo">gogo:set-servo</a>
+ </h3>
+ <h4>
+ gogo:set-servo <i>servo-position</i>
+ </h4>
+ <p>
+ Set the servo position to the value given by <i>servo-position</i>.
+ <p>
+ <i>servo-position</i> must be between 20 and 40 (inclusive).
+ <p>
+ Example:
+ <pre>
+gogo:set-servo 25
+</pre>
+ <h3>
<a name="gogo:stop-burst-mode" id=
"gogo:stop-burst-mode">gogo:stop-burst-mode</a>
</h3>
2  extensions/gogo
@@ -1 +1 @@
-Subproject commit eb86f3fa3c2b07d89b60e585e8738473a1ea8252
+Subproject commit b4b6e893d8cd21d4d88ac072df023e838f5e1ca9
View
31 headless/resources/system/about.txt
@@ -4,7 +4,7 @@ Development team: Jason Bertsche, Nicolas Payette
We also thank the following for their substantial contributions: Eamon McKenzie, Geoff Hulette, Chuck Shubert, Walter Stroup, Damon Centola, Ben Shargel, Matt Goto, Brent Collins, Matt Hellige, James Newell, Andrei Scheinkman, Esther Verreau, Craig Brozefsky, Eric Russell, Josh Cough
-We also gratefully acknowledge the contributions of: Dor Abrahamson, Fernando Alegre, Jason Alt, Zeina Atrash, Gordon Bailey, Eytan Bakshy, Matthew Berland, Stephanie Bezold, Paulo Blikstein, Silas Boyd-Wickizer, Corey Brady, Meridith Bruozas, Rodrigo Cadiz, Ivan Ceraj, Charles Chen, Eric Cheng, Jarva Chow, Rumou Duan, Jared Dunne, Geoff Garen, Jeremy Glassenberg, Katie Goodrum, Steve Gorodetskiy, Ed Hazzard, Carrie Hobbs, Nathan Holbert, Wendy Johnson, Nathan Jones, Hyungsin Kim, Jayun Kim, Woo-young Kim, Daniel Kornhauser, Sergey Krilov, Victor Lee, Reuven Lerner, Sharona Levy, Geoff Mathews, Spiro Maroulis, Dhrumil Mehta, Nate Nichols, Ben Neidhart, Michael Novak, Yevgeny Patarakin, Lorenzo Pesce, Francisco J. Miguel Quesada, Bill Rand, Andy Russell, Phil Saltzmann, Pratim Sengupta, Ben Shapiro, Gagandeep Singh, Mike Stieff, Forrest Stonedahl, Scott Styles, Celina Troutman, Josh Unterman, Aditi Wagh, Baba Kofi Weusijana, Michelle Wilkerson, Nate Wong, Christine Yang, Jack Zhu
+We also gratefully acknowledge the contributions of: Dor Abrahamson, Fernando Alegre, Jason Alt, Zeina Atrash, Gordon Bailey, Eytan Bakshy, Matthew Berland, Stephanie Bezold, Paulo Blikstein, Silas Boyd-Wickizer, Corey Brady, Meridith Bruozas, Rodrigo Cadiz, Ivan Ceraj, Charles Chen, Eric Cheng, Jarva Chow, Rumou Duan, Jared Dunne, Geoff Garen, Jeremy Glassenberg, Katie Goodrum, Steve Gorodetskiy, Ed Hazzard, Bryan Head, Arthur Hjorth, Carrie Hobbs, Nathan Holbert, Wendy Johnson, Nathan Jones, Hyungsin Kim, Jayun Kim, Woo-young Kim, Daniel Kornhauser, Sergey Krilov, Victor Lee, Reuven Lerner, Sharona Levy, Geoff Mathews, Spiro Maroulis, Dhrumil Mehta, Nate Nichols, Ben Neidhart, Michael Novak, Yevgeny Patarakin, Lorenzo Pesce, Francisco J. Miguel Quesada, Bill Rand, Andy Russell, Phil Saltzmann, Pratim Sengupta, Ben Shapiro, Gagandeep Singh, Firat Soylu, Mike Stieff, Forrest Stonedahl, Scott Styles, Celina Troutman, Josh Unterman, Aditi Wagh, David Weintrop, Baba Kofi Weusijana, Michelle Wilkerson, Nate Wong, Christine Yang, Jack Zhu
The CCL gratefully acknowledges almost two decades of support for our NetLogo work. Much of that support came from the National Science Foundation -- grant numbers REC-9814682 and REC-0126227, with further support from REC-0003285, REC-0115699, DRL-0196044, CCF-ITR-0326542, DRL-REC/ROLE-0440113, SBE-0624318, EEC-0648316, IIS-0713619, DRL-RED-9552950, DRL-REC-9632612, and DRL-DRK12-1020101. Additional support came from the Spencer Foundation, Texas Instruments, the Brady Fund, and the Northwestern Institute on Complex Systems.
@@ -23,7 +23,7 @@ The source code is hosted here: https://github.com/NetLogo/NetLogo . Contributi
===
NetLogo
-Copyright (C) 1999-2012 Uri Wilensky
+Copyright (C) 1999-2013 Uri Wilensky
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 2 of the License, or (at your option) any later version.
@@ -38,7 +38,7 @@ Commercial licenses are also available. To inquire about commercial licenses, pl
===
NetLogo User Manual
-Copyright (C) 1999-2012 Uri Wilensky
+Copyright (C) 1999-2013 Uri Wilensky
This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.
@@ -218,3 +218,28 @@ parboiled - Copyright (C) 2009-2011 Mathias Doenitz
This product includes software developed by Mathias Doenitz (http://www.parboiled.org/).
pegdown is released under the Apache License 2.0. (http://www.apache.org/licenses/LICENSE-2.0)
+
+===
+
+For the Modeling Commons functionality, Netlogo uses the Apache HTTPClient and JSON.simple libraries.
+
+The copyright and license for Apache HTTPClient are as follows:
+
+Copyright (c) 1999-2013 The Apache Software Foundation. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
+
+The copyright and license for JSON.simple are as follows:
+
+Copyright (c) Yidong Fang
+
+Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
+
View
2  headless/src/main/org/nlogo/api/TrailDrawerInterface.scala
@@ -12,6 +12,8 @@ trait TrailDrawerInterface extends DrawingInterface {
@throws(classOf[java.io.IOException])
def readImage(is: java.io.InputStream)
@throws(classOf[java.io.IOException])
+ def importDrawing(is: java.io.InputStream)
+ @throws(classOf[java.io.IOException])
def importDrawing(file: File)
def getAndCreateDrawing(dirty: Boolean): java.awt.image.BufferedImage
def clearDrawing()
View
22 headless/src/main/org/nlogo/render/TrailDrawer.java
@@ -150,7 +150,7 @@ public void readImage(java.io.InputStream is)
drawingDirty = true;
}
- public void importDrawing(org.nlogo.api.File file)
+ public void importDrawing(java.io.InputStream is)
throws java.io.IOException {
if (drawingImage == null) {
setUpDrawingImage();
@@ -159,12 +159,10 @@ public void importDrawing(org.nlogo.api.File file)
java.awt.image.BufferedImage image;
- image = javax.imageio.ImageIO.read(file.getInputStream());
-
+ image = javax.imageio.ImageIO.read(is);
if (image == null) {
- throw new javax.imageio.IIOException("The following file is not in a supported image format: " +
- file.getPath());
+ throw new javax.imageio.IIOException("Unsupported image format.");
}
float scalex = (float) getWidth() / (float) image.getWidth();
float scaley = (float) getHeight() / (float) image.getHeight();
@@ -187,9 +185,7 @@ public void importDrawing(org.nlogo.api.File file)
// implementations. -- CLB
if (image.getColorModel().getColorSpace().getType() == java.awt.color.ColorSpace.TYPE_GRAY
&& !image.getColorModel().hasAlpha()) {
- scaledImage =
- trans.createCompatibleDestImage(image,
- image.getColorModel());
+ scaledImage = trans.createCompatibleDestImage(image, image.getColorModel());
trans.filter(image, scaledImage);
} else {
scaledImage = trans.filter(image, null);
@@ -208,6 +204,16 @@ public void importDrawing(org.nlogo.api.File file)
sendPixels = true;
}
+ public void importDrawing(org.nlogo.api.File file)
+ throws java.io.IOException {
+ try {
+ importDrawing(file.getInputStream());
+ }
+ catch (javax.imageio.IIOException ex) {
+ throw new javax.imageio.IIOException("Unsupported image format: " + file.getPath(), ex);
+ }
+ }
+
public void exportDrawingToCSV(java.io.PrintWriter writer) {
if (!drawingBlank) {
writer.println(Dump.csv().encode("DRAWING"));
View
1  project/Depend.scala
@@ -76,6 +76,7 @@ object Depend {
"lite" -> List("window"),
"log" -> List("api"),
"mirror" -> List("plot", "shape"),
+ "mc" -> List("nvm", "swing"),
"nvm" -> List("agent"),
"plot" -> List("api"),
"prim" -> List("nvm"),
View
9 src/main/org/nlogo/api/ModelingCommonsInterface.java
@@ -0,0 +1,9 @@
+// (C) Uri Wilensky. https://github.com/NetLogo/NetLogo
+
+package org.nlogo.api;
+
+public interface ModelingCommonsInterface {
+
+ public void saveToModelingCommons();
+
+}
View
2  src/main/org/nlogo/app/AboutWindow.scala
@@ -42,7 +42,7 @@ class AboutWindow(parent:Frame) extends JDialog(parent,false) {
+ ")</font>" + "</b><br><br>\n"
+ "<font size=-1><b>web site</b> "
+ "<a href=\"http://ccl.northwestern.edu/netlogo/\">ccl.northwestern.edu/netlogo</a><br><br>"
- + "<font color=\"#333333\">&copy 1999-2012 Uri Wilensky<br><br>"
+ + "<font color=\"#333333\">&copy 1999-2013 Uri Wilensky<br><br>"
+ "Please cite as:<br>"
+ "Wilensky, U. 1999. NetLogo. http://ccl.northwestern.edu/netlogo/.<br>"
+ "Center for Connected Learning and Computer-Based Modeling,<br>"
View
67 src/main/org/nlogo/app/App.scala
@@ -117,6 +117,13 @@ object App{
new ComponentParameter(), new ComponentParameter(classOf[AppFrame]),
new ComponentParameter(), new ComponentParameter(),
new ComponentParameter()))
+ val saveFunc = new ModelSaver(pico.getComponent(classOf[App])).save _
+ pico.add(classOf[ModelingCommonsInterface],
+ "org.nlogo.mc.ModelingCommons",
+ Array[Parameter] (
+ new ConstantParameter(saveFunc),
+ new ComponentParameter(classOf[AppFrame]),
+ new ComponentParameter()))
pico.add("org.nlogo.lab.gui.LabManager")
pico.add("org.nlogo.properties.EditDialogFactory")
// we need to make HeadlessWorkspace objects for BehaviorSpace to use.
@@ -295,6 +302,9 @@ class App extends
var colorDialog: ColorDialog = null
var labManager:LabManagerInterface = null
private val listenerManager = new NetLogoListenerManager
+ lazy val modelingCommons = pico.getComponent(classOf[ModelingCommonsInterface])
+ private val ImportWorldURLProp = "netlogo.world_state_url"
+ private val ImportRawWorldURLProp = "netlogo.raw_world_state_url"
/**
* Quits NetLogo by exiting the JVM. Asks user for confirmation first
@@ -507,10 +517,59 @@ class App extends
else if (commandLineMagic != null)
new Events.MagicOpenEvent(commandLineMagic)
.raise(this)
- else if (commandLineURL != null)
- fileMenu.openFromSource(
- org.nlogo.util.Utils.url2String(commandLineURL),
- null, "Starting...", ModelType.Library)
+ else if (commandLineURL != null) {
+
+ try {
+
+ val modelStr = org.nlogo.util.Utils.url2String(commandLineURL)
+ fileMenu.openFromSource(
+ modelStr,
+ java.net.URLDecoder.decode(commandLineURL.reverse takeWhile (_ != '/') reverse, "UTF-8"), "Starting...", ModelType.Library)
+
+ import org.nlogo.awt.EventQueue, org.nlogo.swing.Implicits.thunk2runnable
+ Option(System.getProperty(ImportRawWorldURLProp)) map {
+ url => // `io.Source.fromURL(url).bufferedReader` steps up to bat and... manages to fail gloriously here! --JAB (8/22/12)
+ import java.io.{ BufferedReader, InputStreamReader }, java.net.URL
+ EventQueue.invokeLater {
+ () =>
+ workspace.importWorld(new BufferedReader(new InputStreamReader(new URL(url).openStream())))
+ workspace.view.dirty()
+ workspace.view.repaint()
+ }
+ } getOrElse (Option(System.getProperty(ImportWorldURLProp)) map {
+ url =>
+
+ import java.util.zip.GZIPInputStream, java.io.{ ByteArrayInputStream, InputStreamReader }, scala.io.{ Codec, Source }
+
+ val source = Source.fromURL(url)(Codec.ISO8859)
+ val bytes = source.map(_.toByte).toArray
+ val bais = new ByteArrayInputStream(bytes)
+ val gis = new GZIPInputStream(bais)
+ val reader = new InputStreamReader(gis)
+
+ EventQueue.invokeLater {
+ () => {
+ workspace.importWorld(reader)
+ workspace.view.dirty()
+ workspace.view.repaint()
+ source.close()
+ bais.close()
+ gis.close()
+ reader.close()
+ }
+ }
+
+ })
+ }
+ catch {
+ case ex: java.net.ConnectException =>
+ fileMenu.newModel()
+ JOptionPane.showConfirmDialog(null,
+ "Could not obtain NetLogo model from URL '%s'.\nNetLogo will instead start without any model loaded.".format(commandLineURL),
+ "Connection Failed", JOptionPane.DEFAULT_OPTION)
+ }
+
+ }
else fileMenu.newModel()
}
View
15 src/main/org/nlogo/app/FileMenu.java
@@ -2,6 +2,8 @@
package org.nlogo.app;
+import java.util.Map;
+
import org.nlogo.api.I18N;
import org.nlogo.api.ModelReader;
import org.nlogo.api.ModelSection;
@@ -163,6 +165,19 @@ void action()
}
}
+private class SaveModelingCommonsAction extends FileMenuAction {
+ SaveModelingCommonsAction() {
+ super("Upload To Modeling Commons");
+ }
+
+ @Override
+ void action() throws UserCancelException {
+ //Very verbosely named method, this is called in doSave before calling modelSaver.doSave
+ //so we call it here before saving to Modeling Commons as well
+ checkWithUserBeforeSavingModelFromOldVersion();
+ app.modelingCommons().saveToModelingCommons();
+ }
+}
private class SaveAction extends FileMenuAction {
SaveAction() {
super(I18N.guiJ().get("menu.file.save"));
View
110 src/main/org/nlogo/mc/CreateUserRequest.java
@@ -0,0 +1,110 @@
+// (C) Uri Wilensky. https://github.com/NetLogo/NetLogo
+
+package org.nlogo.mc;
+
+import org.apache.http.client.HttpClient;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+import org.json.simple.parser.ParseException;
+
+import javax.imageio.ImageIO;
+import javax.swing.JDialog;
+import java.awt.Frame;
+import java.awt.image.BufferedImage;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
+public abstract class CreateUserRequest extends MultiPartPostRequest {
+
+ private JDialog loadingDialog;
+ private String invalid;
+ private Frame frame;
+
+ public CreateUserRequest(HttpClient http, Frame frame, String firstName, String lastName, String emailAddress, SexOfPerson sexOfPerson, String country, Integer birthdayYear, Month birthdayMonth, Integer birthdayDay, String password, Image profilePicture) {
+ super(http, ModelingCommons.HOST + "/account/create");
+ this.frame = frame;
+ addStringParam("new_person[first_name]", firstName);
+ addStringParam("new_person[last_name]", lastName);
+ addStringParam("new_person[email_address]", emailAddress);
+ addStringParam("new_person[sex]", sexOfPerson.toString());
+ addStringParam("new_person[country_name]", country);
+ String birthdayYearString = "";
+ if(birthdayYear != null) {
+ birthdayYearString = birthdayYear.toString();
+ }
+ String birthdayMonthString = "";
+ if(birthdayMonth != null) {
+ birthdayMonthString = "" + birthdayMonth.getMonthNum();
+ }
+ String birthdayDayString = "";
+ if(birthdayDay != null) {
+ birthdayDayString = birthdayDay.toString();
+ }
+ addStringParam("new_person[birthdate(1i)]", birthdayYearString);
+ addStringParam("new_person[birthdate(2i)]", birthdayMonthString);
+ addStringParam("new_person[birthdate(3i)]", birthdayDayString);
+ addStringParam("new_person[password]", password);
+ addStringParam("new_person[registration_consent]","1");
+ if(profilePicture != null) {
+ try {
+ ByteArrayOutputStream profilePictureStream = new ByteArrayOutputStream();
+ BufferedImage image = profilePicture.getImage();
+ if(image == null) {
+ invalid = "INVALID_PROFILE_PICTURE";
+ } else {
+ ImageIO.write(image, "png", profilePictureStream);
+ addFileParam("new_person[avatar]", profilePictureStream.toByteArray(), firstName + "_" + lastName + ".png");
+ }
+ } catch(ImageException e) {
+ //Thrown when the picture selected by the user is invalid (ie file that is not an image)
+ invalid = "INVALID_PROFILE_PICTURE";
+ } catch(IOException e) {
+ //Thrown ImageIO.write fails
+ //This should probably never be reached
+ invalid = "INVALID_PROFILE_PICTURE";
+ }
+ }
+ }
+
+ @Override
+ protected void onReturn(String response) {
+ loadingDialog.dispose();
+ if(response == null) {
+ onCreateUser("CONNECTION_ERROR", null);
+ return;
+ }
+ JSONParser json = new JSONParser();
+ try {
+ JSONObject obj = (JSONObject)(json.parse(response));
+ String status = (String)(obj.get("status"));
+ Person person = null;
+ if(status.equals("SUCCESS")) {
+ JSONObject personObj = (JSONObject)(obj.get("person"));
+ person = new Person(
+ (String) personObj.get("first_name"),
+ (String) personObj.get("last_name"),
+ ((Number) personObj.get("id")).intValue(),
+ (String) personObj.get("avatar"),
+ (String) personObj.get("email_address")
+ );
+ }
+ onCreateUser(status, person);
+ } catch(ParseException e) {
+ onCreateUser("INVALID_RESPONSE_FROM_SERVER", null);
+ }
+ }
+
+ @Override
+ public void execute() {
+ if(invalid != null) {
+ onCreateUser(invalid, null);
+ return;
+ }
+ loadingDialog = new LoadingDialog(frame, "Creating account on Modeling Commons");
+ super.execute();
+ loadingDialog.setVisible(true);
+ }
+
+ protected abstract void onCreateUser(String status, Person person);
+
+}
View
92 src/main/org/nlogo/mc/DisableableComboBox.java
@@ -0,0 +1,92 @@
+// (C) Uri Wilensky. https://github.com/NetLogo/NetLogo
+
+package org.nlogo.mc;
+
+import javax.swing.JComboBox;
+import javax.swing.JList;
+import javax.swing.UIManager;
+import javax.swing.plaf.basic.BasicComboBoxRenderer;
+import java.awt.Component;
+
+public class DisableableComboBox extends JComboBox {
+
+ private class Item {
+
+ private Object obj;
+ private boolean enabled;
+
+ public Item(Object obj, boolean enabled) {
+ this.obj = obj;
+ this.enabled = enabled;
+ }
+
+ public Object getObj() {
+ return obj;
+ }
+
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ }
+
+ public String toString() {
+ return obj.toString();
+ }
+
+ }
+
+ public DisableableComboBox() {
+ super();
+ setRenderer(new BasicComboBoxRenderer() {
+ public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
+ Component component = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
+ if(value != null && !(((Item)value).isEnabled())) {
+ component.setEnabled(false);
+ component.setForeground(UIManager.getColor("ComboBox.disabledForeground"));
+ component.setVisible(false);
+ } else {
+ component.setEnabled(true);
+ component.setVisible(true);
+ }
+ return component;
+ }
+ });
+ }
+
+ public int addItem(Object anObject, boolean isObjectEnabled) {
+ Item item = new Item(anObject, isObjectEnabled);
+ super.addItem(item);
+ return getItemCount() - 1;
+ }
+
+ public void setIndexEnabled(int index, boolean isObjectEnabled) {
+ if(index >= 0 && index < getItemCount()) {
+ Item item = (Item)(getItemAt(index));
+ item.setEnabled(isObjectEnabled);
+ }
+ }
+
+ @Override
+ public void setSelectedIndex(int i) {
+ if(i >= 0 && i < getItemCount() && !( ((Item)(getItemAt(i))).isEnabled()) ) {
+ return;
+ }
+ super.setSelectedIndex(i);
+ }
+
+ //Use getSelectedObject instead of getSelectedItem
+ //Overriding getSelectedObject causes problems since internally JComboBox would expect getSelectedItem to return a
+ //type Item
+ public Object getSelectedObject() {
+ Object selectedItem = super.getSelectedItem();
+ if(selectedItem == null) {
+ return null;
+ } else {
+ return ((Item)(selectedItem)).getObj();
+ }
+ }
+
+}
View
59 src/main/org/nlogo/mc/DownloadGroupsRequest.java
@@ -0,0 +1,59 @@
+// (C) Uri Wilensky. https://github.com/NetLogo/NetLogo
+
+package org.nlogo.mc;
+
+import org.apache.http.client.HttpClient;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+import org.json.simple.parser.ParseException;
+
+import javax.swing.JDialog;
+import java.awt.Frame;
+import java.util.ArrayList;
+import java.util.List;
+
+public abstract class DownloadGroupsRequest extends PostRequest {
+
+ private Frame frame;
+ private JDialog loadingDialog;
+
+ public DownloadGroupsRequest(HttpClient http, Frame frame) {
+ super(http, ModelingCommons.HOST + "/account/list_groups");
+ this.frame = frame;
+ }
+
+ @Override
+ protected void onReturn(String response) {
+ loadingDialog.dispose();
+ if(response == null) {
+ onDownloaded("CONNECTION_ERROR", null);
+ return;
+ }
+ JSONParser json = new JSONParser();
+ try {
+ List<Group> newGroups = new ArrayList<Group>();
+ JSONObject obj = (JSONObject) json.parse(response);
+ JSONArray groupsArr = (JSONArray) obj.get("groups");
+ for(Object groupObj : groupsArr) {
+ JSONObject group = (JSONObject) groupObj;
+ int id = ((Number) group.get("id")).intValue();
+ String name = (String) group.get("name");
+ newGroups.add(new Group(id, name));
+ }
+ onDownloaded("SUCCESS", newGroups);
+ } catch(ParseException e) {
+ onDownloaded("INVALID_RESPONSE_FROM_SERVER", null);
+ }
+ }
+
+ @Override
+ public void execute() {
+ loadingDialog = new LoadingDialog(frame, "Loading groups you belong to");
+ super.execute();
+ loadingDialog.setVisible(true);
+ }
+
+ protected abstract void onDownloaded(String status, List<Group> groups);
+
+}
View
65 src/main/org/nlogo/mc/DownloadNewUserParametersRequest.java
@@ -0,0 +1,65 @@
+// (C) Uri Wilensky. https://github.com/NetLogo/NetLogo
+
+package org.nlogo.mc;
+
+import org.apache.http.client.HttpClient;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+import org.json.simple.parser.ParseException;
+
+import javax.swing.JDialog;
+import java.awt.Frame;
+import java.util.ArrayList;
+import java.util.List;
+
+public abstract class DownloadNewUserParametersRequest extends PostRequest {
+
+ private JDialog loadingDialog;
+ private Frame frame;
+
+ public DownloadNewUserParametersRequest(HttpClient http, Frame frame) {
+ super(http, ModelingCommons.HOST + "/account/new");
+ this.frame = frame;
+ }
+
+ @Override
+ protected void onReturn(String response) {
+ loadingDialog.dispose();
+ if(response == null) {
+ onDownloaded("CONNECTION_ERROR", null, null, null);
+ return;
+ }
+ JSONParser json = new JSONParser();
+ try {
+ List<String> priorityCountries = new ArrayList<String>();
+ List<String> unpriorityCountries = new ArrayList<String>();
+ JSONObject obj = (JSONObject) json.parse(response);
+ JSONArray countries = (JSONArray) obj.get("countries");
+ for(Object countryObj : countries) {
+ JSONObject country = (JSONObject) countryObj;
+ String countryName = (String) country.get("name");
+ Boolean isPriority = (Boolean) country.get("priority");
+ if(isPriority) {
+ priorityCountries.add(countryName);
+ } else {
+ unpriorityCountries.add(countryName);
+ }
+ }
+ String userAgreement = (String)(obj.get("user_agreement"));
+ onDownloaded("SUCCESS", userAgreement, priorityCountries, unpriorityCountries);
+ } catch(ParseException e) {
+ onDownloaded("INVALID_RESPONSE_FROM_SERVER", null, null, null);
+ }
+ }
+
+ @Override
+ public void execute() {
+ loadingDialog = new LoadingDialog(frame, "Loading new user information");
+ super.execute();
+ loadingDialog.setVisible(true);
+ }
+
+ protected abstract void onDownloaded(String status, String newUserAgreement, List<String> priorityCountries, List<String> unpriorityCountries);
+
+}
View
32 src/main/org/nlogo/mc/FileImage.java
@@ -0,0 +1,32 @@
+// (C) Uri Wilensky. https://github.com/NetLogo/NetLogo
+
+package org.nlogo.mc;
+
+import javax.imageio.ImageIO;
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+
+public class FileImage implements Image {
+
+ private String filePath;
+
+ public FileImage(String filePath) {
+ this.filePath = filePath;
+ }
+
+ @Override
+ public BufferedImage getImage() throws ImageException {
+ if(filePath == null || filePath.length() == 0) {
+ throw new ImageException("Image path cannot be blank");
+ }
+ File file = new File(filePath);
+ BufferedImage image = null;
+ try {
+ return ImageIO.read(file);
+ } catch(IOException ioException) {
+ throw new ImageException("Invalid image file", ioException);
+ }
+ }
+
+}
View
111 src/main/org/nlogo/mc/FileSelector.java
@@ -0,0 +1,111 @@
+// (C) Uri Wilensky. https://github.com/NetLogo/NetLogo
+
+package org.nlogo.mc;
+
+import org.nlogo.awt.Hierarchy;
+import org.nlogo.awt.UserCancelException;
+import org.nlogo.swing.FileDialog;
+
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.FontMetrics;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ComponentEvent;
+import java.awt.event.ComponentListener;
+
+public class FileSelector extends JPanel {
+
+ private static final String NO_FILE_SELECTED = "No file selected";
+
+ private String filePath;
+ private JButton selectFileButton;
+ private JLabel filePathLabel;
+ private JPanel filePathLabelPanel;
+ private JComponent parent;
+
+ public FileSelector(JComponent parent){
+ super();
+ setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
+ setForeground(Color.BLUE);
+ this.parent = parent;
+ JPanel buttonPanel = new JPanel();
+ selectFileButton = new JButton("Select File");
+ //buttonPanel.add(selectFileButton);
+ add(Box.createRigidArea(new Dimension(10, 0)));
+ add(selectFileButton);
+ add(Box.createRigidArea(new Dimension(10, 0)));
+
+ filePathLabelPanel = new JPanel(new BorderLayout());
+ filePathLabel = new JLabel(NO_FILE_SELECTED);
+
+ filePathLabelPanel.add(filePathLabel, BorderLayout.CENTER);
+ //add(buttonPanel, BorderLayout.LINE_START);
+
+
+ add(filePathLabelPanel);
+
+ selectFileButton.addActionListener(new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent actionEvent) {
+ try {
+
+ filePath = FileDialog.show(Hierarchy.getFrame(FileSelector.this), "Select image to use as preview image", java.awt.FileDialog.LOAD);
+ resizeSelectedFileLabel();
+ } catch(UserCancelException e) {
+ //We don't care if the user cancels (filePath just stays null), so we can ignore this exception
+ }
+ }
+
+ });
+ parent.addComponentListener(new ComponentListener() {
+
+ @Override
+ public void componentResized(ComponentEvent componentEvent) {
+ resizeSelectedFileLabel();
+ }
+
+ @Override
+ public void componentMoved(ComponentEvent componentEvent) {}
+
+ @Override
+ public void componentShown(ComponentEvent componentEvent) {}
+
+ @Override
+ public void componentHidden(ComponentEvent componentEvent) {}
+
+ });
+ }
+
+ @Override
+ public void setEnabled(boolean enable) {
+ filePathLabel.setEnabled(enable);
+ selectFileButton.setEnabled(enable);
+ }
+
+ private void resizeSelectedFileLabel() {
+ if(filePath != null) {
+ String toSet = filePath;
+ FontMetrics metrics = filePathLabel.getFontMetrics(filePathLabel.getFont());
+ double availableWidth = filePathLabelPanel.getVisibleRect().getWidth();
+ System.out.println(availableWidth);
+ while(toSet.length() > 2 && metrics.stringWidth(toSet) > availableWidth) {
+ toSet = "\u2026" + toSet.substring(2);
+ }
+ filePathLabel.setText(toSet);
+ }
+
+ }
+
+ public String getFilePath() {
+ return filePath;
+ }
+}
View
27 src/main/org/nlogo/mc/Group.java
@@ -0,0 +1,27 @@
+// (C) Uri Wilensky. https://github.com/NetLogo/NetLogo
+
+package org.nlogo.mc;
+
+public class Group {
+
+ private int id;
+ private String name;
+
+ public Group(int id, String name) {
+ this.id = id;
+ this.name = name;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String toString() {
+ return getName();
+ }
+
+}
View
11 src/main/org/nlogo/mc/Image.java
@@ -0,0 +1,11 @@
+// (C) Uri Wilensky. https://github.com/NetLogo/NetLogo
+
+package org.nlogo.mc;
+
+import java.awt.image.BufferedImage;
+
+public interface Image {
+
+ public BufferedImage getImage() throws ImageException;
+
+}
View
21 src/main/org/nlogo/mc/ImageException.java
@@ -0,0 +1,21 @@
+// (C) Uri Wilensky. https://github.com/NetLogo/NetLogo
+
+package org.nlogo.mc;
+
+public class ImageException extends Exception {
+
+ public ImageException() {}
+
+ public ImageException(String s) {
+ super(s);
+ }
+
+ public ImageException(String s, Throwable throwable) {
+ super(s, throwable);
+ }
+
+ public ImageException(Throwable throwable) {
+ super(throwable);
+ }
+
+}
View
59 src/main/org/nlogo/mc/LoadingDialog.java
@@ -0,0 +1,59 @@
+// (C) Uri Wilensky. https://github.com/NetLogo/NetLogo
+
+package org.nlogo.mc;
+
+import javax.swing.BorderFactory;
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JProgressBar;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Frame;
+
+public class LoadingDialog extends JDialog {
+
+ //GUI form members
+ private JPanel topLevelContainer;
+ private JLabel label;
+ private JProgressBar progressBar;
+
+ //Data members
+ private String loadingText;
+ private Frame frame;
+
+ public LoadingDialog(Frame frame, String loadingText) {
+ super(frame);
+ this.frame = frame;
+ this.loadingText = loadingText;
+ initializeGUIComponents();
+ label.setText(loadingText);
+ setModal(true);
+ setResizable(false);
+ setUndecorated(true);
+ setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
+ pack();
+ setLocationRelativeTo(frame);
+ }
+
+ private void initializeGUIComponents() {
+ topLevelContainer = new JPanel();
+ topLevelContainer.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
+ topLevelContainer.setLayout(new BoxLayout(topLevelContainer, BoxLayout.Y_AXIS));
+ setContentPane(topLevelContainer);
+
+ label = new JLabel();
+ label.setAlignmentX(Component.CENTER_ALIGNMENT);
+ topLevelContainer.add(label);
+
+ topLevelContainer.add(Box.createRigidArea(new Dimension(0, 10)));
+
+ progressBar = new JProgressBar();
+ progressBar.setIndeterminate(true);
+ progressBar.setAlignmentX(Component.CENTER_ALIGNMENT);
+ topLevelContainer.add(progressBar);
+ }
+
+}
View
198 src/main/org/nlogo/mc/LoginDialog.java
@@ -0,0 +1,198 @@
+// (C) Uri Wilensky. https://github.com/NetLogo/NetLogo
+
+package org.nlogo.mc;
+
+import javax.swing.BorderFactory;
+import javax.swing.Box;
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JPasswordField;
+import javax.swing.JTextField;
+import javax.swing.KeyStroke;
+import javax.swing.SwingConstants;
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Frame;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.util.Arrays;
+
+public class LoginDialog extends JDialog {
+
+ //GUI form members
+ private JPanel topLevelContainer;
+ private JButton cancelButton;
+ private JButton loginButton;
+ private JPasswordField passwordField;
+ private JTextField emailField;
+ private JLabel errorLabel;
+ private JButton createAccountButton;
+
+ //Data members
+ private ModelingCommons communicator;
+ private Frame frame;
+
+ public LoginDialog(Frame frame, final ModelingCommons communicator, String errorLabelText) {
+ super(frame, "Login To Modeling Commons", true);
+ this.communicator = communicator;
+ this.frame = frame;
+ initializeGUIComponents();
+ getRootPane().setDefaultButton(loginButton);
+ errorLabel.setText(errorLabelText);
+ createAccountButton.addActionListener(new ActionListener() {
+
+ public void actionPerformed(ActionEvent e) {
+ dispose();
+ communicator.promptForCreateAccount();
+ }
+
+ });
+ loginButton.addActionListener(new ActionListener() {
+
+ public void actionPerformed(ActionEvent e) {
+ onOK();
+ }
+
+ });
+ cancelButton.addActionListener(new ActionListener() {
+
+ public void actionPerformed(ActionEvent e) {
+ onCancel();
+ }
+
+ });
+ //call onCancel() when cross is clicked
+ setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
+ addWindowListener(new WindowAdapter() {
+
+ public void windowClosing(WindowEvent e) {
+ onCancel();
+ }
+
+ });
+ // call onCancel() on ESCAPE
+ topLevelContainer.registerKeyboardAction(new ActionListener() {
+
+ public void actionPerformed(ActionEvent e) {
+ onCancel();
+ }
+
+ }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
+ this.pack();
+ this.setLocationRelativeTo(frame);
+ this.setResizable(true);
+ }
+
+ private void onOK() {
+ final String emailAddress = emailField.getText();
+ char[] passwordArr = passwordField.getPassword();
+ final String password = new String(passwordArr);
+ Arrays.fill(passwordArr, (char) 0);
+ dispose();
+ LoginRequest request = new LoginRequest(communicator.getHttpClient(), frame, emailAddress, password) {
+
+ @Override
+ protected void onLogin(String status, Person person) {
+ if(status.equals("INVALID_CREDENTIALS")) {
+ communicator.promptForLogin("Invalid email address or password");
+ } else if(status.equals("MISSING_PARAMETERS")) {
+ communicator.promptForLogin("Missing email address or password");
+ } else if(status.equals("CONNECTION_ERROR")) {
+ communicator.promptForLogin("Error connecting to Modeling Commons");
+ } else if(status.equals("SUCCESS")) {
+ communicator.setPerson(person);
+ communicator.promptForUpload();
+ } else {
+ communicator.promptForLogin("Unknown server error");
+ }
+ }
+
+ };
+ //Request.execute MUST come before the call to JDialog.setVisible because the setVisible call does not return if the
+ //dialog is modal (which it is).
+ request.execute();
+ }
+
+ private void onCancel() {
+ dispose();
+ }
+
+ private void setMaxHeightToPreferredHeight(JComponent component) {
+ component.setMaximumSize(new Dimension((int) component.getMaximumSize().getWidth(), (int) component.getPreferredSize().getHeight()));
+ }
+
+ private void initializeGUIComponents() {
+ GridBagConstraints constraints = new GridBagConstraints();
+ constraints.fill = GridBagConstraints.HORIZONTAL;
+ constraints.weightx = 1;
+
+ topLevelContainer = new JPanel();
+ topLevelContainer.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
+ topLevelContainer.setLayout(new BoxLayout(topLevelContainer, BoxLayout.Y_AXIS));
+ setContentPane(topLevelContainer);
+
+ JPanel titlePanel = new JPanel(new FlowLayout(FlowLayout.LEADING));
+ JPanel formPanel = new JPanel(new BorderLayout());
+ JPanel errorPanel = new JPanel(new FlowLayout(FlowLayout.LEADING));
+ JPanel buttonsPanel = new JPanel();
+ buttonsPanel.setLayout(new BoxLayout(buttonsPanel, BoxLayout.X_AXIS));
+
+ topLevelContainer.add(titlePanel);
+ topLevelContainer.add(formPanel);
+ topLevelContainer.add(Box.createVerticalGlue());
+ topLevelContainer.add(errorPanel);
+ topLevelContainer.add(buttonsPanel);
+
+ titlePanel.add(new JLabel("You must login to upload to the Modeling Commons"));
+ setMaxHeightToPreferredHeight(titlePanel);
+
+ JPanel formLabels = new JPanel(new GridLayout(2, 1));
+ formLabels.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));
+ JPanel formFields = new JPanel(new GridLayout(2, 1));
+ formPanel.add(formLabels, BorderLayout.LINE_START);
+ formPanel.add(formFields, BorderLayout.CENTER);
+
+ formLabels.add(new JLabel("Email Address", SwingConstants.TRAILING));
+ emailField = new JTextField();
+ JPanel emailFieldPanel = new JPanel(new GridBagLayout());
+ emailFieldPanel.add(emailField, constraints);
+ formFields.add(emailFieldPanel);
+
+ formLabels.add(new JLabel("Password", SwingConstants.TRAILING));
+ passwordField = new JPasswordField();
+ JPanel passwordFieldPanel = new JPanel(new GridBagLayout());
+ passwordFieldPanel.add(passwordField, constraints);
+ formFields.add(passwordFieldPanel);
+
+ setMaxHeightToPreferredHeight(formPanel);
+
+ errorLabel = new JLabel("Error");
+ errorLabel.setForeground(Color.RED);
+ errorPanel.add(errorLabel);
+ setMaxHeightToPreferredHeight(errorPanel);
+
+ createAccountButton = new JButton("Create Account");
+ cancelButton = new JButton("Cancel");
+ loginButton = new JButton("Login");
+
+ buttonsPanel.add(createAccountButton);
+ buttonsPanel.add(Box.createHorizontalGlue());
+ buttonsPanel.add(cancelButton);
+ buttonsPanel.add(Box.createRigidArea(new Dimension(10, 0)));
+ buttonsPanel.add(loginButton);
+ setMaxHeightToPreferredHeight(buttonsPanel);
+ }
+
+}
View
62 src/main/org/nlogo/mc/LoginRequest.java
@@ -0,0 +1,62 @@
+// (C) Uri Wilensky. https://github.com/NetLogo/NetLogo
+
+package org.nlogo.mc;
+
+import org.apache.http.client.HttpClient;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+import org.json.simple.parser.ParseException;
+
+import javax.swing.JDialog;
+import java.awt.Frame;
+
+public abstract class LoginRequest extends PostRequest {
+
+ private JDialog loadingDialog;
+ private Frame</