Thread: [Java-link-svn] SF.net SVN: java-link: [1]
Status: Pre-Alpha
Brought to you by:
welterde0
From: <wel...@us...> - 2006-03-09 19:33:22
|
Revision: 1 Author: welterde0 Date: 2006-03-09 11:30:15 -0800 (Thu, 09 Mar 2006) ViewCVS: http://svn.sourceforge.net/java-link/?rev=1&view=rev Log Message: ----------- inital import Added Paths: ----------- branches/ tags/ trunk/ trunk/CHANGELOG trunk/Client/ trunk/Client/build.xml trunk/Client/manifest.mf trunk/Client/nbproject/ trunk/Client/nbproject/build-impl.xml trunk/Client/nbproject/genfiles.properties trunk/Client/nbproject/private/ trunk/Client/nbproject/private/private.properties trunk/Client/nbproject/private/profiler/ trunk/Client/nbproject/private/profiler/presets.xml trunk/Client/nbproject/profiler-build-impl.xml trunk/Client/nbproject/project.properties trunk/Client/nbproject/project.xml trunk/Client/src/ trunk/Client/src/org/ trunk/Client/src/org/jlink/ trunk/Client/src/org/jlink/ClientCore.java trunk/Client/src/org/jlink/ClientFrontend.java trunk/Client/src/org/jlink/ClientMain.java trunk/Client/src/org/jlink/ClientNetwork.java trunk/Client/src/org/jlink/ClientSound.java trunk/Client/src/org/jlink/Options.java trunk/Client/src/org/jlink/ServerController.java trunk/Client/src/org/jlink/client/ trunk/Client/src/org/jlink/client/core/ trunk/Client/src/org/jlink/client/core/Connection.java trunk/Client/src/org/jlink/client/frontend/ trunk/Client/src/org/jlink/client/frontend/MainFrame.java trunk/Client/src/org/jlink/client/frontend/menu/ trunk/Client/src/org/jlink/client/frontend/menu/MainMenu.form trunk/Client/src/org/jlink/client/frontend/menu/MainMenu.java trunk/Client/src/org/jlink/client/frontend/theme/ trunk/Client/src/org/jlink/client/frontend/theme/Theme.java trunk/Client/src/org/jlink/client/frontend/theme/ThemeManager.java trunk/Client/src/org/jlink/client/gui/ trunk/Client/src/org/jlink/client/gui/Colors.java trunk/Client/src/org/jlink/client/gui/MenuBean.java trunk/Client/src/org/jlink/client/model/ trunk/Client/src/org/jlink/client/model/Proxy.java trunk/Client/src/org/jlink/client/net/ trunk/Client/src/org/jlink/client/sound/ trunk/Client/test/ trunk/LICENSE trunk/MODDING trunk/MODDING.DE trunk/PROJECTS trunk/README trunk/README.de trunk/ROADMAP trunk/Server/ trunk/Server/build.xml trunk/Server/manifest.mf trunk/Server/nbproject/ trunk/Server/nbproject/build-impl.xml trunk/Server/nbproject/genfiles.properties trunk/Server/nbproject/management-build-impl.xml trunk/Server/nbproject/private/ trunk/Server/nbproject/private/private.properties trunk/Server/nbproject/private/profiler/ trunk/Server/nbproject/private/profiler/custom-0.xml trunk/Server/nbproject/private/profiler/custom-1.xml trunk/Server/nbproject/private/profiler/custom-2.xml trunk/Server/nbproject/private/profiler/presets.xml trunk/Server/nbproject/profiler-build-impl.xml trunk/Server/nbproject/project.properties trunk/Server/nbproject/project.xml trunk/Server/src/ trunk/Server/src/org/ trunk/Server/src/org/jlink/ trunk/Server/src/org/jlink/CoreController.java trunk/Server/src/org/jlink/DatabaseController.java trunk/Server/src/org/jlink/LoginController.java trunk/Server/src/org/jlink/Options.java trunk/Server/src/org/jlink/ServerCore.java trunk/Server/src/org/jlink/ServerDatabase.java trunk/Server/src/org/jlink/ServerMain.java trunk/Server/src/org/jlink/ServerNetwork.java trunk/Server/src/org/jlink/server/ trunk/Server/src/org/jlink/server/db/ trunk/Server/src/org/jlink/server/db/Database.java trunk/Server/src/org/jlink/server/db/DatabaseCreationReader.java trunk/Server/src/org/jlink/server/db/DatabaseNullWriter.java trunk/Server/src/org/jlink/server/db/DatabaseReader.java trunk/Server/src/org/jlink/server/db/DatabaseWriter.java trunk/Server/src/org/jlink/server/jmx/ trunk/Server/src/org/jlink/server/jmx/JMXAgent.java trunk/Server/src/org/jlink/server/jmx/run.access trunk/Server/src/org/jlink/server/jmx/run.password trunk/Server/src/org/jlink/server/jmx/run.properties trunk/Server/src/org/jlink/server/net/ trunk/Server/src/org/jlink/server/net/NetworkBackend.java trunk/Server/test/ trunk/Share/ trunk/Share/build.xml trunk/Share/nbproject/ trunk/Share/nbproject/build-impl.xml trunk/Share/nbproject/genfiles.properties trunk/Share/nbproject/private/ trunk/Share/nbproject/private/private.properties trunk/Share/nbproject/project.properties trunk/Share/nbproject/project.xml trunk/Share/src/ trunk/Share/src/org/ trunk/Share/src/org/jlink/ trunk/Share/src/org/jlink/Core.java trunk/Share/src/org/jlink/Module.java trunk/Share/src/org/jlink/locale/ trunk/Share/src/org/jlink/model/ trunk/Share/src/org/jlink/model/AbstractModelComponent.java trunk/Share/src/org/jlink/model/Avatar.java trunk/Share/src/org/jlink/model/Character.java trunk/Share/src/org/jlink/model/Company.java trunk/Share/src/org/jlink/model/Hardware.java trunk/Share/src/org/jlink/model/ID.java trunk/Share/src/org/jlink/model/IP.java trunk/Share/src/org/jlink/model/Machine.java trunk/Share/src/org/jlink/model/ModelComponent.java trunk/Share/src/org/jlink/model/ModelProxy.java trunk/Share/src/org/jlink/model/NonPlayerCharacter.java trunk/Share/src/org/jlink/model/PlayerCharacter.java trunk/Share/src/org/jlink/model/Route.java trunk/Share/src/org/jlink/model/hw/ trunk/Share/src/org/jlink/model/hw/HardDisk.java trunk/Share/src/org/jlink/model/hw/HardwareComponent.java trunk/Share/src/org/jlink/model/hw/Motherboard.java trunk/Share/src/org/jlink/model/hw/Processor.java trunk/Share/src/org/jlink/model/machine/ trunk/Share/src/org/jlink/model/machine/Gateway.java trunk/Share/src/org/jlink/model/machine/MachineOwner.java trunk/Share/src/org/jlink/model/machine/Partition.java trunk/Share/src/org/jlink/nav/ trunk/Share/src/org/jlink/nav/NavEntry.java trunk/Share/src/org/jlink/nav/NavTree.java trunk/Share/src/org/jlink/nav/auth/ trunk/Share/src/org/jlink/nav/auth/PasswordAuthEntry.java trunk/Share/src/org/jlink/net/ trunk/Share/src/org/jlink/net/ConnectionHandler.java trunk/Share/src/org/jlink/net/ConnectionListener.java trunk/Share/src/org/jlink/net/Message.java trunk/Share/src/org/jlink/net/msgs/ trunk/Share/src/org/jlink/net/msgs/ConnectionAccepted.java trunk/Share/src/org/jlink/net/msgs/ConnectionDenied.java trunk/Share/src/org/jlink/net/msgs/ConnectionEnding.java trunk/Share/src/org/jlink/net/msgs/ConnectionStarting.java trunk/Share/src/org/jlink/net/msgs/Login.java trunk/Share/src/org/jlink/net/msgs/LoginAcceptedMessage.java trunk/Share/src/org/jlink/net/msgs/LoginDeniedMessage.java trunk/Share/src/org/jlink/net/msgs/LoginMessage.java trunk/Share/src/org/jlink/resources/ trunk/Share/src/org/jlink/resources/FontLoader.java trunk/Share/src/org/jlink/resources/fonts/ trunk/Share/src/org/jlink/resources/fonts/battle3.ttf trunk/Share/test/ trunk/Share/test/org/ trunk/Share/test/org/jlink/ trunk/Share/test/org/jlink/resources/ trunk/Share/test/org/jlink/resources/FontLoaderTest.java trunk/TODO trunk/lib/ trunk/lib/commons-pool.jar trunk/lib/log4j/ trunk/lib/log4j/log4j-db.jar trunk/lib/log4j/log4j-jms.jar trunk/lib/log4j/log4j-optional.jar trunk/lib/log4j/log4j-oro.jar trunk/lib/log4j/log4j-smtp.jar trunk/lib/log4j/log4j-xml.jar trunk/lib/log4j/log4j.jar trunk/lib/log4j/oro.jar trunk/lib/other/ trunk/lib/other/swing-layout.jar trunk/templates/ trunk/templates/Client/ trunk/templates/Server/ trunk/templates/Share/ trunk/templates/Share/net/ trunk/templates/Share/net/msgs/ trunk/templates/Share/net/msgs/Message.java trunk/themes/ trunk/themes/default/ trunk/themes/default/menues/ trunk/themes/default/menues/main/ trunk/themes/default/menues/main/account-register.png trunk/themes/default/menues/main/system-change_server.png trunk/themes/default/menues/main/system-exit.png trunk/themes/default/theme.xml Added: trunk/CHANGELOG =================================================================== Added: trunk/Client/build.xml =================================================================== --- trunk/Client/build.xml (rev 0) +++ trunk/Client/build.xml 2006-03-09 19:30:15 UTC (rev 1) @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- You may freely edit this file. See commented blocks below for --> +<!-- some examples of how to customize the build. --> +<!-- (If you delete it and reopen the project it will be recreated.) --> +<project name="Client" default="default" basedir="."> + <description>Builds, tests, and runs the project Client.</description> + <import file="nbproject/build-impl.xml"/> + + <import file="nbproject/profiler-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-with-manifest: JAR building (if you are using a manifest) + -do-jar-without-manifest: JAR building (if you are not using a manifest) + 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="Client-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> Added: trunk/Client/manifest.mf =================================================================== --- trunk/Client/manifest.mf (rev 0) +++ trunk/Client/manifest.mf 2006-03-09 19:30:15 UTC (rev 1) @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +X-COMMENT: Main-Class will be added automatically by build + Added: trunk/Client/nbproject/build-impl.xml =================================================================== --- trunk/Client/nbproject/build-impl.xml (rev 0) +++ trunk/Client/nbproject/build-impl.xml 2006-03-09 19:30:15 UTC (rev 1) @@ -0,0 +1,545 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +*** GENERATED FROM project.xml - DO NOT EDIT *** +*** EDIT ../build.xml INSTEAD *** + +For the purpose of easier reading the script +is divided into following sections: + + - initialization + - compilation + - jar + - execution + - debugging + - javadoc + - junit compilation + - junit execution + - junit debugging + - applet + - cleanup + +--> +<project name="Client-impl" default="default" basedir=".." xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:j2seproject2="http://www.netbeans.org/ns/j2se-project/2" xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1"> + <target name="default" depends="test,jar,javadoc" description="Build and test whole project."/> + <!-- + ====================== + INITIALIZATION SECTION + ====================== + --> + <target name="-pre-init"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target name="-init-private" depends="-pre-init"> + <property file="nbproject/private/private.properties"/> + </target> + <target name="-init-user" depends="-pre-init,-init-private"> + <property file="${user.properties.file}"/> + <!-- The two properties below are usually overridden --> + <!-- by the active platform. Just a fallback. --> + <property name="default.javac.source" value="1.4"/> + <property name="default.javac.target" value="1.4"/> + </target> + <target name="-init-project" depends="-pre-init,-init-private,-init-user"> + <property file="nbproject/project.properties"/> + </target> + <target name="-do-init" depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property"> + <available file="${manifest.file}" property="manifest.available"/> + <condition property="manifest.available+main.class"> + <and> + <isset property="manifest.available"/> + <isset property="main.class"/> + <not> + <equals arg1="${main.class}" arg2="" trim="true"/> + </not> + </and> + </condition> + <condition property="manifest.available+main.class+mkdist.available"> + <and> + <istrue value="${manifest.available+main.class}"/> + <isset property="libs.CopyLibs.classpath"/> + </and> + </condition> + <condition property="have.tests"> + <or> + <available file="${test.src.dir}"/> + </or> + </condition> + <condition property="have.sources"> + <or> + <available file="${src.dir}"/> + </or> + </condition> + <condition property="netbeans.home+have.tests"> + <and> + <isset property="netbeans.home"/> + <isset property="have.tests"/> + </and> + </condition> + <condition property="no.javadoc.preview"> + <isfalse value="${javadoc.preview}"/> + </condition> + <property name="run.jvmargs" value=""/> + <property name="javac.compilerargs" value=""/> + <property name="work.dir" value="${basedir}"/> + <condition property="no.deps"> + <and> + <istrue value="${no.dependencies}"/> + </and> + </condition> + <property name="javac.debug" value="true"/> + <property name="javadoc.preview" value="true"/> + </target> + <target name="-post-init"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target name="-init-check" depends="-pre-init,-init-private,-init-user,-init-project,-do-init"> + <fail unless="src.dir">Must set src.dir</fail> + <fail unless="test.src.dir">Must set test.src.dir</fail> + <fail unless="build.dir">Must set build.dir</fail> + <fail unless="dist.dir">Must set dist.dir</fail> + <fail unless="build.classes.dir">Must set build.classes.dir</fail> + <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail> + <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail> + <fail unless="build.test.results.dir">Must set build.test.results.dir</fail> + <fail unless="build.classes.excludes">Must set build.classes.excludes</fail> + <fail unless="dist.jar">Must set dist.jar</fail> + </target> + <target name="-init-macrodef-property"> + <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1"> + <attribute name="name"/> + <attribute name="value"/> + <sequential> + <property name="@{name}" value="${@{value}}"/> + </sequential> + </macrodef> + </target> + <target name="-init-macrodef-javac"> + <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute name="srcdir" default="${src.dir}"/> + <attribute name="destdir" default="${build.classes.dir}"/> + <attribute name="classpath" default="${javac.classpath}"/> + <attribute name="debug" default="${javac.debug}"/> + <element name="customize" optional="true"/> + <sequential> + <javac srcdir="@{srcdir}" destdir="@{destdir}" debug="@{debug}" deprecation="${javac.deprecation}" source="${javac.source}" target="${javac.target}" includeantruntime="false"> + <classpath> + <path path="@{classpath}"/> + </classpath> + <compilerarg line="${javac.compilerargs}"/> + <customize/> + </javac> + </sequential> + </macrodef> + </target> + <target name="-init-macrodef-junit"> + <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute name="includes" default="**/*Test.java"/> + <sequential> + <junit showoutput="true" fork="true" dir="${basedir}" failureproperty="tests.failed" errorproperty="tests.failed"> + <batchtest todir="${build.test.results.dir}"> + <fileset dir="${test.src.dir}" includes="@{includes}"/> + </batchtest> + <classpath> + <path path="${run.test.classpath}"/> + </classpath> + <syspropertyset> + <propertyref prefix="test-sys-prop."/> + <mapper type="glob" from="test-sys-prop.*" to="*"/> + </syspropertyset> + <formatter type="brief" usefile="false"/> + <formatter type="xml"/> + <jvmarg line="${run.jvmargs}"/> + </junit> + </sequential> + </macrodef> + </target> + <target name="-init-macrodef-nbjpda"> + <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1"> + <attribute name="name" default="${main.class}"/> + <attribute name="classpath" default="${debug.classpath}"/> + <attribute name="stopclassname" default=""/> + <sequential> + <nbjpdastart transport="dt_socket" addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}"> + <classpath> + <path path="@{classpath}"/> + </classpath> + </nbjpdastart> + </sequential> + </macrodef> + <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1"> + <attribute name="dir" default="${build.classes.dir}"/> + <sequential> + <nbjpdareload> + <fileset includes="${fix.includes}*.class" dir="@{dir}"/> + </nbjpdareload> + </sequential> + </macrodef> + </target> + <target name="-init-macrodef-debug"> + <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3"> + <attribute name="classname" default="${main.class}"/> + <attribute name="classpath" default="${debug.classpath}"/> + <element name="customize" optional="true"/> + <sequential> + <java fork="true" classname="@{classname}" dir="${work.dir}"> + <jvmarg value="-Xdebug"/> + <jvmarg value="-Xnoagent"/> + <jvmarg value="-Djava.compiler=none"/> + <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/> + <jvmarg line="${run.jvmargs}"/> + <classpath> + <path path="@{classpath}"/> + </classpath> + <syspropertyset> + <propertyref prefix="run-sys-prop."/> + <mapper type="glob" from="run-sys-prop.*" to="*"/> + </syspropertyset> + <customize/> + </java> + </sequential> + </macrodef> + </target> + <target name="-init-macrodef-java"> + <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1"> + <attribute name="classname" default="${main.class}"/> + <element name="customize" optional="true"/> + <sequential> + <java fork="true" classname="@{classname}" dir="${work.dir}"> + <jvmarg line="${run.jvmargs}"/> + <classpath> + <path path="${run.classpath}"/> + </classpath> + <syspropertyset> + <propertyref prefix="run-sys-prop."/> + <mapper type="glob" from="run-sys-prop.*" to="*"/> + </syspropertyset> + <customize/> + </java> + </sequential> + </macrodef> + </target> + <target name="-init-presetdef-jar"> + <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1"> + <jar jarfile="${dist.jar}" compress="${jar.compress}"> + <j2seproject1:fileset dir="${build.classes.dir}"/> + </jar> + </presetdef> + </target> + <target name="init" depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar"/> + <!-- + =================== + COMPILATION SECTION + =================== + --> + <target name="deps-jar" depends="init" unless="no.deps"> + <ant target="jar" inheritall="false" antfile="${project.Share}/build.xml"/> + </target> + <target name="-pre-pre-compile" depends="init,deps-jar"> + <mkdir dir="${build.classes.dir}"/> + </target> + <target name="-pre-compile"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target name="-do-compile" depends="init,deps-jar,-pre-pre-compile,-pre-compile" if="have.sources"> + <j2seproject3:javac/> + <copy todir="${build.classes.dir}"> + <fileset dir="${src.dir}" excludes="${build.classes.excludes}"/> + </copy> + </target> + <target name="-post-compile"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target name="compile" depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project."/> + <target name="-pre-compile-single"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target name="-do-compile-single" depends="init,deps-jar,-pre-pre-compile"> + <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail> + <j2seproject3:javac> + <customize> + <patternset includes="${javac.includes}"/> + </customize> + </j2seproject3:javac> + </target> + <target name="-post-compile-single"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target name="compile-single" depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single"/> + <!-- + ==================== + JAR BUILDING SECTION + ==================== + --> + <target name="-pre-pre-jar" depends="init"> + <dirname property="dist.jar.dir" file="${dist.jar}"/> + <mkdir dir="${dist.jar.dir}"/> + </target> + <target name="-pre-jar"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target name="-do-jar-without-manifest" depends="init,compile,-pre-pre-jar,-pre-jar" unless="manifest.available"> + <j2seproject1:jar/> + </target> + <target name="-do-jar-with-manifest" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" unless="manifest.available+main.class"> + <j2seproject1:jar manifest="${manifest.file}"/> + </target> + <target name="-do-jar-with-mainclass" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class" unless="manifest.available+main.class+mkdist.available"> + <j2seproject1:jar manifest="${manifest.file}"> + <j2seproject1:manifest> + <j2seproject1:attribute name="Main-Class" value="${main.class}"/> + </j2seproject1:manifest> + </j2seproject1:jar> + <echo>To run this application from the command line without Ant, try:</echo> + <property name="build.classes.dir.resolved" location="${build.classes.dir}"/> + <property name="dist.jar.resolved" location="${dist.jar}"/> + <pathconvert property="run.classpath.with.dist.jar"> + <path path="${run.classpath}"/> + <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/> + </pathconvert> + <echo>java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo> + </target> + <target name="-do-jar-with-libraries" depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+main.class+mkdist.available"> + <property name="build.classes.dir.resolved" location="${build.classes.dir}"/> + <pathconvert property="run.classpath.without.build.classes.dir"> + <path path="${run.classpath}"/> + <map from="${build.classes.dir.resolved}" to=""/> + </pathconvert> + <pathconvert property="jar.classpath" pathsep=" "> + <path path="${run.classpath.without.build.classes.dir}"/> + <chainedmapper> + <flattenmapper/> + <globmapper from="*" to="lib/*"/> + </chainedmapper> + </pathconvert> + <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" name="copylibs" classpath="${libs.CopyLibs.classpath}"/> + <copylibs manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}" jarfile="${dist.jar}" compress="${jar.compress}"> + <fileset dir="${build.classes.dir}"/> + <manifest> + <attribute name="Main-Class" value="${main.class}"/> + <attribute name="Class-Path" value="${jar.classpath}"/> + </manifest> + </copylibs> + <echo>To run this application from the command line without Ant, try:</echo> + <property name="dist.jar.resolved" location="${dist.jar}"/> + <echo>java -jar "${dist.jar.resolved}"</echo> + </target> + <target name="-post-jar"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target name="jar" depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR."/> + <!-- + ================= + EXECUTION SECTION + ================= + --> + <target name="run" depends="init,compile" description="Run a main class."> + <j2seproject1:java> + <customize> + <arg line="${application.args}"/> + </customize> + </j2seproject1:java> + </target> + <target name="run-single" depends="init,compile-single"> + <fail unless="run.class">Must select one file in the IDE or set run.class</fail> + <j2seproject1:java classname="${run.class}"/> + </target> + <!-- + ================= + DEBUGGING SECTION + ================= + --> + <target name="-debug-start-debugger" if="netbeans.home" depends="init"> + <j2seproject1:nbjpdastart name="${debug.class}"/> + </target> + <target name="-debug-start-debuggee" depends="init,compile"> + <j2seproject3:debug> + <customize> + <arg line="${application.args}"/> + </customize> + </j2seproject3:debug> + </target> + <target name="debug" if="netbeans.home" depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE."/> + <target name="-debug-start-debugger-stepinto" if="netbeans.home" depends="init"> + <j2seproject1:nbjpdastart stopclassname="${main.class}"/> + </target> + <target name="debug-stepinto" if="netbeans.home" depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee"/> + <target name="-debug-start-debuggee-single" if="netbeans.home" depends="init,compile-single"> + <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail> + <j2seproject3:debug classname="${debug.class}"/> + </target> + <target name="debug-single" if="netbeans.home" depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single"/> + <target name="-pre-debug-fix" depends="init"> + <fail unless="fix.includes">Must set fix.includes</fail> + <property name="javac.includes" value="${fix.includes}.java"/> + </target> + <target name="-do-debug-fix" if="netbeans.home" depends="init,-pre-debug-fix,compile-single"> + <j2seproject1:nbjpdareload/> + </target> + <target name="debug-fix" if="netbeans.home" depends="init,-pre-debug-fix,-do-debug-fix"/> + <!-- + =============== + JAVADOC SECTION + =============== + --> + <target name="-javadoc-build" depends="init"> + <mkdir dir="${dist.javadoc.dir}"/> + <javadoc destdir="${dist.javadoc.dir}" source="${javac.source}" notree="${javadoc.notree}" use="${javadoc.use}" nonavbar="${javadoc.nonavbar}" noindex="${javadoc.noindex}" splitindex="${javadoc.splitindex}" author="${javadoc.author}" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}" private="${javadoc.private}" additionalparam="${javadoc.additionalparam}" failonerror="true" useexternalfile="true"> + <classpath> + <path path="${javac.classpath}"/> + </classpath> + <sourcepath> + <pathelement location="${src.dir}"/> + </sourcepath> + <packageset dir="${src.dir}" includes="*/**"/> + <fileset dir="${src.dir}" includes="*.java"/> + </javadoc> + </target> + <target name="-javadoc-browse" if="netbeans.home" unless="no.javadoc.preview" depends="init,-javadoc-build"> + <nbbrowse file="${dist.javadoc.dir}/index.html"/> + </target> + <target name="javadoc" depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc."/> + <!-- + ========================= + JUNIT COMPILATION SECTION + ========================= + --> + <target name="-pre-pre-compile-test" if="have.tests" depends="init,compile"> + <mkdir dir="${build.test.classes.dir}"/> + </target> + <target name="-pre-compile-test"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target name="-do-compile-test" if="have.tests" depends="init,compile,-pre-pre-compile-test,-pre-compile-test"> + <j2seproject3:javac srcdir="${test.src.dir}" destdir="${build.test.classes.dir}" debug="true" classpath="${javac.test.classpath}"/> + <copy todir="${build.test.classes.dir}"> + <fileset dir="${test.src.dir}" excludes="**/*.java"/> + </copy> + </target> + <target name="-post-compile-test"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target name="compile-test" depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test"/> + <target name="-pre-compile-test-single"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target name="-do-compile-test-single" if="have.tests" depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single"> + <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail> + <j2seproject3:javac srcdir="${test.src.dir}" destdir="${build.test.classes.dir}" debug="true" classpath="${javac.test.classpath}"> + <customize> + <patternset includes="${javac.includes}"/> + </customize> + </j2seproject3:javac> + <copy todir="${build.test.classes.dir}"> + <fileset dir="${test.src.dir}" excludes="**/*.java"/> + </copy> + </target> + <target name="-post-compile-test-single"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target name="compile-test-single" depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single"/> + <!-- + ======================= + JUNIT EXECUTION SECTION + ======================= + --> + <target name="-pre-test-run" if="have.tests" depends="init"> + <mkdir dir="${build.test.results.dir}"/> + </target> + <target name="-do-test-run" if="have.tests" depends="init,compile-test,-pre-test-run"> + <j2seproject3:junit/> + </target> + <target name="-post-test-run" if="have.tests" depends="init,compile-test,-pre-test-run,-do-test-run"> + <fail if="tests.failed">Some tests failed; see details above.</fail> + </target> + <target name="test-report" if="have.tests" depends="init"/> + <target name="-test-browse" if="netbeans.home+have.tests" depends="init"/> + <target name="test" depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests."/> + <target name="-pre-test-run-single" if="have.tests" depends="init"> + <mkdir dir="${build.test.results.dir}"/> + </target> + <target name="-do-test-run-single" if="have.tests" depends="init,compile-test-single,-pre-test-run-single"> + <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail> + <j2seproject3:junit includes="${test.includes}"/> + </target> + <target name="-post-test-run-single" if="have.tests" depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single"> + <fail if="tests.failed">Some tests failed; see details above.</fail> + </target> + <target name="test-single" depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test."/> + <!-- + ======================= + JUNIT DEBUGGING SECTION + ======================= + --> + <target name="-debug-start-debuggee-test" if="have.tests" depends="init,compile-test"> + <fail unless="test.class">Must select one file in the IDE or set test.class</fail> + <j2seproject3:debug classname="junit.textui.TestRunner" classpath="${debug.test.classpath}"> + <customize> + <arg line="${test.class}"/> + </customize> + </j2seproject3:debug> + </target> + <target name="-debug-start-debugger-test" if="netbeans.home+have.tests" depends="init,compile-test"> + <j2seproject1:nbjpdastart name="${test.class}" classpath="${debug.test.classpath}"/> + </target> + <target name="debug-test" depends="init,compile-test,-debug-start-debugger-test,-debug-start-debuggee-test"/> + <target name="-do-debug-fix-test" if="netbeans.home" depends="init,-pre-debug-fix,compile-test-single"> + <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/> + </target> + <target name="debug-fix-test" if="netbeans.home" depends="init,-pre-debug-fix,-do-debug-fix-test"/> + <!-- + ========================= + APPLET EXECUTION SECTION + ========================= + --> + <target name="run-applet" depends="init,compile-single"> + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail> + <j2seproject1:java classname="sun.applet.AppletViewer"> + <customize> + <arg value="${applet.url}"/> + </customize> + </j2seproject1:java> + </target> + <!-- + ========================= + APPLET DEBUGGING SECTION + ========================= + --> + <target name="-debug-start-debuggee-applet" if="netbeans.home" depends="init,compile-single"> + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail> + <j2seproject3:debug classname="sun.applet.AppletViewer"> + <customize> + <arg value="${applet.url}"/> + </customize> + </j2seproject3:debug> + </target> + <target name="debug-applet" if="netbeans.home" depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet"/> + <!-- + =============== + CLEANUP SECTION + =============== + --> + <target name="deps-clean" depends="init" unless="no.deps"> + <ant target="clean" inheritall="false" antfile="${project.Share}/build.xml"/> + </target> + <target name="-do-clean" depends="init"> + <delete dir="${build.dir}"/> + <delete dir="${dist.dir}"/> + </target> + <target name="-post-clean"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target name="clean" depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products."/> +</project> Added: trunk/Client/nbproject/genfiles.properties =================================================================== --- trunk/Client/nbproject/genfiles.properties (rev 0) +++ trunk/Client/nbproject/genfiles.properties 2006-03-09 19:30:15 UTC (rev 1) @@ -0,0 +1,8 @@ +# 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=c2a3099f +nbproject/build-impl.xml.script.CRC32=a0263979 +nbproject/build-impl.xml.stylesheet.CRC32=99b91518 +nbproject/profiler-build-impl.xml.data.CRC32=c2a3099f +nbproject/profiler-build-impl.xml.script.CRC32=abda56ed +nbproject/profiler-build-impl.xml.stylesheet.CRC32=a5b6598e Added: trunk/Client/nbproject/private/private.properties =================================================================== --- trunk/Client/nbproject/private/private.properties (rev 0) +++ trunk/Client/nbproject/private/private.properties 2006-03-09 19:30:15 UTC (rev 1) @@ -0,0 +1,7 @@ +application.args=../ +file.reference.log4j.jar=../lib/log4j/log4j.jar +file.reference.swing-layout.jar=/home/tassilo/Documents/dev/jlink/svn/trunk/lib/other/swing-layout.jar +javac.debug=true +javadoc.preview=true +project.Share=../Share +user.properties.file=/home/tassilo/.netbeans/5.0/build.properties Added: trunk/Client/nbproject/private/profiler/presets.xml =================================================================== --- trunk/Client/nbproject/private/profiler/presets.xml (rev 0) +++ trunk/Client/nbproject/private/profiler/presets.xml 2006-03-09 19:30:15 UTC (rev 1) @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment></comment> +<entry key="presets.cpufragment.profiler.settings.fragment.selection"></entry> +<entry key="presets.cpupart.profiler.settings.instrumentation.root.methods.size">0</entry> +</properties> Added: trunk/Client/nbproject/profiler-build-impl.xml =================================================================== --- trunk/Client/nbproject/profiler-build-impl.xml (rev 0) +++ trunk/Client/nbproject/profiler-build-impl.xml 2006-03-09 19:30:15 UTC (rev 1) @@ -0,0 +1,131 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +*** GENERATED FROM project.xml - DO NOT EDIT *** +*** EDIT ../build.xml INSTEAD *** + +For the purpose of easier reading the script +is divided into following sections: + + - initialization + - profiling + - applet profiling + +--> +<project name="-profiler-impl" default="profile" basedir=".."> + <target name="default" depends="profile" description="Build and profile the project."/> + <!-- + ====================== + INITIALIZATION SECTION + ====================== + --> + <target name="profile-init" depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check"/> + <target name="-profile-pre-init"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target name="-profile-post-init"> + <!-- Empty placeholder for easier customization. --> + <!-- You can override this target in the ../build.xml file. --> + </target> + <target name="-profile-init-macrodef-profile"> + <macrodef name="resolve"> + <attribute name="name"/> + <attribute name="value"/> + <sequential> + <property name="@{name}" value="${env.@{value}}"/> + </sequential> + </macrodef> + <macrodef name="profile"> + <attribute name="classname" default="${main.class}"/> + <element name="customize" optional="true"/> + <sequential> + <property environment="env"/> + <resolve name="profiler.current.path" value="${profiler.info.pathvar}"/> + <java fork="true" classname="@{classname}" dir="${profiler.info.dir}" jvm="${profiler.info.jvm}"> + <jvmarg value="${profiler.info.jvmargs.agent}"/> + <jvmarg line="${profiler.info.jvmargs}"/> + <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/> + <arg line="${application.args}"/> + <classpath> + <path path="${run.classpath}"/> + </classpath> + <syspropertyset> + <propertyref prefix="run-sys-prop."/> + <mapper type="glob" from="run-sys-prop.*" to="*"/> + </syspropertyset> + <customize/> + </java> + </sequential> + </macrodef> + </target> + <target name="-profile-init-check" depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile"> + <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail> + <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail> + </target> + <!-- + ================= + PROFILING SECTION + ================= + --> + <target name="profile" if="netbeans.home" depends="profile-init,compile" description="Profile a project in the IDE."> + <nbprofiledirect> + <classpath> + <path path="${run.classpath}"/> + </classpath> + </nbprofiledirect> + <profile/> + </target> + <target name="profile-single" if="netbeans.home" depends="profile-init,compile-single" description="Profile a selected class in the IDE."> + <fail unless="profile.class">Must select one file in the IDE or set profile.class</fail> + <nbprofiledirect> + <classpath> + <path path="${run.classpath}"/> + </classpath> + </nbprofiledirect> + <profile classname="${profile.class}"/> + </target> + <!-- + ========================= + APPLET PROFILING SECTION + ========================= + --> + <target name="profile-applet" if="netbeans.home" depends="profile-init,compile-single"> + <nbprofiledirect> + <classpath> + <path path="${run.classpath}"/> + </classpath> + </nbprofiledirect> + <profile classname="sun.applet.AppletViewer"> + <customize> + <arg value="${applet.url}"/> + </customize> + </profile> + </target> + <!-- + ========================= + TESTS PROFILING SECTION + ========================= + --> + <target name="profile-test-single" if="netbeans.home" depends="profile-init,compile-test-single"> + <nbprofiledirect> + <classpath> + <path path="${run.test.classpath}"/> + </classpath> + </nbprofiledirect> + <junit showoutput="true" fork="true" dir="${profiler.info.dir}" jvm="${profiler.info.jvm}" failureproperty="tests.failed" errorproperty="tests.failed"> + <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/> + <jvmarg value="${profiler.info.jvmargs.agent}"/> + <jvmarg line="${profiler.info.jvmargs}"/> + <test name="${profile.class}"/> + <classpath> + <path path="${run.test.classpath}"/> + </classpath> + <syspropertyset> + <propertyref prefix="test-sys-prop."/> + <mapper type="glob" from="test-sys-prop.*" to="*"/> + </syspropertyset> + <formatter type="brief" usefile="false"/> + <formatter type="xml"/> + </junit> + </target> +</project> Added: trunk/Client/nbproject/project.properties =================================================================== --- trunk/Client/nbproject/project.properties (rev 0) +++ trunk/Client/nbproject/project.properties 2006-03-09 19:30:15 UTC (rev 1) @@ -0,0 +1,62 @@ +application.args= +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 +# 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 +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/Client.jar +dist.javadoc.dir=${dist.dir}/javadoc +file.reference.swing-layout.jar=../lib/other/swing-layout.jar +jar.compress=true +javac.classpath=\ + ${reference.Share.jar}:\ + ${file.reference.log4j.jar}:\ + ${file.reference.swing-layout.jar}:\ + ${libs.swing-layout.classpath} +# Space-separated list of extra javac options +javac.compilerargs=-Xlint:unchecked +javac.deprecation=true +javac.source=1.5 +javac.target=1.5 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir}:\ + ${libs.junit.classpath} +javadoc.additionalparam= +javadoc.author=true +javadoc.encoding= +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +main.class=org.jlink.ClientMain +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +platform.active=default_platform +reference.Share.jar=${project.Share}/dist/Share.jar +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 +# or test-sys-prop.name=value to set system properties for unit tests): +run.jvmargs= +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +src.dir=src +test.src.dir=test Added: trunk/Client/nbproject/project.xml =================================================================== --- trunk/Client/nbproject/project.xml (rev 0) +++ trunk/Client/nbproject/project.xml 2006-03-09 19:30:15 UTC (rev 1) @@ -0,0 +1,26 @@ +<?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>Client</name> + <minimum-ant-version>1.6.5</minimum-ant-version> + <source-roots> + <root id="src.dir"/> + </source-roots> + <test-roots> + <root id="test.src.dir"/> + </test-roots> + </data> + <references xmlns="http://www.netbeans.org/ns/ant-project-references/1"> + <reference> + <foreign-project>Share</foreign-project> + <artifact-type>jar</artifact-type> + <script>build.xml</script> + <target>jar</target> + <clean-target>clean</clean-target> + <id>jar</id> + </reference> + </references> + </configuration> +</project> Added: trunk/Client/src/org/jlink/ClientCore.java =================================================================== --- trunk/Client/src/org/jlink/ClientCore.java (rev 0) +++ trunk/Client/src/org/jlink/ClientCore.java 2006-03-09 19:30:15 UTC (rev 1) @@ -0,0 +1,231 @@ +/* + * ClientCore.java + * + * Created on 27. Februar 2006, 10:38 + * + * JLink: An Introversion Uplink Clone with multiplayer support. + * Copyright (C) 2006 Tassilo Schweyer + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.jlink; + +//import +//import::own +//import::sys +//import::sys::util +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Callable; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.ArrayBlockingQueue; +//import::sys::log4j +import org.apache.log4j.Logger; + +/** + * + * @author tassilo + */ +public class ClientCore extends Core { + static { + Core.setImpl(new ClientCore()); + } + ClientCore() { + } + + protected Core createCore() { + ClientCore ret = null; + ret = new ClientCore(); + ret.log = Logger.getLogger("jlink.coreD"); + ret.log.debug("Core created"); + //Core::init() + ret.pool_run_now = new ThreadPoolExecutor(6, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new ArrayBlockingQueue(20, true)); + + + //mods::init() + ret.log.debug("creating other modules"); + ret.mod_sound = ClientSound.create(ret); + ret.mod_frontend = ClientFrontend.create(ret); + ret.mod_network = ClientNetwork.create(ret); + + + return ret; + } + protected void runCorePre() { + log.debug("ClientCore::runCorePre() called"); + //start other modules + log.debug("calling other modules"); + this.pool_run_now.submit(new Callable() { + public Object call() throws Exception { + log.info("Sound::run()"); + mod_sound.run(); + return null; + } + }); + this.pool_run_now.submit(new Callable() { + public Object call() throws Exception { + log.info("Network::run()"); + mod_network.run(); + return null; + } + }); + this.pool_run_now.submit(new Callable() { + public Object call() throws Exception { + log.info("Frontend::run()"); + mod_frontend.run(); + return null; + } + }); + } + protected void runCore() throws Exception { + log.trace("ClientCore::run() called"); + Thread.sleep(100); + if(do_connect) { + this.doConnect(); + } + } + protected void runCoreSuf() { + log.debug("ClientCore::runCoreSuf() called"); + + log.debug("destroying other modules"); + this.mod_sound.destroy(); + this.mod_network.destroy(); + + //Core::destroy() + log.debug("self destroy"); + + log.debug("destroy done"); + } + + //Operations + protected void doConnect() throws Exception { + log.debug("Core::do(connect)"); + synchronized(this.serverLock) { + this.do_connect = false; + log.debug("delegating to mod_network"); + this.mod_network.connect(this.serverHost, this.serverPort); + } + } + + + + //Server::(Host|Port) + public String getServerHost() { + return this.serverHost; + } + public void setServerHost(String nhost) { + if(nhost == null) + throw new NullPointerException(); + synchronized(this.serverLock) { + this.serverHost = nhost; + } + } + public int getServerPort() { + return this.serverPort; + } + public void setServerPort(int nport) { + if(nport <= 0) + throw new IllegalStateException("cannot be <= 0"); + synchronized(this.serverLock) { + this.serverPort = nport; + } + } + public void connect() { + log.debug("Core::connect() called"); + if(this.serverConnected) + return;//TODO: throw IllegalStateExc + synchronized(this.serverLock) { + this.do_connect = true; + } + } + public void disconnect() { + if(!this.serverConnected) + return;//TODO: throw IllegalStateExc + synchronized(this.serverLock) { + this.do_disconnect = true; + } + } + + + + //User-Services + public boolean LoggedIn() { + return this.loginActive; + } + public String getLoginName() { + return this.loginName; + } + public String getLoginPassword() { + return this.loginPass; + } + public void setLoginName(String user) { + if(user == null) + throw new NullPointerException(); + this.loginName = user; + } + public void setLoginPassword(String pass) { + if(pass == null) + throw new NullPointerException(); + this.loginPass = pass; + } + public void login() { + this.do_login = true; + } + + + ///////////////////////// + ///////////////////////// + ////private Variables//// + ///////////////////////// + ///////////////////////// + //Composite// + ///////////// + private ClientFrontend mod_frontend = null; + private ClientNetwork mod_network = null; + private ClientSound mod_sound = null; + public ClientFrontend getFrontend() { + return this.mod_frontend; + } + public ClientNetwork getNetwork() { + return this.mod_network; + } + public ClientSound getSound() { + return this.mod_sound; + } + ////////////////// + //external Usage// + ////////////////// + private String serverHost = "localhost"; + private int serverPort = 3470; //port 3470 is the Standard port + private String serverLock = ""; + private boolean serverConnected = false; + + private String loginName = null; + private String loginPass = null; + private boolean loginActive = false; + //////////////////////////////////// + //internal Usage, and for Services// + //////////////////////////////////// + private ExecutorService pool_run_now = null; + private Logger log = null; + //////////////////////////// + //internal operate() flags// + //////////////////////////// + private boolean do_login = false; + private boolean do_connect = false; + private boolean do_disconnect = false; +} Added: trunk/Client/src/org/jlink/ClientFrontend.java =================================================================== --- trunk/Client/src/org/jlink/ClientFrontend.java (rev 0) +++ trunk/Client/src/org/jlink/ClientFrontend.java 2006-03-09 19:30:15 UTC (rev 1) @@ -0,0 +1,258 @@ +/* + * ClientFrontend.java + * + * Created on 27. Februar 2006, 11:48 + * + * JLink: An Introversion Uplink Clone with multiplayer support. + * Copyright (C) 2006 Tassilo Schweyer + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.jlink; + +//import +//import::own +import org.jlink.Options; +//import::own::frontend +import org.jlink.client.frontend.MainFrame; +import org.jlink.client.frontend.theme.ThemeManager; +import org.jlink.client.frontend.theme.Theme; +//import::own::gui +import org.jlink.client.gui.MenuBean; +//import::sys +//import::sys::io +import java.io.File; +//import::sys::awt +import java.awt.Toolkit; +import java.awt.Dimension; +import java.awt.Image; +import java.awt.MediaTracker; +import java.awt.event.ActionListener; +... [truncated message content] |
From: <wel...@us...> - 2006-03-11 14:59:51
|
Revision: 3 Author: welterde0 Date: 2006-03-11 06:58:56 -0800 (Sat, 11 Mar 2006) ViewCVS: http://svn.sourceforge.net/java-link/?rev=3&view=rev Log Message: ----------- updated MainMenu to use the new MainMenu added simple PasswordLoginWidget added folder web to hold the homepage of JLink Modified Paths: -------------- trunk/Client/nbproject/private/private.properties trunk/Client/nbproject/project.properties trunk/Client/src/org/jlink/ClientCore.java trunk/Client/src/org/jlink/ClientFrontend.java trunk/Client/src/org/jlink/client/frontend/menu/MainMenu.form trunk/Client/src/org/jlink/client/frontend/menu/MainMenu.java trunk/Client/src/org/jlink/client/frontend/theme/Theme.java trunk/Share/src/org/jlink/resources/FontLoader.java trunk/themes/default/menues/main/system-change_server.png trunk/themes/default/theme.xml Added Paths: ----------- trunk/Client/src/org/jlink/client/frontend/PasswordLoginWidget.form trunk/Client/src/org/jlink/client/frontend/PasswordLoginWidget.java trunk/Client/src/org/jlink/client/frontend/PasswordLoginWidgetListener.java trunk/Client/src/org/jlink/client/frontend/controll/ trunk/Client/src/org/jlink/client/frontend/controll/FrontendController.java trunk/Client/src/org/jlink/client/frontend/controll/MainMenuController.java trunk/Client/src/org/jlink/client/frontend/gal/ trunk/Client/src/org/jlink/client/frontend/gal/Frontend.java trunk/Client/src/org/jlink/client/frontend/gal/FrontendListener.java trunk/Client/src/org/jlink/client/frontend/gal/MainMenu.java trunk/Client/src/org/jlink/client/frontend/gal/impl/ trunk/Client/src/org/jlink/client/frontend/gal/impl/FrontendImpl.java trunk/Client/src/org/jlink/client/frontend/menu/MainMenuListener.java trunk/lib/jdom/ trunk/lib/jdom/jaxen-core.jar trunk/lib/jdom/jaxen-jdom.jar trunk/lib/jdom/jdom.jar trunk/lib/jdom/saxpath.jar web/ web/doc_trunk/ Modified: trunk/Client/nbproject/private/private.properties =================================================================== --- trunk/Client/nbproject/private/private.properties 2006-03-10 12:53:52 UTC (rev 2) +++ trunk/Client/nbproject/private/private.properties 2006-03-11 14:58:56 UTC (rev 3) @@ -1,6 +1,10 @@ application.args=../ +file.reference.jaxen-core.jar=../lib/jdom/jaxen-core.jar +file.reference.jaxen-jdom.jar=../lib/jdom/jaxen-jdom.jar +file.reference.jdom.jar=../lib/jdom/jdom.jar file.reference.log4j.jar=../lib/log4j/log4j.jar -file.reference.swing-layout.jar=/home/tassilo/Documents/dev/jlink/svn/trunk/lib/other/swing-layout.jar +file.reference.saxpath.jar=../lib/jdom/saxpath.jar +file.reference.swing-layout.jar=../lib/other/swing-layout.jar javac.debug=true javadoc.preview=true project.Share=../Share Modified: trunk/Client/nbproject/project.properties =================================================================== --- trunk/Client/nbproject/project.properties 2006-03-10 12:53:52 UTC (rev 2) +++ trunk/Client/nbproject/project.properties 2006-03-11 14:58:56 UTC (rev 3) @@ -16,12 +16,20 @@ dist.dir=dist dist.jar=${dist.dir}/Client.jar dist.javadoc.dir=${dist.dir}/javadoc +file.reference.jaxen-core.jar=../lib/jdom/jaxen-core.jar +file.reference.jaxen-jdom.jar=../lib/jdom/jaxen-jdom.jar +file.reference.jdom.jar=../lib/jdom/jdom.jar +file.reference.saxpath.jar=../lib/jdom/saxpath.jar file.reference.swing-layout.jar=../lib/other/swing-layout.jar jar.compress=true javac.classpath=\ ${reference.Share.jar}:\ ${file.reference.log4j.jar}:\ ${file.reference.swing-layout.jar}:\ + ${file.reference.jdom.jar}:\ + ${file.reference.jaxen-core.jar}:\ + ${file.reference.jaxen-jdom.jar}:\ + ${file.reference.saxpath.jar}:\ ${libs.swing-layout.classpath} # Space-separated list of extra javac options javac.compilerargs=-Xlint:unchecked Modified: trunk/Client/src/org/jlink/ClientCore.java =================================================================== --- trunk/Client/src/org/jlink/ClientCore.java 2006-03-10 12:53:52 UTC (rev 2) +++ trunk/Client/src/org/jlink/ClientCore.java 2006-03-11 14:58:56 UTC (rev 3) @@ -53,7 +53,7 @@ ret.log = Logger.getLogger("jlink.coreD"); ret.log.debug("Core created"); //Core::init() - ret.pool_run_now = new ThreadPoolExecutor(6, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new ArrayBlockingQueue(20, true)); + ret.pool_run_now = new ThreadPoolExecutor(6, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(20, true)); //mods::init() Modified: trunk/Client/src/org/jlink/ClientFrontend.java =================================================================== --- trunk/Client/src/org/jlink/ClientFrontend.java 2006-03-10 12:53:52 UTC (rev 2) +++ trunk/Client/src/org/jlink/ClientFrontend.java 2006-03-11 14:58:56 UTC (rev 3) @@ -28,6 +28,8 @@ import org.jlink.Options; //import::own::frontend import org.jlink.client.frontend.MainFrame; +import org.jlink.client.frontend.menu.MainMenu; +import org.jlink.client.frontend.menu.MainMenuListener; import org.jlink.client.frontend.theme.ThemeManager; import org.jlink.client.frontend.theme.Theme; //import::own::gui @@ -58,10 +60,13 @@ public class ClientFrontend implements Module, ServerController { private ClientFrontend() { } + + + //The Module itself public static ClientFrontend create(ClientCore c) { ClientFrontend ret = null; ret = new ClientFrontend(); - ret.c = c; + ret.modCore = c; ret.log = Logger.getLogger("jlink.frontend"); ret.log.debug("ClientFrontend::create(Core) called"); @@ -99,56 +104,67 @@ return ret; } public void run() throws IllegalStateException { - if(!this.active) - throw new IllegalStateException("already destroyed"); - this.root.enable(); - this.mainmenu = this.createMainMenu(); - this.root.setFrame(this.mainmenu.getComponent()); - while(this.active) { - try { - this.operate(); + this.modThread = Thread.currentThread(); + try { + if(!this.modActive) + throw new IllegalStateException("already destroyed"); + + + log.debug("setting up"); + this.frntMainMenu = new MainMenu(); + this.frntMainMenu.setListener(new MainMenuListener() { + public void runChangeServer() { + } + + public void runOptions() { + } + + public void runCreateAcc() { + } + + public void runExit() { + modCore.destroy(); + } + + }); + + this.root.setFrame(this.frntMainMenu); + this.root.enable(); + while(this.modActive) { + try { + this.operate(); + } + catch(Exception e) { + log.error("caught Exception", e); + } } - catch(Exception e) { - this.log.error("caught Exception", e); - } + this.root.disable(); + } finally { + this.modThread = null; } - this.root.disable(); } - public void destroy() { - this.active = false; + this.modActive = false; } - public boolean isDestroyed() { - return this.active; + return this.modActive; } + public void join() { + if(this.modThread == null) + throw new IllegalStateException("Module not running"); + while(true) { + try { + this.modThread.join(); + break; + } catch(InterruptedException e) { + } + } + } //Run methods ///////////// private void operate() throws Exception { - synchronized(this.lock0) { - log.debug("lock0::wait()"); - this.lock0.wait(); - log.debug("lock0::wait() done"); - } - if(this.mainCh == -1) - return; - switch(this.mainCh) { - case 1: - //showing Input Dialog - String h = null; - int p = 0; - h = JOptionPane.showInputDialog(this.mainmenu.getComponent(), "Please enter the Server host"); - //TODO: ask for port - p = 3470; - log.debug("setting Core::server variables to {}:{}", h, p); - this.c.setServerHost(h); - this.c.setServerPort(p); - log.debug("calling Core::connect()"); - this.c.connect(); - log.debug("done"); - } } @@ -158,101 +174,50 @@ //private classes //private Methods - private MenuBean createMainMenu() { - MenuBean ret = new MenuBean(this.mx, this.my); - - ThemeManager tm = ThemeManager.get(); - log.debug("loading Images"); - //Image img_sys_exit = Toolkit.getDefaultToolkit().createImage(new File(ClientMain. - // getDir_app(), "themes/default/menues/main/system-exit.png").getAbsolutePath()); - //Image img_sys_cs = Toolkit.getDefaultToolkit().createImage(new File(ClientMain. - // getDir_app(), "themes/default/menues/main/system-change_server.png").getAbsolutePath()); - Image img_sys_exit = tm.getCurrentTheme().getImage("menues/main/system-exit.png"); - Image img_sys_cs = tm.getCurrentTheme().getImage("menues/main/system-change_server.png"); - //TODO: add other imgs(on demand) - log.debug("scaling images"); - int x0 = (int) (64 * mx); - int y0 = (int) (64 * my); - int x1 = (int) (64 * mx); - int y1 = (int) (64 * my); - img_sys_exit = img_sys_exit.getScaledInstance(x0, y0, Image.SCALE_SMOOTH); - img_sys_cs = img_sys_cs.getScaledInstance(x1, y1, Image.SCALE_SMOOTH); - - log.debug("waiting for being scaled"); - MediaTracker mt = new MediaTracker(ret.getComponent()); - mt.addImage(img_sys_exit, 0); - mt.addImage(img_sys_cs, 1); - //TODO: add other imgs(on demand) - try { - mt.waitForAll(); - } catch (InterruptedException ex) { - //do nothing - } - - log.debug("adding buttons"); - ret.addButton("sys_exit", new ImageIcon(img_sys_exit), 896, 448, 56, 53, "Exits JLink."); - ret.addButtonListener("sys_exit", new ActionListener() { - public void actionPerformed(ActionEvent evt) { - c.destroy(); - } - }); - ret.addButton("sys-change_server", new ImageIcon(img_sys_cs), 896, 64, 70, 64, "Changes the Server"); - ret.addButtonListener("sys-change_server", new ActionListener() { - public void actionPerformed(ActionEvent evt) { - synchronized(lock0) { - lock0.notify(); - } - mainCh = 1; - } - }); - - return ret; - } public void connect() { log.debug("Frontend::connect() delegated"); - this.c.connect(); + this.modCore.connect(); } public void disconnect() { log.debug("Frontend::disconnect() delegated"); - this.c.disconnect(); + this.modCore.disconnect(); } public void setServerHost(String nhost) { log.debug("Frontend::setServerHost({}) delegated", nhost); - this.c.setServerHost(nhost); + this.modCore.setServerHost(nhost); } public String getServerHost() { log.debug("Frontend::getServerHost() delegated"); - return this.c.getServerHost(); + return this.modCore.getServerHost(); } public void setServerPort(int nport) { log.debug("Frontend::setServerPort({}) delegated"); - this.c.setServerPort(nport); + this.modCore.setServerPort(nport); } public int getServerPort() { log.debug("Frontend::getServerPort() delegated"); - return this.c.getServerPort(); + return this.modCore.getServerPort(); } - - public void join() { - } + //The Module itself + private Thread modThread = null; + private boolean modActive = true; + private ClientCore modCore = null; + //The Frontend itself + private MainMenu frntMainMenu = null; + //private Attributes - private boolean active = true; private MainFrame root = null; private double mx = 1; private double my = 1; private Logger log = null; - private ClientCore c = null; - private String lock0 = ""; - private byte mainCh = -1; - private MenuBean mainmenu = null; } Added: trunk/Client/src/org/jlink/client/frontend/PasswordLoginWidget.form =================================================================== --- trunk/Client/src/org/jlink/client/frontend/PasswordLoginWidget.form (rev 0) +++ trunk/Client/src/org/jlink/client/frontend/PasswordLoginWidget.form 2006-03-11 14:58:56 UTC (rev 3) @@ -0,0 +1,98 @@ +<?xml version="1.0" encoding="UTF-8" ?> + +<Form version="1.3" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> + <AuxValues> + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> + </AuxValues> + + <Layout> + <DimensionLayout dim="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jLabel1" alignment="0" pref="376" max="32767" attributes="0"/> + <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="jPasswordField1" alignment="0" pref="314" max="32767" attributes="0"/> + <Component id="jTextField1" alignment="0" pref="314" max="32767" attributes="0"/> + </Group> + </Group> + <Group type="102" alignment="0" attributes="0"> + <Component id="jButton1" min="-2" max="-2" attributes="0"/> + <EmptySpace pref="247" max="32767" attributes="0"/> + <Component id="jButton2" min="-2" max="-2" attributes="0"/> + </Group> + </Group> + <EmptySpace max="-2" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace max="-2" attributes="0"/> + <Component id="jLabel1" min="-2" pref="42" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jTextField1" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jPasswordField1" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jButton1" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jButton2" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace pref="165" max="32767" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Component class="javax.swing.JLabel" name="jLabel1"> + <Properties> + <Property name="text" type="java.lang.String" value="Please Login now"/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel2"> + <Properties> + <Property name="text" type="java.lang.String" value="User-ID"/> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="jTextField1"> + </Component> + <Component class="javax.swing.JPasswordField" name="jPasswordField1"> + </Component> + <Component class="javax.swing.JLabel" name="jLabel3"> + <Properties> + <Property name="text" type="java.lang.String" value="Pass-ID"/> + </Properties> + </Component> + <Component class="javax.swing.JButton" name="jButton1"> + <Properties> + <Property name="text" type="java.lang.String" value="back"/> + </Properties> + </Component> + <Component class="javax.swing.JButton" name="jButton2"> + <Properties> + <Property name="text" type="java.lang.String" value="login"/> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="actionLogin"/> + </Events> + </Component> + </SubComponents> +</Form> Added: trunk/Client/src/org/jlink/client/frontend/PasswordLoginWidget.java =================================================================== --- trunk/Client/src/org/jlink/client/frontend/PasswordLoginWidget.java (rev 0) +++ trunk/Client/src/org/jlink/client/frontend/PasswordLoginWidget.java 2006-03-11 14:58:56 UTC (rev 3) @@ -0,0 +1,134 @@ +/* + * PasswordLoginWidget.java + * + * Created on 10. März 2006, 22:16 + * + * JLink: An Introversion Uplink Clone with multiplayer support. + * Copyright (C) 2006 Tassilo Schweyer + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.jlink.client.frontend; + +/** + * + * @author tassilo + */ +public class PasswordLoginWidget extends javax.swing.JPanel { + + /** Creates new form PasswordLoginWidget */ + public PasswordLoginWidget() { + initComponents(); + } + + public void setListener(PasswordLoginWidgetListener l) { + this.list = l; + } + + /** This method is called from within the constructor to + * initialize the form. + * WARNING: Do NOT modify this code. The content of this method is + * always regenerated by the Form Editor. + */ + // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents + private void initComponents() { + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + jTextField1 = new javax.swing.JTextField(); + jPasswordField1 = new javax.swing.JPasswordField(); + jLabel3 = new javax.swing.JLabel(); + jButton1 = new javax.swing.JButton(); + jButton2 = new javax.swing.JButton(); + + jLabel1.setText("Please Login now"); + + jLabel2.setText("User-ID"); + + jLabel3.setText("Pass-ID"); + + jButton1.setText("back"); + + jButton2.setText("login"); + jButton2.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + actionLogin(evt); + } + }); + + org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(layout.createSequentialGroup() + .addContainerGap() + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE) + .add(layout.createSequentialGroup() + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(jLabel2) + .add(jLabel3)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(jPasswordField1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 314, Short.MAX_VALUE) + .add(jTextField1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 314, Short.MAX_VALUE))) + .add(layout.createSequentialGroup() + .add(jButton1) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 247, Short.MAX_VALUE) + .add(jButton2))) + .addContainerGap()) + ); + layout.setVerticalGroup( + layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(layout.createSequentialGroup() + .addContainerGap() + .add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 42, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(jLabel2) + .add(jTextField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(jPasswordField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(jLabel3)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) + .add(jButton1) + .add(jButton2)) + .addContainerGap(165, Short.MAX_VALUE)) + ); + }// </editor-fold>//GEN-END:initComponents + + private void actionLogin(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_actionLogin + if(this.list == null) + return; + String u = this.jTextField1.getText(); + String p = new String(this.jPasswordField1.getPassword()); + this.list.goLogin(u, p); + }//GEN-LAST:event_actionLogin + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; + private javax.swing.JButton jButton2; + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + private javax.swing.JLabel jLabel3; + private javax.swing.JPasswordField jPasswordField1; + private javax.swing.JTextField jTextField1; + // End of variables declaration//GEN-END:variables + + private PasswordLoginWidgetListener list = null; +} Added: trunk/Client/src/org/jlink/client/frontend/PasswordLoginWidgetListener.java =================================================================== --- trunk/Client/src/org/jlink/client/frontend/PasswordLoginWidgetListener.java (rev 0) +++ trunk/Client/src/org/jlink/client/frontend/PasswordLoginWidgetListener.java 2006-03-11 14:58:56 UTC (rev 3) @@ -0,0 +1,39 @@ +/* + * PasswordLoginWidgetListener.java + * + * Created on 10. März 2006, 22:25 + * + * JLink: An Introversion Uplink Clone with multiplayer support. + * Copyright (C) 2006 Tassilo Schweyer + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.jlink.client.frontend; + +//import +//import::sys +//import::sys::util +import java.util.EventListener; +import java.util.EventObject; + +/** + * + * @author tassilo + */ +public interface PasswordLoginWidgetListener extends EventListener { + public void goLogin(String user, String pass); + public void goBack(); +} Added: trunk/Client/src/org/jlink/client/frontend/controll/FrontendController.java =================================================================== --- trunk/Client/src/org/jlink/client/frontend/controll/FrontendController.java (rev 0) +++ trunk/Client/src/org/jlink/client/frontend/controll/FrontendController.java 2006-03-11 14:58:56 UTC (rev 3) @@ -0,0 +1,43 @@ +/* + * FrontendController.java + * + * Created on 10. März 2006, 23:01 + * + * JLink: An Introversion Uplink Clone with multiplayer support. + * Copyright (C) 2006 Tassilo Schweyer + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.jlink.client.frontend.controll; + +//import +//import::own +//import::sys + + +/** + * + * @author tassilo + */ +public class FrontendController { + + + private FrontendController() { + } + + + +} Added: trunk/Client/src/org/jlink/client/frontend/controll/MainMenuController.java =================================================================== --- trunk/Client/src/org/jlink/client/frontend/controll/MainMenuController.java (rev 0) +++ trunk/Client/src/org/jlink/client/frontend/controll/MainMenuController.java 2006-03-11 14:58:56 UTC (rev 3) @@ -0,0 +1,36 @@ +/* + * MainMenuController.java + * + * Created on 10. März 2006, 23:03 + * + * JLink: An Introversion Uplink Clone with multiplayer support. + * Copyright (C) 2006 Tassilo Schweyer + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.jlink.client.frontend.controll; + +/** + * + * @author tassilo + */ +public class MainMenuController { + + /** Creates a new instance of MainMenuController */ + public MainMenuController() { + } + +} Added: trunk/Client/src/org/jlink/client/frontend/gal/Frontend.java =================================================================== --- trunk/Client/src/org/jlink/client/frontend/gal/Frontend.java (rev 0) +++ trunk/Client/src/org/jlink/client/frontend/gal/Frontend.java 2006-03-11 14:58:56 UTC (rev 3) @@ -0,0 +1,48 @@ +/* + * Frontend.java + * + * Created on 11. März 2006, 12:36 + * + * JLink: An Introversion Uplink Clone with multiplayer support. + * Copyright (C) 2006 Tassilo Schweyer + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.jlink.client.frontend.gal; + +/** + * + * @author tassilo + */ +public interface Frontend { + public static final char VIEW_MAINMENU = 0; + public static final char VIEW_OPTIONS = 1; + public static final char VIEW_ACC_CREATE = 2; + public static final char VIEW_GAME = 3; + + //general Visualization + public void show(); + public void dispose(); + public boolean isVisible(); + + //Views + public char getView(); + public void gotoMainMenu(); + public void gotoOptions(); + public void gotoAccCreation(); + public void gotoGame(); + public void setListener(FrontendListener l); +} Added: trunk/Client/src/org/jlink/client/frontend/gal/FrontendListener.java =================================================================== --- trunk/Client/src/org/jlink/client/frontend/gal/FrontendListener.java (rev 0) +++ trunk/Client/src/org/jlink/client/frontend/gal/FrontendListener.java 2006-03-11 14:58:56 UTC (rev 3) @@ -0,0 +1,38 @@ +/* + * FrontendListener.java + * + * Created on 11. März 2006, 15:18 + * + * JLink: An Introversion Uplink Clone with multiplayer support. + * Copyright (C) 2006 Tassilo Schweyer + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.jlink.client.frontend.gal; + +//import +//import::sys +//import::sys::util +import java.util.EventListener; + +/** + * + * @author tassilo + */ +public interface FrontendListener extends EventListener { + public void changedView(char oldView, char newView); + +} Added: trunk/Client/src/org/jlink/client/frontend/gal/MainMenu.java =================================================================== --- trunk/Client/src/org/jlink/client/frontend/gal/MainMenu.java (rev 0) +++ trunk/Client/src/org/jlink/client/frontend/gal/MainMenu.java 2006-03-11 14:58:56 UTC (rev 3) @@ -0,0 +1,32 @@ +/* + * MainMenu.java + * + * Created on 11. März 2006, 12:37 + * + * JLink: An Introversion Uplink Clone with multiplayer support. + * Copyright (C) 2006 Tassilo Schweyer + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.jlink.client.frontend.gal; + +/** + * + * @author tassilo + */ +public interface MainMenu { + +} Added: trunk/Client/src/org/jlink/client/frontend/gal/impl/FrontendImpl.java =================================================================== --- trunk/Client/src/org/jlink/client/frontend/gal/impl/FrontendImpl.java (rev 0) +++ trunk/Client/src/org/jlink/client/frontend/gal/impl/FrontendImpl.java 2006-03-11 14:58:56 UTC (rev 3) @@ -0,0 +1,82 @@ +/* + * FrontendImpl.java + * + * Created on 11. März 2006, 15:03 + * + * JLink: An Introversion Uplink Clone with multiplayer support. + * Copyright (C) 2006 Tassilo Schweyer + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.jlink.client.frontend.gal.impl; + +//import +//import::own +//import::own::frontend +//import::own::frontend::GAL +import org.jlink.client.frontend.gal.Frontend; +import org.jlink.client.frontend.gal.FrontendListener; + +/** + * + * @author tassilo + */ +public class FrontendImpl implements Frontend { + + /** Creates a new instance of FrontendImpl */ + public FrontendImpl() { + } + + public void show() { + + this.viewActive = true; + } + + public void dispose() { + + this.viewActive = false; + } + + public boolean isVisible() { + return this.viewActive; + } + + public char getView() { + return this.viewCur; + } + + public void gotoMainMenu() { + } + + public void gotoOptions() { + } + + public void gotoAccCreation() { + } + + public void gotoGame() { + } + + public void setListener(FrontendListener l) { + this.list = l; + } + + + private char viewCur = 0; + private boolean viewActive = false; + + private FrontendListener list = null; +} Modified: trunk/Client/src/org/jlink/client/frontend/menu/MainMenu.form =================================================================== --- trunk/Client/src/org/jlink/client/frontend/menu/MainMenu.form 2006-03-10 12:53:52 UTC (rev 2) +++ trunk/Client/src/org/jlink/client/frontend/menu/MainMenu.form 2006-03-11 14:58:56 UTC (rev 3) @@ -14,12 +14,14 @@ <Group type="102" attributes="0"> <EmptySpace max="-2" attributes="0"/> <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" alignment="1" attributes="0"> - <Component id="jLabel1" pref="330" max="32767" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> - <Component id="connectButton" min="-2" max="-2" attributes="0"/> - </Group> + <Component id="jLabel1" pref="424" max="32767" attributes="0"/> + <Component id="passwordLoginWidget1" alignment="0" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="changeServerButton" alignment="1" min="-2" max="-2" attributes="0"/> <Component id="optionsButton" alignment="1" min="-2" max="-2" attributes="0"/> + <Component id="createButton" alignment="1" min="-2" max="-2" attributes="0"/> <Component id="exitButton" alignment="1" min="-2" max="-2" attributes="0"/> </Group> <EmptySpace max="-2" attributes="0"/> @@ -31,29 +33,55 @@ <Group type="102" alignment="0" attributes="0"> <EmptySpace max="-2" attributes="0"/> <Group type="103" groupAlignment="3" attributes="0"> - <Component id="connectButton" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="changeServerButton" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jLabel1" alignment="3" min="-2" pref="58" max="-2" attributes="0"/> </Group> <EmptySpace max="-2" attributes="0"/> - <Component id="optionsButton" min="-2" max="-2" attributes="0"/> - <EmptySpace pref="235" max="32767" attributes="0"/> - <Component id="exitButton" min="-2" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <Component id="optionsButton" min="-2" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="createButton" min="-2" max="-2" attributes="0"/> + <EmptySpace pref="114" max="32767" attributes="0"/> + <Component id="exitButton" min="-2" max="-2" attributes="0"/> + </Group> + <Component id="passwordLoginWidget1" min="-2" max="-2" attributes="0"/> + </Group> <EmptySpace max="-2" attributes="0"/> </Group> </Group> </DimensionLayout> </Layout> <SubComponents> - <Component class="javax.swing.JButton" name="connectButton"> + <Component class="javax.swing.JButton" name="changeServerButton"> <Properties> <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> - <Connection code="getIcon("menues/main/systen-server_connect.png")" type="code"/> + <Connection code="getIcon("menues/main/system-change_server.png")" type="code"/> </Property> + <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> + <Dimension value="[64, 64]"/> + </Property> </Properties> </Component> <Component class="javax.swing.JButton" name="optionsButton"> + <Properties> + <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> + <Dimension value="[64, 64]"/> + </Property> + </Properties> </Component> <Component class="javax.swing.JButton" name="exitButton"> + <Properties> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> + <Connection code="getIcon("menues/main/system-exit.png")" type="code"/> + </Property> + <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> + <Dimension value="[64, 64]"/> + </Property> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="exitClicked"/> + </Events> </Component> <Component class="javax.swing.JLabel" name="jLabel1"> <Properties> @@ -63,5 +91,17 @@ <Property name="text" type="java.lang.String" value="JLink"/> </Properties> </Component> + <Component class="javax.swing.JButton" name="createButton"> + <Properties> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> + <Connection code="getIcon("menues/main/account-register.png")" type="code"/> + </Property> + <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> + <Dimension value="[64, 64]"/> + </Property> + </Properties> + </Component> + <Component class="org.jlink.client.frontend.PasswordLoginWidget" name="passwordLoginWidget1"> + </Component> </SubComponents> </Form> Modified: trunk/Client/src/org/jlink/client/frontend/menu/MainMenu.java =================================================================== --- trunk/Client/src/org/jlink/client/frontend/menu/MainMenu.java 2006-03-10 12:53:52 UTC (rev 2) +++ trunk/Client/src/org/jlink/client/frontend/menu/MainMenu.java 2006-03-11 14:58:56 UTC (rev 3) @@ -27,10 +27,12 @@ //import::own import org.jlink.resources.FontLoader; //import::sys +import org.apache.log4j.Logger; import java.awt.Image; import java.awt.MediaTracker; import javax.swing.ImageIcon; import javax.swing.JPanel; +import org.jlink.client.frontend.PasswordLoginWidget; import org.jlink.client.frontend.theme.Theme; import org.jlink.client.frontend.theme.ThemeManager; @@ -42,10 +44,16 @@ /** Creates new form MainMenu */ public MainMenu() { + log = Logger.getLogger("frontend.mainmenu"); + log.debug("MainMenu created"); cur = ThemeManager.get().getCurrentTheme(); initComponents(); } + public void setListener(MainMenuListener l) { + this.list = l; + } + /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is @@ -53,16 +61,32 @@ */ // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents private void initComponents() { - connectButton = new javax.swing.JButton(); + changeServerButton = new javax.swing.JButton(); optionsButton = new javax.swing.JButton(); exitButton = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); + createButton = new javax.swing.JButton(); + passwordLoginWidget1 = new org.jlink.client.frontend.PasswordLoginWidget(); - connectButton.setIcon(getIcon("menues/main/systen-server_connect.png")); + changeServerButton.setIcon(getIcon("menues/main/system-change_server.png")); + changeServerButton.setPreferredSize(new java.awt.Dimension(64, 64)); + optionsButton.setPreferredSize(new java.awt.Dimension(64, 64)); + + exitButton.setIcon(getIcon("menues/main/system-exit.png")); + exitButton.setPreferredSize(new java.awt.Dimension(64, 64)); + exitButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + exitClicked(evt); + } + }); + jLabel1.setFont(FontLoader.getFont0().deriveFont(30)); jLabel1.setText("JLink"); + createButton.setIcon(getIcon("menues/main/account-register.png")); + createButton.setPreferredSize(new java.awt.Dimension(64, 64)); + org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( @@ -70,12 +94,14 @@ .add(layout.createSequentialGroup() .addContainerGap() .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) - .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() - .add(jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 330, Short.MAX_VALUE) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(connectButton)) - .add(org.jdesktop.layout.GroupLayout.TRAILING, optionsButton) - .add(org.jdesktop.layout.GroupLayout.TRAILING, exitButton)) + .add(jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 424, Short.MAX_VALUE) + .add(passwordLoginWidget1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(org.jdesktop.layout.GroupLayout.TRAILING, changeServerButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(org.jdesktop.layout.GroupLayout.TRAILING, optionsButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(org.jdesktop.layout.GroupLayout.TRAILING, createButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(org.jdesktop.layout.GroupLayout.TRAILING, exitButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addContainerGap()) ); layout.setVerticalGroup( @@ -83,33 +109,55 @@ .add(layout.createSequentialGroup() .addContainerGap() .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) - .add(connectButton) - .add(jLabel1)) + .add(changeServerButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 58, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) - .add(optionsButton) - .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 235, Short.MAX_VALUE) - .add(exitButton) + .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) + .add(layout.createSequentialGroup() + .add(optionsButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) + .add(createButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 114, Short.MAX_VALUE) + .add(exitButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) + .add(passwordLoginWidget1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) .addContainerGap()) ); }// </editor-fold>//GEN-END:initComponents + + private void exitClicked(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitClicked + if(this.list == null) + return; + this.list.runExit(); + }//GEN-LAST:event_exitClicked private ImageIcon getIcon(String p) { + log.debug("loading image: {}", p); Image i = this.cur.getImage(p); - i = i.getScaledInstance(64, 64, Image.SCALE_SMOOTH); + log.debug("scaling"); + i = i.getScaledInstance(54, 54, Image.SCALE_SMOOTH); + log.debug("waiting"); MediaTracker mt = new MediaTracker(this); mt.addImage(i, 0); try { mt.waitForAll(); } catch (InterruptedException ex) { } + log.debug("returning"); return new ImageIcon(i); } + + + // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JButton connectButton; + private javax.swing.JButton changeServerButton; + private javax.swing.JButton createButton; private javax.swing.JButton exitButton; private javax.swing.JLabel jLabel1; private javax.swing.JButton optionsButton; + private org.jlink.client.frontend.PasswordLoginWidget passwordLoginWidget1; // End of variables declaration//GEN-END:variables - private Theme cur = null; + private Theme cur = null; + private Logger log = null; + private MainMenuListener list = null; } Added: trunk/Client/src/org/jlink/client/frontend/menu/MainMenuListener.java =================================================================== --- trunk/Client/src/org/jlink/client/frontend/menu/MainMenuListener.java (rev 0) +++ trunk/Client/src/org/jlink/client/frontend/menu/MainMenuListener.java 2006-03-11 14:58:56 UTC (rev 3) @@ -0,0 +1,41 @@ +/* + * MainMenuListener.java + * + * Created on 10. März 2006, 21:47 + * + * JLink: An Introversion Uplink Clone with multiplayer support. + * Copyright (C) 2006 Tassilo Schweyer + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.jlink.client.frontend.menu; + +//import +//import::sys +//import::sys::util +import java.util.EventListener; +import java.util.EventObject; + +/** + * + * @author tassilo + */ +public interface MainMenuListener extends EventListener { + public void runChangeServer(); + public void runOptions(); + public void runCreateAcc(); + public void runExit(); +} Modified: trunk/Client/src/org/jlink/client/frontend/theme/Theme.java =================================================================== --- trunk/Client/src/org/jlink/client/frontend/theme/Theme.java 2006-03-10 12:53:52 UTC (rev 2) +++ trunk/Client/src/org/jlink/client/frontend/theme/Theme.java 2006-03-11 14:58:56 UTC (rev 3) @@ -26,30 +26,99 @@ //import::sys import java.io.File; import org.apache.log4j.Logger; -//import::awt +import org.apache.log4j.NDC; +//import::sys::awt import java.awt.Image; import java.awt.Toolkit; import java.awt.MediaTracker; +import java.awt.Color; +//import::sys::jdom +import org.jdom.Document; +import org.jdom.JDOMException; +import org.jdom.input.SAXBuilder; +import org.jdom.xpath.XPath; /** * * @author tassilo */ public class Theme { + public static final int MENU_MAIN = 0; + public static Theme load(File dir) { if(!dir.isDirectory()) throw new IllegalArgumentException(); Theme ret = null; ret = new Theme(); ret.log = Logger.getLogger("jlink.frontend.theme"); - ret.log.debug("loaded Theme from {}", dir.getAbsolutePath()); + ret.log.debug("loading Theme from {}", dir.getAbsolutePath()); + ret.dir = dir; ret.name = dir.getName(); + ret.validate(0); + try { + ret.loadConfig(); + } catch(Exception e) { + ret.log.error("Cannot load theme", e); + return null; + } + return ret; } + public void loadConfig() throws Exception { + log.debug("loading Theme config"); + File c = new File(this.dir, "theme.xml"); + SAXBuilder build = new SAXBuilder(); + log.debug("loading XML"); + this.doc = build.build(c); + } + //Core Operations + public boolean validate(int maxMissing) { + if(maxMissing < 0) + throw new IllegalArgumentException("maxMissing found: [" + maxMissing + "] required: >= 0"); + NDC.push(this.name); + log.debug("Theme::{}::validate({})", this.name, maxMissing); + NDC.push("validate"); + + log.debug("checking MainMenu images"); + + log.debug("checking for: menues/main/system-exit.png"); + File img0 = new File(dir, "menues/main/system-exit.png"); + if(!img0.exists()) { + log.info("Image /menues/main/system-exit.png not found"); + maxMissing--; + } + + log.debug("checking for: menues/main/system-change_server.png"); + File img1 = new File(dir, "menues/main/system-change_server.png"); + if(!img1.exists()) { + log.info("Image /menues/main/system-change_server.png not found"); + maxMissing--; + } + + log.debug("checking for: menues/main/account-register.png"); + File img2 = new File(dir, "menues/main/account-register.png"); + if(!img2.exists()) { + log.info("Image /menues/main/account-register.png not found"); + maxMissing--; + } + + if(maxMissing < 0) { + log.debug("returning false"); + NDC.pop(); + NDC.pop(); + return false; + } else { + log.debug("returning true"); + NDC.pop(); + NDC.pop(); + return true; + } + } + //Core props public String getName() { return this.name; @@ -76,11 +145,38 @@ } + //Color Operations + public Color getMenuBGColor(int id) { + Color ret = null; + boolean e = false; + switch(id) { + case MENU_MAIN: + + try { + String t = XPath.selectSingleNode(this.doc, "/child::menu/attribute::name[(child::text() = \"main\")]/child::background/attribute::color").toString(); + } catch (JDOMException ex) { + log.error("Error reading from Theme config", ex); + ret = null; + } + break; + } + + if(ret == null) + throw new IllegalArgumentException(); + + return ret; + } + private Theme() { } - private String name = null; + + + private String name = null; + private Document doc = null; + + private Logger log = null; private File dir = null; Modified: trunk/Share/src/org/jlink/resources/FontLoader.java =================================================================== --- trunk/Share/src/org/jlink/resources/FontLoader.java 2006-03-10 12:53:52 UTC (rev 2) +++ trunk/Share/src/org/jlink/resources/FontLoader.java 2006-03-11 14:58:56 UTC (rev 3) @@ -49,7 +49,7 @@ } - return ret; + return ret.deriveFont(60f); } Added: trunk/lib/jdom/jaxen-core.jar =================================================================== (Binary files differ) Property changes on: trunk/lib/jdom/jaxen-core.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/lib/jdom/jaxen-jdom.jar =================================================================== (Binary files differ) Property changes on: trunk/lib/jdom/jaxen-jdom.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/lib/jdom/jdom.jar =================================================================== (Binary files differ) Property changes on: trunk/lib/jdom/jdom.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/lib/jdom/saxpath.jar =================================================================== (Binary files differ) Property changes on: trunk/lib/jdom/saxpath.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/themes/default/menues/main/system-change_server.png =================================================================== (Binary files differ) Modified: trunk/themes/default/theme.xml =================================================================== --- trunk/themes/default/theme.xml 2006-03-10 12:53:52 UTC (rev 2) +++ trunk/themes/default/theme.xml 2006-03-11 14:58:56 UTC (rev 3) @@ -2,7 +2,10 @@ <theme> <meta> - <property name="name" value="default"/> + <property name="name" value="Standard"/> <property name="author" value="Tassilo Schweyer"/> </meta> + <menu name="main"> + <background color="00186f"/> + </menu> </theme> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |