| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,9 @@ | |||
| 1 | + <?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | + <classpath> | ||
| 3 | + <classpathentry kind="src" path="src"/> | ||
| 4 | + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> | ||
| 5 | + <classpathentry combineaccessrules="false" kind="src" path="/processing-app"/> | ||
| 6 | + <classpathentry kind="lib" path="/processing-app/lib/antlr.jar" sourcepath="/processing-app/lib/antlr-src.zip"/> | ||
| 7 | + <classpathentry kind="lib" path="/processing-core/bin"/> | ||
| 8 | + <classpathentry kind="output" path="core/bin"/> | ||
| 9 | + </classpath> | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1 +1,4 @@ | |||
| 1 | - android-core.zip | ||
| 1 | + bin | ||
| 2 | + android-core.zip | ||
| 3 | + release | ||
| 4 | + **/.DS_Store | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,17 @@ | |||
| 1 | + <?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | + <projectDescription> | ||
| 3 | + <name>android-mode</name> | ||
| 4 | + <comment></comment> | ||
| 5 | + <projects> | ||
| 6 | + </projects> | ||
| 7 | + <buildSpec> | ||
| 8 | + <buildCommand> | ||
| 9 | + <name>org.eclipse.jdt.core.javabuilder</name> | ||
| 10 | + <arguments> | ||
| 11 | + </arguments> | ||
| 12 | + </buildCommand> | ||
| 13 | + </buildSpec> | ||
| 14 | + <natures> | ||
| 15 | + <nature>org.eclipse.jdt.core.javanature</nature> | ||
| 16 | + </natures> | ||
| 17 | + </projectDescription> | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,121 @@ | |||
| 1 | + <?xml version="1.0"?> | ||
| 2 | + | ||
| 3 | + <project name="Android Mode for Processing" default="build"> | ||
| 4 | + | ||
| 5 | + <!-- path to the main processing repo --> | ||
| 6 | + <property name="processing.dir" value=".." /> | ||
| 7 | + | ||
| 8 | + <property name="core.jar.path" value="android-core.zip" /> | ||
| 9 | + <property name="mode.jar.path" value="mode/AndroidMode.jar" /> | ||
| 10 | + <property name="mode.dist.path" value="release/AndroidMode.zip" /> | ||
| 11 | + | ||
| 12 | + | ||
| 13 | + <target name="clean" description="Clean the build directories"> | ||
| 14 | + <delete dir="bin" /> | ||
| 15 | + <delete file="${mode.jar.path}" /> | ||
| 16 | + | ||
| 17 | + <!-- clean the core.jar project for Android --> | ||
| 18 | + <subant buildpath="core" target="clean"/> | ||
| 19 | + </target> | ||
| 20 | + | ||
| 21 | + <target name="compile" description="Compile sources"> | ||
| 22 | + <!-- build the core.jar file for Android --> | ||
| 23 | + <subant buildpath="core" target="build"/> | ||
| 24 | + | ||
| 25 | + <condition property="core-built"> | ||
| 26 | + <available file="${processing.dir}/core/library/core.jar" /> | ||
| 27 | + </condition> | ||
| 28 | + <fail unless="core-built" | ||
| 29 | + message="Please build the core library first and make sure it sits in ${processing.dir}/core/library/core.jar" /> | ||
| 30 | + | ||
| 31 | + <mkdir dir="bin" /> | ||
| 32 | + | ||
| 33 | + <!-- env used to set classpath below --> | ||
| 34 | + <property environment="env" /> | ||
| 35 | + | ||
| 36 | + <!-- | ||
| 37 | + classpath="../core/library/core.jar; lib/ant.jar; lib/ant-launcher.jar; lib/antlr.jar; lib/apple.jar; lib/jdt-core.jar; lib/jna.jar; lib/org-netbeans-swing-outline.jar;lib/com.ibm.icu_4.4.2.v20110823.jar;lib/jdi.jar;lib/jdimodel.jar;lib/org.eclipse.osgi_3.8.1.v20120830-144521.jar" | ||
| 38 | + --> | ||
| 39 | + <javac source="1.6" | ||
| 40 | + target="1.6" | ||
| 41 | + destdir="bin" | ||
| 42 | + encoding="UTF-8" | ||
| 43 | + includeAntRuntime="false" | ||
| 44 | + classpath="${processing.dir}/core/library/core.jar; | ||
| 45 | + ${processing.dir}/app/pde.jar; | ||
| 46 | + ${processing.dir}/app/lib/ant.jar; | ||
| 47 | + ${processing.dir}/app/lib/ant-launcher.jar; | ||
| 48 | + ${processing.dir}/app/lib/antlr.jar" | ||
| 49 | + debug="on"> | ||
| 50 | + <src path="src" /> | ||
| 51 | + </javac> | ||
| 52 | + </target> | ||
| 53 | + | ||
| 54 | + | ||
| 55 | + <target name="build" depends="compile" description="Build Android mode"> | ||
| 56 | + <jar basedir="bin" destfile="${mode.jar.path}" /> | ||
| 57 | + </target> | ||
| 58 | + | ||
| 59 | + | ||
| 60 | + <!-- now that this is standalone, probably not really needed --> | ||
| 61 | + <!-- | ||
| 62 | + <target name="android-dist-check"> | ||
| 63 | + --> | ||
| 64 | + <!-- ensure that the android-core.zip file has been built --> | ||
| 65 | + <!-- | ||
| 66 | + <available file="${core.jar.path}" | ||
| 67 | + property="android-core-present" /> | ||
| 68 | + --> | ||
| 69 | + <!--<echo message="${target.path}/modes/android/android-core.zip" />--> | ||
| 70 | + <!-- | ||
| 71 | + <fail unless="android-core-present" | ||
| 72 | + message="android-core.zip was not built, but is required for dist. Install the Android tools, set ANDROID_SDK, and try again." /> | ||
| 73 | + </target> | ||
| 74 | + --> | ||
| 75 | + | ||
| 76 | + | ||
| 77 | + <target name="dist" | ||
| 78 | + depends="build" | ||
| 79 | + description="Create AndroidMode.zip and AndroidMode.txt"> | ||
| 80 | + <mkdir dir="release" /> | ||
| 81 | + | ||
| 82 | + <zip destfile="${mode.dist.path}"> | ||
| 83 | + <zipfileset dir="." prefix="AndroidMode"> | ||
| 84 | + <include name="android-core.zip" /> | ||
| 85 | + <include name="mode.properties" /> | ||
| 86 | + <include name="examples/**" /> | ||
| 87 | + <include name="icons/**" /> | ||
| 88 | + <include name="theme/**" /> | ||
| 89 | + <!-- no extra keywords file | ||
| 90 | + <include name="keywords.txt" /> | ||
| 91 | + --> | ||
| 92 | + <exclude name="**/._*" /> | ||
| 93 | + </zipfileset> | ||
| 94 | + </zip> | ||
| 95 | + | ||
| 96 | + <copy file="mode.properties" | ||
| 97 | + tofile="release/AndroidMode.txt" /> | ||
| 98 | + </target> | ||
| 99 | + | ||
| 100 | + | ||
| 101 | + <target name="upload" depends="dist" description="Upload to processing.org"> | ||
| 102 | + <!-- | ||
| 103 | + <scp todir="${user}@processing.org:/var/www/web/download/"> | ||
| 104 | + <fileset dir="release"> | ||
| 105 | + <include name="AndroidMode.txt" /> | ||
| 106 | + <include name="AndroidMode.zip" /> | ||
| 107 | + </fileset> | ||
| 108 | + </scp> | ||
| 109 | + --> | ||
| 110 | + <exec executable="scp"> | ||
| 111 | + <arg value="release/AndroidMode.txt" /> | ||
| 112 | + <arg value="${user.name}@processing.org:/var/www/android/" /> | ||
| 113 | + </exec> | ||
| 114 | + <exec executable="scp"> | ||
| 115 | + <arg value="release/AndroidMode.zip" /> | ||
| 116 | + <arg value="${user.name}@processing.org:/var/www/android/" /> | ||
| 117 | + </exec> | ||
| 118 | + </target> | ||
| 119 | + | ||
| 120 | + | ||
| 121 | + </project> | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -43,6 +43,8 @@ | |||
| 43 | 43 | * | |
| 44 | 44 | * @webref data:composite | |
| 45 | 45 | * @see PApplet#loadXML(String) | |
| 46 | + * @see PApplet#parseXML(String) | ||
| 47 | + * @see PApplet#saveXML(XML, String) | ||
| 46 | 48 | */ | |
| 47 | 49 | public class XML implements Serializable { | |
| 48 | 50 | ||
@@ -75,16 +77,26 @@ protected XML() { } | |||
| 75 | 77 | // this(parent.createReader(filename)); | |
| 76 | 78 | // } | |
| 77 | 79 | ||
| 80 | + | ||
| 81 | + /** | ||
| 82 | + * @param file description TBD | ||
| 83 | + */ | ||
| 78 | 84 | public XML(File file) throws IOException, ParserConfigurationException, SAXException { | |
| 79 | 85 | this(file, null); | |
| 80 | 86 | } | |
| 81 | 87 | ||
| 82 | 88 | ||
| 89 | + /** | ||
| 90 | + * @param options description TBD | ||
| 91 | + */ | ||
| 83 | 92 | public XML(File file, String options) throws IOException, ParserConfigurationException, SAXException { | |
| 84 | 93 | this(PApplet.createReader(file), options); | |
| 85 | 94 | } | |
| 86 | 95 | ||
| 87 | 96 | ||
| 97 | + /** | ||
| 98 | + * @param input description TBD | ||
| 99 | + */ | ||
| 88 | 100 | public XML(InputStream input) throws IOException, ParserConfigurationException, SAXException { | |
| 89 | 101 | this(input, null); | |
| 90 | 102 | } | |
@@ -138,6 +150,9 @@ protected XML(Reader reader, String options) throws IOException, ParserConfigura | |||
| 138 | 150 | } | |
| 139 | 151 | ||
| 140 | 152 | ||
| 153 | + /** | ||
| 154 | + * @param name description TBD | ||
| 155 | + */ | ||
| 141 | 156 | // TODO is there a more efficient way of doing this? wow. | |
| 142 | 157 | public XML(String name) throws ParserConfigurationException { | |
| 143 | 158 | DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); | |
@@ -749,6 +764,58 @@ public String getContent() { | |||
| 749 | 764 | } | |
| 750 | 765 | ||
| 751 | 766 | ||
| 767 | + public int getIntContent() { | ||
| 768 | + return getIntContent(0); | ||
| 769 | + } | ||
| 770 | + | ||
| 771 | + | ||
| 772 | + public int getIntContent(int defaultValue) { | ||
| 773 | + return PApplet.parseInt(node.getTextContent(), defaultValue); | ||
| 774 | + } | ||
| 775 | + | ||
| 776 | + | ||
| 777 | + public float getFloatContent() { | ||
| 778 | + return getFloatContent(0); | ||
| 779 | + } | ||
| 780 | + | ||
| 781 | + | ||
| 782 | + public float getFloatContent(float defaultValue) { | ||
| 783 | + return PApplet.parseFloat(node.getTextContent(), defaultValue); | ||
| 784 | + } | ||
| 785 | + | ||
| 786 | + | ||
| 787 | + public long getLongContent() { | ||
| 788 | + return getLongContent(0); | ||
| 789 | + } | ||
| 790 | + | ||
| 791 | + | ||
| 792 | + public long getLongContent(long defaultValue) { | ||
| 793 | + String c = node.getTextContent(); | ||
| 794 | + if (c != null) { | ||
| 795 | + try { | ||
| 796 | + return Long.parseLong(c); | ||
| 797 | + } catch (NumberFormatException nfe) { } | ||
| 798 | + } | ||
| 799 | + return defaultValue; | ||
| 800 | + } | ||
| 801 | + | ||
| 802 | + | ||
| 803 | + public double getDoubleContent() { | ||
| 804 | + return getDoubleContent(0); | ||
| 805 | + } | ||
| 806 | + | ||
| 807 | + | ||
| 808 | + public double getDoubleContent(double defaultValue) { | ||
| 809 | + String c = node.getTextContent(); | ||
| 810 | + if (c != null) { | ||
| 811 | + try { | ||
| 812 | + return Double.parseDouble(c); | ||
| 813 | + } catch (NumberFormatException nfe) { } | ||
| 814 | + } | ||
| 815 | + return defaultValue; | ||
| 816 | + } | ||
| 817 | + | ||
| 818 | + | ||
| 752 | 819 | /** | |
| 753 | 820 | * @webref xml:method | |
| 754 | 821 | * @brief Sets the content of an element | |
@@ -758,6 +825,26 @@ public void setContent(String text) { | |||
| 758 | 825 | } | |
| 759 | 826 | ||
| 760 | 827 | ||
| 828 | + public void setIntContent(int value) { | ||
| 829 | + setContent(String.valueOf(value)); | ||
| 830 | + } | ||
| 831 | + | ||
| 832 | + | ||
| 833 | + public void setFloatContent(float value) { | ||
| 834 | + setContent(String.valueOf(value)); | ||
| 835 | + } | ||
| 836 | + | ||
| 837 | + | ||
| 838 | + public void setLongContent(long value) { | ||
| 839 | + setContent(String.valueOf(value)); | ||
| 840 | + } | ||
| 841 | + | ||
| 842 | + | ||
| 843 | + public void setDoubleContent(double value) { | ||
| 844 | + setContent(String.valueOf(value)); | ||
| 845 | + } | ||
| 846 | + | ||
| 847 | + | ||
| 761 | 848 | /** | |
| 762 | 849 | * Format this XML data as a String. | |
| 763 | 850 | * | |
| Back | FazBrowse Home | New Git URL |
0 commit comments