diff options
38 files changed, 5432 insertions, 5418 deletions
diff --git a/ServerSettings.xml b/ServerSettings.xml index 11dd45d..4343a72 100644 --- a/ServerSettings.xml +++ b/ServerSettings.xml @@ -1,6 +1,6 @@ -<?xml version="1.0" encoding="UTF-8"?> -<java version="1.6.0_0" class="java.beans.XMLDecoder"> - <string>jdbc:postgresql://localhost:5432/yalp</string> - <string>huhu</string> - <string>yalp</string> -</java> +<?xml version="1.0" encoding="UTF-8"?> +<java version="1.6.0_17" class="java.beans.XMLDecoder"> + <string>jdbc:postgresql://localhost:5432/yalp</string> + <string>huhu</string> + <string>yalp</string> +</java> diff --git a/build-java.bat b/build-java.bat new file mode 100644 index 0000000..45904ba --- /dev/null +++ b/build-java.bat @@ -0,0 +1,2 @@ +set CLASSPATH=d:\test\yalp\lib\log4j-1.2.15.jar;d:\test\yalp\lib\commons-net-1.4.1.jar;d:\test\yalp\lib\postgresql-8.1-404.jdbc3.jar;d:\test\yalp\lib\yajil-0.3.3.jar;d:\test\yalp\lib\win-swt.jar +ant %1 diff --git a/build.bat b/build.bat new file mode 100644 index 0000000..2767f22 --- /dev/null +++ b/build.bat @@ -0,0 +1,4 @@ +# python stuff +./build-python.bat +# java stuff +./build-java.bat @@ -1,231 +1,231 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<project name="yalp" default="all" basedir="."> - <property name="srcInterfaces" value="src/YalpInterfaces"/> - - <property name="srcInputs" value="src/YalpInputs"/> - <property name="srcOutputs" value="src/YalpOutputs"/> - <property name="srcAuth" value="src/YalpAuth"/> - <property name="srcServer" value="src/YalpServer"/> - <property name="srcClients" value="src/YalpClients"/> - <property name="srcPgSqlInputIndexer" value="${srcInputs}/YalpPGSqlInput/YalpPGSQLIndexer"/> - <property name="srcVlcTelnetOutput" value="${srcOutputs}/YalpVlcTelnetOutput"/> - <property name="srcPGSqlInput" value="${srcInputs}/YalpPGSqlInput"/> - <property name="srcPGSqlAuth" value="${srcAuth}/YalpPGSqlAuth"/> - - <property name="srcSwtClient" value="${srcClients}/SwtClient"/> - <property name="srcSwtClientGUI" value="${srcSwtClient}/GUI"/> - - <property name="src" value="src/"/> - <property name="doc" value="doc/"/> - <property name="sqldoc" value="${doc}/sql"/> - <property name="javadoc" value="${doc}/java"/> - <property name="doxydoc" value="${doc}/doxygen"/> - <property name="build" value="build/"/> - <property name="lib" value="lib/"/> - - <property name="log4jLibs" value="lib/log4j-1.2.15.jar"/> - <property name="vlctelnetLibs" value="lib/commons-net-1.4.1.jar"/> - <property name="swtLibs" value="/usr/share/swt-3/lib/swt.jar /usr/lib/java/swt.jar /usr/share/java/swt.jar"/> - <property name="indexerLibs" value="lib/yajil-0.3.3.jar"/> - <property name="dbLibs" value="lib/postgresql-8.1-404.jdbc3.jar"/> - - <property name="idlj" value="../idlj.sh"/> - <property name="psqldoc" value="./postgresql_autodoc/postgresql_autodoc"/> - - <path id="project.class.path"> - <pathelement location="{lib}"/> - <pathelement path="${java.class.path}"/> - <pathelement path="${additional.path}"/> - </path> - - <target name="all" depends="vlctelnetoutput, pgsqlinput, pgsqlindexer, pgsqlauth, server, swtclient" description="builds server and client"> - <echo>Doing all</echo> - </target> - - <target name="interfaces" description="Create stubs/skeletons from idl"> - <mkdir dir="${build}"/> - <exec dir="${src}" executable="${idlj}"> - <arg value="yalp.idl"/> - </exec> - <javac srcdir="${srcInterfaces}" destdir="${build}"/> - </target> - - <target name ="server" depends="interfaces" description="builds the Server"> - <javac debug="true" srcdir="${srcServer}" destdir="${build}"/> - <jar destfile="yalpServer.jar" basedir="${build}"> - <path id="project.class.path"> - <pathelement location="${lib}"/> - <pathelement path="${java.class.path}"/> - <pathelement path="${additional.path}"/> - </path> - <manifest> - <attribute name="Built-By" value="${user.name}"/> - <attribute name="Main-Class" value="YalpServer.YalpServer"/> - <attribute name="Class-Path" value="${log4jLibs}"/> - </manifest> - </jar> - </target> - - <target name ="outputs" description="builds output base files"> - <javac debug="true" srcdir="${srcOutputs}" destdir="${build}"/> - </target> - - <target name ="vlctelnetoutput" depends="interfaces, outputs" description="builds the vlctelnetoutput"> - <javac debug="true" srcdir="${srcVlcTelnetOutput}" destdir="${build}"/> - <jar destfile="yalpVlcTelnetOutput.jar" basedir="${build}"> - <path id="project.class.path"> - <pathelement location="${lib}"/> - <pathelement path="${java.class.path}"/> - <pathelement path="${additional.path}"/> - </path> - <manifest> - <attribute name="Built-By" value="${user.name}"/> - <attribute name="Main-Class" value="YalpOutputs.YalpVlcTelnetOutput.YalpVlcTelnetOutput"/> - <attribute name="Class-Path" value="${vlctelnetLibs} ${log4jLibs}"/> - </manifest> - </jar> - </target> - - <target name ="inputs" description="builds input base files"> - <javac debug="true" srcdir="${srcInputs}" destdir="${build}"/> - </target> - - <target name ="pgsqlinput" depends="interfaces, inputs" description="builds the pgsql input plugin"> - <javac debug="true" srcdir="${srcPGSqlInput}" destdir="${build}"/> - <jar destfile="yalpPGSqlInput.jar" basedir="${build}"> - <path id="project.class.path"> - <pathelement location="${lib}"/> - <pathelement path="${java.class.path}"/> - <pathelement path="${additional.path}"/> - </path> - <manifest> - <attribute name="Built-By" value="${user.name}"/> - <attribute name="Main-Class" value="YalpInputs.YalpPGSqlInput.YalpPGSqlInput"/> - <attribute name="Class-Path" value="${dbLibs} ${log4jLibs}"/> - </manifest> - </jar> - </target> - - <target name="pgsqlindexer" description="indexer for pgsqlinputplugin"> - <mkdir dir="${build}/indexer"/> - <javac debug="true" srcdir="${srcPgSqlInputIndexer}" destdir="${build}/indexer"/> - <jar destfile="yalpPGSqlIndexer.jar" basedir="${build}"> - <path id="project.class.path"> - <pathelement location="${lib}"/> - <pathelement path="${java.class.path}"/> - <pathelement path="${additional.path}"/> - </path> - <manifest> - <attribute name="Built-By" value="${user.name}"/> - <attribute name="Main-Class" value="YalpInputs.YalpPGSqlInput.YalpPGSQLIndexer.YalpPGSQLIndexer"/> - <attribute name="Class-Path" value="${indexerLibs}"/> - </manifest> - </jar> - </target> - - <target name ="auth" description="builds auth base files"> - <javac debug="true" srcdir="${srcAuth}" destdir="${build}"/> - </target> - - <target name ="pgsqlauth" depends="interfaces, auth" description="builds the pgsql auth plugin"> - <javac debug="true" srcdir="${srcPGSqlAuth}" destdir="${build}"/> - <jar destfile="yalpPGSqlAuth.jar" basedir="${build}"> - <path id="project.class.path"> - <pathelement location="${lib}"/> - <pathelement path="${java.class.path}"/> - <pathelement path="${additional.path}"/> - </path> - <manifest> - <attribute name="Built-By" value="${user.name}"/> - <attribute name="Main-Class" value="YalpAuth.YalpPGSqlAuth.YalpPGSqlAuth"/> - <attribute name="Class-Path" value="${dbLibs}"/> - </manifest> - </jar> - </target> - - <target name ="clients" depends="interfaces" description="builds the client bsae files"> - <javac debug="true" srcdir="${srcClients}" destdir="${build}"/> - </target> - - <target name ="swtclient" depends="clients" description="builds SWT GUI"> - <javac debug="true" srcdir="${srcSwtClient}" destdir="${build}"/> - <jar destfile="yalpSWTClient.jar" basedir="${build}"> - <path id="project.class.path"> - <pathelement location="${lib}"/> - <pathelement path="${java.class.path}"/> - <pathelement path="${additional.path}"/> - </path> - <manifest> - <attribute name="Built-By" value="${user.name}"/> - <attribute name="Main-Class" value="YalpClients.SwtClient.SwtClient"/> - <attribute name="Class-Path" value="${swtLibs}"/> - </manifest> - </jar> - </target> - - <target name="swtgui" depends="swtclient"> - <javac debug="true" srcdir="${srcSwtGUI}" destdir="${build}"> - <classpath refid="project.class.path"/> - </javac> - </target> - - <target name="clean" depends="cleandoc" description="Removes previous build"> - <delete verbose="true"> - <fileset dir="${build}"/> - <fileset dir="${srcInterfaces}"/> - </delete> - </target> - - <target name="runserver" depends="server" description="starts Server"> - <java jar="server.jar" fork="true"/> - </target> - - <target name="runclient" depends="swtclient" description="starts Client"> - <java jar="client.jar" fork="true"/> - </target> - - <target name="cleandoc" depends="cleandoxydoc, cleansqldoc, cleanjavadoc"/> - - <target name="cleansqldoc" description="Removes previous sqldoc"> - <delete verbose="true"> - <fileset dir="${sqldoc}"/> - </delete> - </target> - - <target name="cleandoxydoc" description="Removes previous doxygen"> - <delete verbose="true"> - <fileset dir="${doxydoc}"/> - </delete> - </target> - - <target name="cleanjavadoc" description="Removes previous javadoc"> - <delete verbose="true"> - <fileset dir="${javadoc}"/> - </delete> - </target> - - <target name="doc" depends="cleandoc" description="generates javadoc"> - <javadoc packagenames="org.umlgraph.doclet.*, YalpAuth.*, YalpServer, YalpClients.*, YalpInterfaces, YalpOutputs.*, YalpInputs.*" sourcepath="src" author="true" version="true" private="true" use="true" destdir="${javadoc}"> - <doclet name="org.umlgraph.doclet.UmlGraphDoc" path="./build-tools/UmlGraph-5.2.jar"> - <param name="-inferrel"/> - <param name="-inferdep"/> - <param name="-hide" value="java.*"/> - <param name="-collpackages" value="java.util.*"/> - <param name="-qualify"/> - <param name="-postfixpackage"/> - <param name="-nodefontsize" value="9"/> - <param name="-nodefontpackagesize" value="7"/> - <param name="-link" value="http://java.sun.com/javase/6/docs/guide/javadoc/doclet/spec"/> - <param name="-link" value="http://java.sun.com/javase/6/docs/api"/> - </doclet> - </javadoc> - <exec dir="." executable="${psqldoc}"> - <arg line="-d yalp -f ${sqldoc}/yalp -h localhost -u yalp -p 5432 --password=yalp -l ./postgresql_autodoc"/> - </exec> - <exec dir="." executable="/usr/bin/doxygen"> - <arg line="yalp.doxy"/> - </exec> - </target> - -</project> +<?xml version="1.0" encoding="UTF-8"?>
+
+<project name="yalp" default="all" basedir=".">
+ <property name="srcInterfaces" value="src/YalpInterfaces"/>
+
+ <property name="srcInputs" value="src/YalpInputs"/>
+ <property name="srcOutputs" value="src/YalpOutputs"/>
+ <property name="srcAuth" value="src/YalpAuth"/>
+ <property name="srcServer" value="src/YalpServer"/>
+ <property name="srcClients" value="src/YalpClients"/>
+ <property name="srcPgSqlInputIndexer" value="${srcInputs}/YalpPGSqlInput/YalpPGSQLIndexer"/>
+ <property name="srcVlcTelnetOutput" value="${srcOutputs}/YalpVlcTelnetOutput"/>
+ <property name="srcPGSqlInput" value="${srcInputs}/YalpPGSqlInput"/>
+ <property name="srcPGSqlAuth" value="${srcAuth}/YalpPGSqlAuth"/>
+
+ <property name="srcSwtClient" value="${srcClients}/SwtClient"/>
+ <property name="srcSwtClientGUI" value="${srcSwtClient}/GUI"/>
+
+ <property name="src" value="src/"/>
+ <property name="doc" value="doc/"/>
+ <property name="sqldoc" value="${doc}/sql"/>
+ <property name="javadoc" value="${doc}/java"/>
+ <property name="doxydoc" value="${doc}/doxygen"/>
+ <property name="build" value="build/"/>
+ <property name="lib" value="lib/"/>
+
+ <property name="log4jLibs" value="lib/log4j-1.2.15.jar"/>
+ <property name="vlctelnetLibs" value="lib/commons-net-1.4.1.jar"/>
+ <property name="swtLibs" value="/usr/share/swt-3/lib/swt.jar /usr/lib/java/swt.jar /usr/share/java/swt.jar"/>
+ <property name="indexerLibs" value="lib/yajil-0.3.3.jar"/>
+ <property name="dbLibs" value="lib/postgresql-8.1-404.jdbc3.jar"/>
+
+ <property name="idlj" value="d:\test\yalp\winidlj.bat"/>
+ <property name="psqldoc" value="./postgresql_autodoc/postgresql_autodoc"/>
+
+ <path id="project.class.path">
+ <pathelement location="{lib}"/>
+ <pathelement path="${java.class.path}"/>
+ <pathelement path="${additional.path}"/>
+ </path>
+
+ <target name="all" depends="vlctelnetoutput, pgsqlinput, pgsqlindexer, pgsqlauth, server, swtclient" description="builds server and client">
+ <echo>Doing all</echo>
+ </target>
+
+ <target name="interfaces" description="Create stubs/skeletons from idl">
+ <mkdir dir="${build}"/>
+ <exec dir="${src}" executable="${idlj}">
+ <arg value="yalp.idl"/>
+ </exec>
+ <javac srcdir="${srcInterfaces}" destdir="${build}"/>
+ </target>
+
+ <target name ="server" depends="interfaces" description="builds the Server">
+ <javac debug="true" srcdir="${srcServer}" destdir="${build}"/>
+ <jar destfile="yalpServer.jar" basedir="${build}">
+ <path id="project.class.path">
+ <pathelement location="${lib}"/>
+ <pathelement path="${java.class.path}"/>
+ <pathelement path="${additional.path}"/>
+ </path>
+ <manifest>
+ <attribute name="Built-By" value="${user.name}"/>
+ <attribute name="Main-Class" value="YalpServer.YalpServer"/>
+ <attribute name="Class-Path" value="${log4jLibs}"/>
+ </manifest>
+ </jar>
+ </target>
+
+ <target name ="outputs" description="builds output base files">
+ <javac debug="true" srcdir="${srcOutputs}" destdir="${build}"/>
+ </target>
+
+ <target name ="vlctelnetoutput" depends="interfaces, outputs" description="builds the vlctelnetoutput">
+ <javac debug="true" srcdir="${srcVlcTelnetOutput}" destdir="${build}"/>
+ <jar destfile="yalpVlcTelnetOutput.jar" basedir="${build}">
+ <path id="project.class.path">
+ <pathelement location="${lib}"/>
+ <pathelement path="${java.class.path}"/>
+ <pathelement path="${additional.path}"/>
+ </path>
+ <manifest>
+ <attribute name="Built-By" value="${user.name}"/>
+ <attribute name="Main-Class" value="YalpOutputs.YalpVlcTelnetOutput.YalpVlcTelnetOutput"/>
+ <attribute name="Class-Path" value="${vlctelnetLibs} ${log4jLibs}"/>
+ </manifest>
+ </jar>
+ </target>
+
+ <target name ="inputs" description="builds input base files">
+ <javac debug="true" srcdir="${srcInputs}" destdir="${build}"/>
+ </target>
+
+ <target name ="pgsqlinput" depends="interfaces, inputs" description="builds the pgsql input plugin">
+ <javac debug="true" srcdir="${srcPGSqlInput}" destdir="${build}"/>
+ <jar destfile="yalpPGSqlInput.jar" basedir="${build}">
+ <path id="project.class.path">
+ <pathelement location="${lib}"/>
+ <pathelement path="${java.class.path}"/>
+ <pathelement path="${additional.path}"/>
+ </path>
+ <manifest>
+ <attribute name="Built-By" value="${user.name}"/>
+ <attribute name="Main-Class" value="YalpInputs.YalpPGSqlInput.YalpPGSqlInput"/>
+ <attribute name="Class-Path" value="${dbLibs} ${log4jLibs}"/>
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="pgsqlindexer" description="indexer for pgsqlinputplugin">
+ <mkdir dir="${build}/indexer"/>
+ <javac debug="true" srcdir="${srcPgSqlInputIndexer}" destdir="${build}/indexer"/>
+ <jar destfile="yalpPGSqlIndexer.jar" basedir="${build}">
+ <path id="project.class.path">
+ <pathelement location="${lib}"/>
+ <pathelement path="${java.class.path}"/>
+ <pathelement path="${additional.path}"/>
+ </path>
+ <manifest>
+ <attribute name="Built-By" value="${user.name}"/>
+ <attribute name="Main-Class" value="YalpInputs.YalpPGSqlInput.YalpPGSQLIndexer.YalpPGSQLIndexer"/>
+ <attribute name="Class-Path" value="${indexerLibs}"/>
+ </manifest>
+ </jar>
+ </target>
+
+ <target name ="auth" description="builds auth base files">
+ <javac debug="true" srcdir="${srcAuth}" destdir="${build}"/>
+ </target>
+
+ <target name ="pgsqlauth" depends="interfaces, auth" description="builds the pgsql auth plugin">
+ <javac debug="true" srcdir="${srcPGSqlAuth}" destdir="${build}"/>
+ <jar destfile="yalpPGSqlAuth.jar" basedir="${build}">
+ <path id="project.class.path">
+ <pathelement location="${lib}"/>
+ <pathelement path="${java.class.path}"/>
+ <pathelement path="${additional.path}"/>
+ </path>
+ <manifest>
+ <attribute name="Built-By" value="${user.name}"/>
+ <attribute name="Main-Class" value="YalpAuth.YalpPGSqlAuth.YalpPGSqlAuth"/>
+ <attribute name="Class-Path" value="${dbLibs} ${log4jLibs}"/>
+ </manifest>
+ </jar>
+ </target>
+
+ <target name ="clients" depends="interfaces" description="builds the client bsae files">
+ <javac debug="true" srcdir="${srcClients}" destdir="${build}"/>
+ </target>
+
+ <target name ="swtclient" depends="clients" description="builds SWT GUI">
+ <javac debug="true" srcdir="${srcSwtClient}" destdir="${build}"/>
+ <jar destfile="yalpSWTClient.jar" basedir="${build}">
+ <path id="project.class.path">
+ <pathelement location="${lib}"/>
+ <pathelement path="${java.class.path}"/>
+ <pathelement path="${additional.path}"/>
+ </path>
+ <manifest>
+ <attribute name="Built-By" value="${user.name}"/>
+ <attribute name="Main-Class" value="YalpClients.SwtClient.SwtClient"/>
+ <attribute name="Class-Path" value="${swtLibs}"/>
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="swtgui" depends="swtclient">
+ <javac debug="true" srcdir="${srcSwtGUI}" destdir="${build}">
+ <classpath refid="project.class.path"/>
+ </javac>
+ </target>
+
+ <target name="clean" depends="cleandoc" description="Removes previous build">
+ <delete verbose="true">
+ <fileset dir="${build}"/>
+ <fileset dir="${srcInterfaces}"/>
+ </delete>
+ </target>
+
+ <target name="runserver" depends="server" description="starts Server">
+ <java jar="server.jar" fork="true"/>
+ </target>
+
+ <target name="runclient" depends="swtclient" description="starts Client">
+ <java jar="client.jar" fork="true"/>
+ </target>
+
+ <target name="cleandoc" depends="cleandoxydoc, cleansqldoc, cleanjavadoc"/>
+
+ <target name="cleansqldoc" description="Removes previous sqldoc">
+ <delete verbose="true">
+ <fileset dir="${sqldoc}"/>
+ </delete>
+ </target>
+
+ <target name="cleandoxydoc" description="Removes previous doxygen">
+ <delete verbose="true">
+ <fileset dir="${doxydoc}"/>
+ </delete>
+ </target>
+
+ <target name="cleanjavadoc" description="Removes previous javadoc">
+ <delete verbose="true">
+ <fileset dir="${javadoc}"/>
+ </delete>
+ </target>
+
+ <target name="doc" depends="cleandoc" description="generates javadoc">
+ <javadoc packagenames="org.umlgraph.doclet.*, YalpAuth.*, YalpServer, YalpClients.*, YalpInterfaces, YalpOutputs.*, YalpInputs.*" sourcepath="src" author="true" version="true" private="true" use="true" destdir="${javadoc}">
+ <doclet name="org.umlgraph.doclet.UmlGraphDoc" path="./build-tools/UmlGraph-5.2.jar">
+ <param name="-inferrel"/>
+ <param name="-inferdep"/>
+ <param name="-hide" value="java.*"/>
+ <param name="-collpackages" value="java.util.*"/>
+ <param name="-qualify"/>
+ <param name="-postfixpackage"/>
+ <param name="-nodefontsize" value="9"/>
+ <param name="-nodefontpackagesize" value="7"/>
+ <param name="-link" value="http://java.sun.com/javase/6/docs/guide/javadoc/doclet/spec"/>
+ <param name="-link" value="http://java.sun.com/javase/6/docs/api"/>
+ </doclet>
+ </javadoc>
+ <exec dir="." executable="${psqldoc}">
+ <arg line="-d yalp -f ${sqldoc}/yalp -h localhost -u yalp -p 5432 --password=yalp -l ./postgresql_autodoc"/>
+ </exec>
+ <exec dir="." executable="/usr/bin/doxygen">
+ <arg line="yalp.doxy"/>
+ </exec>
+ </target>
+
+</project>
diff --git a/client.policy b/client.policy index d6dfbb2..0a0cdcc 100644 --- a/client.policy +++ b/client.policy @@ -1,20 +1,20 @@ -grant { - permission java.net.SocketPermission "*:80","connect,resolve"; - permission java.util.PropertyPermission "swt.version", "read"; - permission java.util.PropertyPermission "user.dir", "read"; - permission java.util.PropertyPermission "os.name", "read"; - - permission java.util.PropertyPermission "org.eclipse.swt.internal.carbon.smallFonts", "read"; - permission java.util.PropertyPermission "org.eclipse.swt.internal.carbon.noFocusRing", "read"; - permission java.lang.RuntimePermission "loadLibrary.swt-gtk-3448", "read"; - permission java.lang.RuntimePermission "loadLibrary.swt-pi-gtk-3448", "read"; - permission java.lang.RuntimePermission "loadLibrary.swt-pi-gtk", "read"; - permission java.lang.RuntimePermission "loadLibrary.swt-pi-carbon","read"; - permission java.lang.RuntimePermission "loadLibrary.swt-pi-carbon-3139" ,"read"; - permission java.lang.RuntimePermission "loadLibrary.swt-win32-3139" ,"read"; - permission java.lang.RuntimePermission "loadLibrary.swt-carbon-3139" ,"read"; - permission java.io.FilePermission "<<ALL FILES>>","read,write,execute"; - permission java.io.FilePermission "C:\\Programme\\VideoLAN\\VLC\\vlc","execute"; - permission java.io.FilePermission "/Applications/VLC.app/Contents/MacOS/VLC","execute"; - permission java.net.SocketPermission "*:1024-","connect,resolve"; -}; +grant {
+ permission java.net.SocketPermission "*:80","connect,resolve";
+ permission java.util.PropertyPermission "swt.version", "read";
+ permission java.util.PropertyPermission "user.dir", "read";
+ permission java.util.PropertyPermission "os.name", "read";
+
+ permission java.util.PropertyPermission "org.eclipse.swt.internal.carbon.smallFonts", "read";
+ permission java.util.PropertyPermission "org.eclipse.swt.internal.carbon.noFocusRing", "read";
+ permission java.lang.RuntimePermission "loadLibrary.swt-gtk-3448", "read";
+ permission java.lang.RuntimePermission "loadLibrary.swt-pi-gtk-3448", "read";
+ permission java.lang.RuntimePermission "loadLibrary.swt-pi-gtk", "read";
+ permission java.lang.RuntimePermission "loadLibrary.swt-pi-carbon","read";
+ permission java.lang.RuntimePermission "loadLibrary.swt-pi-carbon-3139" ,"read";
+ permission java.lang.RuntimePermission "loadLibrary.swt-win32-3139" ,"read";
+ permission java.lang.RuntimePermission "loadLibrary.swt-carbon-3139" ,"read";
+ permission java.io.FilePermission "<<ALL FILES>>","read,write,execute";
+ permission java.io.FilePermission "C:\\Programme\\VideoLAN\\VLC\\vlc","execute";
+ permission java.io.FilePermission "/Applications/VLC.app/Contents/MacOS/VLC","execute";
+ permission java.net.SocketPermission "*:1024-","connect,resolve";
+};
diff --git a/lib/win-swt.jar b/lib/win-swt.jar Binary files differnew file mode 100644 index 0000000..d434d9e --- /dev/null +++ b/lib/win-swt.jar diff --git a/removed-code/Client.java b/removed-code/Client.java index 5957cf2..a945f48 100755 --- a/removed-code/Client.java +++ b/removed-code/Client.java @@ -1,48 +1,48 @@ -/* - * Copyright (c) 2006 Manuel Traut and Volker Dahnke - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: Manuel Traut and Volker Dahnke - */ - -package YalpClients.SwtClient; -import YalpClients.SwtClient.GUI.*; - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; - -/* - * Class Client - * - * <em>Instances Model, LoadDialog and StartDialog</em> - * - * @author Volker Dahnke - * - * @version 1 02-04-2006<br> - */ - public class Client implements Runnable{ - -/* - * enables the Class to be loaded dynamicly. - * Instances Model, LoadDialog and StartDialog. - */ - - public void run () { - - LoadDialog load = new LoadDialog( - new Shell(Display.getDefault(),SWT.NONE), SWT.NONE); - - load.show(); - final Model model = new Model(); - load.close(); - - StartDialog start = - new StartDialog(new Shell(Display.getDefault(),SWT.MIN),model, SWT.NONE); - - start.show(); - } -} +/*
+ * Copyright (c) 2006 Manuel Traut and Volker Dahnke
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors: Manuel Traut and Volker Dahnke
+ */
+
+package YalpClients.SwtClient;
+import YalpClients.SwtClient.GUI.*;
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+/*
+ * Class Client
+ *
+ * <em>Instances Model, LoadDialog and StartDialog</em>
+ *
+ * @author Volker Dahnke
+ *
+ * @version 1 02-04-2006<br>
+ */
+ public class Client implements Runnable{
+
+/*
+ * enables the Class to be loaded dynamicly.
+ * Instances Model, LoadDialog and StartDialog.
+ */
+
+ public void run () {
+
+ LoadDialog load = new LoadDialog(
+ new Shell(Display.getDefault(),SWT.NONE), SWT.NONE);
+
+ load.show();
+ final Model model = new Model();
+ load.close();
+
+ StartDialog start =
+ new StartDialog(new Shell(Display.getDefault(),SWT.MIN),model, SWT.NONE);
+
+ start.show();
+ }
+}
diff --git a/server.bat b/server.bat new file mode 100644 index 0000000..eb44132 --- /dev/null +++ b/server.bat @@ -0,0 +1,3 @@ +start orbd -ORBInitialPort 1050 +sleep 4 +java -Djava.library.path=D:\test\yalp\lib -jar yalpServer.jar -ORBInitialPort 1050 -ORBInitialHost localhost diff --git a/server.policy b/server.policy index 5ff3c7e..e07e45d 100644 --- a/server.policy +++ b/server.policy @@ -1,8 +1,8 @@ -grant { - permission java.io.FilePermission "<<ALL FILES>>","execute, read, write"; - permission java.io.FilePermission "C:\\Programme\\VideoLAN\\VLC\\vlc","execute"; - permission java.io.FilePermission "/Applications/VLC.app/Contents/MacOS/VLC","execute"; - permission java.net.SocketPermission "*:1024-","connect,accept,resolve"; - permission java.util.PropertyPermission "id3.default_language", "read"; - permission java.util.PropertyPermission "id3.default_encoding", "read"; -}; +grant {
+ permission java.io.FilePermission "<<ALL FILES>>","execute, read, write";
+ permission java.io.FilePermission "C:\\Programme\\VideoLAN\\VLC\\vlc","execute";
+ permission java.io.FilePermission "/Applications/VLC.app/Contents/MacOS/VLC","execute";
+ permission java.net.SocketPermission "*:1024-","connect,accept,resolve";
+ permission java.util.PropertyPermission "id3.default_language", "read";
+ permission java.util.PropertyPermission "id3.default_encoding", "read";
+};
diff --git a/src/YalpAuth/YalpPGSqlAuth/DatabaseDefines.java b/src/YalpAuth/YalpPGSqlAuth/DatabaseDefines.java index 70c00d7..5ff92c7 100644 --- a/src/YalpAuth/YalpPGSqlAuth/DatabaseDefines.java +++ b/src/YalpAuth/YalpPGSqlAuth/DatabaseDefines.java @@ -1,65 +1,65 @@ -/* - * Copyright (c) 2006 Manuel Traut and Volker Dahnke - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: Manuel Traut and Volker Dahnke - */ -package YalpAuth.YalpPGSqlAuth; - -/* - * Class DatabaseDefines - * - * <em></em> - * - * @author Manuel Traut - * - * @version 0.1 28-08-2008<br> - * - */ - -public class DatabaseDefines { - - public String dbConnection="jdbc:postgresql://10.0.3.20:5432/yalp_user"; - public String dbUser="yalp"; - public String dbPasswd="huhu"; - -/* - * set string for dbConnection - * @param dbConnection - * "jdbc:postgresql://<serverIP>:<portOfDB>/<dataBaseName>"; - */ - public void setDBConnection(String dbConnection){ - this.dbConnection = dbConnection; - } - -/* - * set userName for db Edit - * @param dbUser - */ - public void setDBUser(String dbUser){ - this.dbUser = dbUser; - } - -/* - * set string for db Password - * @param DBPasswd - */ - public void setDBPasswd(String DBPasswd){ - this.dbPasswd = DBPasswd; - } - - public String getDBConnection(){ - return this.dbConnection; - } - - public String getDBUser(){ - return this.dbUser; - } - - public String getDBPasswd(){ - return this.dbPasswd; - } -} +/*
+ * Copyright (c) 2006 Manuel Traut and Volker Dahnke
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors: Manuel Traut and Volker Dahnke
+ */
+package YalpAuth.YalpPGSqlAuth;
+
+/*
+ * Class DatabaseDefines
+ *
+ * <em></em>
+ *
+ * @author Manuel Traut
+ *
+ * @version 0.1 28-08-2008<br>
+ *
+ */
+
+public class DatabaseDefines {
+
+ public String dbConnection="jdbc:postgresql://10.0.3.20:5432/yalp_user";
+ public String dbUser="yalp";
+ public String dbPasswd="huhu";
+
+/*
+ * set string for dbConnection
+ * @param dbConnection
+ * "jdbc:postgresql://<serverIP>:<portOfDB>/<dataBaseName>";
+ */
+ public void setDBConnection(String dbConnection){
+ this.dbConnection = dbConnection;
+ }
+
+/*
+ * set userName for db Edit
+ * @param dbUser
+ */
+ public void setDBUser(String dbUser){
+ this.dbUser = dbUser;
+ }
+
+/*
+ * set string for db Password
+ * @param DBPasswd
+ */
+ public void setDBPasswd(String DBPasswd){
+ this.dbPasswd = DBPasswd;
+ }
+
+ public String getDBConnection(){
+ return this.dbConnection;
+ }
+
+ public String getDBUser(){
+ return this.dbUser;
+ }
+
+ public String getDBPasswd(){
+ return this.dbPasswd;
+ }
+}
diff --git a/src/YalpAuth/YalpPGSqlAuth/YalpPGSqlAuth.java b/src/YalpAuth/YalpPGSqlAuth/YalpPGSqlAuth.java index 676fe3c..1668684 100644 --- a/src/YalpAuth/YalpPGSqlAuth/YalpPGSqlAuth.java +++ b/src/YalpAuth/YalpPGSqlAuth/YalpPGSqlAuth.java @@ -1,33 +1,33 @@ -/* - * Copyright (c) 2006 Manuel Traut and Volker Dahnke - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: Manuel Traut and Volker Dahnke - */ -package YalpAuth.YalpPGSqlAuth; - -import YalpInterfaces.*; - -/* - * Class YalpPGSqlAuth - * - * <em>Implements functionality of the DBConnectionInterface</em> - * - * @author Volker Dahnke / Manuel Traut - * - * @version 1 02-04-2006<br> - */ - -public class YalpPGSqlAuth { - private YalpAuthInterfaceImpl con; - private DatabaseDefines config; - - public static void main(String[] args) - { - System.out.println("YalpPGSqlAuth\n"); - PGSqlAuth auth = new PGSqlAuth(args); - } -} +/*
+ * Copyright (c) 2006 Manuel Traut and Volker Dahnke
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors: Manuel Traut and Volker Dahnke
+ */
+package YalpAuth.YalpPGSqlAuth;
+
+import YalpInterfaces.*;
+
+/*
+ * Class YalpPGSqlAuth
+ *
+ * <em>Implements functionality of the DBConnectionInterface</em>
+ *
+ * @author Volker Dahnke / Manuel Traut
+ *
+ * @version 1 02-04-2006<br>
+ */
+
+public class YalpPGSqlAuth {
+ private YalpAuthPluginImpl con;
+ private DatabaseDefines config;
+
+ public static void main(String[] args)
+ {
+ System.out.println("YalpPGSqlAuth\n");
+ PGSqlAuth auth = new PGSqlAuth(args);
+ }
+}
diff --git a/src/YalpClients/SwtClient/GUI/GUI.java b/src/YalpClients/SwtClient/GUI/GUI.java index ab9db71..475f09b 100644 --- a/src/YalpClients/SwtClient/GUI/GUI.java +++ b/src/YalpClients/SwtClient/GUI/GUI.java @@ -1,2104 +1,2104 @@ -/* - * Copyright (c) 2006 Manuel Traut and Volker Dahnke - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: Manuel Traut and Volker Dahnke - */ - -package YalpClients.SwtClient.GUI; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; -import org.eclipse.swt.events.*; -import java.util.*; - -import YalpInterfaces.*; -import YalpClients.SwtClient.*; - -/* - * - * Class GUI - * - * <em></em> - * - * @author Volker Dahnke / Manuel Traut - * - * @version 1 02-04-2006<br> - * - */ -public class GUI extends org.eclipse.swt.widgets.Composite { - - public Model model; - public Composite resultComposite; - public Composite playlistComposite; - public Composite bottemComposite; - public Table resultTable1; - public Table resultTable2; - public Composite composite1; - public Composite changeComposite; - public Table UserTable; - public Composite composite3; - - private AccessRights userKind; - private StyledText styledText1; - private CTabFolder cTabFolder1; - private CTabItem tab1; - private Composite container1; - private Composite topComposite; - private Group find; - private Group logo; - private CTabItem tab2; - private Composite container2; - private Group group1; - private Group group2; - private CLabel authorLabel; - private CLabel titleLabel; - private CLabel streamLabel2; - private CLabel actualStreamLabel2; - private CLabel actualStreamLabel1; - private CLabel streamLabel1; - private CLabel data2; - private CLabel data1; - private Button shutdown; - private TableColumn ip; - private TableColumn userName; - public Table iptable; - private Composite composite4; - - private Button submitButton; - private CLabel adminAddLabel; - private CLabel passwdAddLable; - private CLabel usernameAddLable; - private CLabel realnameAddLabel; - private CCombo adminAdd; - private Text realnameAdd; - private Text passwdAdd; - private Text usernameAdd; - private Group tab3group5; - private Button next; - private Button stop; - private Button play; - private CLabel cLabel2; - private Button save; - private Text userTableId; - private Text passwd; - private Text username; - private Text userTableName; - private CLabel adminLabel; - private CCombo adminCombo; - private CLabel nameLable; - private CLabel passwdLable; - private CLabel usernameLable; - private CLabel idLable; - private Group tab3group4; - private Button delete; - private Button add1; - private Group tab3Group3; - private Group tab3Group2; - private Group tab3Group1; - private Composite container3; - private Button deleteButton; - private Button addButton; - private StyledText status; - private Button saveButton; - private Text id; - private CLabel idLabel; - private CLabel cLabel1; - private CLabel nameLabel; - private CLabel pathLabel; - private CLabel lastEditLable; - private CLabel ownerIdLabel; - private CLabel resolutionLabel; - private CLabel vBitrateLabel; - private CLabel aBitrateLabel; - private CLabel durationLabel; - private CLabel yearLabel; - private CLabel categoryLabel; - private CLabel albumLabel; - private CCombo type; - private Text name; - private Text path; - private Text lastEdit; - private Text ownerId; - private Text resolution; - private Text vBitrate; - private Text aBitrate; - private Text duration; - private Text year; - private Text category; - private Text album; - private Text author; - private Text title; - private Composite composite2; - private Table playlistTable; - private Button add2; - private Button del; - private Boolean isNotPlaying=true; - private Boolean paused =true; - private CTabItem tab3; - private Composite parent; - private Display display; - final Image pauseImage=new Image(this.getDisplay(),"img/pause.gif"); - final Image playImage=new Image(this.getDisplay(),"img/play.gif"); - final Image forwardImage=new Image(this.getDisplay(),"img/forward.gif"); - { - //Register as a resource user - SWTResourceManager will - //handle the obtaining and disposing of resources - SWTResourceManager.registerResourceUser(this); - } - - public GUI( Composite parent, Display display, Model model, - AccessRights userKind, int style ) { - - super(parent, style); - - this.parent = parent; - this.display = display; - this.model = model; - this.userKind = userKind; - - initGUI(); - } - - private void initGUI() { - try { - this.setSize(800, 600); - this.setBackground(SWTResourceManager.getColor(192, 192, 192)); - GridLayout thisLayout = new GridLayout(1, true); - thisLayout.marginWidth = 5; - thisLayout.marginHeight = 5; - thisLayout.numColumns = 1; - thisLayout.makeColumnsEqualWidth = true; - thisLayout.horizontalSpacing = 5; - thisLayout.verticalSpacing = 5; - this.setLayout(thisLayout); - - { - if (this.userKind.value() == AccessRights._USER){ - cTabFolder1 = new CTabFolder(this, SWT.NONE); - GridData cTabFolder1LData = new GridData(); - cTabFolder1LData.widthHint = 787; - cTabFolder1LData.heightHint = 568; - cTabFolder1.setLayoutData(cTabFolder1LData); - { - tab1 = new CTabItem(cTabFolder1,SWT.NONE); - tab1.setText("Find"); - { - container1 = new Composite(cTabFolder1,SWT.NONE); - tab1.setControl(container1); - RowLayout container1Layout = new RowLayout(org.eclipse.swt.SWT.HORIZONTAL); - container1.setLayout(container1Layout); - { - topComposite = new Composite(container1,SWT.NONE); - GridLayout topCompositeLayout = new GridLayout(); - topCompositeLayout.makeColumnsEqualWidth = true; - topCompositeLayout.numColumns = 2; - topCompositeLayout.verticalSpacing = 2; - topCompositeLayout.horizontalSpacing = 5; - topComposite.setLayout(topCompositeLayout); - RowData topCompositeLData = new RowData(); - topCompositeLData.width = 783; - topCompositeLData.height = 566; - topComposite.setLayoutData(topCompositeLData); - { - find = new Group(topComposite,SWT.NONE); - this.find(find,resultComposite,playlistComposite,bottemComposite,1); - } - { - logo = new Group(topComposite,SWT.NONE); - this.logo(logo); - } - { - resultComposite = new Composite(topComposite,SWT.NONE); - resultTable1 = new Table(resultComposite,SWT.MULTI|SWT.FULL_SELECTION); - resultTable1.setToolTipText("Medias"); - resultTable1.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent evt) { - add2.setEnabled(true); - } - }); - this.resultTable(resultComposite,resultTable1,1); - } - { - playlistComposite = new Composite(topComposite,SWT.NONE); - FormLayout playlistCompositeLayout = new FormLayout(); - playlistComposite.setLayout(playlistCompositeLayout); - GridData playlistCompositeLData = new GridData(); - playlistCompositeLData.heightHint = 390; - playlistCompositeLData.horizontalAlignment = GridData.FILL; - playlistComposite.setLayoutData(playlistCompositeLData); - playlistComposite.setVisible(false); - playlistComposite.setSize(238, 390); - { - next = new Button(playlistComposite,SWT.PUSH | SWT.CENTER); - FormData nextLData = new FormData(); - nextLData.width = 45; - nextLData.height = 21; - nextLData.left = new FormAttachment(0, 1000, 185); - nextLData.top = new FormAttachment(0, 1000, 365); - next.setLayoutData(nextLData); - next.setEnabled(false); - next.setFont(SWTResourceManager.getFont("Times", 8, 1, false, false)); - next.setToolTipText("play next Title"); - next.setImage(forwardImage); - next.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent evt) { - model.next(); - } - }); - } - { - stop = new Button(playlistComposite,SWT.PUSH | SWT.CENTER); - FormData stopLData = new FormData(); - stopLData.width = 35; - stopLData.height = 21; - stopLData.left = new FormAttachment(0, 1000, 91); - stopLData.top = new FormAttachment(0, 1000, 365); - stop.setLayoutData(stopLData); - stop.setImage(new Image(this.getDisplay(),"img/stop.gif")); - stop.setEnabled(false); - stop.setToolTipText("stop"); - stop.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent evt) { - if (model.stop()){ - play.setEnabled(true); - next.setEnabled(false); - stop.setEnabled(false); - play.setImage(playImage); - play.setToolTipText("play"); - isNotPlaying=true; - } - - } - }); - } - { - play = new Button(playlistComposite,SWT.PUSH | SWT.CENTER); - FormData playLData = new FormData(); - playLData.width = 35; - playLData.height = 21; - playLData.left = new FormAttachment(0, 1000, 50); - playLData.top = new FormAttachment(0, 1000, 365); - play.setLayoutData(playLData); - play.setImage(playImage); - play.setEnabled(false); - play.setToolTipText("play"); - play.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent evt) { - stop.setEnabled(true); - if (playlistTable.getItemCount()>1)next.setEnabled(true); - del.setEnabled(false); - //add2.setEnabled(false); - if (isNotPlaying){ - play.setCursor(SWTResourceManager.getCursor(SWT.CURSOR_WAIT)); - if(model.play()){ - play.setImage(pauseImage); - play.setToolTipText("pause"); - play.setCursor(SWTResourceManager.getCursor(SWT.NONE)); - isNotPlaying= false; - }else; - }else{ - if(model.pause()){ - if (paused){ - play.setImage(playImage); - play.setToolTipText("play"); - paused=false; - }else{ - play.setImage(pauseImage); - play.setToolTipText("pause"); - paused=true; - } - }else; - } - - } - }); - } - { - add2 = new Button(playlistComposite,SWT.PUSH | SWT.CENTER); - FormData addLData = new FormData(); - addLData.width = 25; - addLData.height = 21; - addLData.left = new FormAttachment(0, 1000, 2); - addLData.top = new FormAttachment(0, 1000, 160); - add2.setLayoutData(addLData); - add2.setText(">>"); - add2.setEnabled(false); - add2.setToolTipText("add to Playlist"); - add2.setFont(SWTResourceManager.getFont("Times", 8, 1, false, false)); - add2.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent evt) { - if (System.getProperty("os.name")== "Mac OS X"){ - for (int i=resultTable1.getSelectionCount()-1;i>=0;i--){ - int id=new Integer(resultTable1.getSelection()[i].getText(0)).intValue(); - System.out.println(resultTable1.getSelection()[i].getText(1)); - model.add2PlayList(id); - } - }else{ - for (int i=0;i<resultTable1.getSelectionCount();i++){ - int id=new Integer(resultTable1.getSelection()[i].getText(0)).intValue(); - System.out.println(resultTable1.getSelection()[i].getText(1)); - model.add2PlayList(id); - } - } - while(playlistTable.getItemCount()!=0){ - playlistTable.remove(0); - } - ArrayList<Media> playlist=model.getToPlaylist(); - for(int i=0;i<playlist.size();i++){ - Media result=playlist.get(i); - TableItem item = new TableItem(playlistTable,SWT.NONE); - item.setText(0,result.name); - item.setText(1,result.duration); - } - play.setEnabled(true); - if (playlistTable.getItemCount()>1&& !isNotPlaying)next.setEnabled(true); - } - }); - } - { - del = new Button(playlistComposite,SWT.PUSH | SWT.CENTER); - FormData delLData = new FormData(); - delLData.width = 25; - delLData.height = 21; - delLData.left = new FormAttachment(0, 1000, 2); - delLData.top = new FormAttachment(0, 1000, 200); - del.setLayoutData(delLData); - del.setEnabled(false); - del.setToolTipText("del from Playlist"); - del.setText("<<"); - del.setFont(SWTResourceManager.getFont("Times", 8, 1, false, false)); - del.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent evt) { - for (int i=playlistTable.getSelectionCount()-1;i>=0;i--){ - int pos = playlistTable.getSelectionIndices()[i]; - model.removeFromPlayList(pos); - } - - del.setEnabled(false); - while(playlistTable.getItemCount()!=0){ - playlistTable.remove(0); - } - ArrayList<Media> playlist=model.getToPlaylist(); - for(int i=0;i<playlist.size();i++){ - Media result=playlist.get(i); - TableItem item = new TableItem(playlistTable,SWT.NONE); - item.setText(0,result.name); - item.setText(1,result.duration); - } - if (playlistTable.getItemCount()==0)play.setEnabled(false); - } - }); - } - { - playlistTable = new Table(playlistComposite,SWT.MULTI|SWT.FULL_SELECTION); - playlistTable.setHeaderVisible(true); - FormData playlistTableLData = new FormData(); - playlistTableLData.width = 184; - playlistTableLData.height = 330; - playlistTableLData.top = new FormAttachment(24, 1000, 0); - playlistTableLData.left = new FormAttachment(0, 1000, 38); - playlistTable.setLayoutData(playlistTableLData); - playlistTable.setToolTipText("Playlist"); - playlistTable.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent evt) { - if (isNotPlaying)del.setEnabled(true); - } - }); - TableColumn title = new TableColumn(playlistTable,SWT.LEFT); - title.setText("Title"); - title.setWidth(120); - title.setMoveable(true); - TableColumn duration = new TableColumn(playlistTable,SWT.RIGHT); - duration.setText("Duration"); - duration.setWidth(80); - duration.setMoveable(true); - } - } - } - /*{ - bottemComposite = new Composite(container1,SWT.NONE); - bottemComposite.setVisible(false); - GridLayout bottemCompositeLayout = new GridLayout(); - bottemCompositeLayout.makeColumnsEqualWidth = true; - bottemCompositeLayout.verticalSpacing = 2; - bottemCompositeLayout.horizontalSpacing = 5; - bottemComposite.setLayout(bottemCompositeLayout); - RowData bottemCompositeLData = new RowData(); - bottemCompositeLData.width = 777; - bottemCompositeLData.height = 68; - bottemComposite.setLayoutData(bottemCompositeLData); - { - styledText1 = new StyledText(bottemComposite,SWT.NONE); - GridData styledText1LData = new GridData(); - styledText1LData.widthHint = 765; - styledText1LData.heightHint = 55; - styledText1.setLayoutData(styledText1LData); - styledText1.setText("styledText1"); - styledText1.setSize(765, 55); - } - }*/ - } - } - { - tab2 = new CTabItem(cTabFolder1,SWT.NONE); - tab2.setText("Change"); - { - container2 = new Composite(cTabFolder1,SWT.NONE); - GridLayout container2Layout = new GridLayout(); - container2Layout.makeColumnsEqualWidth = true; - container2.setLayout(container2Layout); - tab2.setControl(container2); - container2.setVisible(false); - { - composite2 = new Composite(container2,SWT.NONE); - GridLayout composite2Layout = new GridLayout(); - composite2Layout.makeColumnsEqualWidth = true; - composite2Layout.numColumns=2; - composite2.setLayout(composite2Layout); - GridData composite2LData = new GridData(); - composite2LData.widthHint = 780; - composite2LData.heightHint = 497; - composite2.setLayoutData(composite2LData); - { - group1 = new Group(composite2,SWT.NONE); - this.find(group1,group2,composite1,changeComposite,2); - } - { - group2 = new Group(composite2,SWT.NONE); - this.logo(group2); - } - { - composite1 = new Composite(composite2,SWT.NONE); - { - resultTable2 = new Table(composite1,SWT.MULTI|SWT.FULL_SELECTION); - resultTable2.setToolTipText("Medias"); - resultTable2.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent evt) { - if(resultTable2.getSelectionCount()<2){ - int identity =new Integer(resultTable2.getSelection()[0].getText()).intValue(); - Media result = model.getMediaWithId(identity,2); - if (result!=null){ - id.setText(new Integer(result.id).toString()); - title.setText(result.name); - /* t.b.d. parse from string props - author.setText(result.author); - album.setText(result.album); - category.setText(result.category); - year.setText(result.year); - */ - duration.setText(result.duration); - /* - aBitrate.setText(new Integer(result.aBitrate).toString()); - vBitrate.setText(new Integer(result.vBitrate).toString()); - resolution.setText(result.resolution); - */ - ownerId.setText(result.owner.name); - lastEdit.setText(result.lastEdit); - path.setText(result.path); - name.setText(result.name); - String _type = model.getTypeName(result.type); - type.setText(_type); - changeComposite.setVisible(true); - deleteButton.setVisible(true); - } - }else changeComposite.setVisible(false); - } - }); - this.resultTable(composite1,resultTable2,2); - } - } - { - changeComposite = new Composite(composite2,SWT.NONE); - FormLayout changeCompositeLayout = new FormLayout(); - changeComposite.setLayout(changeCompositeLayout); - GridData changeCompositeLData = new GridData(); - changeCompositeLData.widthHint = 238; - changeCompositeLData.heightHint = 357; - changeCompositeLData.verticalAlignment = GridData.BEGINNING; - changeComposite.setLayoutData(changeCompositeLData); - changeComposite.setVisible(false); - { - saveButton = new Button(changeComposite,SWT.PUSH | SWT.CENTER); - saveButton.setText("Save"); - FormData saveButtonLData = new FormData(); - saveButtonLData.width = 40; - saveButtonLData.height = 21; - saveButtonLData.left = new FormAttachment(0, 1000, 30); - saveButtonLData.top = new FormAttachment(0, 1000, 315); - saveButton.setLayoutData(saveButtonLData); - saveButton.setToolTipText("save Changes"); - saveButton.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent evt) { - saveButtonWidgetSelected(evt); - } - }); - } - { - id = new Text(changeComposite,SWT.NONE); - FormData idLData = new FormData(); - idLData.width = 124; - idLData.height = 14; - idLData.left = new FormAttachment(0, 1000, 100); - idLData.top = new FormAttachment(0, 1000, 10); - id.setLayoutData(idLData); - id.setEditable(false); - } - { - idLabel = new CLabel(changeComposite,SWT.NONE); - idLabel.setText("Id:"); - FormData idLabelLData = new FormData(); - idLabelLData.width = 60; - idLabelLData.height = 21; - idLabelLData.left = new FormAttachment(0, 1000, 20); - idLabelLData.top = new FormAttachment(0, 1000, 5); - idLabel.setLayoutData(idLabelLData); - } - { - cLabel1 = new CLabel(changeComposite,SWT.NONE); - cLabel1.setText("Type:"); - FormData cLabel1LData = new FormData(); - cLabel1LData.width = 60; - cLabel1LData.height = 21; - cLabel1LData.left = new FormAttachment(0, 1000, 20); - cLabel1LData.top = new FormAttachment(0, 1000, 285); - cLabel1.setLayoutData(cLabel1LData); - } - { - nameLabel = new CLabel(changeComposite,SWT.NONE); - nameLabel.setText("Name:"); - FormData nameLabelLData = new FormData(); - nameLabelLData.width = 60; - nameLabelLData.height = 21; - nameLabelLData.left = new FormAttachment(0, 1000, 20); - nameLabelLData.top = new FormAttachment(0, 1000, 265); - nameLabel.setLayoutData(nameLabelLData); - } - { - pathLabel = new CLabel(changeComposite,SWT.NONE); - pathLabel.setText("Path:"); - FormData pathLabelLData = new FormData(); - pathLabelLData.width = 60; - pathLabelLData.height = 21; - pathLabelLData.left = new FormAttachment(0, 1000, 20); - pathLabelLData.top = new FormAttachment(0, 1000, 245); - pathLabel.setLayoutData(pathLabelLData); - } - { - lastEditLable = new CLabel(changeComposite,SWT.NONE); - lastEditLable.setText("Last Edit:"); - FormData lastEditLableLData = new FormData(); - lastEditLableLData.width = 60; - lastEditLableLData.height = 21; - lastEditLableLData.left = new FormAttachment(0, 1000, 20); - lastEditLableLData.top = new FormAttachment(0, 1000, 225); - lastEditLable.setLayoutData(lastEditLableLData); - } - { - ownerIdLabel = new CLabel(changeComposite,SWT.NONE); - ownerIdLabel.setText("Owner:"); - FormData ownerIdLabelLData = new FormData(); - ownerIdLabelLData.width = 60; - ownerIdLabelLData.height = 21; - ownerIdLabelLData.left = new FormAttachment(0, 1000, 20); - ownerIdLabelLData.top = new FormAttachment(0, 1000, 205); - ownerIdLabel.setLayoutData(ownerIdLabelLData); - } - { - resolutionLabel = new CLabel(changeComposite,SWT.NONE); - resolutionLabel.setText("Resolution:"); - FormData resolutionLabelLData = new FormData(); - resolutionLabelLData.width = 60; - resolutionLabelLData.height = 21; - resolutionLabelLData.left = new FormAttachment(0, 1000, 20); - resolutionLabelLData.top = new FormAttachment(0, 1000, 185); - resolutionLabel.setLayoutData(resolutionLabelLData); - } - { - vBitrateLabel = new CLabel(changeComposite,SWT.NONE); - vBitrateLabel.setText("V-Bitrate:"); - FormData vBitrateLabelLData = new FormData(); - vBitrateLabelLData.width = 60; - vBitrateLabelLData.height = 21; - vBitrateLabelLData.left = new FormAttachment(0, 1000, 20); - vBitrateLabelLData.top = new FormAttachment(0, 1000, 165); - vBitrateLabel.setLayoutData(vBitrateLabelLData); - } - { - aBitrateLabel = new CLabel(changeComposite,SWT.NONE); - aBitrateLabel.setText("A-Bitrate:"); - FormData aBitrateLabelLData = new FormData(); - aBitrateLabelLData.width = 60; - aBitrateLabelLData.height = 21; - aBitrateLabelLData.left = new FormAttachment(0, 1000, 20); - aBitrateLabelLData.top = new FormAttachment(0, 1000, 145); - aBitrateLabel.setLayoutData(aBitrateLabelLData); - } - { - durationLabel = new CLabel(changeComposite,SWT.NONE); - durationLabel.setText("Duration:"); - FormData durationLabelLData = new FormData(); - durationLabelLData.width = 60; - durationLabelLData.height = 21; - durationLabelLData.left = new FormAttachment(0, 1000, 20); - durationLabelLData.top = new FormAttachment(0, 1000, 125); - durationLabel.setLayoutData(durationLabelLData); - } - { - yearLabel = new CLabel(changeComposite,SWT.NONE); - yearLabel.setText("Year:"); - FormData yearLabelLData = new FormData(); - yearLabelLData.width = 60; - yearLabelLData.height = 21; - yearLabelLData.left = new FormAttachment(0, 1000, 20); - yearLabelLData.top = new FormAttachment(0, 1000, 105); - yearLabel.setLayoutData(yearLabelLData); - } - { - categoryLabel = new CLabel(changeComposite,SWT.NONE); - categoryLabel.setText("Category:"); - FormData categoryLabelLData = new FormData(); - categoryLabelLData.width = 60; - categoryLabelLData.height = 21; - categoryLabelLData.left = new FormAttachment(0, 1000, 20); - categoryLabelLData.top = new FormAttachment(0, 1000, 85); - categoryLabel.setLayoutData(categoryLabelLData); - } - { - albumLabel = new CLabel(changeComposite,SWT.NONE); - albumLabel.setText("Album"); - FormData albumLabelLData = new FormData(); - albumLabelLData.width = 60; - albumLabelLData.height = 21; - albumLabelLData.left = new FormAttachment(0, 1000, 20); - albumLabelLData.top = new FormAttachment(0, 1000, 65); - albumLabel.setLayoutData(albumLabelLData); - } - { - authorLabel = new CLabel(changeComposite,SWT.NONE); - authorLabel.setText("Author:"); - FormData authorLabelLData = new FormData(); - authorLabelLData.width = 60; - authorLabelLData.height = 21; - authorLabelLData.left = new FormAttachment(0, 1000, 20); - authorLabelLData.top = new FormAttachment(0, 1000, 45); - authorLabel.setLayoutData(authorLabelLData); - } - { - titleLabel = new CLabel(changeComposite,SWT.NONE); - titleLabel.setText("Title:"); - FormData cLabel1LData1 = new FormData(); - cLabel1LData1.width = 60; - cLabel1LData1.height = 21; - cLabel1LData1.left = new FormAttachment(0, 1000, 20); - cLabel1LData1.top = new FormAttachment(0, 1000, 25); - titleLabel.setLayoutData(cLabel1LData1); - } - { - type = new CCombo(changeComposite,SWT.NONE); - FormData typeLData = new FormData(); - typeLData.width = 111; - typeLData.height = 16; - typeLData.left = new FormAttachment(0, 1000, 100); - typeLData.top = new FormAttachment(0, 1000, 290); - type.setLayoutData(typeLData); - type.setCursor(SWTResourceManager.getCursor(SWT.CURSOR_HAND)); - { - type.add("audio"); - type.add("video"); - } - } - { - name = new Text(changeComposite,SWT.NONE); - FormData nameLData = new FormData(); - nameLData.width = 124; - nameLData.height = 14; - nameLData.left = new FormAttachment(0, 1000, 100); - nameLData.top = new FormAttachment(0, 1000, 270); - name.setLayoutData(nameLData); - name.setEditable(false); - } - { - path = new Text(changeComposite,SWT.NONE); - FormData pathLData = new FormData(); - pathLData.width = 124; - pathLData.height = 14; - pathLData.left = new FormAttachment(0, 1000, 100); - pathLData.top = new FormAttachment(0, 1000, 250); - path.setLayoutData(pathLData); - path.setEditable(false); - } - { - lastEdit = new Text(changeComposite,SWT.NONE); - FormData lastEditLData = new FormData(); - lastEditLData.width = 124; - lastEditLData.height = 14; - lastEditLData.left = new FormAttachment(0, 1000, 100); - lastEditLData.top = new FormAttachment(0, 1000, 230); - lastEdit.setLayoutData(lastEditLData); - lastEdit.setEditable(false); - } - { - ownerId = new Text(changeComposite,SWT.NONE); - FormData ownerIdLData = new FormData(); - ownerIdLData.width = 124; - ownerIdLData.height = 14; - ownerIdLData.left = new FormAttachment(0, 1000, 100); - ownerIdLData.top = new FormAttachment(0, 1000, 210); - ownerId.setLayoutData(ownerIdLData); - ownerId.setEditable(false); - } - { - resolution = new Text(changeComposite,SWT.NONE); - FormData resolutionLData = new FormData(); - resolutionLData.width = 124; - resolutionLData.height = 14; - resolutionLData.left = new FormAttachment(0, 1000, 100); - resolutionLData.top = new FormAttachment(0, 1000, 190); - resolution.setLayoutData(resolutionLData); - } - { - vBitrate = new Text(changeComposite,SWT.NONE); - FormData vBitrateLData = new FormData(); - vBitrateLData.width = 124; - vBitrateLData.height = 14; - vBitrateLData.left = new FormAttachment(0, 1000, 100); - vBitrateLData.top = new FormAttachment(0, 1000, 170); - vBitrate.setLayoutData(vBitrateLData); - } - { - aBitrate = new Text(changeComposite,SWT.NONE); - FormData aBitrateLData = new FormData(); - aBitrateLData.width = 124; - aBitrateLData.height = 14; - aBitrateLData.left = new FormAttachment(0, 1000, 100); - aBitrateLData.top = new FormAttachment(0, 1000, 150); - aBitrate.setLayoutData(aBitrateLData); - } - { - duration = new Text(changeComposite,SWT.NONE); - FormData durationLData = new FormData(); - durationLData.width = 124; - durationLData.height = 14; - durationLData.left = new FormAttachment(0, 1000, 100); - durationLData.top = new FormAttachment(0, 1000, 130); - duration.setLayoutData(durationLData); - } - { - year = new Text(changeComposite,SWT.NONE); - FormData yearLData = new FormData(); - yearLData.width = 124; - yearLData.height = 14; - yearLData.left = new FormAttachment(0, 1000, 100); - yearLData.top = new FormAttachment(0, 1000, 110); - year.setLayoutData(yearLData); - } - { - category = new Text(changeComposite,SWT.NONE); - FormData categoryLData = new FormData(); - categoryLData.width = 124; - categoryLData.height = 14; - categoryLData.left = new FormAttachment(0, 1000, 100); - categoryLData.top = new FormAttachment(0, 1000, 90); - category.setLayoutData(categoryLData); - category.setCursor(SWTResourceManager.getCursor(SWT.CURSOR_WAIT)); - } - { - album = new Text(changeComposite,SWT.NONE); - FormData albumLData = new FormData(); - albumLData.width = 124; - albumLData.height = 14; - albumLData.left = new FormAttachment(0, 1000, 100); - albumLData.top = new FormAttachment(0, 1000, 70); - album.setLayoutData(albumLData); - } - { - author = new Text(changeComposite,SWT.NONE); - FormData authorLData = new FormData(); - authorLData.width = 124; - authorLData.height = 14; - authorLData.left = new FormAttachment(0, 1000, 100); - authorLData.top = new FormAttachment(0, 1000, 50); - author.setLayoutData(authorLData); - } - { - title = new Text(changeComposite,SWT.NONE); - FormData titleLData = new FormData(); - titleLData.width = 124; - titleLData.height = 13; - titleLData.top = new FormAttachment(0, 1000, 30); - titleLData.left = new FormAttachment(0, 1000, 100); - title.setLayoutData(titleLData); - } - } - } - { - composite3 = new Composite(container2,SWT.NONE); - FormLayout composite3Layout = new FormLayout(); - composite3.setLayout(composite3Layout); - GridData composite3LData = new GridData(); - composite3LData.widthHint = 777; - composite3LData.heightHint = 58; - composite3.setLayoutData(composite3LData); - { - deleteButton = new Button(composite3,SWT.PUSH | SWT.CENTER); - deleteButton.setText("Delete"); - deleteButton.setVisible(false); - FormData deleteButtonLData = new FormData(); - deleteButtonLData.width = 150; - deleteButtonLData.height = 30; - deleteButtonLData.left = new FormAttachment(0, 1000, 470); - deleteButtonLData.top = new FormAttachment(0, 1000, 15); - deleteButton.setLayoutData(deleteButtonLData); - deleteButton.setToolTipText("delete File from Database"); - deleteButton.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent evt) { - deleteButtonWidgetSelected(evt); - } - }); - } - { - addButton = new Button(composite3,SWT.PUSH | SWT.CENTER); - addButton.setText("Add"); - FormData addButtonLData = new FormData(); - addButtonLData.width = 150; - addButtonLData.height = 30; - addButtonLData.left = new FormAttachment(0, 1000, 160); - addButtonLData.top = new FormAttachment(0, 1000, 15); - addButton.setLayoutData(addButtonLData); - addButton.setToolTipText("add new Files to Database"); - addButton.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent evt) { - addButtonWidgetSelected(evt); - } - }); - } - } - } - } - { - tab3 = new CTabItem(cTabFolder1,SWT.NONE); - tab3.setText("Server"); - { - container3 = new Composite(cTabFolder1,SWT.NONE); - GridLayout container3Layout = new GridLayout(); - container3Layout.makeColumnsEqualWidth = true; - container3Layout.numColumns=2; - container3Layout.verticalSpacing = 0; - container3Layout.horizontalSpacing = 5; - container3.setLayout(container3Layout); - tab3.setControl(container3); - { - tab3Group1 = new Group(container3,SWT.NONE); - FormLayout tab3Group1Layout = new FormLayout(); - tab3Group1.setLayout(tab3Group1Layout); - GridData tab3Group1LData = new GridData(); - tab3Group1LData.widthHint = 500; - tab3Group1LData.heightHint = 129; - tab3Group1LData.horizontalAlignment = GridData.CENTER; - tab3Group1.setLayoutData(tab3Group1LData); - { - composite4 = new Composite(tab3Group1, SWT.NONE); - FormLayout composite4Layout = new FormLayout(); - composite4.setLayout(composite4Layout); - FormData composite4LData = new FormData(); - composite4LData.width = 504; - composite4LData.height = 140; - composite4LData.left = new FormAttachment(0, 1000, -3); - composite4LData.top = new FormAttachment(0, 1000, -6); - composite4.setLayoutData(composite4LData); - { - actualStreamLabel2 = new CLabel( - composite4, - SWT.NONE); - FormData actualStreamLabel2LData = new FormData(); - actualStreamLabel2LData.width = 98; - actualStreamLabel2LData.height = 21; - actualStreamLabel2LData.left = new FormAttachment(0, 1000, 180); - actualStreamLabel2LData.top = new FormAttachment(0, 1000, 65); - actualStreamLabel2.setLayoutData(actualStreamLabel2LData); - actualStreamLabel2.setFont(SWTResourceManager.getFont("Times", 8, 1, false, false)); - } - { - actualStreamLabel1 = new CLabel( - composite4, - SWT.NONE); - actualStreamLabel1.setText("Actual Number of Streams:"); - FormData actualStreamLabel1LData = new FormData(); - actualStreamLabel1LData.width = 160; - actualStreamLabel1LData.height = 21; - actualStreamLabel1LData.left = new FormAttachment(0, 1000, 14); - actualStreamLabel1LData.top = new FormAttachment(0, 1000, 65); - actualStreamLabel1.setLayoutData(actualStreamLabel1LData); - actualStreamLabel1.setFont(SWTResourceManager.getFont("Times", 8, 1, false, false)); - } - { - streamLabel2 = new CLabel( - composite4, - SWT.None); - FormData streamLabel2LData = new FormData(); - streamLabel2LData.width = 98; - streamLabel2LData.height = 21; - streamLabel2LData.left = new FormAttachment(0, 1000, 180); - streamLabel2LData.top = new FormAttachment(0, 1000, 40); - streamLabel2.setLayoutData(streamLabel2LData); - streamLabel2.setFont(SWTResourceManager.getFont("Times", 8, 1, false, false)); - } - { - streamLabel1 = new CLabel( - composite4, - SWT.NONE); - streamLabel1.setText("Total Number of Streams:"); - FormData streamLabel1LData = new FormData(); - streamLabel1LData.width = 150; - streamLabel1LData.height = 21; - streamLabel1LData.left = new FormAttachment(0, 1000, 14); - streamLabel1LData.top = new FormAttachment(0, 1000, 40); - streamLabel1.setLayoutData(streamLabel1LData); - streamLabel1.setFont(SWTResourceManager.getFont("Times", 8, 1, false, false)); - } - { - data2 = new CLabel(composite4, SWT.NONE); - FormData data2LData = new FormData(); - data2LData.width = 98; - data2LData.height = 21; - data2LData.left = new FormAttachment(0, 1000, 180); - data2LData.top = new FormAttachment(0, 1000, 15); - data2.setLayoutData(data2LData); - data2.setFont(SWTResourceManager.getFont("Times", 8, 1, false, false)); - } - { - data1 = new CLabel(composite4, SWT.NONE); - data1.setText("Total Data in Database:"); - FormData data1LData = new FormData(); - data1LData.width = 150; - data1LData.height = 21; - data1LData.left = new FormAttachment(0, 1000, 14); - data1LData.top = new FormAttachment(0, 1000, 15); - data1.setLayoutData(data1LData); - data1.setFont(SWTResourceManager.getFont("Times", 8, 1, false, false)); - } - { - shutdown = new Button(composite4, SWT.PUSH - | SWT.CENTER); - shutdown.setText("Shutdown"); - FormData shutdownLData = new FormData(); - shutdownLData.width = 77; - shutdownLData.height = 21; - shutdownLData.left = new FormAttachment(0, 1000, 35); - shutdownLData.top = new FormAttachment(0, 1000, 105); - shutdown.setLayoutData(shutdownLData); - shutdown.setToolTipText("Server shutdown"); - shutdown.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent evt) { - model.serverShutdown(); - } - }); - } - { - iptable = new Table(composite4, SWT.SINGLE); - FormData iptableLData = new FormData(); - iptableLData.width = 173; - iptableLData.height = 110; - iptableLData.left = new FormAttachment(0, 1000, 308); - iptableLData.top = new FormAttachment(0, 1000, 7); - iptable.setLayoutData(iptableLData); - iptable.setHeaderVisible(true); - iptable.setToolTipText("User online"); - { - userName = new TableColumn( - iptable, - SWT.CENTER); - userName.setText("Username"); - userName.setWidth(70); - } - { - ip = new TableColumn(iptable, SWT.BEGINNING); - ip.setText("Ip"); - ip.setWidth(119); - } - final int time = 1000; - final Runnable timer = new Runnable() { - public void run() { - refillIpTable(); - data2.setText("not supported in yalp2"); - streamLabel2.setText( /*new Integer(model.getAllStreamNum()).toString() */ "not supported in yalp2"); - display.timerExec(time, this); - actualStreamLabel2.setText( /*new Integer(model.getActualStreamNum()).toString()*/ "not supported in yalp2"); - } - }; - display.timerExec(time, timer); - } - } - } - { - tab3Group2 = new Group(container3,SWT.NONE); - this.logo(tab3Group2); - } - { - tab3Group3 = new Group(container3,SWT.NONE); - FormLayout tab3Group3Layout = new FormLayout(); - tab3Group3.setLayout(tab3Group3Layout); - GridData tab3Group3LData = new GridData(); - tab3Group3LData.widthHint = 500; - tab3Group3LData.heightHint = 284; - tab3Group3LData.horizontalAlignment = GridData.CENTER; - tab3Group3.setLayoutData(tab3Group3LData); - tab3Group3.setText("User Management"); - { - delete = new Button(tab3Group3,SWT.PUSH | SWT.CENTER); - delete.setText("Delete"); - FormData deleteLData = new FormData(); - deleteLData.width = 45; - deleteLData.height = 21; - deleteLData.left = new FormAttachment(0, 1000, 447); - deleteLData.top = new FormAttachment(0, 1000, 254); - delete.setLayoutData(deleteLData); - delete.setToolTipText("delete User"); - delete.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent evt) { - YalpUser toChange = new YalpUser(); - toChange.id = new Integer(userTableId.getText()).intValue(); - toChange.name = username.getText(); - model.changeUser(toChange, passwd.getText(), Action.DELETE); - while(UserTable.getItemCount()!=0){ - UserTable.remove(0); - } - ArrayList<YalpUser> resultList = model.getUser(); - for (int i = 0; i < resultList.size(); i++) { - TableItem item; - YalpUser result = resultList.get(i); - item = new TableItem(UserTable,SWT.NONE); - item.setText(0,new Integer(result.id).toString()); - item.setText(1,result.name); - // item.setText(2,result.password); - item.setText(3,result.realName); - item.setText(4,model.accessRightsName(result.level)); - } - tab3group4.setVisible(false); - } - }); - } - { - add1 = new Button(tab3Group3,SWT.PUSH | SWT.CENTER); - add1.setText("Add"); - FormData addLData = new FormData(); - addLData.width = 45; - addLData.height = 21; - addLData.left = new FormAttachment(0, 1000, 7); - addLData.top = new FormAttachment(0, 1000, 254); - add1.setLayoutData(addLData); - add1.setToolTipText("add new User "); - add1.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent evt) { - tab3group5.setVisible(true); - } - }); - } - { - UserTable = new Table(tab3Group3,SWT.SINGLE|SWT.FULL_SELECTION); - FormData UserTableLData = new FormData(); - UserTableLData.width = 467; - UserTableLData.height = 224; - UserTableLData.left = new FormAttachment(11, 1000, 0); - UserTableLData.right = new FormAttachment(988, 1000, 0); - UserTableLData.top = new FormAttachment(19, 1000, 0); - UserTableLData.bottom = new FormAttachment(864, 1000, 0); - UserTable.setLayoutData(UserTableLData); - UserTable.setHeaderVisible(true); - UserTable.setToolTipText("registrated User"); - UserTable.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent evt) { - userTableId.setText(UserTable.getSelection()[0].getText(0)); - username.setText(UserTable.getSelection()[0].getText(1)); - passwd.setText(UserTable.getSelection()[0].getText(2)); - userTableName.setText(UserTable.getSelection()[0].getText(3)); - adminCombo.setText(UserTable.getSelection()[0].getText(4)); - tab3group4.setVisible(true); - } - }); - { - TableColumn id = new TableColumn(UserTable,SWT.BEGINNING); - id.setText("ID"); - id.setWidth(45); - id.setMoveable(true); - id.addListener(SWT.Selection, new SortListener(this,UserTable,0,5)); - TableColumn userName = new TableColumn(UserTable,SWT.BEGINNING); - userName.setMoveable(true); - userName.setText("Username"); - userName.setWidth(120); - userName.addListener(SWT.Selection, new SortListener(this,UserTable,1,5)); - TableColumn passwd = new TableColumn(UserTable,SWT.BEGINNING); - passwd.setMoveable(true); - passwd.setText("Password"); - passwd.setWidth(120); - passwd.addListener(SWT.Selection, new SortListener(this,UserTable,2,5)); - TableColumn name = new TableColumn(UserTable,SWT.BEGINNING); - name.setMoveable(true); - name.setText("Name"); - name.setWidth(130); - name.addListener(SWT.Selection, new SortListener(this,UserTable,3,5)); - TableColumn admin = new TableColumn(UserTable,SWT.BEGINNING); - admin.setMoveable(true); - admin.setText("Admin"); - admin.setWidth(74); - admin.addListener(SWT.Selection, new SortListener(this,UserTable,4,5)); - //TableColumn huhu=new TableColumn(UserTable,SWT.BEGINNING); - //huhu.dispose(); - ArrayList<YalpUser> resultList = model.getUser(); - for (int i = 0; i < resultList.size(); i++) { - TableItem item; - YalpUser result = resultList.get(i); - item = new TableItem(UserTable,SWT.NONE); - item.setText(0,new Integer(result.id).toString()); - item.setText(1,result.name); - //item.setText(2,result.passwd); - item.setText(3,result.realName); - item.setText(4,model.accessRightsName(result.level)); - } - } - } - } - { - tab3group4 = new Group(container3,SWT.NONE); - FormLayout tab3group4Layout = new FormLayout(); - tab3group4.setLayout(tab3group4Layout); - tab3group4.setText("Edit User"); - GridData tab3group4LData = new GridData(); - tab3group4LData.widthHint = 256; - tab3group4LData.heightHint = 284; - tab3group4.setLayoutData(tab3group4LData); - tab3group4.setVisible(false); - { - save = new Button(tab3group4,SWT.PUSH | SWT.CENTER); - save.setText("save"); - FormData saveLData = new FormData(); - saveLData.width = 45; - saveLData.height = 21; - saveLData.left = new FormAttachment(0, 1000, 42); - saveLData.top = new FormAttachment(0, 1000, 157); - save.setLayoutData(saveLData); - save.setToolTipText("save Changes"); - save.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent evt) { - YalpUser toChange = new YalpUser(); - toChange.id = new Integer(userTableId.getText()).intValue(); - toChange.name = username.getText(); - model.changeUser(toChange, passwd.getText(), Action.EDIT); - while(UserTable.getItemCount()!=0){ - UserTable.remove(0); - } - ArrayList<YalpUser> resultList = model.getUser(); - for (int i = 0; i < resultList.size(); i++) { - TableItem item; - YalpUser result = resultList.get(i); - item = new TableItem(UserTable,SWT.NONE); - item.setText(0,new Integer(result.id).toString()); - item.setText(1,result.name); - //item.setText(2,result.passwd); - item.setText(3,result.realName); - item.setText(4,model.accessRightsName(result.level)); - } - tab3group4.setVisible(false); - } - }); - } - { - userTableName = new Text(tab3group4,SWT.NONE); - FormData text2LData = new FormData(); - text2LData.width = 94; - text2LData.height = 14; - text2LData.left = new FormAttachment(0, 1000, 117); - text2LData.top = new FormAttachment(0, 1000, 112); - userTableName .setLayoutData(text2LData); - } - { - passwd = new Text(tab3group4,SWT.NONE); - FormData passwdLData = new FormData(); - passwdLData.width = 94; - passwdLData.height = 14; - passwdLData.left = new FormAttachment(0, 1000, 117); - passwdLData.top = new FormAttachment(0, 1000, 92); - passwd.setLayoutData(passwdLData); - } - { - username = new Text(tab3group4,SWT.NONE); - FormData usernameLData = new FormData(); - usernameLData.width = 94; - usernameLData.height = 14; - usernameLData.left = new FormAttachment(0, 1000, 117); - usernameLData.top = new FormAttachment(0, 1000, 72); - username.setLayoutData(usernameLData); - } - { - userTableId = new Text(tab3group4,SWT.NONE); - FormData text1LData = new FormData(); - text1LData.width = 94; - text1LData.height = 14; - text1LData.left = new FormAttachment(0, 1000, 117); - text1LData.top = new FormAttachment(0, 1000, 52); - userTableId.setLayoutData(text1LData); - userTableId.setEditable(false); - } - { - adminLabel = new CLabel(tab3group4,SWT.NONE); - adminLabel.setText("Admin:"); - FormData adminLabelLData = new FormData(); - adminLabelLData.width = 42; - adminLabelLData.height = 21; - adminLabelLData.left = new FormAttachment(0, 1000, 27); - adminLabelLData.top = new FormAttachment(0, 1000, 127); - adminLabel.setLayoutData(adminLabelLData); - } - { - idLable = new CLabel(tab3group4,SWT.NONE); - idLable.setText("Id:"); - FormData idLableLData = new FormData(); - idLableLData.width = 20; - idLableLData.height = 21; - idLableLData.left = new FormAttachment(107, 1000, 0); - idLableLData.right = new FormAttachment(185, 1000, 0); - idLableLData.top = new FormAttachment(167, 1000, 0); - idLableLData.bottom = new FormAttachment(241, 1000, 0); - idLable.setLayoutData(idLableLData); - } - { - usernameLable = new CLabel(tab3group4,SWT.NONE); - usernameLable.setText("Username:"); - FormData usernameLableLData = new FormData(); - usernameLableLData.width = 58; - usernameLableLData.height = 21; - usernameLableLData.left = new FormAttachment(107, 1000, 0); - usernameLableLData.right = new FormAttachment(333, 1000, 0); - usernameLableLData.top = new FormAttachment(237, 1000, 0); - usernameLableLData.bottom = new FormAttachment(311, 1000, 0); - usernameLable.setLayoutData(usernameLableLData); - } - { - passwdLable = new CLabel(tab3group4,SWT.NONE); - passwdLable.setText("Password:"); - FormData passwdLableLData = new FormData(); - passwdLableLData.width = 56; - passwdLableLData.height = 21; - passwdLableLData.left = new FormAttachment(107, 1000, 0); - passwdLableLData.right = new FormAttachment(326, 1000, 0); - passwdLableLData.top = new FormAttachment(308, 1000, 0); - passwdLableLData.bottom = new FormAttachment(382, 1000, 0); - passwdLable.setLayoutData(passwdLableLData); - } - { - nameLable = new CLabel(tab3group4,SWT.NONE); - nameLable.setText("Name:"); - FormData nameLableLData = new FormData(); - nameLableLData.width = 37; - nameLableLData.height = 21; - nameLableLData.left = new FormAttachment(107, 1000, 0); - nameLableLData.right = new FormAttachment(251, 1000, 0); - nameLableLData.top = new FormAttachment(378, 1000, 0); - nameLableLData.bottom = new FormAttachment(452, 1000, 0); - nameLable.setLayoutData(nameLableLData); - } - { - adminCombo = new CCombo(tab3group4,SWT.NONE); - FormData adminComboLData = new FormData(); - adminComboLData.width = 81; - adminComboLData.height = 16; - adminComboLData.left = new FormAttachment(458, 1000, 0); - adminComboLData.right = new FormAttachment(849, 1000, 0); - adminComboLData.top = new FormAttachment(466, 1000, 0); - adminComboLData.bottom = new FormAttachment(522, 1000, 0); - adminCombo.setLayoutData(adminComboLData); - { - adminCombo.add("true"); - adminCombo.add("false"); - } - } - } - tab3group5 = new Group(container3,SWT.NONE); - FormLayout tab3group5Layout = new FormLayout(); - tab3group5.setLayout(tab3group5Layout); - GridData tab3group5LData = new GridData(); - tab3group5LData.widthHint = 500; - tab3group5LData.heightHint = 99; - tab3group5.setLayoutData(tab3group5LData); - tab3group5.setText("Add User"); - tab3group5.setVisible(false); - { - submitButton = new Button(tab3group5,SWT.PUSH | SWT.CENTER); - submitButton.setText("Submit"); - FormData submitButtonLData = new FormData(); - submitButtonLData.width = 50; - submitButtonLData.height = 21; - submitButtonLData.left = new FormAttachment(0, 1000, 382); - submitButtonLData.top = new FormAttachment(0, 1000, 52); - submitButton.setLayoutData(submitButtonLData); - submitButton.setToolTipText("add User"); - submitButton.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent evt) { - System.out.println("submit"); - YalpUser toChange = new YalpUser(); - toChange.id = 100; - toChange.name = usernameAdd.getText(); - toChange.realName = realnameAdd.getText(); - model.changeUser(toChange, passwdAdd.getText(), Action.CREATE); - while(UserTable.getItemCount()!=0){ - UserTable.remove(0); - } - ArrayList<YalpUser> resultList = model.getUser(); - for (int i = 0; i < resultList.size(); i++) { - TableItem item; - YalpUser result = resultList.get(i); - item = new TableItem(UserTable,SWT.NONE); - item.setText(0,new Integer(result.id).toString()); - item.setText(1,result.name); - //item.setText(2,result.passwd); - item.setText(3,result.realName); - item.setText(4,model.accessRightsName(result.level)); - } - } - }); - } - { - adminAddLabel = new CLabel(tab3group5,SWT.NONE); - adminAddLabel.setText("Admin:"); - FormData adminAddLabelLData = new FormData(); - adminAddLabelLData.width = 40; - adminAddLabelLData.height = 21; - adminAddLabelLData.left = new FormAttachment(0, 1000, 291); - adminAddLabelLData.top = new FormAttachment(0, 1000, 17); - adminAddLabel.setLayoutData(adminAddLabelLData); - } - { - passwdAddLable = new CLabel(tab3group5,SWT.NONE); - passwdAddLable.setText("Password:"); - FormData passwdAddLableLData = new FormData(); - passwdAddLableLData.width = 60; - passwdAddLableLData.height = 21; - passwdAddLableLData.left = new FormAttachment(0, 1000, 17); - passwdAddLableLData.top = new FormAttachment(0, 1000, 57); - passwdAddLable.setLayoutData(passwdAddLableLData); - } - { - usernameAddLable = new CLabel(tab3group5,SWT.NONE); - usernameAddLable.setText("Username:"); - FormData usernameAddLableLData = new FormData(); - usernameAddLableLData.width = 60; - usernameAddLableLData.height = 21; - usernameAddLableLData.left = new FormAttachment(0, 1000, 17); - usernameAddLableLData.top = new FormAttachment(0, 1000, 37); - usernameAddLable.setLayoutData(usernameAddLableLData); - } - { - realnameAddLabel = new CLabel(tab3group5,SWT.NONE); - realnameAddLabel.setText("Name:"); - FormData realnameAddLabelLData = new FormData(); - realnameAddLabelLData.width = 60; - realnameAddLabelLData.height = 21; - realnameAddLabelLData.left = new FormAttachment(0, 1000, 17); - realnameAddLabelLData.top = new FormAttachment(0, 1000, 17); - realnameAddLabel.setLayoutData(realnameAddLabelLData); - } - { - adminAdd = new CCombo(tab3group5,SWT.NONE); - FormData adminAddLData = new FormData(); - adminAddLData.width = 65; - adminAddLData.height = 12; - adminAddLData.left = new FormAttachment(0, 1000, 347); - adminAddLData.top = new FormAttachment(0, 1000, 22); - adminAdd.setLayoutData(adminAddLData); - adminAdd.setText("false"); - { - adminAdd.add("false"); - adminAdd.add("true"); - } - } - { - realnameAdd = new Text(tab3group5,SWT.NONE); - FormData realnameAddLData = new FormData(); - realnameAddLData.width = 174; - realnameAddLData.height = 14; - realnameAddLData.left = new FormAttachment(0, 1000, 82); - realnameAddLData.top = new FormAttachment(0, 1000, 22); - realnameAdd.setLayoutData(realnameAddLData); - } - { - usernameAdd = new Text(tab3group5,SWT.NONE); - FormData usernameAddLData = new FormData(); - usernameAddLData.width = 174; - usernameAddLData.height = 13; - usernameAddLData.left = new FormAttachment(165, 1000, 0); - usernameAddLData.right = new FormAttachment(525, 1000, 0); - usernameAddLData.top = new FormAttachment(429, 1000, 0); - usernameAddLData.bottom = new FormAttachment(560, 1000, 0); - usernameAdd.setLayoutData(usernameAddLData); - } - { - FormData PasswdAddLData = new FormData(); - PasswdAddLData.width = 174; - PasswdAddLData.height = 13; - PasswdAddLData.left = new FormAttachment(165, 1000, 0); - PasswdAddLData.right = new FormAttachment(525, 1000, 0); - PasswdAddLData.top = new FormAttachment(631, 1000, 0); - PasswdAddLData.bottom = new FormAttachment(762, 1000, 0); - passwdAdd = new Text(tab3group5,SWT.NONE); - passwdAdd.setLayoutData(PasswdAddLData); - } - } - } - cTabFolder1.setSelection(0); - } - else{ - GridData testLData = new GridData(); - testLData.widthHint = 792; - testLData.heightHint = 590; - Composite simpelUser = new Composite(this, SWT.NONE); - RowLayout testLayout = new RowLayout(org.eclipse.swt.SWT.HORIZONTAL); - simpelUser.setLayout(testLayout); - simpelUser.setLayoutData(testLData); - { - topComposite = new Composite(simpelUser,SWT.NONE); - GridLayout topCompositeLayout = new GridLayout(); - topCompositeLayout.makeColumnsEqualWidth = true; - topCompositeLayout.numColumns = 2; - topCompositeLayout.verticalSpacing = 2; - topCompositeLayout.horizontalSpacing = 5; - topComposite.setLayout(topCompositeLayout); - RowData topCompositeLData = new RowData(); - topCompositeLData.width = 783; - topCompositeLData.height = 566; - topComposite.setLayoutData(topCompositeLData); - { - find = new Group(topComposite,SWT.NONE); - this.find(find,resultComposite,playlistComposite,bottemComposite,1); - } - { - logo = new Group(topComposite,SWT.NONE); - this.logo(logo); - } - { - resultComposite = new Composite(topComposite,SWT.NONE); - resultTable1 = new Table(resultComposite,SWT.MULTI|SWT.FULL_SELECTION); - resultTable1.setToolTipText("Medias"); - resultTable1.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent evt) { - add2.setEnabled(true); - } - }); - this.resultTable(resultComposite,resultTable1,1); - } - { - playlistComposite = new Composite(topComposite,SWT.NONE); - FormLayout playlistCompositeLayout = new FormLayout(); - playlistComposite.setLayout(playlistCompositeLayout); - GridData playlistCompositeLData = new GridData(); - playlistCompositeLData.heightHint = 390; - playlistCompositeLData.horizontalAlignment = GridData.FILL; - playlistComposite.setLayoutData(playlistCompositeLData); - playlistComposite.setVisible(false); - playlistComposite.setSize(238, 390); - { - next = new Button(playlistComposite,SWT.PUSH | SWT.CENTER); - FormData nextLData = new FormData(); - nextLData.width = 45; - nextLData.height = 21; - nextLData.left = new FormAttachment(0, 1000, 185); - nextLData.top = new FormAttachment(0, 1000, 365); - next.setLayoutData(nextLData); - next.setEnabled(false); - next.setFont(SWTResourceManager.getFont("Times", 8, 1, false, false)); - next.setToolTipText("play next Title"); - next.setImage(forwardImage); - next.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent evt) { - model.next(); - } - }); - } - { - stop = new Button(playlistComposite,SWT.PUSH | SWT.CENTER); - FormData stopLData = new FormData(); - stopLData.width = 35; - stopLData.height = 21; - stopLData.left = new FormAttachment(0, 1000, 91); - stopLData.top = new FormAttachment(0, 1000, 365); - stop.setLayoutData(stopLData); - stop.setImage(new Image(this.getDisplay(),"img/stop.gif")); - stop.setEnabled(false); - stop.setToolTipText("stop"); - stop.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent evt) { - if (model.stop()){ - play.setEnabled(true); - next.setEnabled(false); - stop.setEnabled(false); - play.setImage(playImage); - play.setToolTipText("play"); - isNotPlaying=true; - } - - } - }); - } - { - play = new Button(playlistComposite,SWT.PUSH | SWT.CENTER); - FormData playLData = new FormData(); - playLData.width = 35; - playLData.height = 21; - playLData.left = new FormAttachment(0, 1000, 50); - playLData.top = new FormAttachment(0, 1000, 365); - play.setLayoutData(playLData); - play.setImage(playImage); - play.setEnabled(false); - play.setToolTipText("play"); - play.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent evt) { - stop.setEnabled(true); - if (playlistTable.getItemCount()>1)next.setEnabled(true); - del.setEnabled(false); - //add2.setEnabled(false); - if (isNotPlaying){ - play.setCursor(SWTResourceManager.getCursor(SWT.CURSOR_WAIT)); - if(model.play()){ - play.setImage(pauseImage); - play.setToolTipText("pause"); - play.setCursor(SWTResourceManager.getCursor(SWT.NONE)); - isNotPlaying= false; - }else; - }else{ - if(model.pause()){ - if (paused){ - play.setImage(playImage); - play.setToolTipText("play"); - paused=false; - }else{ - play.setImage(pauseImage); - play.setToolTipText("pause"); - paused=true; - } - }else; - } - - } - }); - } - { - add2 = new Button(playlistComposite,SWT.PUSH | SWT.CENTER); - FormData addLData = new FormData(); - addLData.width = 25; - addLData.height = 21; - addLData.left = new FormAttachment(0, 1000, 2); - addLData.top = new FormAttachment(0, 1000, 160); - add2.setLayoutData(addLData); - add2.setText(">>"); - add2.setEnabled(false); - add2.setToolTipText("add to Playlist"); - add2.setFont(SWTResourceManager.getFont("Times", 8, 1, false, false)); - add2.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent evt) { - if (System.getProperty("os.name")== "Mac OS X"){ - for (int i=resultTable1.getSelectionCount()-1;i>=0;i--){ - int id=new Integer(resultTable1.getSelection()[i].getText(0)).intValue(); - System.out.println(resultTable1.getSelection()[i].getText(1)); - model.add2PlayList(id); - } - }else{ - for (int i=0;i<resultTable1.getSelectionCount();i++){ - int id=new Integer(resultTable1.getSelection()[i].getText(0)).intValue(); - System.out.println(resultTable1.getSelection()[i].getText(1)); - model.add2PlayList(id); - } - } - while(playlistTable.getItemCount()!=0){ - playlistTable.remove(0); - } - ArrayList<Media> playlist=model.getToPlaylist(); - for(int i=0;i<playlist.size();i++){ - Media result=playlist.get(i); - TableItem item = new TableItem(playlistTable,SWT.NONE); - item.setText(0,result.name); - item.setText(1,result.duration); - } - play.setEnabled(true); - if (playlistTable.getItemCount()>1&& !isNotPlaying)next.setEnabled(true); - } - }); - } - { - del = new Button(playlistComposite,SWT.PUSH | SWT.CENTER); - FormData delLData = new FormData(); - delLData.width = 25; - delLData.height = 21; - delLData.left = new FormAttachment(0, 1000, 2); - delLData.top = new FormAttachment(0, 1000, 200); - del.setLayoutData(delLData); - del.setEnabled(false); - del.setToolTipText("del from Playlist"); - del.setText("<<"); - del.setFont(SWTResourceManager.getFont("Times", 8, 1, false, false)); - del.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent evt) { - for (int i=playlistTable.getSelectionCount()-1;i>=0;i--){ - int pos = playlistTable.getSelectionIndices()[i]; - model.removeFromPlayList(pos); - } - - del.setEnabled(false); - while(playlistTable.getItemCount()!=0){ - playlistTable.remove(0); - } - ArrayList<Media> playlist=model.getToPlaylist(); - for(int i=0;i<playlist.size();i++){ - Media result=playlist.get(i); - TableItem item = new TableItem(playlistTable,SWT.NONE); - item.setText(0,result.name); - item.setText(1,result.duration); - } - if (playlistTable.getItemCount()==0)play.setEnabled(false); - } - }); - } - { - playlistTable = new Table(playlistComposite,SWT.MULTI|SWT.FULL_SELECTION); - playlistTable.setHeaderVisible(true); - FormData playlistTableLData = new FormData(); - playlistTableLData.width = 184; - playlistTableLData.height = 330; - playlistTableLData.top = new FormAttachment(24, 1000, 0); - playlistTableLData.left = new FormAttachment(0, 1000, 38); - playlistTable.setLayoutData(playlistTableLData); - playlistTable.setToolTipText("Playlist"); - playlistTable.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent evt) { - if (isNotPlaying)del.setEnabled(true); - } - }); - TableColumn title = new TableColumn(playlistTable,SWT.LEFT); - title.setText("Title"); - title.setWidth(120); - title.setMoveable(true); - TableColumn duration = new TableColumn(playlistTable,SWT.RIGHT); - duration.setText("Duration"); - duration.setWidth(80); - duration.setMoveable(true); - } - } - } - } - } - this.layout(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - //TODO:start find - private void find(Group find,Composite resultComposite, Composite playlistComposite,Composite bottemComposite,int _tab){ - final Text searchField = new Text(find,SWT.NONE); - final Button findButton = new Button(find,SWT.PUSH | SWT.CENTER); - final Button allCheckBox = new Button(find,SWT.RADIO | SWT.LEFT); - final Button videoCheckBox = new Button(find,SWT.RADIO | SWT.LEFT); - final Button audioCheckBox = new Button(find,SWT.RADIO | SWT.LEFT); - final CLabel returnNum= new CLabel(find, SWT.NONE); - final int tab=_tab; - { - cLabel2 = new CLabel(find, SWT.NONE); - if (tab==1)cLabel2.setText("find and stream mutimedia files"); - else cLabel2.setText("find and manage mutimedia files"); - FormData cLabel2LData = new FormData(); - cLabel2LData.width = 250; - cLabel2LData.height = 21; - cLabel2LData.left = new FormAttachment(0,1000,46); - cLabel2LData.top = new FormAttachment(0,1000,13); - cLabel2.setLayoutData(cLabel2LData); - } - { - - FormData allCheckBoxLData = new FormData(); - allCheckBoxLData.left = new FormAttachment(0, 1000, 95); - allCheckBoxLData.top = new FormAttachment(0, 1000, 98); - allCheckBoxLData.width = 56; - allCheckBoxLData.height = 14; - allCheckBox.setLayoutData(allCheckBoxLData); - allCheckBox.setText("All"); - allCheckBox.setSelection(true); - allCheckBox.setToolTipText("Find Audio and Video Files"); - allCheckBox.addKeyListener(new KeyAdapter() { - public void keyPressed(KeyEvent evt) { - if (evt.character == SWT.CR) { - searchPressed( - searchField, - videoCheckBox, - audioCheckBox, - returnNum, - tab); - } - } - }); - } - { - - FormData audioCheckBoxLData = new FormData(); - audioCheckBoxLData.left = new FormAttachment(0, 1000, 195); - audioCheckBoxLData.top = new FormAttachment(0, 1000, 98); - audioCheckBoxLData.width = 56; - audioCheckBoxLData.height = 14; - audioCheckBox.setLayoutData(audioCheckBoxLData); - audioCheckBox.setText("Audio"); - audioCheckBox.setToolTipText("Find Audio Files"); - audioCheckBox - .addKeyListener(new KeyAdapter() { - public void keyPressed(KeyEvent evt) { - if (evt.character == SWT.CR) { - searchPressed( - searchField, - videoCheckBox, - audioCheckBox, - returnNum, - tab); - } - } - }); - } - { - - FormData videoCheckBoxLData = new FormData(); - videoCheckBoxLData.left = new FormAttachment(0, 1000, 296); - videoCheckBoxLData.top = new FormAttachment(0, 1000, 98); - videoCheckBoxLData.width = 56; - videoCheckBoxLData.height = 14; - videoCheckBox.setLayoutData(videoCheckBoxLData); - videoCheckBox.setText("Video"); - videoCheckBox.setToolTipText("Find Video Files"); - videoCheckBox - .addKeyListener(new KeyAdapter() { - public void keyPressed(KeyEvent evt) { - if (evt.character == SWT.CR) { - searchPressed( - searchField, - videoCheckBox, - audioCheckBox, - returnNum, - tab); - } - } - }); - } - - - FormLayout findLayout = new FormLayout(); - find.setLayout(findLayout); - GridData findLData = new GridData(); - findLData.widthHint = 497; - findLData.heightHint = 130; - find.setLayoutData(findLData); - find.setSize(497, 104); - find.addKeyListener(new KeyAdapter() { - public void keyPressed(KeyEvent evt) { - if (evt.character==SWT.CR){ - searchPressed(searchField,videoCheckBox,audioCheckBox,returnNum,tab); - } - } - }); - { - //searchField - FormData searchFieldLData = new FormData(); - searchFieldLData.width = 344; - searchFieldLData.height = 20; - searchFieldLData.left = new FormAttachment(0,1000,37); - searchFieldLData.top = new FormAttachment(0,1000,55); - searchField.setLayoutData(searchFieldLData); - searchField.setFont(SWTResourceManager.getFont("Times",12,0,false,false)); - searchField.setToolTipText("Keyword"); - searchField.addKeyListener(new KeyAdapter() { - public void keyPressed(KeyEvent evt) { - if (evt.character==SWT.CR){ - searchPressed(searchField,videoCheckBox,audioCheckBox,returnNum,tab); - } - } - }); - } - { - //findButton - findButton.setText("Find"); - FormData findButtonLData = new FormData(70,26); - findButtonLData.width = 70; - findButtonLData.height = 26; - findButtonLData.left = new FormAttachment(0,1000,403); - findButtonLData.top = new FormAttachment(0,1000,52); - findButton.setLayoutData(findButtonLData); - findButton.setSize(70, 26); - findButton.setToolTipText("Find"); - findButton.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent evt) { - add2.setEnabled(false); - searchPressed(searchField,videoCheckBox,audioCheckBox,returnNum,tab); - } - }); - } - { - returnNum.setText(""); - FormData returnNumLData = new FormData(); - returnNumLData.width = 63; - returnNumLData.height = 21; - returnNumLData.left = new FormAttachment(0, 1000, 410); - returnNumLData.top = new FormAttachment(0, 1000, 93); - returnNum.setLayoutData(returnNumLData); - } - } - - //TODO logo - private void logo(Group logo){ - FormLayout logoLayout = new FormLayout(); - logo.setLayout(logoLayout); - GridData logoLData = new GridData(); - logoLData.widthHint = 260; - logoLData.heightHint = 130; - logo.setLayoutData(logoLData); - logoLayout.marginWidth=30; - logoLayout.marginHeight=0; - { - cLabel2 = new CLabel(logo,SWT.NONE); - cLabel2.setImage(new Image(this.getDisplay(),"img/yalpV2.gif")); - } - - - - } - - - - //TODO resultComposite - private void resultTable(Composite resultComposite,Table resultTable,int tab){ - - resultComposite.setVisible(false); - FormLayout resultCompositeLayout = new FormLayout(); - resultComposite.setLayout(resultCompositeLayout); - GridData resultCompositeLData = new GridData(); - resultCompositeLData.widthHint = 502; - if (tab==1)resultCompositeLData.heightHint = 390; - else resultCompositeLData.heightHint = 380; - resultComposite.setLayoutData(resultCompositeLData); - { - FormData resultTableLData = new FormData(); - resultTableLData.width = 482; - if (tab==1)resultTableLData.height = 365; - else resultTableLData.height = 313; - resultTableLData.left = new FormAttachment(0, 1000, 0); - resultTableLData.top = new FormAttachment(0, 1000, 7); - resultTable.setLayoutData(resultTableLData); - resultTable.setHeaderVisible(true); - TableColumn id = new TableColumn(resultTable,SWT.RIGHT); - id.setText("ID"); - id.setWidth(0); - id.setMoveable(true); - id.addListener(SWT.Selection, new SortListener(this,resultTable,0,8)); - TableColumn title = new TableColumn(resultTable,SWT.LEFT); - title.setText("Title"); - title.setWidth(110); - title.setMoveable(true); - title.addListener(SWT.Selection, new SortListener(this,resultTable,1,8)); - TableColumn author = new TableColumn(resultTable,SWT.LEFT); - author.setText("Author"); - author.setWidth(100); - author.setMoveable(true); - author.addListener(SWT.Selection, new SortListener(this,resultTable,2,8)); - TableColumn album = new TableColumn(resultTable,SWT.LEFT); - album.setText("Album"); - album.setWidth(100); - album.setMoveable(true); - album.addListener(SWT.Selection, new SortListener(this,resultTable,3,8)); - TableColumn year = new TableColumn(resultTable,SWT.LEFT); - year.setText("Year"); - year.setWidth(60); - year.setMoveable(true); - year.addListener(SWT.Selection, new SortListener(this,resultTable,4,8)); - TableColumn category = new TableColumn(resultTable,SWT.LEFT); - category.setText("Category"); - category.setWidth(60); - category.setMoveable(true); - category.addListener(SWT.Selection, new SortListener(this,resultTable,5,8)); - TableColumn type = new TableColumn(resultTable,SWT.LEFT); - type.setText("Type"); - type.setWidth(60); - type.setMoveable(true); - type.addListener(SWT.Selection, new SortListener(this,resultTable,6,8)); - } - - } - private void saveButtonWidgetSelected(SelectionEvent evt) { - try{ - int OwnerId = model.getOwnerid(ownerId.getText()); - Media media = new Media(); - media.id = new Integer(id.getText()).intValue(); - media.name = title.getText(); - media.duration = duration.getText(); - media.lastEdit = new Date(System.currentTimeMillis()).toString(); - media.path = path.getText(); - media.fileName = name.getText(); - /* t.b.d. - author.getText(); - album.getText(); - category.getText(); - year.getText(); - new Integer(aBitrate.getText()).intValue(); - new Integer(vBitrate.getText()).intValue(); - resolution.getText(); - OwnerId; - */ - if (model.changeMedia(media, Action.EDIT)) { - int select=resultTable2.getSelectionIndex(); - TableItem item= new TableItem(resultTable2,SWT.NONE,select); - item.setText(0,new Integer(media.id).toString()); - item.setText(1,media.name); - /* t.b.d. read from string props - item.setText(2,media.author.name); - item.setText(3,media.album); - item.setText(4,media.year); - item.setText(5,media.category); - */ - item.setText(6,model.getTypeName(media.type)); - resultTable2.remove(select+1); - resultTable2.setSelection(select); - changeComposite.setVisible(false); - deleteButton.setVisible(false); - } - }catch (Exception e){ - System.out.println("Exception in SaveButton"+e); - } - } - - private void searchPressed(Text searchField,Button videoCheckBox,Button audioCheckBox,CLabel returnNum,int tab){ - String search = searchField.getText(); - int returnVal; - ArrayList<MediaType> types = new ArrayList<MediaType>(); - - if( videoCheckBox.getSelection() ) - types.add(MediaType.VIDEO); - - if( audioCheckBox.getSelection() ) - types.add(MediaType.SOUND); - /* t.b.d. add IMAGE support */ - - if (tab==1){ - while(resultTable1.getItemCount()!=0){ - resultTable1.remove(0); - } - }else{ - while(resultTable2.getItemCount()!=0){ - resultTable2.remove(0); - } - } - returnVal= model.search(search, types, tab); - ArrayList<Media>resultList = model.getMedia(tab); - for( int i = 0; - (resultList != null) && (i < resultList.size()); - i++ ) - { - TableItem item; - Media result=resultList.get(i); - if (tab==1) item=new TableItem(resultTable1,SWT.NONE); - else item= new TableItem(resultTable2,SWT.NONE); - item.setText(0,new Integer(result.id).toString()); - item.setText(1,result.name); - /* t.b.d. add string_props support - if(result.author != null) - item.setText(2,result.author); - - if(result.album != null) - item.setText(3,result.album); - - if(result.year != null) - item.setText(4,result.year); - - if(result.category != null) - item.setText(5,result.category); - */ - if(result.type != null) - item.setText(6,model.getTypeName(result.type)); - - } - if (tab==1){ - if (returnVal==1)returnNum.setText(returnVal+" Media"); - else returnNum.setText(returnVal+" Medias"); - resultComposite.setVisible(true); - playlistComposite.setVisible(true); - //bottemComposite.setVisible(true); - } - if (tab==2){ - if (returnVal==1)returnNum.setText(returnVal+" Media"); - else returnNum.setText(returnVal+" Medias"); - composite1.setVisible(true); - } - } - - - private void deleteButtonWidgetSelected(SelectionEvent evt) { - try{ - for (int i=resultTable2.getSelectionCount()-1;i>=0;i--){ - - Media result = model.getMediaWithId( - new Integer(resultTable2.getSelection()[i].getText(0)).intValue(),2 ); - - changeComposite.setVisible(false); - deleteButton.setVisible(false); - model.changeMedia(result, Action.DELETE); - resultTable2.remove(resultTable2.getSelectionIndices()[i]); - } - }catch (Exception e){ - System.out.println("Exception in DeleteButton "+e); - } - } - private void addButtonWidgetSelected(SelectionEvent evt) { - System.out.println("browser not implemented in yalp v2"); - } - - - public void refillIpTable(){ - /* t.b.d. replace by session viewer - try{ - ArrayList<ClientInfo> list=model.srvCon.getClientInfo(); - while(iptable.getItemCount()!=0){ - iptable.remove(0); - } - for(ClientInfo info : list){ - TableItem item = new TableItem(iptable,SWT.NONE); - item.setText(0,info.getUserName()); - item.setText(1,info.getIp()); - } - }catch(Exception e){System.out.println("geht nicht "+e);} - */ - } - - public void show(){ - ((Shell)this.parent).setImage(new Image(display,"img/yalpV2_klein.gif")); - ((Shell)this.parent).setText("yalp"); - this.parent.addListener(SWT.Dispose,new org.eclipse.swt.widgets.Listener(){ - public void handleEvent(org.eclipse.swt.widgets.Event e) { - ShellClose(); - } - }); - Point size = this.getSize(); - java.awt.Dimension screen = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); - Rectangle shellBounds = this.parent.computeTrim((screen.width-size.x)/2,(screen.height-size.y)/2,size.x,size.y); - this.parent.setLayout(new FillLayout()); - this.parent.layout(); - this.parent.setBounds(shellBounds); - ((Shell)this.parent).open(); - while (!this.parent.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - } - public void ShellClose(){ - this.model.logoff(); - System.exit(0); - } - -} - +/*
+ * Copyright (c) 2006 Manuel Traut and Volker Dahnke
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors: Manuel Traut and Volker Dahnke
+ */
+
+package YalpClients.SwtClient.GUI;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.layout.*;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.swt.events.*;
+import java.util.*;
+
+import YalpInterfaces.*;
+import YalpClients.SwtClient.*;
+
+/*
+ *
+ * Class GUI
+ *
+ * <em></em>
+ *
+ * @author Volker Dahnke / Manuel Traut
+ *
+ * @version 1 02-04-2006<br>
+ *
+ */
+public class GUI extends org.eclipse.swt.widgets.Composite {
+
+ public Model model;
+ public Composite resultComposite;
+ public Composite playlistComposite;
+ public Composite bottemComposite;
+ public Table resultTable1;
+ public Table resultTable2;
+ public Composite composite1;
+ public Composite changeComposite;
+ public Table UserTable;
+ public Composite composite3;
+
+ private AccessRights userKind;
+ private StyledText styledText1;
+ private CTabFolder cTabFolder1;
+ private CTabItem tab1;
+ private Composite container1;
+ private Composite topComposite;
+ private Group find;
+ private Group logo;
+ private CTabItem tab2;
+ private Composite container2;
+ private Group group1;
+ private Group group2;
+ private CLabel authorLabel;
+ private CLabel titleLabel;
+ private CLabel streamLabel2;
+ private CLabel actualStreamLabel2;
+ private CLabel actualStreamLabel1;
+ private CLabel streamLabel1;
+ private CLabel data2;
+ private CLabel data1;
+ private Button shutdown;
+ private TableColumn ip;
+ private TableColumn userName;
+ public Table iptable;
+ private Composite composite4;
+
+ private Button submitButton;
+ private CLabel adminAddLabel;
+ private CLabel passwdAddLable;
+ private CLabel usernameAddLable;
+ private CLabel realnameAddLabel;
+ private CCombo adminAdd;
+ private Text realnameAdd;
+ private Text passwdAdd;
+ private Text usernameAdd;
+ private Group tab3group5;
+ private Button next;
+ private Button stop;
+ private Button play;
+ private CLabel cLabel2;
+ private Button save;
+ private Text userTableId;
+ private Text passwd;
+ private Text username;
+ private Text userTableName;
+ private CLabel adminLabel;
+ private CCombo adminCombo;
+ private CLabel nameLable;
+ private CLabel passwdLable;
+ private CLabel usernameLable;
+ private CLabel idLable;
+ private Group tab3group4;
+ private Button delete;
+ private Button add1;
+ private Group tab3Group3;
+ private Group tab3Group2;
+ private Group tab3Group1;
+ private Composite container3;
+ private Button deleteButton;
+ private Button addButton;
+ private StyledText status;
+ private Button saveButton;
+ private Text id;
+ private CLabel idLabel;
+ private CLabel cLabel1;
+ private CLabel nameLabel;
+ private CLabel pathLabel;
+ private CLabel lastEditLable;
+ private CLabel ownerIdLabel;
+ private CLabel resolutionLabel;
+ private CLabel vBitrateLabel;
+ private CLabel aBitrateLabel;
+ private CLabel durationLabel;
+ private CLabel yearLabel;
+ private CLabel categoryLabel;
+ private CLabel albumLabel;
+ private CCombo type;
+ private Text name;
+ private Text path;
+ private Text lastEdit;
+ private Text ownerId;
+ private Text resolution;
+ private Text vBitrate;
+ private Text aBitrate;
+ private Text duration;
+ private Text year;
+ private Text category;
+ private Text album;
+ private Text author;
+ private Text title;
+ private Composite composite2;
+ private Table playlistTable;
+ private Button add2;
+ private Button del;
+ private Boolean isNotPlaying=true;
+ private Boolean paused =true;
+ private CTabItem tab3;
+ private Composite parent;
+ private Display display;
+ final Image pauseImage=new Image(this.getDisplay(),"img/pause.gif");
+ final Image playImage=new Image(this.getDisplay(),"img/play.gif");
+ final Image forwardImage=new Image(this.getDisplay(),"img/forward.gif");
+ {
+ //Register as a resource user - SWTResourceManager will
+ //handle the obtaining and disposing of resources
+ SWTResourceManager.registerResourceUser(this);
+ }
+
+ public GUI( Composite parent, Display display, Model model,
+ AccessRights userKind, int style ) {
+
+ super(parent, style);
+
+ this.parent = parent;
+ this.display = display;
+ this.model = model;
+ this.userKind = userKind;
+
+ initGUI();
+ }
+
+ private void initGUI() {
+ try {
+ this.setSize(800, 600);
+ this.setBackground(SWTResourceManager.getColor(192, 192, 192));
+ GridLayout thisLayout = new GridLayout(1, true);
+ thisLayout.marginWidth = 5;
+ thisLayout.marginHeight = 5;
+ thisLayout.numColumns = 1;
+ thisLayout.makeColumnsEqualWidth = true;
+ thisLayout.horizontalSpacing = 5;
+ thisLayout.verticalSpacing = 5;
+ this.setLayout(thisLayout);
+
+ {
+ if (this.userKind.value() == AccessRights._USER){
+ cTabFolder1 = new CTabFolder(this, SWT.NONE);
+ GridData cTabFolder1LData = new GridData();
+ cTabFolder1LData.widthHint = 787;
+ cTabFolder1LData.heightHint = 568;
+ cTabFolder1.setLayoutData(cTabFolder1LData);
+ {
+ tab1 = new CTabItem(cTabFolder1,SWT.NONE);
+ tab1.setText("Find");
+ {
+ container1 = new Composite(cTabFolder1,SWT.NONE);
+ tab1.setControl(container1);
+ RowLayout container1Layout = new RowLayout(org.eclipse.swt.SWT.HORIZONTAL);
+ container1.setLayout(container1Layout);
+ {
+ topComposite = new Composite(container1,SWT.NONE);
+ GridLayout topCompositeLayout = new GridLayout();
+ topCompositeLayout.makeColumnsEqualWidth = true;
+ topCompositeLayout.numColumns = 2;
+ topCompositeLayout.verticalSpacing = 2;
+ topCompositeLayout.horizontalSpacing = 5;
+ topComposite.setLayout(topCompositeLayout);
+ RowData topCompositeLData = new RowData();
+ topCompositeLData.width = 783;
+ topCompositeLData.height = 566;
+ topComposite.setLayoutData(topCompositeLData);
+ {
+ find = new Group(topComposite,SWT.NONE);
+ this.find(find,resultComposite,playlistComposite,bottemComposite,1);
+ }
+ {
+ logo = new Group(topComposite,SWT.NONE);
+ this.logo(logo);
+ }
+ {
+ resultComposite = new Composite(topComposite,SWT.NONE);
+ resultTable1 = new Table(resultComposite,SWT.MULTI|SWT.FULL_SELECTION);
+ resultTable1.setToolTipText("Medias");
+ resultTable1.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ add2.setEnabled(true);
+ }
+ });
+ this.resultTable(resultComposite,resultTable1,1);
+ }
+ {
+ playlistComposite = new Composite(topComposite,SWT.NONE);
+ FormLayout playlistCompositeLayout = new FormLayout();
+ playlistComposite.setLayout(playlistCompositeLayout);
+ GridData playlistCompositeLData = new GridData();
+ playlistCompositeLData.heightHint = 390;
+ playlistCompositeLData.horizontalAlignment = GridData.FILL;
+ playlistComposite.setLayoutData(playlistCompositeLData);
+ playlistComposite.setVisible(false);
+ playlistComposite.setSize(238, 390);
+ {
+ next = new Button(playlistComposite,SWT.PUSH | SWT.CENTER);
+ FormData nextLData = new FormData();
+ nextLData.width = 45;
+ nextLData.height = 21;
+ nextLData.left = new FormAttachment(0, 1000, 185);
+ nextLData.top = new FormAttachment(0, 1000, 365);
+ next.setLayoutData(nextLData);
+ next.setEnabled(false);
+ next.setFont(SWTResourceManager.getFont("Times", 8, 1, false, false));
+ next.setToolTipText("play next Title");
+ next.setImage(forwardImage);
+ next.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ model.next();
+ }
+ });
+ }
+ {
+ stop = new Button(playlistComposite,SWT.PUSH | SWT.CENTER);
+ FormData stopLData = new FormData();
+ stopLData.width = 35;
+ stopLData.height = 21;
+ stopLData.left = new FormAttachment(0, 1000, 91);
+ stopLData.top = new FormAttachment(0, 1000, 365);
+ stop.setLayoutData(stopLData);
+ stop.setImage(new Image(this.getDisplay(),"img/stop.gif"));
+ stop.setEnabled(false);
+ stop.setToolTipText("stop");
+ stop.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ if (model.stop()){
+ play.setEnabled(true);
+ next.setEnabled(false);
+ stop.setEnabled(false);
+ play.setImage(playImage);
+ play.setToolTipText("play");
+ isNotPlaying=true;
+ }
+
+ }
+ });
+ }
+ {
+ play = new Button(playlistComposite,SWT.PUSH | SWT.CENTER);
+ FormData playLData = new FormData();
+ playLData.width = 35;
+ playLData.height = 21;
+ playLData.left = new FormAttachment(0, 1000, 50);
+ playLData.top = new FormAttachment(0, 1000, 365);
+ play.setLayoutData(playLData);
+ play.setImage(playImage);
+ play.setEnabled(false);
+ play.setToolTipText("play");
+ play.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ stop.setEnabled(true);
+ if (playlistTable.getItemCount()>1)next.setEnabled(true);
+ del.setEnabled(false);
+ //add2.setEnabled(false);
+ if (isNotPlaying){
+ play.setCursor(SWTResourceManager.getCursor(SWT.CURSOR_WAIT));
+ if(model.play()){
+ play.setImage(pauseImage);
+ play.setToolTipText("pause");
+ play.setCursor(SWTResourceManager.getCursor(SWT.NONE));
+ isNotPlaying= false;
+ }else;
+ }else{
+ if(model.pause()){
+ if (paused){
+ play.setImage(playImage);
+ play.setToolTipText("play");
+ paused=false;
+ }else{
+ play.setImage(pauseImage);
+ play.setToolTipText("pause");
+ paused=true;
+ }
+ }else;
+ }
+
+ }
+ });
+ }
+ {
+ add2 = new Button(playlistComposite,SWT.PUSH | SWT.CENTER);
+ FormData addLData = new FormData();
+ addLData.width = 25;
+ addLData.height = 21;
+ addLData.left = new FormAttachment(0, 1000, 2);
+ addLData.top = new FormAttachment(0, 1000, 160);
+ add2.setLayoutData(addLData);
+ add2.setText(">>");
+ add2.setEnabled(false);
+ add2.setToolTipText("add to Playlist");
+ add2.setFont(SWTResourceManager.getFont("Times", 8, 1, false, false));
+ add2.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ if (System.getProperty("os.name")== "Mac OS X"){
+ for (int i=resultTable1.getSelectionCount()-1;i>=0;i--){
+ int id=new Integer(resultTable1.getSelection()[i].getText(0)).intValue();
+ System.out.println(resultTable1.getSelection()[i].getText(1));
+ model.add2PlayList(id);
+ }
+ }else{
+ for (int i=0;i<resultTable1.getSelectionCount();i++){
+ int id=new Integer(resultTable1.getSelection()[i].getText(0)).intValue();
+ System.out.println(resultTable1.getSelection()[i].getText(1));
+ model.add2PlayList(id);
+ }
+ }
+ while(playlistTable.getItemCount()!=0){
+ playlistTable.remove(0);
+ }
+ ArrayList<Media> playlist=model.getToPlaylist();
+ for(int i=0;i<playlist.size();i++){
+ Media result=playlist.get(i);
+ TableItem item = new TableItem(playlistTable,SWT.NONE);
+ item.setText(0,result.name);
+ item.setText(1,result.duration);
+ }
+ play.setEnabled(true);
+ if (playlistTable.getItemCount()>1&& !isNotPlaying)next.setEnabled(true);
+ }
+ });
+ }
+ {
+ del = new Button(playlistComposite,SWT.PUSH | SWT.CENTER);
+ FormData delLData = new FormData();
+ delLData.width = 25;
+ delLData.height = 21;
+ delLData.left = new FormAttachment(0, 1000, 2);
+ delLData.top = new FormAttachment(0, 1000, 200);
+ del.setLayoutData(delLData);
+ del.setEnabled(false);
+ del.setToolTipText("del from Playlist");
+ del.setText("<<");
+ del.setFont(SWTResourceManager.getFont("Times", 8, 1, false, false));
+ del.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ for (int i=playlistTable.getSelectionCount()-1;i>=0;i--){
+ int pos = playlistTable.getSelectionIndices()[i];
+ model.removeFromPlayList(pos);
+ }
+
+ del.setEnabled(false);
+ while(playlistTable.getItemCount()!=0){
+ playlistTable.remove(0);
+ }
+ ArrayList<Media> playlist=model.getToPlaylist();
+ for(int i=0;i<playlist.size();i++){
+ Media result=playlist.get(i);
+ TableItem item = new TableItem(playlistTable,SWT.NONE);
+ item.setText(0,result.name);
+ item.setText(1,result.duration);
+ }
+ if (playlistTable.getItemCount()==0)play.setEnabled(false);
+ }
+ });
+ }
+ {
+ playlistTable = new Table(playlistComposite,SWT.MULTI|SWT.FULL_SELECTION);
+ playlistTable.setHeaderVisible(true);
+ FormData playlistTableLData = new FormData();
+ playlistTableLData.width = 184;
+ playlistTableLData.height = 330;
+ playlistTableLData.top = new FormAttachment(24, 1000, 0);
+ playlistTableLData.left = new FormAttachment(0, 1000, 38);
+ playlistTable.setLayoutData(playlistTableLData);
+ playlistTable.setToolTipText("Playlist");
+ playlistTable.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ if (isNotPlaying)del.setEnabled(true);
+ }
+ });
+ TableColumn title = new TableColumn(playlistTable,SWT.LEFT);
+ title.setText("Title");
+ title.setWidth(120);
+ title.setMoveable(true);
+ TableColumn duration = new TableColumn(playlistTable,SWT.RIGHT);
+ duration.setText("Duration");
+ duration.setWidth(80);
+ duration.setMoveable(true);
+ }
+ }
+ }
+ /*{
+ bottemComposite = new Composite(container1,SWT.NONE);
+ bottemComposite.setVisible(false);
+ GridLayout bottemCompositeLayout = new GridLayout();
+ bottemCompositeLayout.makeColumnsEqualWidth = true;
+ bottemCompositeLayout.verticalSpacing = 2;
+ bottemCompositeLayout.horizontalSpacing = 5;
+ bottemComposite.setLayout(bottemCompositeLayout);
+ RowData bottemCompositeLData = new RowData();
+ bottemCompositeLData.width = 777;
+ bottemCompositeLData.height = 68;
+ bottemComposite.setLayoutData(bottemCompositeLData);
+ {
+ styledText1 = new StyledText(bottemComposite,SWT.NONE);
+ GridData styledText1LData = new GridData();
+ styledText1LData.widthHint = 765;
+ styledText1LData.heightHint = 55;
+ styledText1.setLayoutData(styledText1LData);
+ styledText1.setText("styledText1");
+ styledText1.setSize(765, 55);
+ }
+ }*/
+ }
+ }
+ {
+ tab2 = new CTabItem(cTabFolder1,SWT.NONE);
+ tab2.setText("Change");
+ {
+ container2 = new Composite(cTabFolder1,SWT.NONE);
+ GridLayout container2Layout = new GridLayout();
+ container2Layout.makeColumnsEqualWidth = true;
+ container2.setLayout(container2Layout);
+ tab2.setControl(container2);
+ container2.setVisible(false);
+ {
+ composite2 = new Composite(container2,SWT.NONE);
+ GridLayout composite2Layout = new GridLayout();
+ composite2Layout.makeColumnsEqualWidth = true;
+ composite2Layout.numColumns=2;
+ composite2.setLayout(composite2Layout);
+ GridData composite2LData = new GridData();
+ composite2LData.widthHint = 780;
+ composite2LData.heightHint = 497;
+ composite2.setLayoutData(composite2LData);
+ {
+ group1 = new Group(composite2,SWT.NONE);
+ this.find(group1,group2,composite1,changeComposite,2);
+ }
+ {
+ group2 = new Group(composite2,SWT.NONE);
+ this.logo(group2);
+ }
+ {
+ composite1 = new Composite(composite2,SWT.NONE);
+ {
+ resultTable2 = new Table(composite1,SWT.MULTI|SWT.FULL_SELECTION);
+ resultTable2.setToolTipText("Medias");
+ resultTable2.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ if(resultTable2.getSelectionCount()<2){
+ int identity =new Integer(resultTable2.getSelection()[0].getText()).intValue();
+ Media result = model.getMediaWithId(identity,2);
+ if (result!=null){
+ id.setText(new Integer(result.id).toString());
+ title.setText(result.name);
+ /* t.b.d. parse from string props
+ author.setText(result.author);
+ album.setText(result.album);
+ category.setText(result.category);
+ year.setText(result.year);
+ */
+ duration.setText(result.duration);
+ /*
+ aBitrate.setText(new Integer(result.aBitrate).toString());
+ vBitrate.setText(new Integer(result.vBitrate).toString());
+ resolution.setText(result.resolution);
+ */
+ ownerId.setText(result.owner.name);
+ lastEdit.setText(result.lastEdit);
+ path.setText(result.path);
+ name.setText(result.name);
+ String _type = model.getTypeName(result.type);
+ type.setText(_type);
+ changeComposite.setVisible(true);
+ deleteButton.setVisible(true);
+ }
+ }else changeComposite.setVisible(false);
+ }
+ });
+ this.resultTable(composite1,resultTable2,2);
+ }
+ }
+ {
+ changeComposite = new Composite(composite2,SWT.NONE);
+ FormLayout changeCompositeLayout = new FormLayout();
+ changeComposite.setLayout(changeCompositeLayout);
+ GridData changeCompositeLData = new GridData();
+ changeCompositeLData.widthHint = 238;
+ changeCompositeLData.heightHint = 357;
+ changeCompositeLData.verticalAlignment = GridData.BEGINNING;
+ changeComposite.setLayoutData(changeCompositeLData);
+ changeComposite.setVisible(false);
+ {
+ saveButton = new Button(changeComposite,SWT.PUSH | SWT.CENTER);
+ saveButton.setText("Save");
+ FormData saveButtonLData = new FormData();
+ saveButtonLData.width = 40;
+ saveButtonLData.height = 21;
+ saveButtonLData.left = new FormAttachment(0, 1000, 30);
+ saveButtonLData.top = new FormAttachment(0, 1000, 315);
+ saveButton.setLayoutData(saveButtonLData);
+ saveButton.setToolTipText("save Changes");
+ saveButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ saveButtonWidgetSelected(evt);
+ }
+ });
+ }
+ {
+ id = new Text(changeComposite,SWT.NONE);
+ FormData idLData = new FormData();
+ idLData.width = 124;
+ idLData.height = 14;
+ idLData.left = new FormAttachment(0, 1000, 100);
+ idLData.top = new FormAttachment(0, 1000, 10);
+ id.setLayoutData(idLData);
+ id.setEditable(false);
+ }
+ {
+ idLabel = new CLabel(changeComposite,SWT.NONE);
+ idLabel.setText("Id:");
+ FormData idLabelLData = new FormData();
+ idLabelLData.width = 60;
+ idLabelLData.height = 21;
+ idLabelLData.left = new FormAttachment(0, 1000, 20);
+ idLabelLData.top = new FormAttachment(0, 1000, 5);
+ idLabel.setLayoutData(idLabelLData);
+ }
+ {
+ cLabel1 = new CLabel(changeComposite,SWT.NONE);
+ cLabel1.setText("Type:");
+ FormData cLabel1LData = new FormData();
+ cLabel1LData.width = 60;
+ cLabel1LData.height = 21;
+ cLabel1LData.left = new FormAttachment(0, 1000, 20);
+ cLabel1LData.top = new FormAttachment(0, 1000, 285);
+ cLabel1.setLayoutData(cLabel1LData);
+ }
+ {
+ nameLabel = new CLabel(changeComposite,SWT.NONE);
+ nameLabel.setText("Name:");
+ FormData nameLabelLData = new FormData();
+ nameLabelLData.width = 60;
+ nameLabelLData.height = 21;
+ nameLabelLData.left = new FormAttachment(0, 1000, 20);
+ nameLabelLData.top = new FormAttachment(0, 1000, 265);
+ nameLabel.setLayoutData(nameLabelLData);
+ }
+ {
+ pathLabel = new CLabel(changeComposite,SWT.NONE);
+ pathLabel.setText("Path:");
+ FormData pathLabelLData = new FormData();
+ pathLabelLData.width = 60;
+ pathLabelLData.height = 21;
+ pathLabelLData.left = new FormAttachment(0, 1000, 20);
+ pathLabelLData.top = new FormAttachment(0, 1000, 245);
+ pathLabel.setLayoutData(pathLabelLData);
+ }
+ {
+ lastEditLable = new CLabel(changeComposite,SWT.NONE);
+ lastEditLable.setText("Last Edit:");
+ FormData lastEditLableLData = new FormData();
+ lastEditLableLData.width = 60;
+ lastEditLableLData.height = 21;
+ lastEditLableLData.left = new FormAttachment(0, 1000, 20);
+ lastEditLableLData.top = new FormAttachment(0, 1000, 225);
+ lastEditLable.setLayoutData(lastEditLableLData);
+ }
+ {
+ ownerIdLabel = new CLabel(changeComposite,SWT.NONE);
+ ownerIdLabel.setText("Owner:");
+ FormData ownerIdLabelLData = new FormData();
+ ownerIdLabelLData.width = 60;
+ ownerIdLabelLData.height = 21;
+ ownerIdLabelLData.left = new FormAttachment(0, 1000, 20);
+ ownerIdLabelLData.top = new FormAttachment(0, 1000, 205);
+ ownerIdLabel.setLayoutData(ownerIdLabelLData);
+ }
+ {
+ resolutionLabel = new CLabel(changeComposite,SWT.NONE);
+ resolutionLabel.setText("Resolution:");
+ FormData resolutionLabelLData = new FormData();
+ resolutionLabelLData.width = 60;
+ resolutionLabelLData.height = 21;
+ resolutionLabelLData.left = new FormAttachment(0, 1000, 20);
+ resolutionLabelLData.top = new FormAttachment(0, 1000, 185);
+ resolutionLabel.setLayoutData(resolutionLabelLData);
+ }
+ {
+ vBitrateLabel = new CLabel(changeComposite,SWT.NONE);
+ vBitrateLabel.setText("V-Bitrate:");
+ FormData vBitrateLabelLData = new FormData();
+ vBitrateLabelLData.width = 60;
+ vBitrateLabelLData.height = 21;
+ vBitrateLabelLData.left = new FormAttachment(0, 1000, 20);
+ vBitrateLabelLData.top = new FormAttachment(0, 1000, 165);
+ vBitrateLabel.setLayoutData(vBitrateLabelLData);
+ }
+ {
+ aBitrateLabel = new CLabel(changeComposite,SWT.NONE);
+ aBitrateLabel.setText("A-Bitrate:");
+ FormData aBitrateLabelLData = new FormData();
+ aBitrateLabelLData.width = 60;
+ aBitrateLabelLData.height = 21;
+ aBitrateLabelLData.left = new FormAttachment(0, 1000, 20);
+ aBitrateLabelLData.top = new FormAttachment(0, 1000, 145);
+ aBitrateLabel.setLayoutData(aBitrateLabelLData);
+ }
+ {
+ durationLabel = new CLabel(changeComposite,SWT.NONE);
+ durationLabel.setText("Duration:");
+ FormData durationLabelLData = new FormData();
+ durationLabelLData.width = 60;
+ durationLabelLData.height = 21;
+ durationLabelLData.left = new FormAttachment(0, 1000, 20);
+ durationLabelLData.top = new FormAttachment(0, 1000, 125);
+ durationLabel.setLayoutData(durationLabelLData);
+ }
+ {
+ yearLabel = new CLabel(changeComposite,SWT.NONE);
+ yearLabel.setText("Year:");
+ FormData yearLabelLData = new FormData();
+ yearLabelLData.width = 60;
+ yearLabelLData.height = 21;
+ yearLabelLData.left = new FormAttachment(0, 1000, 20);
+ yearLabelLData.top = new FormAttachment(0, 1000, 105);
+ yearLabel.setLayoutData(yearLabelLData);
+ }
+ {
+ categoryLabel = new CLabel(changeComposite,SWT.NONE);
+ categoryLabel.setText("Category:");
+ FormData categoryLabelLData = new FormData();
+ categoryLabelLData.width = 60;
+ categoryLabelLData.height = 21;
+ categoryLabelLData.left = new FormAttachment(0, 1000, 20);
+ categoryLabelLData.top = new FormAttachment(0, 1000, 85);
+ categoryLabel.setLayoutData(categoryLabelLData);
+ }
+ {
+ albumLabel = new CLabel(changeComposite,SWT.NONE);
+ albumLabel.setText("Album");
+ FormData albumLabelLData = new FormData();
+ albumLabelLData.width = 60;
+ albumLabelLData.height = 21;
+ albumLabelLData.left = new FormAttachment(0, 1000, 20);
+ albumLabelLData.top = new FormAttachment(0, 1000, 65);
+ albumLabel.setLayoutData(albumLabelLData);
+ }
+ {
+ authorLabel = new CLabel(changeComposite,SWT.NONE);
+ authorLabel.setText("Author:");
+ FormData authorLabelLData = new FormData();
+ authorLabelLData.width = 60;
+ authorLabelLData.height = 21;
+ authorLabelLData.left = new FormAttachment(0, 1000, 20);
+ authorLabelLData.top = new FormAttachment(0, 1000, 45);
+ authorLabel.setLayoutData(authorLabelLData);
+ }
+ {
+ titleLabel = new CLabel(changeComposite,SWT.NONE);
+ titleLabel.setText("Title:");
+ FormData cLabel1LData1 = new FormData();
+ cLabel1LData1.width = 60;
+ cLabel1LData1.height = 21;
+ cLabel1LData1.left = new FormAttachment(0, 1000, 20);
+ cLabel1LData1.top = new FormAttachment(0, 1000, 25);
+ titleLabel.setLayoutData(cLabel1LData1);
+ }
+ {
+ type = new CCombo(changeComposite,SWT.NONE);
+ FormData typeLData = new FormData();
+ typeLData.width = 111;
+ typeLData.height = 16;
+ typeLData.left = new FormAttachment(0, 1000, 100);
+ typeLData.top = new FormAttachment(0, 1000, 290);
+ type.setLayoutData(typeLData);
+ type.setCursor(SWTResourceManager.getCursor(SWT.CURSOR_HAND));
+ {
+ type.add("audio");
+ type.add("video");
+ }
+ }
+ {
+ name = new Text(changeComposite,SWT.NONE);
+ FormData nameLData = new FormData();
+ nameLData.width = 124;
+ nameLData.height = 14;
+ nameLData.left = new FormAttachment(0, 1000, 100);
+ nameLData.top = new FormAttachment(0, 1000, 270);
+ name.setLayoutData(nameLData);
+ name.setEditable(false);
+ }
+ {
+ path = new Text(changeComposite,SWT.NONE);
+ FormData pathLData = new FormData();
+ pathLData.width = 124;
+ pathLData.height = 14;
+ pathLData.left = new FormAttachment(0, 1000, 100);
+ pathLData.top = new FormAttachment(0, 1000, 250);
+ path.setLayoutData(pathLData);
+ path.setEditable(false);
+ }
+ {
+ lastEdit = new Text(changeComposite,SWT.NONE);
+ FormData lastEditLData = new FormData();
+ lastEditLData.width = 124;
+ lastEditLData.height = 14;
+ lastEditLData.left = new FormAttachment(0, 1000, 100);
+ lastEditLData.top = new FormAttachment(0, 1000, 230);
+ lastEdit.setLayoutData(lastEditLData);
+ lastEdit.setEditable(false);
+ }
+ {
+ ownerId = new Text(changeComposite,SWT.NONE);
+ FormData ownerIdLData = new FormData();
+ ownerIdLData.width = 124;
+ ownerIdLData.height = 14;
+ ownerIdLData.left = new FormAttachment(0, 1000, 100);
+ ownerIdLData.top = new FormAttachment(0, 1000, 210);
+ ownerId.setLayoutData(ownerIdLData);
+ ownerId.setEditable(false);
+ }
+ {
+ resolution = new Text(changeComposite,SWT.NONE);
+ FormData resolutionLData = new FormData();
+ resolutionLData.width = 124;
+ resolutionLData.height = 14;
+ resolutionLData.left = new FormAttachment(0, 1000, 100);
+ resolutionLData.top = new FormAttachment(0, 1000, 190);
+ resolution.setLayoutData(resolutionLData);
+ }
+ {
+ vBitrate = new Text(changeComposite,SWT.NONE);
+ FormData vBitrateLData = new FormData();
+ vBitrateLData.width = 124;
+ vBitrateLData.height = 14;
+ vBitrateLData.left = new FormAttachment(0, 1000, 100);
+ vBitrateLData.top = new FormAttachment(0, 1000, 170);
+ vBitrate.setLayoutData(vBitrateLData);
+ }
+ {
+ aBitrate = new Text(changeComposite,SWT.NONE);
+ FormData aBitrateLData = new FormData();
+ aBitrateLData.width = 124;
+ aBitrateLData.height = 14;
+ aBitrateLData.left = new FormAttachment(0, 1000, 100);
+ aBitrateLData.top = new FormAttachment(0, 1000, 150);
+ aBitrate.setLayoutData(aBitrateLData);
+ }
+ {
+ duration = new Text(changeComposite,SWT.NONE);
+ FormData durationLData = new FormData();
+ durationLData.width = 124;
+ durationLData.height = 14;
+ durationLData.left = new FormAttachment(0, 1000, 100);
+ durationLData.top = new FormAttachment(0, 1000, 130);
+ duration.setLayoutData(durationLData);
+ }
+ {
+ year = new Text(changeComposite,SWT.NONE);
+ FormData yearLData = new FormData();
+ yearLData.width = 124;
+ yearLData.height = 14;
+ yearLData.left = new FormAttachment(0, 1000, 100);
+ yearLData.top = new FormAttachment(0, 1000, 110);
+ year.setLayoutData(yearLData);
+ }
+ {
+ category = new Text(changeComposite,SWT.NONE);
+ FormData categoryLData = new FormData();
+ categoryLData.width = 124;
+ categoryLData.height = 14;
+ categoryLData.left = new FormAttachment(0, 1000, 100);
+ categoryLData.top = new FormAttachment(0, 1000, 90);
+ category.setLayoutData(categoryLData);
+ category.setCursor(SWTResourceManager.getCursor(SWT.CURSOR_WAIT));
+ }
+ {
+ album = new Text(changeComposite,SWT.NONE);
+ FormData albumLData = new FormData();
+ albumLData.width = 124;
+ albumLData.height = 14;
+ albumLData.left = new FormAttachment(0, 1000, 100);
+ albumLData.top = new FormAttachment(0, 1000, 70);
+ album.setLayoutData(albumLData);
+ }
+ {
+ author = new Text(changeComposite,SWT.NONE);
+ FormData authorLData = new FormData();
+ authorLData.width = 124;
+ authorLData.height = 14;
+ authorLData.left = new FormAttachment(0, 1000, 100);
+ authorLData.top = new FormAttachment(0, 1000, 50);
+ author.setLayoutData(authorLData);
+ }
+ {
+ title = new Text(changeComposite,SWT.NONE);
+ FormData titleLData = new FormData();
+ titleLData.width = 124;
+ titleLData.height = 13;
+ titleLData.top = new FormAttachment(0, 1000, 30);
+ titleLData.left = new FormAttachment(0, 1000, 100);
+ title.setLayoutData(titleLData);
+ }
+ }
+ }
+ {
+ composite3 = new Composite(container2,SWT.NONE);
+ FormLayout composite3Layout = new FormLayout();
+ composite3.setLayout(composite3Layout);
+ GridData composite3LData = new GridData();
+ composite3LData.widthHint = 777;
+ composite3LData.heightHint = 58;
+ composite3.setLayoutData(composite3LData);
+ {
+ deleteButton = new Button(composite3,SWT.PUSH | SWT.CENTER);
+ deleteButton.setText("Delete");
+ deleteButton.setVisible(false);
+ FormData deleteButtonLData = new FormData();
+ deleteButtonLData.width = 150;
+ deleteButtonLData.height = 30;
+ deleteButtonLData.left = new FormAttachment(0, 1000, 470);
+ deleteButtonLData.top = new FormAttachment(0, 1000, 15);
+ deleteButton.setLayoutData(deleteButtonLData);
+ deleteButton.setToolTipText("delete File from Database");
+ deleteButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ deleteButtonWidgetSelected(evt);
+ }
+ });
+ }
+ {
+ addButton = new Button(composite3,SWT.PUSH | SWT.CENTER);
+ addButton.setText("Add");
+ FormData addButtonLData = new FormData();
+ addButtonLData.width = 150;
+ addButtonLData.height = 30;
+ addButtonLData.left = new FormAttachment(0, 1000, 160);
+ addButtonLData.top = new FormAttachment(0, 1000, 15);
+ addButton.setLayoutData(addButtonLData);
+ addButton.setToolTipText("add new Files to Database");
+ addButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ addButtonWidgetSelected(evt);
+ }
+ });
+ }
+ }
+ }
+ }
+ {
+ tab3 = new CTabItem(cTabFolder1,SWT.NONE);
+ tab3.setText("Server");
+ {
+ container3 = new Composite(cTabFolder1,SWT.NONE);
+ GridLayout container3Layout = new GridLayout();
+ container3Layout.makeColumnsEqualWidth = true;
+ container3Layout.numColumns=2;
+ container3Layout.verticalSpacing = 0;
+ container3Layout.horizontalSpacing = 5;
+ container3.setLayout(container3Layout);
+ tab3.setControl(container3);
+ {
+ tab3Group1 = new Group(container3,SWT.NONE);
+ FormLayout tab3Group1Layout = new FormLayout();
+ tab3Group1.setLayout(tab3Group1Layout);
+ GridData tab3Group1LData = new GridData();
+ tab3Group1LData.widthHint = 500;
+ tab3Group1LData.heightHint = 129;
+ tab3Group1LData.horizontalAlignment = GridData.CENTER;
+ tab3Group1.setLayoutData(tab3Group1LData);
+ {
+ composite4 = new Composite(tab3Group1, SWT.NONE);
+ FormLayout composite4Layout = new FormLayout();
+ composite4.setLayout(composite4Layout);
+ FormData composite4LData = new FormData();
+ composite4LData.width = 504;
+ composite4LData.height = 140;
+ composite4LData.left = new FormAttachment(0, 1000, -3);
+ composite4LData.top = new FormAttachment(0, 1000, -6);
+ composite4.setLayoutData(composite4LData);
+ {
+ actualStreamLabel2 = new CLabel(
+ composite4,
+ SWT.NONE);
+ FormData actualStreamLabel2LData = new FormData();
+ actualStreamLabel2LData.width = 98;
+ actualStreamLabel2LData.height = 21;
+ actualStreamLabel2LData.left = new FormAttachment(0, 1000, 180);
+ actualStreamLabel2LData.top = new FormAttachment(0, 1000, 65);
+ actualStreamLabel2.setLayoutData(actualStreamLabel2LData);
+ actualStreamLabel2.setFont(SWTResourceManager.getFont("Times", 8, 1, false, false));
+ }
+ {
+ actualStreamLabel1 = new CLabel(
+ composite4,
+ SWT.NONE);
+ actualStreamLabel1.setText("Actual Number of Streams:");
+ FormData actualStreamLabel1LData = new FormData();
+ actualStreamLabel1LData.width = 160;
+ actualStreamLabel1LData.height = 21;
+ actualStreamLabel1LData.left = new FormAttachment(0, 1000, 14);
+ actualStreamLabel1LData.top = new FormAttachment(0, 1000, 65);
+ actualStreamLabel1.setLayoutData(actualStreamLabel1LData);
+ actualStreamLabel1.setFont(SWTResourceManager.getFont("Times", 8, 1, false, false));
+ }
+ {
+ streamLabel2 = new CLabel(
+ composite4,
+ SWT.None);
+ FormData streamLabel2LData = new FormData();
+ streamLabel2LData.width = 98;
+ streamLabel2LData.height = 21;
+ streamLabel2LData.left = new FormAttachment(0, 1000, 180);
+ streamLabel2LData.top = new FormAttachment(0, 1000, 40);
+ streamLabel2.setLayoutData(streamLabel2LData);
+ streamLabel2.setFont(SWTResourceManager.getFont("Times", 8, 1, false, false));
+ }
+ {
+ streamLabel1 = new CLabel(
+ composite4,
+ SWT.NONE);
+ streamLabel1.setText("Total Number of Streams:");
+ FormData streamLabel1LData = new FormData();
+ streamLabel1LData.width = 150;
+ streamLabel1LData.height = 21;
+ streamLabel1LData.left = new FormAttachment(0, 1000, 14);
+ streamLabel1LData.top = new FormAttachment(0, 1000, 40);
+ streamLabel1.setLayoutData(streamLabel1LData);
+ streamLabel1.setFont(SWTResourceManager.getFont("Times", 8, 1, false, false));
+ }
+ {
+ data2 = new CLabel(composite4, SWT.NONE);
+ FormData data2LData = new FormData();
+ data2LData.width = 98;
+ data2LData.height = 21;
+ data2LData.left = new FormAttachment(0, 1000, 180);
+ data2LData.top = new FormAttachment(0, 1000, 15);
+ data2.setLayoutData(data2LData);
+ data2.setFont(SWTResourceManager.getFont("Times", 8, 1, false, false));
+ }
+ {
+ data1 = new CLabel(composite4, SWT.NONE);
+ data1.setText("Total Data in Database:");
+ FormData data1LData = new FormData();
+ data1LData.width = 150;
+ data1LData.height = 21;
+ data1LData.left = new FormAttachment(0, 1000, 14);
+ data1LData.top = new FormAttachment(0, 1000, 15);
+ data1.setLayoutData(data1LData);
+ data1.setFont(SWTResourceManager.getFont("Times", 8, 1, false, false));
+ }
+ {
+ shutdown = new Button(composite4, SWT.PUSH
+ | SWT.CENTER);
+ shutdown.setText("Shutdown");
+ FormData shutdownLData = new FormData();
+ shutdownLData.width = 77;
+ shutdownLData.height = 21;
+ shutdownLData.left = new FormAttachment(0, 1000, 35);
+ shutdownLData.top = new FormAttachment(0, 1000, 105);
+ shutdown.setLayoutData(shutdownLData);
+ shutdown.setToolTipText("Server shutdown");
+ shutdown.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ model.serverShutdown();
+ }
+ });
+ }
+ {
+ iptable = new Table(composite4, SWT.SINGLE);
+ FormData iptableLData = new FormData();
+ iptableLData.width = 173;
+ iptableLData.height = 110;
+ iptableLData.left = new FormAttachment(0, 1000, 308);
+ iptableLData.top = new FormAttachment(0, 1000, 7);
+ iptable.setLayoutData(iptableLData);
+ iptable.setHeaderVisible(true);
+ iptable.setToolTipText("User online");
+ {
+ userName = new TableColumn(
+ iptable,
+ SWT.CENTER);
+ userName.setText("Username");
+ userName.setWidth(70);
+ }
+ {
+ ip = new TableColumn(iptable, SWT.BEGINNING);
+ ip.setText("Ip");
+ ip.setWidth(119);
+ }
+ final int time = 1000;
+ final Runnable timer = new Runnable() {
+ public void run() {
+ refillIpTable();
+ data2.setText("not supported in yalp2");
+ streamLabel2.setText( /*new Integer(model.getAllStreamNum()).toString() */ "not supported in yalp2");
+ display.timerExec(time, this);
+ actualStreamLabel2.setText( /*new Integer(model.getActualStreamNum()).toString()*/ "not supported in yalp2");
+ }
+ };
+ display.timerExec(time, timer);
+ }
+ }
+ }
+ {
+ tab3Group2 = new Group(container3,SWT.NONE);
+ this.logo(tab3Group2);
+ }
+ {
+ tab3Group3 = new Group(container3,SWT.NONE);
+ FormLayout tab3Group3Layout = new FormLayout();
+ tab3Group3.setLayout(tab3Group3Layout);
+ GridData tab3Group3LData = new GridData();
+ tab3Group3LData.widthHint = 500;
+ tab3Group3LData.heightHint = 284;
+ tab3Group3LData.horizontalAlignment = GridData.CENTER;
+ tab3Group3.setLayoutData(tab3Group3LData);
+ tab3Group3.setText("User Management");
+ {
+ delete = new Button(tab3Group3,SWT.PUSH | SWT.CENTER);
+ delete.setText("Delete");
+ FormData deleteLData = new FormData();
+ deleteLData.width = 45;
+ deleteLData.height = 21;
+ deleteLData.left = new FormAttachment(0, 1000, 447);
+ deleteLData.top = new FormAttachment(0, 1000, 254);
+ delete.setLayoutData(deleteLData);
+ delete.setToolTipText("delete User");
+ delete.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ YalpUser toChange = new YalpUser();
+ toChange.id = new Integer(userTableId.getText()).intValue();
+ toChange.name = username.getText();
+ model.changeUser(toChange, passwd.getText(), Action.DELETE);
+ while(UserTable.getItemCount()!=0){
+ UserTable.remove(0);
+ }
+ ArrayList<YalpUser> resultList = model.getUser();
+ for (int i = 0; i < resultList.size(); i++) {
+ TableItem item;
+ YalpUser result = resultList.get(i);
+ item = new TableItem(UserTable,SWT.NONE);
+ item.setText(0,new Integer(result.id).toString());
+ item.setText(1,result.name);
+ // item.setText(2,result.password);
+ item.setText(3,result.realName);
+ item.setText(4,model.accessRightsName(result.level));
+ }
+ tab3group4.setVisible(false);
+ }
+ });
+ }
+ {
+ add1 = new Button(tab3Group3,SWT.PUSH | SWT.CENTER);
+ add1.setText("Add");
+ FormData addLData = new FormData();
+ addLData.width = 45;
+ addLData.height = 21;
+ addLData.left = new FormAttachment(0, 1000, 7);
+ addLData.top = new FormAttachment(0, 1000, 254);
+ add1.setLayoutData(addLData);
+ add1.setToolTipText("add new User ");
+ add1.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ tab3group5.setVisible(true);
+ }
+ });
+ }
+ {
+ UserTable = new Table(tab3Group3,SWT.SINGLE|SWT.FULL_SELECTION);
+ FormData UserTableLData = new FormData();
+ UserTableLData.width = 467;
+ UserTableLData.height = 224;
+ UserTableLData.left = new FormAttachment(11, 1000, 0);
+ UserTableLData.right = new FormAttachment(988, 1000, 0);
+ UserTableLData.top = new FormAttachment(19, 1000, 0);
+ UserTableLData.bottom = new FormAttachment(864, 1000, 0);
+ UserTable.setLayoutData(UserTableLData);
+ UserTable.setHeaderVisible(true);
+ UserTable.setToolTipText("registrated User");
+ UserTable.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ userTableId.setText(UserTable.getSelection()[0].getText(0));
+ username.setText(UserTable.getSelection()[0].getText(1));
+ passwd.setText(UserTable.getSelection()[0].getText(2));
+ userTableName.setText(UserTable.getSelection()[0].getText(3));
+ adminCombo.setText(UserTable.getSelection()[0].getText(4));
+ tab3group4.setVisible(true);
+ }
+ });
+ {
+ TableColumn id = new TableColumn(UserTable,SWT.BEGINNING);
+ id.setText("ID");
+ id.setWidth(45);
+ id.setMoveable(true);
+ id.addListener(SWT.Selection, new SortListener(this,UserTable,0,5));
+ TableColumn userName = new TableColumn(UserTable,SWT.BEGINNING);
+ userName.setMoveable(true);
+ userName.setText("Username");
+ userName.setWidth(120);
+ userName.addListener(SWT.Selection, new SortListener(this,UserTable,1,5));
+ TableColumn passwd = new TableColumn(UserTable,SWT.BEGINNING);
+ passwd.setMoveable(true);
+ passwd.setText("Password");
+ passwd.setWidth(120);
+ passwd.addListener(SWT.Selection, new SortListener(this,UserTable,2,5));
+ TableColumn name = new TableColumn(UserTable,SWT.BEGINNING);
+ name.setMoveable(true);
+ name.setText("Name");
+ name.setWidth(130);
+ name.addListener(SWT.Selection, new SortListener(this,UserTable,3,5));
+ TableColumn admin = new TableColumn(UserTable,SWT.BEGINNING);
+ admin.setMoveable(true);
+ admin.setText("Admin");
+ admin.setWidth(74);
+ admin.addListener(SWT.Selection, new SortListener(this,UserTable,4,5));
+ //TableColumn huhu=new TableColumn(UserTable,SWT.BEGINNING);
+ //huhu.dispose();
+ ArrayList<YalpUser> resultList = model.getUser();
+ for (int i = 0; i < resultList.size(); i++) {
+ TableItem item;
+ YalpUser result = resultList.get(i);
+ item = new TableItem(UserTable,SWT.NONE);
+ item.setText(0,new Integer(result.id).toString());
+ item.setText(1,result.name);
+ //item.setText(2,result.passwd);
+ item.setText(3,result.realName);
+ item.setText(4,model.accessRightsName(result.level));
+ }
+ }
+ }
+ }
+ {
+ tab3group4 = new Group(container3,SWT.NONE);
+ FormLayout tab3group4Layout = new FormLayout();
+ tab3group4.setLayout(tab3group4Layout);
+ tab3group4.setText("Edit User");
+ GridData tab3group4LData = new GridData();
+ tab3group4LData.widthHint = 256;
+ tab3group4LData.heightHint = 284;
+ tab3group4.setLayoutData(tab3group4LData);
+ tab3group4.setVisible(false);
+ {
+ save = new Button(tab3group4,SWT.PUSH | SWT.CENTER);
+ save.setText("save");
+ FormData saveLData = new FormData();
+ saveLData.width = 45;
+ saveLData.height = 21;
+ saveLData.left = new FormAttachment(0, 1000, 42);
+ saveLData.top = new FormAttachment(0, 1000, 157);
+ save.setLayoutData(saveLData);
+ save.setToolTipText("save Changes");
+ save.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ YalpUser toChange = new YalpUser();
+ toChange.id = new Integer(userTableId.getText()).intValue();
+ toChange.name = username.getText();
+ model.changeUser(toChange, passwd.getText(), Action.EDIT);
+ while(UserTable.getItemCount()!=0){
+ UserTable.remove(0);
+ }
+ ArrayList<YalpUser> resultList = model.getUser();
+ for (int i = 0; i < resultList.size(); i++) {
+ TableItem item;
+ YalpUser result = resultList.get(i);
+ item = new TableItem(UserTable,SWT.NONE);
+ item.setText(0,new Integer(result.id).toString());
+ item.setText(1,result.name);
+ //item.setText(2,result.passwd);
+ item.setText(3,result.realName);
+ item.setText(4,model.accessRightsName(result.level));
+ }
+ tab3group4.setVisible(false);
+ }
+ });
+ }
+ {
+ userTableName = new Text(tab3group4,SWT.NONE);
+ FormData text2LData = new FormData();
+ text2LData.width = 94;
+ text2LData.height = 14;
+ text2LData.left = new FormAttachment(0, 1000, 117);
+ text2LData.top = new FormAttachment(0, 1000, 112);
+ userTableName .setLayoutData(text2LData);
+ }
+ {
+ passwd = new Text(tab3group4,SWT.NONE);
+ FormData passwdLData = new FormData();
+ passwdLData.width = 94;
+ passwdLData.height = 14;
+ passwdLData.left = new FormAttachment(0, 1000, 117);
+ passwdLData.top = new FormAttachment(0, 1000, 92);
+ passwd.setLayoutData(passwdLData);
+ }
+ {
+ username = new Text(tab3group4,SWT.NONE);
+ FormData usernameLData = new FormData();
+ usernameLData.width = 94;
+ usernameLData.height = 14;
+ usernameLData.left = new FormAttachment(0, 1000, 117);
+ usernameLData.top = new FormAttachment(0, 1000, 72);
+ username.setLayoutData(usernameLData);
+ }
+ {
+ userTableId = new Text(tab3group4,SWT.NONE);
+ FormData text1LData = new FormData();
+ text1LData.width = 94;
+ text1LData.height = 14;
+ text1LData.left = new FormAttachment(0, 1000, 117);
+ text1LData.top = new FormAttachment(0, 1000, 52);
+ userTableId.setLayoutData(text1LData);
+ userTableId.setEditable(false);
+ }
+ {
+ adminLabel = new CLabel(tab3group4,SWT.NONE);
+ adminLabel.setText("Admin:");
+ FormData adminLabelLData = new FormData();
+ adminLabelLData.width = 42;
+ adminLabelLData.height = 21;
+ adminLabelLData.left = new FormAttachment(0, 1000, 27);
+ adminLabelLData.top = new FormAttachment(0, 1000, 127);
+ adminLabel.setLayoutData(adminLabelLData);
+ }
+ {
+ idLable = new CLabel(tab3group4,SWT.NONE);
+ idLable.setText("Id:");
+ FormData idLableLData = new FormData();
+ idLableLData.width = 20;
+ idLableLData.height = 21;
+ idLableLData.left = new FormAttachment(107, 1000, 0);
+ idLableLData.right = new FormAttachment(185, 1000, 0);
+ idLableLData.top = new FormAttachment(167, 1000, 0);
+ idLableLData.bottom = new FormAttachment(241, 1000, 0);
+ idLable.setLayoutData(idLableLData);
+ }
+ {
+ usernameLable = new CLabel(tab3group4,SWT.NONE);
+ usernameLable.setText("Username:");
+ FormData usernameLableLData = new FormData();
+ usernameLableLData.width = 58;
+ usernameLableLData.height = 21;
+ usernameLableLData.left = new FormAttachment(107, 1000, 0);
+ usernameLableLData.right = new FormAttachment(333, 1000, 0);
+ usernameLableLData.top = new FormAttachment(237, 1000, 0);
+ usernameLableLData.bottom = new FormAttachment(311, 1000, 0);
+ usernameLable.setLayoutData(usernameLableLData);
+ }
+ {
+ passwdLable = new CLabel(tab3group4,SWT.NONE);
+ passwdLable.setText("Password:");
+ FormData passwdLableLData = new FormData();
+ passwdLableLData.width = 56;
+ passwdLableLData.height = 21;
+ passwdLableLData.left = new FormAttachment(107, 1000, 0);
+ passwdLableLData.right = new FormAttachment(326, 1000, 0);
+ passwdLableLData.top = new FormAttachment(308, 1000, 0);
+ passwdLableLData.bottom = new FormAttachment(382, 1000, 0);
+ passwdLable.setLayoutData(passwdLableLData);
+ }
+ {
+ nameLable = new CLabel(tab3group4,SWT.NONE);
+ nameLable.setText("Name:");
+ FormData nameLableLData = new FormData();
+ nameLableLData.width = 37;
+ nameLableLData.height = 21;
+ nameLableLData.left = new FormAttachment(107, 1000, 0);
+ nameLableLData.right = new FormAttachment(251, 1000, 0);
+ nameLableLData.top = new FormAttachment(378, 1000, 0);
+ nameLableLData.bottom = new FormAttachment(452, 1000, 0);
+ nameLable.setLayoutData(nameLableLData);
+ }
+ {
+ adminCombo = new CCombo(tab3group4,SWT.NONE);
+ FormData adminComboLData = new FormData();
+ adminComboLData.width = 81;
+ adminComboLData.height = 16;
+ adminComboLData.left = new FormAttachment(458, 1000, 0);
+ adminComboLData.right = new FormAttachment(849, 1000, 0);
+ adminComboLData.top = new FormAttachment(466, 1000, 0);
+ adminComboLData.bottom = new FormAttachment(522, 1000, 0);
+ adminCombo.setLayoutData(adminComboLData);
+ {
+ adminCombo.add("true");
+ adminCombo.add("false");
+ }
+ }
+ }
+ tab3group5 = new Group(container3,SWT.NONE);
+ FormLayout tab3group5Layout = new FormLayout();
+ tab3group5.setLayout(tab3group5Layout);
+ GridData tab3group5LData = new GridData();
+ tab3group5LData.widthHint = 500;
+ tab3group5LData.heightHint = 99;
+ tab3group5.setLayoutData(tab3group5LData);
+ tab3group5.setText("Add User");
+ tab3group5.setVisible(false);
+ {
+ submitButton = new Button(tab3group5,SWT.PUSH | SWT.CENTER);
+ submitButton.setText("Submit");
+ FormData submitButtonLData = new FormData();
+ submitButtonLData.width = 50;
+ submitButtonLData.height = 21;
+ submitButtonLData.left = new FormAttachment(0, 1000, 382);
+ submitButtonLData.top = new FormAttachment(0, 1000, 52);
+ submitButton.setLayoutData(submitButtonLData);
+ submitButton.setToolTipText("add User");
+ submitButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ System.out.println("submit");
+ YalpUser toChange = new YalpUser();
+ toChange.id = 100;
+ toChange.name = usernameAdd.getText();
+ toChange.realName = realnameAdd.getText();
+ model.changeUser(toChange, passwdAdd.getText(), Action.CREATE);
+ while(UserTable.getItemCount()!=0){
+ UserTable.remove(0);
+ }
+ ArrayList<YalpUser> resultList = model.getUser();
+ for (int i = 0; i < resultList.size(); i++) {
+ TableItem item;
+ YalpUser result = resultList.get(i);
+ item = new TableItem(UserTable,SWT.NONE);
+ item.setText(0,new Integer(result.id).toString());
+ item.setText(1,result.name);
+ //item.setText(2,result.passwd);
+ item.setText(3,result.realName);
+ item.setText(4,model.accessRightsName(result.level));
+ }
+ }
+ });
+ }
+ {
+ adminAddLabel = new CLabel(tab3group5,SWT.NONE);
+ adminAddLabel.setText("Admin:");
+ FormData adminAddLabelLData = new FormData();
+ adminAddLabelLData.width = 40;
+ adminAddLabelLData.height = 21;
+ adminAddLabelLData.left = new FormAttachment(0, 1000, 291);
+ adminAddLabelLData.top = new FormAttachment(0, 1000, 17);
+ adminAddLabel.setLayoutData(adminAddLabelLData);
+ }
+ {
+ passwdAddLable = new CLabel(tab3group5,SWT.NONE);
+ passwdAddLable.setText("Password:");
+ FormData passwdAddLableLData = new FormData();
+ passwdAddLableLData.width = 60;
+ passwdAddLableLData.height = 21;
+ passwdAddLableLData.left = new FormAttachment(0, 1000, 17);
+ passwdAddLableLData.top = new FormAttachment(0, 1000, 57);
+ passwdAddLable.setLayoutData(passwdAddLableLData);
+ }
+ {
+ usernameAddLable = new CLabel(tab3group5,SWT.NONE);
+ usernameAddLable.setText("Username:");
+ FormData usernameAddLableLData = new FormData();
+ usernameAddLableLData.width = 60;
+ usernameAddLableLData.height = 21;
+ usernameAddLableLData.left = new FormAttachment(0, 1000, 17);
+ usernameAddLableLData.top = new FormAttachment(0, 1000, 37);
+ usernameAddLable.setLayoutData(usernameAddLableLData);
+ }
+ {
+ realnameAddLabel = new CLabel(tab3group5,SWT.NONE);
+ realnameAddLabel.setText("Name:");
+ FormData realnameAddLabelLData = new FormData();
+ realnameAddLabelLData.width = 60;
+ realnameAddLabelLData.height = 21;
+ realnameAddLabelLData.left = new FormAttachment(0, 1000, 17);
+ realnameAddLabelLData.top = new FormAttachment(0, 1000, 17);
+ realnameAddLabel.setLayoutData(realnameAddLabelLData);
+ }
+ {
+ adminAdd = new CCombo(tab3group5,SWT.NONE);
+ FormData adminAddLData = new FormData();
+ adminAddLData.width = 65;
+ adminAddLData.height = 12;
+ adminAddLData.left = new FormAttachment(0, 1000, 347);
+ adminAddLData.top = new FormAttachment(0, 1000, 22);
+ adminAdd.setLayoutData(adminAddLData);
+ adminAdd.setText("false");
+ {
+ adminAdd.add("false");
+ adminAdd.add("true");
+ }
+ }
+ {
+ realnameAdd = new Text(tab3group5,SWT.NONE);
+ FormData realnameAddLData = new FormData();
+ realnameAddLData.width = 174;
+ realnameAddLData.height = 14;
+ realnameAddLData.left = new FormAttachment(0, 1000, 82);
+ realnameAddLData.top = new FormAttachment(0, 1000, 22);
+ realnameAdd.setLayoutData(realnameAddLData);
+ }
+ {
+ usernameAdd = new Text(tab3group5,SWT.NONE);
+ FormData usernameAddLData = new FormData();
+ usernameAddLData.width = 174;
+ usernameAddLData.height = 13;
+ usernameAddLData.left = new FormAttachment(165, 1000, 0);
+ usernameAddLData.right = new FormAttachment(525, 1000, 0);
+ usernameAddLData.top = new FormAttachment(429, 1000, 0);
+ usernameAddLData.bottom = new FormAttachment(560, 1000, 0);
+ usernameAdd.setLayoutData(usernameAddLData);
+ }
+ {
+ FormData PasswdAddLData = new FormData();
+ PasswdAddLData.width = 174;
+ PasswdAddLData.height = 13;
+ PasswdAddLData.left = new FormAttachment(165, 1000, 0);
+ PasswdAddLData.right = new FormAttachment(525, 1000, 0);
+ PasswdAddLData.top = new FormAttachment(631, 1000, 0);
+ PasswdAddLData.bottom = new FormAttachment(762, 1000, 0);
+ passwdAdd = new Text(tab3group5,SWT.NONE);
+ passwdAdd.setLayoutData(PasswdAddLData);
+ }
+ }
+ }
+ cTabFolder1.setSelection(0);
+ }
+ else{
+ GridData testLData = new GridData();
+ testLData.widthHint = 792;
+ testLData.heightHint = 590;
+ Composite simpelUser = new Composite(this, SWT.NONE);
+ RowLayout testLayout = new RowLayout(org.eclipse.swt.SWT.HORIZONTAL);
+ simpelUser.setLayout(testLayout);
+ simpelUser.setLayoutData(testLData);
+ {
+ topComposite = new Composite(simpelUser,SWT.NONE);
+ GridLayout topCompositeLayout = new GridLayout();
+ topCompositeLayout.makeColumnsEqualWidth = true;
+ topCompositeLayout.numColumns = 2;
+ topCompositeLayout.verticalSpacing = 2;
+ topCompositeLayout.horizontalSpacing = 5;
+ topComposite.setLayout(topCompositeLayout);
+ RowData topCompositeLData = new RowData();
+ topCompositeLData.width = 783;
+ topCompositeLData.height = 566;
+ topComposite.setLayoutData(topCompositeLData);
+ {
+ find = new Group(topComposite,SWT.NONE);
+ this.find(find,resultComposite,playlistComposite,bottemComposite,1);
+ }
+ {
+ logo = new Group(topComposite,SWT.NONE);
+ this.logo(logo);
+ }
+ {
+ resultComposite = new Composite(topComposite,SWT.NONE);
+ resultTable1 = new Table(resultComposite,SWT.MULTI|SWT.FULL_SELECTION);
+ resultTable1.setToolTipText("Medias");
+ resultTable1.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ add2.setEnabled(true);
+ }
+ });
+ this.resultTable(resultComposite,resultTable1,1);
+ }
+ {
+ playlistComposite = new Composite(topComposite,SWT.NONE);
+ FormLayout playlistCompositeLayout = new FormLayout();
+ playlistComposite.setLayout(playlistCompositeLayout);
+ GridData playlistCompositeLData = new GridData();
+ playlistCompositeLData.heightHint = 390;
+ playlistCompositeLData.horizontalAlignment = GridData.FILL;
+ playlistComposite.setLayoutData(playlistCompositeLData);
+ playlistComposite.setVisible(false);
+ playlistComposite.setSize(238, 390);
+ {
+ next = new Button(playlistComposite,SWT.PUSH | SWT.CENTER);
+ FormData nextLData = new FormData();
+ nextLData.width = 45;
+ nextLData.height = 21;
+ nextLData.left = new FormAttachment(0, 1000, 185);
+ nextLData.top = new FormAttachment(0, 1000, 365);
+ next.setLayoutData(nextLData);
+ next.setEnabled(false);
+ next.setFont(SWTResourceManager.getFont("Times", 8, 1, false, false));
+ next.setToolTipText("play next Title");
+ next.setImage(forwardImage);
+ next.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ model.next();
+ }
+ });
+ }
+ {
+ stop = new Button(playlistComposite,SWT.PUSH | SWT.CENTER);
+ FormData stopLData = new FormData();
+ stopLData.width = 35;
+ stopLData.height = 21;
+ stopLData.left = new FormAttachment(0, 1000, 91);
+ stopLData.top = new FormAttachment(0, 1000, 365);
+ stop.setLayoutData(stopLData);
+ stop.setImage(new Image(this.getDisplay(),"img/stop.gif"));
+ stop.setEnabled(false);
+ stop.setToolTipText("stop");
+ stop.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ if (model.stop()){
+ play.setEnabled(true);
+ next.setEnabled(false);
+ stop.setEnabled(false);
+ play.setImage(playImage);
+ play.setToolTipText("play");
+ isNotPlaying=true;
+ }
+
+ }
+ });
+ }
+ {
+ play = new Button(playlistComposite,SWT.PUSH | SWT.CENTER);
+ FormData playLData = new FormData();
+ playLData.width = 35;
+ playLData.height = 21;
+ playLData.left = new FormAttachment(0, 1000, 50);
+ playLData.top = new FormAttachment(0, 1000, 365);
+ play.setLayoutData(playLData);
+ play.setImage(playImage);
+ play.setEnabled(false);
+ play.setToolTipText("play");
+ play.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ stop.setEnabled(true);
+ if (playlistTable.getItemCount()>1)next.setEnabled(true);
+ del.setEnabled(false);
+ //add2.setEnabled(false);
+ if (isNotPlaying){
+ play.setCursor(SWTResourceManager.getCursor(SWT.CURSOR_WAIT));
+ if(model.play()){
+ play.setImage(pauseImage);
+ play.setToolTipText("pause");
+ play.setCursor(SWTResourceManager.getCursor(SWT.NONE));
+ isNotPlaying= false;
+ }else;
+ }else{
+ if(model.pause()){
+ if (paused){
+ play.setImage(playImage);
+ play.setToolTipText("play");
+ paused=false;
+ }else{
+ play.setImage(pauseImage);
+ play.setToolTipText("pause");
+ paused=true;
+ }
+ }else;
+ }
+
+ }
+ });
+ }
+ {
+ add2 = new Button(playlistComposite,SWT.PUSH | SWT.CENTER);
+ FormData addLData = new FormData();
+ addLData.width = 25;
+ addLData.height = 21;
+ addLData.left = new FormAttachment(0, 1000, 2);
+ addLData.top = new FormAttachment(0, 1000, 160);
+ add2.setLayoutData(addLData);
+ add2.setText(">>");
+ add2.setEnabled(false);
+ add2.setToolTipText("add to Playlist");
+ add2.setFont(SWTResourceManager.getFont("Times", 8, 1, false, false));
+ add2.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ if (System.getProperty("os.name")== "Mac OS X"){
+ for (int i=resultTable1.getSelectionCount()-1;i>=0;i--){
+ int id=new Integer(resultTable1.getSelection()[i].getText(0)).intValue();
+ System.out.println(resultTable1.getSelection()[i].getText(1));
+ model.add2PlayList(id);
+ }
+ }else{
+ for (int i=0;i<resultTable1.getSelectionCount();i++){
+ int id=new Integer(resultTable1.getSelection()[i].getText(0)).intValue();
+ System.out.println(resultTable1.getSelection()[i].getText(1));
+ model.add2PlayList(id);
+ }
+ }
+ while(playlistTable.getItemCount()!=0){
+ playlistTable.remove(0);
+ }
+ ArrayList<Media> playlist=model.getToPlaylist();
+ for(int i=0;i<playlist.size();i++){
+ Media result=playlist.get(i);
+ TableItem item = new TableItem(playlistTable,SWT.NONE);
+ item.setText(0,result.name);
+ item.setText(1,result.duration);
+ }
+ play.setEnabled(true);
+ if (playlistTable.getItemCount()>1&& !isNotPlaying)next.setEnabled(true);
+ }
+ });
+ }
+ {
+ del = new Button(playlistComposite,SWT.PUSH | SWT.CENTER);
+ FormData delLData = new FormData();
+ delLData.width = 25;
+ delLData.height = 21;
+ delLData.left = new FormAttachment(0, 1000, 2);
+ delLData.top = new FormAttachment(0, 1000, 200);
+ del.setLayoutData(delLData);
+ del.setEnabled(false);
+ del.setToolTipText("del from Playlist");
+ del.setText("<<");
+ del.setFont(SWTResourceManager.getFont("Times", 8, 1, false, false));
+ del.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ for (int i=playlistTable.getSelectionCount()-1;i>=0;i--){
+ int pos = playlistTable.getSelectionIndices()[i];
+ model.removeFromPlayList(pos);
+ }
+
+ del.setEnabled(false);
+ while(playlistTable.getItemCount()!=0){
+ playlistTable.remove(0);
+ }
+ ArrayList<Media> playlist=model.getToPlaylist();
+ for(int i=0;i<playlist.size();i++){
+ Media result=playlist.get(i);
+ TableItem item = new TableItem(playlistTable,SWT.NONE);
+ item.setText(0,result.name);
+ item.setText(1,result.duration);
+ }
+ if (playlistTable.getItemCount()==0)play.setEnabled(false);
+ }
+ });
+ }
+ {
+ playlistTable = new Table(playlistComposite,SWT.MULTI|SWT.FULL_SELECTION);
+ playlistTable.setHeaderVisible(true);
+ FormData playlistTableLData = new FormData();
+ playlistTableLData.width = 184;
+ playlistTableLData.height = 330;
+ playlistTableLData.top = new FormAttachment(24, 1000, 0);
+ playlistTableLData.left = new FormAttachment(0, 1000, 38);
+ playlistTable.setLayoutData(playlistTableLData);
+ playlistTable.setToolTipText("Playlist");
+ playlistTable.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ if (isNotPlaying)del.setEnabled(true);
+ }
+ });
+ TableColumn title = new TableColumn(playlistTable,SWT.LEFT);
+ title.setText("Title");
+ title.setWidth(120);
+ title.setMoveable(true);
+ TableColumn duration = new TableColumn(playlistTable,SWT.RIGHT);
+ duration.setText("Duration");
+ duration.setWidth(80);
+ duration.setMoveable(true);
+ }
+ }
+ }
+ }
+ }
+ this.layout();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ //TODO:start find
+ private void find(Group find,Composite resultComposite, Composite playlistComposite,Composite bottemComposite,int _tab){
+ final Text searchField = new Text(find,SWT.NONE);
+ final Button findButton = new Button(find,SWT.PUSH | SWT.CENTER);
+ final Button allCheckBox = new Button(find,SWT.RADIO | SWT.LEFT);
+ final Button videoCheckBox = new Button(find,SWT.RADIO | SWT.LEFT);
+ final Button audioCheckBox = new Button(find,SWT.RADIO | SWT.LEFT);
+ final CLabel returnNum= new CLabel(find, SWT.NONE);
+ final int tab=_tab;
+ {
+ cLabel2 = new CLabel(find, SWT.NONE);
+ if (tab==1)cLabel2.setText("find and stream mutimedia files");
+ else cLabel2.setText("find and manage mutimedia files");
+ FormData cLabel2LData = new FormData();
+ cLabel2LData.width = 250;
+ cLabel2LData.height = 21;
+ cLabel2LData.left = new FormAttachment(0,1000,46);
+ cLabel2LData.top = new FormAttachment(0,1000,13);
+ cLabel2.setLayoutData(cLabel2LData);
+ }
+ {
+
+ FormData allCheckBoxLData = new FormData();
+ allCheckBoxLData.left = new FormAttachment(0, 1000, 95);
+ allCheckBoxLData.top = new FormAttachment(0, 1000, 98);
+ allCheckBoxLData.width = 56;
+ allCheckBoxLData.height = 14;
+ allCheckBox.setLayoutData(allCheckBoxLData);
+ allCheckBox.setText("All");
+ allCheckBox.setSelection(true);
+ allCheckBox.setToolTipText("Find Audio and Video Files");
+ allCheckBox.addKeyListener(new KeyAdapter() {
+ public void keyPressed(KeyEvent evt) {
+ if (evt.character == SWT.CR) {
+ searchPressed(
+ searchField,
+ videoCheckBox,
+ audioCheckBox,
+ returnNum,
+ tab);
+ }
+ }
+ });
+ }
+ {
+
+ FormData audioCheckBoxLData = new FormData();
+ audioCheckBoxLData.left = new FormAttachment(0, 1000, 195);
+ audioCheckBoxLData.top = new FormAttachment(0, 1000, 98);
+ audioCheckBoxLData.width = 56;
+ audioCheckBoxLData.height = 14;
+ audioCheckBox.setLayoutData(audioCheckBoxLData);
+ audioCheckBox.setText("Audio");
+ audioCheckBox.setToolTipText("Find Audio Files");
+ audioCheckBox
+ .addKeyListener(new KeyAdapter() {
+ public void keyPressed(KeyEvent evt) {
+ if (evt.character == SWT.CR) {
+ searchPressed(
+ searchField,
+ videoCheckBox,
+ audioCheckBox,
+ returnNum,
+ tab);
+ }
+ }
+ });
+ }
+ {
+
+ FormData videoCheckBoxLData = new FormData();
+ videoCheckBoxLData.left = new FormAttachment(0, 1000, 296);
+ videoCheckBoxLData.top = new FormAttachment(0, 1000, 98);
+ videoCheckBoxLData.width = 56;
+ videoCheckBoxLData.height = 14;
+ videoCheckBox.setLayoutData(videoCheckBoxLData);
+ videoCheckBox.setText("Video");
+ videoCheckBox.setToolTipText("Find Video Files");
+ videoCheckBox
+ .addKeyListener(new KeyAdapter() {
+ public void keyPressed(KeyEvent evt) {
+ if (evt.character == SWT.CR) {
+ searchPressed(
+ searchField,
+ videoCheckBox,
+ audioCheckBox,
+ returnNum,
+ tab);
+ }
+ }
+ });
+ }
+
+
+ FormLayout findLayout = new FormLayout();
+ find.setLayout(findLayout);
+ GridData findLData = new GridData();
+ findLData.widthHint = 497;
+ findLData.heightHint = 130;
+ find.setLayoutData(findLData);
+ find.setSize(497, 104);
+ find.addKeyListener(new KeyAdapter() {
+ public void keyPressed(KeyEvent evt) {
+ if (evt.character==SWT.CR){
+ searchPressed(searchField,videoCheckBox,audioCheckBox,returnNum,tab);
+ }
+ }
+ });
+ {
+ //searchField
+ FormData searchFieldLData = new FormData();
+ searchFieldLData.width = 344;
+ searchFieldLData.height = 20;
+ searchFieldLData.left = new FormAttachment(0,1000,37);
+ searchFieldLData.top = new FormAttachment(0,1000,55);
+ searchField.setLayoutData(searchFieldLData);
+ searchField.setFont(SWTResourceManager.getFont("Times",12,0,false,false));
+ searchField.setToolTipText("Keyword");
+ searchField.addKeyListener(new KeyAdapter() {
+ public void keyPressed(KeyEvent evt) {
+ if (evt.character==SWT.CR){
+ searchPressed(searchField,videoCheckBox,audioCheckBox,returnNum,tab);
+ }
+ }
+ });
+ }
+ {
+ //findButton
+ findButton.setText("Find");
+ FormData findButtonLData = new FormData(70,26);
+ findButtonLData.width = 70;
+ findButtonLData.height = 26;
+ findButtonLData.left = new FormAttachment(0,1000,403);
+ findButtonLData.top = new FormAttachment(0,1000,52);
+ findButton.setLayoutData(findButtonLData);
+ findButton.setSize(70, 26);
+ findButton.setToolTipText("Find");
+ findButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ add2.setEnabled(false);
+ searchPressed(searchField,videoCheckBox,audioCheckBox,returnNum,tab);
+ }
+ });
+ }
+ {
+ returnNum.setText("");
+ FormData returnNumLData = new FormData();
+ returnNumLData.width = 63;
+ returnNumLData.height = 21;
+ returnNumLData.left = new FormAttachment(0, 1000, 410);
+ returnNumLData.top = new FormAttachment(0, 1000, 93);
+ returnNum.setLayoutData(returnNumLData);
+ }
+ }
+
+ //TODO logo
+ private void logo(Group logo){
+ FormLayout logoLayout = new FormLayout();
+ logo.setLayout(logoLayout);
+ GridData logoLData = new GridData();
+ logoLData.widthHint = 260;
+ logoLData.heightHint = 130;
+ logo.setLayoutData(logoLData);
+ logoLayout.marginWidth=30;
+ logoLayout.marginHeight=0;
+ {
+ cLabel2 = new CLabel(logo,SWT.NONE);
+ cLabel2.setImage(new Image(this.getDisplay(),"img/yalpV2.gif"));
+ }
+
+
+
+ }
+
+
+
+ //TODO resultComposite
+ private void resultTable(Composite resultComposite,Table resultTable,int tab){
+
+ resultComposite.setVisible(false);
+ FormLayout resultCompositeLayout = new FormLayout();
+ resultComposite.setLayout(resultCompositeLayout);
+ GridData resultCompositeLData = new GridData();
+ resultCompositeLData.widthHint = 502;
+ if (tab==1)resultCompositeLData.heightHint = 390;
+ else resultCompositeLData.heightHint = 380;
+ resultComposite.setLayoutData(resultCompositeLData);
+ {
+ FormData resultTableLData = new FormData();
+ resultTableLData.width = 482;
+ if (tab==1)resultTableLData.height = 365;
+ else resultTableLData.height = 313;
+ resultTableLData.left = new FormAttachment(0, 1000, 0);
+ resultTableLData.top = new FormAttachment(0, 1000, 7);
+ resultTable.setLayoutData(resultTableLData);
+ resultTable.setHeaderVisible(true);
+ TableColumn id = new TableColumn(resultTable,SWT.RIGHT);
+ id.setText("ID");
+ id.setWidth(0);
+ id.setMoveable(true);
+ id.addListener(SWT.Selection, new SortListener(this,resultTable,0,8));
+ TableColumn title = new TableColumn(resultTable,SWT.LEFT);
+ title.setText("Title");
+ title.setWidth(110);
+ title.setMoveable(true);
+ title.addListener(SWT.Selection, new SortListener(this,resultTable,1,8));
+ TableColumn author = new TableColumn(resultTable,SWT.LEFT);
+ author.setText("Author");
+ author.setWidth(100);
+ author.setMoveable(true);
+ author.addListener(SWT.Selection, new SortListener(this,resultTable,2,8));
+ TableColumn album = new TableColumn(resultTable,SWT.LEFT);
+ album.setText("Album");
+ album.setWidth(100);
+ album.setMoveable(true);
+ album.addListener(SWT.Selection, new SortListener(this,resultTable,3,8));
+ TableColumn year = new TableColumn(resultTable,SWT.LEFT);
+ year.setText("Year");
+ year.setWidth(60);
+ year.setMoveable(true);
+ year.addListener(SWT.Selection, new SortListener(this,resultTable,4,8));
+ TableColumn category = new TableColumn(resultTable,SWT.LEFT);
+ category.setText("Category");
+ category.setWidth(60);
+ category.setMoveable(true);
+ category.addListener(SWT.Selection, new SortListener(this,resultTable,5,8));
+ TableColumn type = new TableColumn(resultTable,SWT.LEFT);
+ type.setText("Type");
+ type.setWidth(60);
+ type.setMoveable(true);
+ type.addListener(SWT.Selection, new SortListener(this,resultTable,6,8));
+ }
+
+ }
+ private void saveButtonWidgetSelected(SelectionEvent evt) {
+ try{
+ int OwnerId = model.getOwnerid(ownerId.getText());
+ Media media = new Media();
+ media.id = new Integer(id.getText()).intValue();
+ media.name = title.getText();
+ media.duration = duration.getText();
+ media.lastEdit = new Date(System.currentTimeMillis()).toString();
+ media.path = path.getText();
+ media.fileName = name.getText();
+ /* t.b.d.
+ author.getText();
+ album.getText();
+ category.getText();
+ year.getText();
+ new Integer(aBitrate.getText()).intValue();
+ new Integer(vBitrate.getText()).intValue();
+ resolution.getText();
+ OwnerId;
+ */
+ if (model.changeMedia(media, Action.EDIT)) {
+ int select=resultTable2.getSelectionIndex();
+ TableItem item= new TableItem(resultTable2,SWT.NONE,select);
+ item.setText(0,new Integer(media.id).toString());
+ item.setText(1,media.name);
+ /* t.b.d. read from string props
+ item.setText(2,media.author.name);
+ item.setText(3,media.album);
+ item.setText(4,media.year);
+ item.setText(5,media.category);
+ */
+ item.setText(6,model.getTypeName(media.type));
+ resultTable2.remove(select+1);
+ resultTable2.setSelection(select);
+ changeComposite.setVisible(false);
+ deleteButton.setVisible(false);
+ }
+ }catch (Exception e){
+ System.out.println("Exception in SaveButton"+e);
+ }
+ }
+
+ private void searchPressed(Text searchField,Button videoCheckBox,Button audioCheckBox,CLabel returnNum,int tab){
+ String search = searchField.getText();
+ int returnVal;
+ ArrayList<MediaType> types = new ArrayList<MediaType>();
+
+ if( videoCheckBox.getSelection() )
+ types.add(MediaType.VIDEO);
+
+ if( audioCheckBox.getSelection() )
+ types.add(MediaType.SOUND);
+ /* t.b.d. add IMAGE support */
+
+ if (tab==1){
+ while(resultTable1.getItemCount()!=0){
+ resultTable1.remove(0);
+ }
+ }else{
+ while(resultTable2.getItemCount()!=0){
+ resultTable2.remove(0);
+ }
+ }
+ returnVal= model.search(search, types, tab);
+ ArrayList<Media>resultList = model.getMedia(tab);
+ for( int i = 0;
+ (resultList != null) && (i < resultList.size());
+ i++ )
+ {
+ TableItem item;
+ Media result=resultList.get(i);
+ if (tab==1) item=new TableItem(resultTable1,SWT.NONE);
+ else item= new TableItem(resultTable2,SWT.NONE);
+ item.setText(0,new Integer(result.id).toString());
+ item.setText(1,result.name);
+ /* t.b.d. add string_props support
+ if(result.author != null)
+ item.setText(2,result.author);
+
+ if(result.album != null)
+ item.setText(3,result.album);
+
+ if(result.year != null)
+ item.setText(4,result.year);
+
+ if(result.category != null)
+ item.setText(5,result.category);
+ */
+ if(result.type != null)
+ item.setText(6,model.getTypeName(result.type));
+
+ }
+ if (tab==1){
+ if (returnVal==1)returnNum.setText(returnVal+" Media");
+ else returnNum.setText(returnVal+" Medias");
+ resultComposite.setVisible(true);
+ playlistComposite.setVisible(true);
+ //bottemComposite.setVisible(true);
+ }
+ if (tab==2){
+ if (returnVal==1)returnNum.setText(returnVal+" Media");
+ else returnNum.setText(returnVal+" Medias");
+ composite1.setVisible(true);
+ }
+ }
+
+
+ private void deleteButtonWidgetSelected(SelectionEvent evt) {
+ try{
+ for (int i=resultTable2.getSelectionCount()-1;i>=0;i--){
+
+ Media result = model.getMediaWithId(
+ new Integer(resultTable2.getSelection()[i].getText(0)).intValue(),2 );
+
+ changeComposite.setVisible(false);
+ deleteButton.setVisible(false);
+ model.changeMedia(result, Action.DELETE);
+ resultTable2.remove(resultTable2.getSelectionIndices()[i]);
+ }
+ }catch (Exception e){
+ System.out.println("Exception in DeleteButton "+e);
+ }
+ }
+ private void addButtonWidgetSelected(SelectionEvent evt) {
+ System.out.println("browser not implemented in yalp v2");
+ }
+
+
+ public void refillIpTable(){
+ /* t.b.d. replace by session viewer
+ try{
+ ArrayList<ClientInfo> list=model.srvCon.getClientInfo();
+ while(iptable.getItemCount()!=0){
+ iptable.remove(0);
+ }
+ for(ClientInfo info : list){
+ TableItem item = new TableItem(iptable,SWT.NONE);
+ item.setText(0,info.getUserName());
+ item.setText(1,info.getIp());
+ }
+ }catch(Exception e){System.out.println("geht nicht "+e);}
+ */
+ }
+
+ public void show(){
+ ((Shell)this.parent).setImage(new Image(display,"img/yalpV2_klein.gif"));
+ ((Shell)this.parent).setText("yalp");
+ this.parent.addListener(SWT.Dispose,new org.eclipse.swt.widgets.Listener(){
+ public void handleEvent(org.eclipse.swt.widgets.Event e) {
+ ShellClose();
+ }
+ });
+ Point size = this.getSize();
+ java.awt.Dimension screen = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
+ Rectangle shellBounds = this.parent.computeTrim((screen.width-size.x)/2,(screen.height-size.y)/2,size.x,size.y);
+ this.parent.setLayout(new FillLayout());
+ this.parent.layout();
+ this.parent.setBounds(shellBounds);
+ ((Shell)this.parent).open();
+ while (!this.parent.isDisposed()) {
+ if (!display.readAndDispatch())
+ display.sleep();
+ }
+ }
+ public void ShellClose(){
+ this.model.logoff();
+ System.exit(0);
+ }
+
+}
+
diff --git a/src/YalpClients/SwtClient/GUI/InitGUI.java b/src/YalpClients/SwtClient/GUI/InitGUI.java index e432c50..6b1fa51 100644 --- a/src/YalpClients/SwtClient/GUI/InitGUI.java +++ b/src/YalpClients/SwtClient/GUI/InitGUI.java @@ -1,58 +1,58 @@ -/* - * Copyright (c) 2006 Manuel Traut and Volker Dahnke - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: Manuel Traut and Volker Dahnke - */ - -package YalpClients.SwtClient.GUI; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; - -import YalpClients.SwtClient.*; -import YalpInterfaces.AccessRights; - -/* - * Class InitGUI - * - * <em></em> - * - * @author Volker Dahnke / Manuel Traut - * - * @version 1 02-04-2006<br> - * - */ - -public class InitGUI { - private Model model; - private Display display; - private int time = 1000; - - public InitGUI(Model model,AccessRights kind){ - this.model=model; - this.display = Display.getDefault(); - final Runnable timer = new Runnable() { - public void run() { - serverStillAlive(this); - } - }; - display.timerExec(time, timer); - - GUI gui= new GUI( - new Shell(display ,SWT.MIN), display, model, kind, SWT.NULL ); - gui.show(); - } - - public void serverStillAlive(Runnable timer){ - model.serverStillAlive(); - if (!this.model.getLogoff()){ - this.display.timerExec(time, timer); - } - } - -} +/*
+ * Copyright (c) 2006 Manuel Traut and Volker Dahnke
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors: Manuel Traut and Volker Dahnke
+ */
+
+package YalpClients.SwtClient.GUI;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+import YalpClients.SwtClient.*;
+import YalpInterfaces.AccessRights;
+
+/*
+ * Class InitGUI
+ *
+ * <em></em>
+ *
+ * @author Volker Dahnke / Manuel Traut
+ *
+ * @version 1 02-04-2006<br>
+ *
+ */
+
+public class InitGUI {
+ private Model model;
+ private Display display;
+ private int time = 1000;
+
+ public InitGUI(Model model,AccessRights kind){
+ this.model=model;
+ this.display = Display.getDefault();
+ final Runnable timer = new Runnable() {
+ public void run() {
+ serverStillAlive(this);
+ }
+ };
+ display.timerExec(time, timer);
+
+ GUI gui= new GUI(
+ new Shell(display ,SWT.MIN), display, model, kind, SWT.NULL );
+ gui.show();
+ }
+
+ public void serverStillAlive(Runnable timer){
+ model.serverStillAlive();
+ if (!this.model.getLogoff()){
+ this.display.timerExec(time, timer);
+ }
+ }
+
+}
diff --git a/src/YalpClients/SwtClient/GUI/LoadDialog.java b/src/YalpClients/SwtClient/GUI/LoadDialog.java index fbe068b..dcdc4a8 100644 --- a/src/YalpClients/SwtClient/GUI/LoadDialog.java +++ b/src/YalpClients/SwtClient/GUI/LoadDialog.java @@ -1,110 +1,110 @@ -/* - * Copyright (c) 2006 Manuel Traut and Volker Dahnke - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: Manuel Traut and Volker Dahnke - */ - -package YalpClients.SwtClient.GUI; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -/* - * Class LoadDialog - * - * <em></em> - * - * @author Volker Dahnke / Manuel Traut - * - * @version 1 02-04-2006<br> - */ -public class LoadDialog extends Composite{ - - { - //Register as a resource user - SWTResourceManager will - //handle the obtaining and disposing of resources - SWTResourceManager.registerResourceUser(this); - } - - private CLabel cLabel1; - private CLabel cLabel2; - private CLabel cLabel3; - private Shell parent; - - public LoadDialog(Composite parent, int style) { - super(parent, style); - this.parent=(Shell)parent; - initDialog(); - } - - private void initDialog(){ - GridLayout thisLayout = new GridLayout(); - thisLayout.makeColumnsEqualWidth = true; - this.setLayout(thisLayout); - this.setSize(300,170); - { - Composite composite = new Composite(this, SWT.NONE); - FormLayout compositeLayout = new FormLayout(); - composite.setLayout(compositeLayout); - GridData compositeLData = new GridData(); - compositeLData.widthHint = 287; - compositeLData.heightHint = 165; - composite.setLayoutData(compositeLData); - composite.setVisible(true); - { - cLabel3 = new CLabel(composite, SWT.LEFT); - cLabel3.setText("Copyright (c) 2006 Manuel Traut and Volker Dahnke"); - FormData cLabel3LData = new FormData(); - cLabel3LData.width = 300; - cLabel3LData.height = 20; - cLabel3LData.left = new FormAttachment(0, 1000, 0); - cLabel3LData.top = new FormAttachment(0, 1000, 145); - cLabel3.setLayoutData(cLabel3LData); - cLabel3.setFont(SWTResourceManager.getFont("Times", 7, 0, false, false)); - } - { - cLabel2 = new CLabel(composite, SWT.CENTER); - cLabel2.setText("Loading..."); - FormData cLabel2LData = new FormData(); - cLabel2LData.width = 105; - cLabel2LData.height = 25; - cLabel2LData.left = new FormAttachment(0, 1000, 91); - cLabel2LData.top = new FormAttachment(0, 1000, 123); - cLabel2.setLayoutData(cLabel2LData); - cLabel2.setFont(SWTResourceManager.getFont("Times", 12, 1, false, false)); - } - { - cLabel1 = new CLabel(composite, SWT.CENTER); - FormData cLabel1LData = new FormData(); - cLabel1LData.width = 200; - cLabel1LData.height = 120; - cLabel1LData.left = new FormAttachment(0, 1000, 40); - cLabel1LData.top = new FormAttachment(0, 1000, 0); - cLabel1.setLayoutData(cLabel1LData); - cLabel1.setImage(new Image(this.getDisplay(),"img/yalpV2.gif")); - } - - } - } - - public void show(){ - Point size = this.getSize(); - java.awt.Dimension screen = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); - Rectangle shellBounds = this.parent.computeTrim((screen.width-size.x)/2,(screen.height-size.y)/2,size.x,size.y); - this.parent.setLayout(new FillLayout()); - this.parent.layout(); - this.parent.setBounds(shellBounds); - this.parent.open(); - } - - public void close(){ - this.parent.close(); - } -} +/*
+ * Copyright (c) 2006 Manuel Traut and Volker Dahnke
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors: Manuel Traut and Volker Dahnke
+ */
+
+package YalpClients.SwtClient.GUI;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.layout.*;
+import org.eclipse.swt.widgets.*;
+
+/*
+ * Class LoadDialog
+ *
+ * <em></em>
+ *
+ * @author Volker Dahnke / Manuel Traut
+ *
+ * @version 1 02-04-2006<br>
+ */
+public class LoadDialog extends Composite{
+
+ {
+ //Register as a resource user - SWTResourceManager will
+ //handle the obtaining and disposing of resources
+ SWTResourceManager.registerResourceUser(this);
+ }
+
+ private CLabel cLabel1;
+ private CLabel cLabel2;
+ private CLabel cLabel3;
+ private Shell parent;
+
+ public LoadDialog(Composite parent, int style) {
+ super(parent, style);
+ this.parent=(Shell)parent;
+ initDialog();
+ }
+
+ private void initDialog(){
+ GridLayout thisLayout = new GridLayout();
+ thisLayout.makeColumnsEqualWidth = true;
+ this.setLayout(thisLayout);
+ this.setSize(300,170);
+ {
+ Composite composite = new Composite(this, SWT.NONE);
+ FormLayout compositeLayout = new FormLayout();
+ composite.setLayout(compositeLayout);
+ GridData compositeLData = new GridData();
+ compositeLData.widthHint = 287;
+ compositeLData.heightHint = 165;
+ composite.setLayoutData(compositeLData);
+ composite.setVisible(true);
+ {
+ cLabel3 = new CLabel(composite, SWT.LEFT);
+ cLabel3.setText("Copyright (c) 2006 Manuel Traut and Volker Dahnke");
+ FormData cLabel3LData = new FormData();
+ cLabel3LData.width = 300;
+ cLabel3LData.height = 20;
+ cLabel3LData.left = new FormAttachment(0, 1000, 0);
+ cLabel3LData.top = new FormAttachment(0, 1000, 145);
+ cLabel3.setLayoutData(cLabel3LData);
+ cLabel3.setFont(SWTResourceManager.getFont("Times", 7, 0, false, false));
+ }
+ {
+ cLabel2 = new CLabel(composite, SWT.CENTER);
+ cLabel2.setText("Loading...");
+ FormData cLabel2LData = new FormData();
+ cLabel2LData.width = 105;
+ cLabel2LData.height = 25;
+ cLabel2LData.left = new FormAttachment(0, 1000, 91);
+ cLabel2LData.top = new FormAttachment(0, 1000, 123);
+ cLabel2.setLayoutData(cLabel2LData);
+ cLabel2.setFont(SWTResourceManager.getFont("Times", 12, 1, false, false));
+ }
+ {
+ cLabel1 = new CLabel(composite, SWT.CENTER);
+ FormData cLabel1LData = new FormData();
+ cLabel1LData.width = 200;
+ cLabel1LData.height = 120;
+ cLabel1LData.left = new FormAttachment(0, 1000, 40);
+ cLabel1LData.top = new FormAttachment(0, 1000, 0);
+ cLabel1.setLayoutData(cLabel1LData);
+ cLabel1.setImage(new Image(this.getDisplay(),"img/yalpV2.gif"));
+ }
+
+ }
+ }
+
+ public void show(){
+ Point size = this.getSize();
+ java.awt.Dimension screen = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
+ Rectangle shellBounds = this.parent.computeTrim((screen.width-size.x)/2,(screen.height-size.y)/2,size.x,size.y);
+ this.parent.setLayout(new FillLayout());
+ this.parent.layout();
+ this.parent.setBounds(shellBounds);
+ this.parent.open();
+ }
+
+ public void close(){
+ this.parent.close();
+ }
+}
diff --git a/src/YalpClients/SwtClient/GUI/SWTResourceManager.java b/src/YalpClients/SwtClient/GUI/SWTResourceManager.java index 258c883..87dffc3 100644 --- a/src/YalpClients/SwtClient/GUI/SWTResourceManager.java +++ b/src/YalpClients/SwtClient/GUI/SWTResourceManager.java @@ -1,145 +1,145 @@ -package YalpClients.SwtClient.GUI; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Vector; - -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Cursor; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.FontData; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Widget; - -/* - * Class to manage SWT resources (Font, Color, Image and Cursor) - * There are no restrictions on the use of this code. - * - * You may change this code and your changes will not be overwritten, - * but if you change the version number below then this class will be - * completely overwritten by Jigloo. - * #SWTResourceManager:version4.0.0# - */ -public class SWTResourceManager { - - private static HashMap resources = new HashMap(); - private static Vector users = new Vector(); - private static SWTResourceManager instance = new SWTResourceManager(); - - private static DisposeListener disposeListener = new DisposeListener() { - public void widgetDisposed(DisposeEvent e) { - users.remove(e.getSource()); - if (users.size() == 0) - dispose(); - } - }; - - /* - * This method should be called by *all* Widgets which use resources - * provided by this SWTResourceManager. When widgets are disposed, - * they are removed from the "users" Vector, and when no more - * registered Widgets are left, all resources are disposed. - * <P> - * If this method is not called for all Widgets then it should not be called - * at all, and the "dispose" method should be explicitly called after all - * resources are no longer being used. - */ - public static void registerResourceUser(Widget widget) { - if (users.contains(widget)) - return; - users.add(widget); - widget.addDisposeListener(disposeListener); - } - - public static void dispose() { - Iterator it = resources.keySet().iterator(); - while (it.hasNext()) { - Object resource = resources.get(it.next()); - if (resource instanceof Font) - ((Font) resource).dispose(); - else if (resource instanceof Color) - ((Color) resource).dispose(); - else if (resource instanceof Image) - ((Image) resource).dispose(); - else if (resource instanceof Cursor) - ((Cursor) resource).dispose(); - } - resources.clear(); - } - - public static Font getFont(String name, int size, int style) { - return getFont(name, size, style, false, false); - } - - public static Font getFont(String name, int size, int style, boolean strikeout, boolean underline) { - String fontName = name + "|" + size + "|" + style + "|" + strikeout + "|" + underline; - if (resources.containsKey(fontName)) - return (Font) resources.get(fontName); - FontData fd = new FontData(name, size, style); - if (strikeout || underline) { - try { - Class lfCls = Class.forName("org.eclipse.swt.internal.win32.LOGFONT"); - Object lf = FontData.class.getField("data").get(fd); - if (lf != null && lfCls != null) { - if (strikeout) - lfCls.getField("lfStrikeOut").set(lf, new Byte((byte) 1)); - if (underline) - lfCls.getField("lfUnderline").set(lf, new Byte((byte) 1)); - } - } catch (Throwable e) { - System.err.println( - "Unable to set underline or strikeout" + " (probably on a non-Windows platform). " + e); - } - } - Font font = new Font(Display.getDefault(), fd); - resources.put(fontName, font); - return font; - } - - public static Image getImage(String url, Control widget) { - Image img = getImage(url); - if(img != null && widget != null) - img.setBackground(widget.getBackground()); - return img; - } - - public static Image getImage(String url) { - try { - url = url.replace('\\', '/'); - if (url.startsWith("/")) - url = url.substring(1); - if (resources.containsKey(url)) - return (Image) resources.get(url); - Image img = new Image(Display.getDefault(), instance.getClass().getClassLoader().getResourceAsStream(url)); - if (img != null) - resources.put(url, img); - return img; - } catch (Exception e) { - System.err.println("SWTResourceManager.getImage: Error getting image "+url+", "+e); - return null; - } - } - - public static Color getColor(int red, int green, int blue) { - String name = "COLOR:" + red + "," + green + "," + blue; - if (resources.containsKey(name)) - return (Color) resources.get(name); - Color color = new Color(Display.getDefault(), red, green, blue); - resources.put(name, color); - return color; - } - - public static Cursor getCursor(int type) { - String name = "CURSOR:" + type; - if (resources.containsKey(name)) - return (Cursor) resources.get(name); - Cursor cursor = new Cursor(Display.getDefault(), type); - resources.put(name, cursor); - return cursor; - } - -} +package YalpClients.SwtClient.GUI;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Vector;
+
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Widget;
+
+/*
+ * Class to manage SWT resources (Font, Color, Image and Cursor)
+ * There are no restrictions on the use of this code.
+ *
+ * You may change this code and your changes will not be overwritten,
+ * but if you change the version number below then this class will be
+ * completely overwritten by Jigloo.
+ * #SWTResourceManager:version4.0.0#
+ */
+public class SWTResourceManager {
+
+ private static HashMap resources = new HashMap();
+ private static Vector users = new Vector();
+ private static SWTResourceManager instance = new SWTResourceManager();
+
+ private static DisposeListener disposeListener = new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ users.remove(e.getSource());
+ if (users.size() == 0)
+ dispose();
+ }
+ };
+
+ /*
+ * This method should be called by *all* Widgets which use resources
+ * provided by this SWTResourceManager. When widgets are disposed,
+ * they are removed from the "users" Vector, and when no more
+ * registered Widgets are left, all resources are disposed.
+ * <P>
+ * If this method is not called for all Widgets then it should not be called
+ * at all, and the "dispose" method should be explicitly called after all
+ * resources are no longer being used.
+ */
+ public static void registerResourceUser(Widget widget) {
+ if (users.contains(widget))
+ return;
+ users.add(widget);
+ widget.addDisposeListener(disposeListener);
+ }
+
+ public static void dispose() {
+ Iterator it = resources.keySet().iterator();
+ while (it.hasNext()) {
+ Object resource = resources.get(it.next());
+ if (resource instanceof Font)
+ ((Font) resource).dispose();
+ else if (resource instanceof Color)
+ ((Color) resource).dispose();
+ else if (resource instanceof Image)
+ ((Image) resource).dispose();
+ else if (resource instanceof Cursor)
+ ((Cursor) resource).dispose();
+ }
+ resources.clear();
+ }
+
+ public static Font getFont(String name, int size, int style) {
+ return getFont(name, size, style, false, false);
+ }
+
+ public static Font getFont(String name, int size, int style, boolean strikeout, boolean underline) {
+ String fontName = name + "|" + size + "|" + style + "|" + strikeout + "|" + underline;
+ if (resources.containsKey(fontName))
+ return (Font) resources.get(fontName);
+ FontData fd = new FontData(name, size, style);
+ if (strikeout || underline) {
+ try {
+ Class lfCls = Class.forName("org.eclipse.swt.internal.win32.LOGFONT");
+ Object lf = FontData.class.getField("data").get(fd);
+ if (lf != null && lfCls != null) {
+ if (strikeout)
+ lfCls.getField("lfStrikeOut").set(lf, new Byte((byte) 1));
+ if (underline)
+ lfCls.getField("lfUnderline").set(lf, new Byte((byte) 1));
+ }
+ } catch (Throwable e) {
+ System.err.println(
+ "Unable to set underline or strikeout" + " (probably on a non-Windows platform). " + e);
+ }
+ }
+ Font font = new Font(Display.getDefault(), fd);
+ resources.put(fontName, font);
+ return font;
+ }
+
+ public static Image getImage(String url, Control widget) {
+ Image img = getImage(url);
+ if(img != null && widget != null)
+ img.setBackground(widget.getBackground());
+ return img;
+ }
+
+ public static Image getImage(String url) {
+ try {
+ url = url.replace('\\', '/');
+ if (url.startsWith("/"))
+ url = url.substring(1);
+ if (resources.containsKey(url))
+ return (Image) resources.get(url);
+ Image img = new Image(Display.getDefault(), instance.getClass().getClassLoader().getResourceAsStream(url));
+ if (img != null)
+ resources.put(url, img);
+ return img;
+ } catch (Exception e) {
+ System.err.println("SWTResourceManager.getImage: Error getting image "+url+", "+e);
+ return null;
+ }
+ }
+
+ public static Color getColor(int red, int green, int blue) {
+ String name = "COLOR:" + red + "," + green + "," + blue;
+ if (resources.containsKey(name))
+ return (Color) resources.get(name);
+ Color color = new Color(Display.getDefault(), red, green, blue);
+ resources.put(name, color);
+ return color;
+ }
+
+ public static Cursor getCursor(int type) {
+ String name = "CURSOR:" + type;
+ if (resources.containsKey(name))
+ return (Cursor) resources.get(name);
+ Cursor cursor = new Cursor(Display.getDefault(), type);
+ resources.put(name, cursor);
+ return cursor;
+ }
+
+}
diff --git a/src/YalpClients/SwtClient/GUI/SortListener.java b/src/YalpClients/SwtClient/GUI/SortListener.java index 78598d6..a2ff35a 100644 --- a/src/YalpClients/SwtClient/GUI/SortListener.java +++ b/src/YalpClients/SwtClient/GUI/SortListener.java @@ -1,63 +1,63 @@ -/* - * Copyright (c) 2006 Manuel Traut and Volker Dahnke - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: Manuel Traut and Volker Dahnke - */ - -package YalpClients.SwtClient.GUI; - -import java.text.Collator; -import java.util.Locale; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.*; - -/* - * Class SortListener - * - * <em></em> - * - * @author Volker Dahnke / Manuel Traut - * - * @version 1 02-04-2006<br> - */ -public class SortListener implements Listener{ - private Table table; - private int colum,numColum; - private GUI gui; - - public SortListener(GUI gui,Table table,int colum,int numColum){ - this.colum=colum; - this.numColum=numColum; - this.table=table; - this.gui=gui; - } - - public void handleEvent(Event e) { - TableItem[] items = table.getItems(); - Collator collator = Collator.getInstance(Locale.getDefault()); - for (int i = 1; i < items.length; i++) { - String value1 = items[i].getText(colum); - for (int j = 0; j < i; j++) { - String value2 = items[j].getText(colum); - if (collator.compare(value1, value2) < 0) { - String[] values= new String[numColum]; - for(int g=0;g<numColum;g++){ - values[g]= items[i].getText(g); - } - items[i].dispose(); - TableItem item = new TableItem(table, SWT.NONE, j); - item.setText(values); - items = table.getItems(); - break; - } - } - } - gui.changeComposite.setVisible(false); - table.setSelection(0); - } -} - +/*
+ * Copyright (c) 2006 Manuel Traut and Volker Dahnke
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors: Manuel Traut and Volker Dahnke
+ */
+
+package YalpClients.SwtClient.GUI;
+
+import java.text.Collator;
+import java.util.Locale;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.*;
+
+/*
+ * Class SortListener
+ *
+ * <em></em>
+ *
+ * @author Volker Dahnke / Manuel Traut
+ *
+ * @version 1 02-04-2006<br>
+ */
+public class SortListener implements Listener{
+ private Table table;
+ private int colum,numColum;
+ private GUI gui;
+
+ public SortListener(GUI gui,Table table,int colum,int numColum){
+ this.colum=colum;
+ this.numColum=numColum;
+ this.table=table;
+ this.gui=gui;
+ }
+
+ public void handleEvent(Event e) {
+ TableItem[] items = table.getItems();
+ Collator collator = Collator.getInstance(Locale.getDefault());
+ for (int i = 1; i < items.length; i++) {
+ String value1 = items[i].getText(colum);
+ for (int j = 0; j < i; j++) {
+ String value2 = items[j].getText(colum);
+ if (collator.compare(value1, value2) < 0) {
+ String[] values= new String[numColum];
+ for(int g=0;g<numColum;g++){
+ values[g]= items[i].getText(g);
+ }
+ items[i].dispose();
+ TableItem item = new TableItem(table, SWT.NONE, j);
+ item.setText(values);
+ items = table.getItems();
+ break;
+ }
+ }
+ }
+ gui.changeComposite.setVisible(false);
+ table.setSelection(0);
+ }
+}
+
diff --git a/src/YalpClients/SwtClient/GUI/StartDialog.java b/src/YalpClients/SwtClient/GUI/StartDialog.java index 8f828f0..11ecc7f 100644 --- a/src/YalpClients/SwtClient/GUI/StartDialog.java +++ b/src/YalpClients/SwtClient/GUI/StartDialog.java @@ -1,236 +1,236 @@ -/* - * Copyright (c) 2006 Manuel Traut and Volker Dahnke - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: Manuel Traut and Volker Dahnke - */ - -package YalpClients.SwtClient.GUI; - -import YalpClients.SwtClient.Model; -import YalpInterfaces.AccessRights; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.*; -import org.eclipse.swt.events.*; -import org.eclipse.swt.graphics.*; -import org.eclipse.swt.layout.*; -import org.eclipse.swt.widgets.*; - -/* - * Class StartDialog - * - * <em></em> - * - * @author Volker Dahnke / Manuel Traut - * - * @version 1 02-04-2006<br> - */ -public class StartDialog extends Composite { - - { - //Register as a resource user - SWTResourceManager will - //handle the obtaining and disposing of resources - SWTResourceManager.registerResourceUser(this); - } - private Display display; - private CLabel cLabel1; - private CLabel LogoLabel; - private Model model; - private Composite parent; - private Composite composite; - private CLabel logonLable; - private Button ok; - private Text passwd; - private Text username; - private CLabel passwdLable; - private CLabel usernameLable; - - - public StartDialog(Composite parent,Model model, int style) { - super(parent, style); - - this.parent=parent; - this.model=model; - this.display=Display.getDefault(); - initStartDialog(); - } - - private void initStartDialog(){ - GridLayout thisLayout = new GridLayout(); - thisLayout.makeColumnsEqualWidth = true; - this.setLayout(thisLayout); - this.setSize(300,150); - Listener listener =new Listener() { - public void handleEvent(org.eclipse.swt.widgets.Event evt) { - if (evt.character==SWT.CR){ - OkPressed(); - } - } - }; - addListener(SWT.KeyDown,listener); - { - composite = new Composite(this, SWT.NONE); - FormLayout compositeLayout = new FormLayout(); - composite.setLayout(compositeLayout); - GridData compositeLData = new GridData(); - compositeLData.widthHint = 287; - compositeLData.heightHint = 140; - composite.setLayoutData(compositeLData); - composite.setVisible(true); - composite.addKeyListener(new KeyAdapter() { - public void keyPressed(KeyEvent evt) { - if (evt.character==SWT.CR){ - OkPressed(); - } - } - }); - { - cLabel1 = new CLabel(composite, SWT.NONE); - FormData cLabel1LData = new FormData(); - cLabel1LData.width = 120; - cLabel1LData.height = 20; - cLabel1LData.left = new FormAttachment(0, 1000, 93); - cLabel1LData.top = new FormAttachment(0, 1000, 40); - cLabel1.setLayoutData(cLabel1LData); - Color col =display.getSystemColor(SWT.COLOR_RED); - cLabel1.setForeground(col); - cLabel1.setFont(SWTResourceManager.getFont("Times", 10, 1, false, false)); - } - { - LogoLabel = new CLabel(composite, SWT.NONE); - FormData LogoLabelLData = new FormData(); - LogoLabelLData.width = 70; - LogoLabelLData.height = 42; - LogoLabelLData.left = new FormAttachment(0, 1000, 77); - LogoLabelLData.top = new FormAttachment(0, 1000, 0); - LogoLabelLData.right = new FormAttachment(1000, 1000, -140); - LogoLabelLData.bottom = new FormAttachment(1000, 1000, -98); - LogoLabel.setLayoutData(LogoLabelLData); - LogoLabel.setImage(new Image(this.getDisplay(),"img/yalpV2_mittel.gif")); - } - { - logonLable = new CLabel(composite, SWT.BEGINNING); - logonLable.setText("Login"); - FormData logonLableLData = new FormData(); - logonLableLData.width = 70; - logonLableLData.height = 28; - logonLableLData.left = new FormAttachment(0, 1000, 147); - logonLableLData.top = new FormAttachment(0, 1000, 5); - logonLable.setLayoutData(logonLableLData); - logonLable.setFont(SWTResourceManager.getFont("Times", 14, 1, false, false)); - } - { - username = new Text(composite, SWT.NONE); - FormData usernameLData = new FormData(); - usernameLData.width = 117; - usernameLData.height = 15; - usernameLData.left = new FormAttachment(0, 1000, 120); - usernameLData.top = new FormAttachment(0, 1000, 65); - username.setLayoutData(usernameLData); - username.setFocus(); - username.addKeyListener(new KeyAdapter() { - public void keyPressed(KeyEvent evt) { - if (evt.character==SWT.CR){ - OkPressed(); - } - } - }); - } - { - passwd = new Text(composite, SWT.PASSWORD); - FormData passwdLData = new FormData(); - passwdLData.width = 117; - passwdLData.height = 15; - passwdLData.left = new FormAttachment(0, 1000, 120); - passwdLData.top = new FormAttachment(0, 1000, 88); - passwd.setLayoutData(passwdLData); - passwd.addKeyListener(new KeyAdapter() { - public void keyPressed(KeyEvent evt) { - if (evt.character==SWT.CR){ - OkPressed(); - } - } - }); - } - { - ok = new Button(composite, SWT.PUSH | SWT.CENTER); - ok.setText("OK"); - FormData okLData = new FormData(); - okLData.width = 65; - okLData.height = 21; - okLData.left = new FormAttachment(0, 1000, 110); - okLData.top = new FormAttachment(0, 1000, 115); - ok.setLayoutData(okLData); - ok.setFont(SWTResourceManager.getFont("Times", 10, 1, false, false)); - ok.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent evt) { - OkPressed(); - } - }); - } - { - passwdLable = new CLabel(composite, SWT.NONE); - passwdLable.setText("Password:"); - FormData passwdLableLData = new FormData(); - passwdLableLData.width = 70; - passwdLableLData.height = 20; - passwdLableLData.left = new FormAttachment(0, 1000, 35); - passwdLableLData.top = new FormAttachment(0, 1000, 83); - passwdLable.setLayoutData(passwdLableLData); - passwdLable.setFont(SWTResourceManager.getFont("Times", 10, 0, false, false)); - } - { - usernameLable = new CLabel(composite, SWT.NONE); - usernameLable.setText("Username:"); - FormData usernameLableLData = new FormData(); - usernameLableLData.width = 70; - usernameLableLData.height = 20; - usernameLableLData.left = new FormAttachment(0, 1000, 35); - usernameLableLData.top = new FormAttachment(0, 1000, 60); - usernameLable.setLayoutData(usernameLableLData); - usernameLable.setFont(SWTResourceManager.getFont("Times", 10, 0, false, false)); - } - } - this.layout(); - - } - private void OkPressed(){ - AccessRights kind; - kind = model.userVerify(username.getText(), passwd.getText()); - - if (kind.value() == AccessRights._NO_YALP_SERVER ) { - cLabel1.setText("Server offline"); - } else if (kind.value() == AccessRights._DENY ){ - cLabel1.setText("Access Denied"); - username.setText(""); - passwd.setText(""); - username.setFocus(); - } else { - display.close(); - InitGUI gui = new InitGUI(model, kind); - } - - } - - public void show(){ - ((Shell)this.parent).setImage(new Image(display,"img/yalpV2_klein.gif")); - ((Shell)this.parent).setText("yalp"); - Point size = this.getSize(); - java.awt.Dimension screen = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); - Rectangle shellBounds = this.parent.computeTrim((screen.width-size.x)/2,(screen.height-size.y)/2,size.x,size.y); - this.parent.setLayout(new FillLayout()); - this.parent.layout(); - this.parent.setBounds(shellBounds); - ((Shell)this.parent).open(); - while (!this.parent.isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - } - - -} +/*
+ * Copyright (c) 2006 Manuel Traut and Volker Dahnke
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors: Manuel Traut and Volker Dahnke
+ */
+
+package YalpClients.SwtClient.GUI;
+
+import YalpClients.SwtClient.Model;
+import YalpInterfaces.AccessRights;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.*;
+import org.eclipse.swt.events.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.layout.*;
+import org.eclipse.swt.widgets.*;
+
+/*
+ * Class StartDialog
+ *
+ * <em></em>
+ *
+ * @author Volker Dahnke / Manuel Traut
+ *
+ * @version 1 02-04-2006<br>
+ */
+public class StartDialog extends Composite {
+
+ {
+ //Register as a resource user - SWTResourceManager will
+ //handle the obtaining and disposing of resources
+ SWTResourceManager.registerResourceUser(this);
+ }
+ private Display display;
+ private CLabel cLabel1;
+ private CLabel LogoLabel;
+ private Model model;
+ private Composite parent;
+ private Composite composite;
+ private CLabel logonLable;
+ private Button ok;
+ private Text passwd;
+ private Text username;
+ private CLabel passwdLable;
+ private CLabel usernameLable;
+
+
+ public StartDialog(Composite parent,Model model, int style) {
+ super(parent, style);
+
+ this.parent=parent;
+ this.model=model;
+ this.display=Display.getDefault();
+ initStartDialog();
+ }
+
+ private void initStartDialog(){
+ GridLayout thisLayout = new GridLayout();
+ thisLayout.makeColumnsEqualWidth = true;
+ this.setLayout(thisLayout);
+ this.setSize(300,150);
+ Listener listener =new Listener() {
+ public void handleEvent(org.eclipse.swt.widgets.Event evt) {
+ if (evt.character==SWT.CR){
+ OkPressed();
+ }
+ }
+ };
+ addListener(SWT.KeyDown,listener);
+ {
+ composite = new Composite(this, SWT.NONE);
+ FormLayout compositeLayout = new FormLayout();
+ composite.setLayout(compositeLayout);
+ GridData compositeLData = new GridData();
+ compositeLData.widthHint = 287;
+ compositeLData.heightHint = 140;
+ composite.setLayoutData(compositeLData);
+ composite.setVisible(true);
+ composite.addKeyListener(new KeyAdapter() {
+ public void keyPressed(KeyEvent evt) {
+ if (evt.character==SWT.CR){
+ OkPressed();
+ }
+ }
+ });
+ {
+ cLabel1 = new CLabel(composite, SWT.NONE);
+ FormData cLabel1LData = new FormData();
+ cLabel1LData.width = 120;
+ cLabel1LData.height = 20;
+ cLabel1LData.left = new FormAttachment(0, 1000, 93);
+ cLabel1LData.top = new FormAttachment(0, 1000, 40);
+ cLabel1.setLayoutData(cLabel1LData);
+ Color col =display.getSystemColor(SWT.COLOR_RED);
+ cLabel1.setForeground(col);
+ cLabel1.setFont(SWTResourceManager.getFont("Times", 10, 1, false, false));
+ }
+ {
+ LogoLabel = new CLabel(composite, SWT.NONE);
+ FormData LogoLabelLData = new FormData();
+ LogoLabelLData.width = 70;
+ LogoLabelLData.height = 42;
+ LogoLabelLData.left = new FormAttachment(0, 1000, 77);
+ LogoLabelLData.top = new FormAttachment(0, 1000, 0);
+ LogoLabelLData.right = new FormAttachment(1000, 1000, -140);
+ LogoLabelLData.bottom = new FormAttachment(1000, 1000, -98);
+ LogoLabel.setLayoutData(LogoLabelLData);
+ LogoLabel.setImage(new Image(this.getDisplay(),"img/yalpV2_mittel.gif"));
+ }
+ {
+ logonLable = new CLabel(composite, SWT.BEGINNING);
+ logonLable.setText("Login");
+ FormData logonLableLData = new FormData();
+ logonLableLData.width = 70;
+ logonLableLData.height = 28;
+ logonLableLData.left = new FormAttachment(0, 1000, 147);
+ logonLableLData.top = new FormAttachment(0, 1000, 5);
+ logonLable.setLayoutData(logonLableLData);
+ logonLable.setFont(SWTResourceManager.getFont("Times", 14, 1, false, false));
+ }
+ {
+ username = new Text(composite, SWT.NONE);
+ FormData usernameLData = new FormData();
+ usernameLData.width = 117;
+ usernameLData.height = 15;
+ usernameLData.left = new FormAttachment(0, 1000, 120);
+ usernameLData.top = new FormAttachment(0, 1000, 65);
+ username.setLayoutData(usernameLData);
+ username.setFocus();
+ username.addKeyListener(new KeyAdapter() {
+ public void keyPressed(KeyEvent evt) {
+ if (evt.character==SWT.CR){
+ OkPressed();
+ }
+ }
+ });
+ }
+ {
+ passwd = new Text(composite, SWT.PASSWORD);
+ FormData passwdLData = new FormData();
+ passwdLData.width = 117;
+ passwdLData.height = 15;
+ passwdLData.left = new FormAttachment(0, 1000, 120);
+ passwdLData.top = new FormAttachment(0, 1000, 88);
+ passwd.setLayoutData(passwdLData);
+ passwd.addKeyListener(new KeyAdapter() {
+ public void keyPressed(KeyEvent evt) {
+ if (evt.character==SWT.CR){
+ OkPressed();
+ }
+ }
+ });
+ }
+ {
+ ok = new Button(composite, SWT.PUSH | SWT.CENTER);
+ ok.setText("OK");
+ FormData okLData = new FormData();
+ okLData.width = 65;
+ okLData.height = 21;
+ okLData.left = new FormAttachment(0, 1000, 110);
+ okLData.top = new FormAttachment(0, 1000, 115);
+ ok.setLayoutData(okLData);
+ ok.setFont(SWTResourceManager.getFont("Times", 10, 1, false, false));
+ ok.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent evt) {
+ OkPressed();
+ }
+ });
+ }
+ {
+ passwdLable = new CLabel(composite, SWT.NONE);
+ passwdLable.setText("Password:");
+ FormData passwdLableLData = new FormData();
+ passwdLableLData.width = 70;
+ passwdLableLData.height = 20;
+ passwdLableLData.left = new FormAttachment(0, 1000, 35);
+ passwdLableLData.top = new FormAttachment(0, 1000, 83);
+ passwdLable.setLayoutData(passwdLableLData);
+ passwdLable.setFont(SWTResourceManager.getFont("Times", 10, 0, false, false));
+ }
+ {
+ usernameLable = new CLabel(composite, SWT.NONE);
+ usernameLable.setText("Username:");
+ FormData usernameLableLData = new FormData();
+ usernameLableLData.width = 70;
+ usernameLableLData.height = 20;
+ usernameLableLData.left = new FormAttachment(0, 1000, 35);
+ usernameLableLData.top = new FormAttachment(0, 1000, 60);
+ usernameLable.setLayoutData(usernameLableLData);
+ usernameLable.setFont(SWTResourceManager.getFont("Times", 10, 0, false, false));
+ }
+ }
+ this.layout();
+
+ }
+ private void OkPressed(){
+ AccessRights kind;
+ kind = model.userVerify(username.getText(), passwd.getText());
+
+ if (kind.value() == AccessRights._NO_YALP_SERVER ) {
+ cLabel1.setText("Server offline");
+ } else if (kind.value() == AccessRights._DENY ){
+ cLabel1.setText("Access Denied");
+ username.setText("");
+ passwd.setText("");
+ username.setFocus();
+ } else {
+ display.close();
+ InitGUI gui = new InitGUI(model, kind);
+ }
+
+ }
+
+ public void show(){
+ ((Shell)this.parent).setImage(new Image(display,"img/yalpV2_klein.gif"));
+ ((Shell)this.parent).setText("yalp");
+ Point size = this.getSize();
+ java.awt.Dimension screen = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
+ Rectangle shellBounds = this.parent.computeTrim((screen.width-size.x)/2,(screen.height-size.y)/2,size.x,size.y);
+ this.parent.setLayout(new FillLayout());
+ this.parent.layout();
+ this.parent.setBounds(shellBounds);
+ ((Shell)this.parent).open();
+ while (!this.parent.isDisposed()) {
+ if (!display.readAndDispatch())
+ display.sleep();
+ }
+ }
+
+
+}
diff --git a/src/YalpClients/SwtClient/Model.java b/src/YalpClients/SwtClient/Model.java index 0ebc09c..5423dc4 100755 --- a/src/YalpClients/SwtClient/Model.java +++ b/src/YalpClients/SwtClient/Model.java @@ -1,759 +1,759 @@ -/* - * Copyright (c) 2006 Manuel Traut and Volker Dahnke - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: Manuel Traut and Volker Dahnke - */ - -package YalpClients.SwtClient; - -import YalpInterfaces.*; -import YalpClients.*; - -import java.beans.XMLDecoder; -import java.beans.XMLEncoder; -import java.io.*; -import java.net.Inet4Address; -import java.net.MalformedURLException; -import java.net.UnknownHostException; -import java.sql.SQLException; -import java.util.ArrayList; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.MessageBox; -import org.eclipse.swt.widgets.Shell; - -import org.omg.CosNaming.*; -import org.omg.CosNaming.NamingContextPackage.*; -import org.omg.CORBA.*; - -/* - * Class Model - * - * <em>Implementiert die Schnittstellenfunktionen zur Steuerung des Servers - * (Datenbankinhalte schreiben, lesen; Streaming steuern</em> - * - * @author Volker Dahnke / Manuel Traut - * - * @version 0.6 14-12-2005<br> - * - * @see client.GUI - */ - -public class Model { - - public ServerControlInterface srvCon; - private Process vlcPlayer; - private Output actualStream = new Output(); - private Output streamInfo = new Output(); - private ArrayList<Media> findMedia = new ArrayList<Media>(); - private ArrayList<Media> editMedia = new ArrayList<Media>(); - private ArrayList<Media> toPlaylist = new ArrayList<Media>(); - private ArrayList<Media> playList = new ArrayList<Media>(); - private ArrayList<YalpUser> userList = new ArrayList<YalpUser>(); - private ClientConfiguration settings; - private String clientIP; - private String curPasswd; - private AccessRights userGroup=AccessRights.DENY; - private String userName; - private Boolean playback = false; - private Boolean logoff= false; - private Session session = new Session(); -/* - * Instances srvConnection to Registry, DbConnection, ServerControl - * and VlcStreamer. Also instances Class variables - */ - public Model(String[] argv) { - - this.settings=new ClientConfiguration(); - loadConfig("ClientConfiguration.xml"); - writeConfig("ClientConfiguration.xml"); - - try { - ORB orb = ORB.init(argv, null); - - org.omg.CORBA.Object objRef = - orb.resolve_initial_references("NameService"); - - NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef); - - String name = "YALP_Server"; - srvCon = ServerControlInterfaceHelper.narrow(ncRef.resolve_str(name)); - } catch (Exception e) {// DEBUG - String errorStr="couldn't connect to YALP Server"; - - MessageBox messageBox = new MessageBox( - new Shell(Display.getDefault(),SWT.MIN), SWT.OK ); - - System.out.println(e); - messageBox.setMessage(errorStr); - messageBox.open(); - System.exit(0); - } - - // determine client IP Adress - try { - this.clientIP = Inet4Address.getLocalHost().getHostAddress(); - System.out.println(this.clientIP); - } catch (UnknownHostException e) { - String errorStr = "Model.model: determine IP failed"; - - MessageBox messageBox = new MessageBox( - new Shell(Display.getDefault(),SWT.MIN), SWT.OK ); - - System.out.println(errorStr); - messageBox.setMessage(errorStr); - messageBox.open(); - System.exit(0); - } - this.userList = new ArrayList<YalpUser>(); - this.playList = new ArrayList<Media>(); - this.toPlaylist = new ArrayList<Media>(); - } - -/* - * write Configuration to XML File - * - * @param fileName - * @return boolean: true if succesful - */ - public boolean writeConfig(String fileName) { - try { - FileOutputStream srvConfigFile = new FileOutputStream(fileName); - XMLEncoder srvConfigWriter = new XMLEncoder(srvConfigFile); - srvConfigWriter.writeObject(settings.serverIP); - srvConfigWriter.writeObject(settings.classServerPort); - srvConfigWriter.writeObject(settings.registryPort); - srvConfigWriter.writeObject(settings.vlcCommand); - srvConfigWriter.close(); - } catch (FileNotFoundException fnfe) { - return false; - } - return true; - } - -/* - * load Configuration from XML File if possible - * - * @param fileName - * @return boolean: true if succesful - */ - public boolean loadConfig(String fileName){ - try{ - FileInputStream srvConfigFile = new FileInputStream(fileName); - XMLDecoder srvConfigLoader = new XMLDecoder(srvConfigFile); - System.out.println(srvConfigFile); - settings.serverIP = (String)srvConfigLoader.readObject(); - settings.classServerPort= (Integer)srvConfigLoader.readObject(); - settings.registryPort = (Integer)srvConfigLoader.readObject(); - settings.vlcCommand = (String)srvConfigLoader.readObject(); - srvConfigLoader.close(); - } catch(FileNotFoundException fnfe) { - System.out.println("Configuration not found, loading defaults..."); - return false; - } catch(ClassCastException cce) { - System.out.println("Errors in Configuration, loading defaults..."); - return false; - } - return true; - } - -/* - * get acutal srvConfig object - * - * @return ClientConfiguration: aktuelle Konfiguration - */ - public ClientConfiguration getConfig(){ - return this.settings; - } - -/* - * setzen und speichern eines ClientConfiguration Files - * - * @param set - * ClientConfiguration.xml - * @return boolean: true if succesful written Configuration - */ - public boolean setConfig(ClientConfiguration set){ - this.settings = set; - return this.writeConfig("ClientConfiguration.xml"); - } - -/* - * Sends YalpUsername and passwd to Server and returns YalpUsergroup - * - * @param username - * @param passwd - * @return AccessRights - */ - public AccessRights userVerify(String username,String passwd){ - this.userName=username; - this.curPasswd = passwd; - YalpErrorHolder err = new YalpErrorHolder(); - SessionHolder sess = new SessionHolder(); - try{ - // log on server - this.srvCon.clientLogon(this.userName,passwd,this.clientIP,sess,err); - this.session = sess.value; - this.userGroup = sess.value.me.level; - /* - } catch (RemoteException e) { - System.out.println("client.Model: Logon on Server failed 1"+ e); - e.printStackTrace(); - System.out.println("client.Model: Logon on Server failed 1"); - } catch (MalformedURLException e) { - System.out.println("client.Model: Logon on Server failed 2"); - } catch (SQLException e) { - System.out.println("client.Model: Logon on Server failed 3"); - } catch (NotBoundException e) { - System.out.println("client.Model: Logon on Server failed 4"); - */ - }catch(NullPointerException e){ - System.out.println("YALP Server couldn't be reached"); - this.userGroup = AccessRights.NO_YALP_SERVER; - } - return this.userGroup; - } - -/* - * Gets a list with all YalpUsers from the server - * - * @return ArrayList<YalpUser> all registered YalpUsers - */ - public ArrayList<YalpUser> getUser(){ - YalpErrorHolder err = new YalpErrorHolder(); - try{ - UsersHolder usr = new UsersHolder(); - this.srvCon.getUser(usr, err); - this.userList = new ArrayList<YalpUser>(usr.value.length); - for(int i = 0; i < usr.value.length; i++) - this.userList.add(usr.value[i]); - }catch(Exception e){ - System.out.println("Exceoption in Model userList "+ e); - } - return userList; - } - -/* - * Sends User change request to server - * - * @param user - * Configuration with changes on specific YalpUser - */ - public void changeUser(YalpUser user, String passwd, Action action) { - YalpErrorHolder err = new YalpErrorHolder(); - try{ - this.srvCon.changeUser( user, - passwd, - action, - err ); - System.out.println(err.value.descr); - }catch(Exception e){ - System.out.println("Exceoption in Model changeUser "+ e); - } - } - -/* - * Sends Media change request to server and refreshes Model data - * - * @param media - * to change - * @return boolean: succesful changed media - */ - public Boolean changeMedia(Media media, Action action){ - YalpErrorHolder err = new YalpErrorHolder(); - try{ - this.srvCon.changeMedia(media, action, err); - if(err.value.code == YalpErrorCode.OK){ - Media result; - for (int i=0;i<this.editMedia.size();i++){ - result=this.editMedia.get(i); - /* t.b.d. alter to new db desgin - if (result.id==media.id){ - result.type=media.type; - result.title=media.title; - result.author=media.author; - result.album=media.album; - result.category=media.category; - result.year=media.year; - result.duration=media.duration; - result.aBitrate=media.aBitrate; - result.vBitrate=media.vBitrate; - result.resolution=media.resolution; - result.ownerId=media.ownerId; - result.lastEdit=media.lastEdit; - result.path=media.path; - result.name=media.name; - return true; - } - */ - } - } - } catch(Exception e) { - System.out.println("Exceoption in Model changeUser "+ e); - } - return false; - } - -/* - * adds Media with given id to Playlist - * - * @param id - */ - public void add2PlayList(int id){ - Boolean notfound=true; - for (int i=0;(i<this.findMedia.size())&& (notfound);i++){ - Media result=this.findMedia.get(i); - if (result.id==id){ - String name = result.name; - String path = result.path; - if(playback){ - this.add2Stream(name, path); - } - this.playList.add(result); - this.toPlaylist.add(result); - notfound=false; - } - } - } - -/* - * Removes Media with given id from Playlist - * - * @param id - */ - public void removeFromPlayList(int id){ - /* t.b.d. - this.playList.remItem(id); - this.toPlaylist.remove(id); - */ - } - -/* - * Returns List with items to play - * - * @return ArrayList<Media>: ArrayList to create Playlist from - */ - public ArrayList<Media> getToPlaylist(){ - return this.toPlaylist; - } - -/* - * Creates new Stream with actual playlist - * - * @return Streaminfo: about new created Stream, Client should use this, - * information to get the Information howto receive the stream - */ - public Output createOutput(){ - /* t.b.d. former createStream */ - streamInfo.outputAction = Action.CREATE; - Media[] a = {}; - streamInfo.playlist = this.playList.toArray(a); - return this.streamInfo; - } - -/* - * Sends search request to server and refreshes Model data - * - * @param request - * Search Request - * @param kind - * 1 - search in first Window; other ints: search in other window - * (admins edit view) - * @return int: number of results - */ - public int search(String request, ArrayList<MediaType> types, int kind){ - YalpErrorHolder err = new YalpErrorHolder(); - MediasHolder result = new MediasHolder(); - try{ - MediaType[] a = {}; - if (kind == 1){ - srvCon.search(request, types.toArray(a), result, err); - for(int i = 0; i < result.value.length; i++) - findMedia.add(result.value[i]); - return findMedia.size(); - } else { - srvCon.search(request, types.toArray(a), result, err); - for(int i = 0; i < result.value.length; i++) - editMedia.add(result.value[i]); - return editMedia.size(); - } - } catch(Exception e){ - e.printStackTrace(); - System.out.println("Exceoption in Model search "+ e); - return 0; - } - } - -/* - * Returns the search result - * - * @param kind - * 1 - for searchMedia of mainwindow; 2 - for searchMedia of editView - * @return ArrayList<Media>: last found medias - */ - - public ArrayList<Media> getMedia(int kind){ - if (kind==1) return this.findMedia; - else return this.editMedia; - } - -/* - * Retuns search result with given id - * - * @param id - * of the result - * @param kind - * 1 - for mainWindow, 2 for admins editView - * @return Media: searchMedia, with specified ID - */ - public Media getMediaWithId(int id,int kind){ - ArrayList<Media> resultList; - if (kind==1)resultList= this.findMedia; - else resultList=this.editMedia; - for (int i=0;(i<resultList.size());i++){ - Media result=resultList.get(i); - if (result.id==id){ - return result; - } - } - return null; - } - -/* - * Retuns id of YalpUser with given username - * - * @param username - * @return int: useriD - */ - public int getOwnerid(String username){ - ArrayList<YalpUser> ownerList =this.userList; - for (YalpUser owner:ownerList){ - if (owner.name.equals(username)){ - return owner.id; - } - } - return 0; - } - -/* - * Returns MediaType as string - * - * @param mediatype - * @return string - */ - public String getTypeName(MediaType type) - { - switch(type.value()) - { - case MediaType._IMAGE: - return "image"; - case MediaType._SOUND: - return "sound"; - case MediaType._VIDEO: - return "video"; - default: - return "unknown"; - } - } - -/* - * Returns AccessRights as string - * - * @param mediatype - * @return string - */ - public String accessRightsName(AccessRights type) - { - switch(type.value()) - { - case AccessRights._USER: - return "user"; - case AccessRights._ADMIN: - return "admin"; - case AccessRights._DENY: - return "no login"; - default: - return "unknown"; - } - } - - -/* - * Sets class variable actualStream to given value - * - * @param aStream - * stream to srvControl via play, pause, etc - */ - public void setActualStream(Output aStream){ - actualStream = aStream; - } - -/* - * Starts Video Lan Player - * - * @return boolean: true if vlc can be started and a stream is actualStream - */ - private boolean startVLC(){ - - String vlcCmd = "/usr/bin/vlc" + - " --ignore-config --no-qt-privacy-ask --video-on-top --qt-display-mode=2"; - //settings.vlcCommand -/* - switch (this.actualStream.getAccess()){ - case UDP: - */ - vlcCmd += " udp://@:"; - /* - break; - case HTTP: - vlcCmd += "http://"; - break; - default: - System.out.println( - "client.Model.startVLC: playback this type is not supported" ); - } -*/ - vlcCmd += "9993"; // actualStream.info.params; - System.out.println(vlcCmd); - - try { - this.vlcPlayer = Runtime.getRuntime().exec(vlcCmd); - } catch (IOException e) { - System.out.println("client.Model.startVLC: starting vlcPlayer failed"); - return false; - } - return true; - } - -/* - * Stops Video Lan Player - * - */ - private void stopVLC(){ - playback = false; - if(vlcPlayer != null) - vlcPlayer.destroy(); - } - -/* - * Starts playback of actual playlist - * - * @return void - */ - public boolean play(){ - - playback = true; - - actualStream.outputAction = Action.CREATE; - actualStream.info = new AccessInfo( "bam", - "bam", - "vlc", - "params", - AccessType.STREAM ); - - Media[] a = new Media[playList.size()]; - actualStream.playlist = playList.toArray(a); - actualStream.destIp = clientIP; - - YalpErrorHolder err = new YalpErrorHolder(); - - OutputHolder tmp = new OutputHolder(); - tmp.value = actualStream; - - srvCon.control(tmp, err); - actualStream = tmp.value; - - actualStream.outputAction = Action.START; - OutputHolder tmp2 = new OutputHolder(actualStream); - srvCon.control(tmp2, err); - actualStream = tmp2.value; - startVLC(); - return true; - } - -/* - * Adds a new Media to Playlist. Only during playback - * - * @param name - * @param path - * @return boolean: true if succesful added - */ - public boolean add2Stream(String name, String path){ - - YalpErrorHolder err = new YalpErrorHolder(); - Media[] empty = {}; - this.actualStream.playlist = empty; - - Media media = new Media(); - media.path = path; - media.fileName = name; - - this.actualStream.playlist[this.actualStream.playlist.length] = media; - this.actualStream.outputAction = Action.CREATE; - - OutputHolder tmp = new OutputHolder(this.actualStream); - this.srvCon.control(tmp, err); - this.actualStream = tmp.value; - return true; - } - -/* - * Stops playback - * - * @return boolean: false - if srvConnection to streamer failed - */ - public boolean stop(){ - YalpErrorHolder err = new YalpErrorHolder(); - this.actualStream.outputAction = Action.STOP; - OutputHolder tmp = new OutputHolder(this.actualStream); - this.srvCon.control(tmp,err); - this.actualStream = tmp.value; - this.stopVLC(); - return true; - } - -/* - * jumps to next media in playlist - * - * @return boolean: false - if srvConnection to streamer failed - */ - public boolean next(){ - YalpErrorHolder err = new YalpErrorHolder(); - this.actualStream.outputAction = Action.FORWARD; - OutputHolder tmp = new OutputHolder(this.actualStream); - this.srvCon.control(tmp,err); - this.actualStream = tmp.value; - return true; - } - -/* - * Pauses playback - * - * @return boolean: false - if srvConnection to streamer failed - */ - public boolean pause(){ - YalpErrorHolder err = new YalpErrorHolder(); - this.actualStream.outputAction = Action.PAUSE; - OutputHolder tmp = new OutputHolder(this.actualStream); - this.srvCon.control(tmp,err); - this.actualStream = tmp.value; - return true; - } - -/* - * Causes the server to clean up and shutdown - * - */ - public void serverShutdown(){ - if (this.playback) - this.stop(); - this.srvCon.serverShutdown(); - } - -/* - * Checks if the server is still alive if not Client shutdown - * - */ - public void serverStillAlive(){ - // try{ - // srvCon.ping(); - /* }catch (RemoteException e){ - if (this.playback) - this.stopVLC(); - String errorStr="Server shutdown - Client is going down too"; - - MessageBox messageBox = new MessageBox( - new Shell(Display.getDefault(),SWT.MIN), SWT.OK); - - System.out.println(errorStr); - messageBox.setMessage(errorStr); - messageBox.open(); - System.exit(0); - } */ - } - -/* - * Returns client IP address - * - * @return String: ipAddress - */ - public String getClientIp(){ - return this.clientIP; - } - -/* - * Returns username of logged in user - * - * @return String: username - */ - public String getYalpUserName(){ - return this.userName; - } - -/* - * Returns indication if playback is runing - * - * @return boolean: true - if is play'in - */ - public Boolean getPlayback(){ - return this.playback; - } - -/* - * Get Total amount of streams played - * - * @return int: number of Streams totally played - * - public int getAllStreamNum(){ - try{ - return this.srvCon.getStreamCounter().getAllStreams(); - }catch (Exception e){ - System.out.println("Exception in Model.getAllStreamNum"+e); - } - return -1; - } - */ - -/* - * Gets amount of Streams actual playing - * - * @return int: number of Streams play'in at the moment - * - public int getActualStreamNum(){ - try{ - return this.srvCon.getStreamCounter().getActualStreams(); - }catch (Exception e){ - System.out.println("Exception in Model.getActualStreamNum"+e); - } - return -1; - } - */ - -/* - * Sets class variable logoff to true and logs off from server - */ - public void logoff(){ - YalpErrorHolder err = new YalpErrorHolder(); - try{ - this.logoff=true; - this.srvCon.clientLogoff(this.session, err); - }catch(Exception e) {// DEBUG - System.out.println("Model Exeptions in logoff"); - e.printStackTrace(); - } - } - -/* - * Returns indication if client is logging of - * - * @return Boolean: true - if is logging of - */ - public Boolean getLogoff(){ - return this.logoff; - } -} +/*
+ * Copyright (c) 2006 Manuel Traut and Volker Dahnke
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors: Manuel Traut and Volker Dahnke
+ */
+
+package YalpClients.SwtClient;
+
+import YalpInterfaces.*;
+import YalpClients.*;
+
+import java.beans.XMLDecoder;
+import java.beans.XMLEncoder;
+import java.io.*;
+import java.net.Inet4Address;
+import java.net.MalformedURLException;
+import java.net.UnknownHostException;
+import java.sql.SQLException;
+import java.util.ArrayList;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.swt.widgets.Shell;
+
+import org.omg.CosNaming.*;
+import org.omg.CosNaming.NamingContextPackage.*;
+import org.omg.CORBA.*;
+
+/*
+ * Class Model
+ *
+ * <em>Implementiert die Schnittstellenfunktionen zur Steuerung des Servers
+ * (Datenbankinhalte schreiben, lesen; Streaming steuern</em>
+ *
+ * @author Volker Dahnke / Manuel Traut
+ *
+ * @version 0.6 14-12-2005<br>
+ *
+ * @see client.GUI
+ */
+
+public class Model {
+
+ public ServerControlInterface srvCon;
+ private Process vlcPlayer;
+ private Output actualStream = new Output();
+ private Output streamInfo = new Output();
+ private ArrayList<Media> findMedia = new ArrayList<Media>();
+ private ArrayList<Media> editMedia = new ArrayList<Media>();
+ private ArrayList<Media> toPlaylist = new ArrayList<Media>();
+ private ArrayList<Media> playList = new ArrayList<Media>();
+ private ArrayList<YalpUser> userList = new ArrayList<YalpUser>();
+ private ClientConfiguration settings;
+ private String clientIP;
+ private String curPasswd;
+ private AccessRights userGroup=AccessRights.DENY;
+ private String userName;
+ private Boolean playback = false;
+ private Boolean logoff= false;
+ private Session session = new Session();
+/*
+ * Instances srvConnection to Registry, DbConnection, ServerControl
+ * and VlcStreamer. Also instances Class variables
+ */
+ public Model(String[] argv) {
+
+ this.settings=new ClientConfiguration();
+ loadConfig("ClientConfiguration.xml");
+ writeConfig("ClientConfiguration.xml");
+
+ try {
+ ORB orb = ORB.init(argv, null);
+
+ org.omg.CORBA.Object objRef =
+ orb.resolve_initial_references("NameService");
+
+ NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);
+
+ String name = "YALP_Server";
+ srvCon = ServerControlInterfaceHelper.narrow(ncRef.resolve_str(name));
+ } catch (Exception e) {// DEBUG
+ String errorStr="couldn't connect to YALP Server";
+
+ MessageBox messageBox = new MessageBox(
+ new Shell(Display.getDefault(),SWT.MIN), SWT.OK );
+
+ System.out.println(e);
+ messageBox.setMessage(errorStr);
+ messageBox.open();
+ System.exit(0);
+ }
+
+ // determine client IP Adress
+ try {
+ this.clientIP = Inet4Address.getLocalHost().getHostAddress();
+ System.out.println(this.clientIP);
+ } catch (UnknownHostException e) {
+ String errorStr = "Model.model: determine IP failed";
+
+ MessageBox messageBox = new MessageBox(
+ new Shell(Display.getDefault(),SWT.MIN), SWT.OK );
+
+ System.out.println(errorStr);
+ messageBox.setMessage(errorStr);
+ messageBox.open();
+ System.exit(0);
+ }
+ this.userList = new ArrayList<YalpUser>();
+ this.playList = new ArrayList<Media>();
+ this.toPlaylist = new ArrayList<Media>();
+ }
+
+/*
+ * write Configuration to XML File
+ *
+ * @param fileName
+ * @return boolean: true if succesful
+ */
+ public boolean writeConfig(String fileName) {
+ try {
+ FileOutputStream srvConfigFile = new FileOutputStream(fileName);
+ XMLEncoder srvConfigWriter = new XMLEncoder(srvConfigFile);
+ srvConfigWriter.writeObject(settings.serverIP);
+ srvConfigWriter.writeObject(settings.classServerPort);
+ srvConfigWriter.writeObject(settings.registryPort);
+ srvConfigWriter.writeObject(settings.vlcCommand);
+ srvConfigWriter.close();
+ } catch (FileNotFoundException fnfe) {
+ return false;
+ }
+ return true;
+ }
+
+/*
+ * load Configuration from XML File if possible
+ *
+ * @param fileName
+ * @return boolean: true if succesful
+ */
+ public boolean loadConfig(String fileName){
+ try{
+ FileInputStream srvConfigFile = new FileInputStream(fileName);
+ XMLDecoder srvConfigLoader = new XMLDecoder(srvConfigFile);
+ System.out.println(srvConfigFile);
+ settings.serverIP = (String)srvConfigLoader.readObject();
+ settings.classServerPort= (Integer)srvConfigLoader.readObject();
+ settings.registryPort = (Integer)srvConfigLoader.readObject();
+ settings.vlcCommand = (String)srvConfigLoader.readObject();
+ srvConfigLoader.close();
+ } catch(FileNotFoundException fnfe) {
+ System.out.println("Configuration not found, loading defaults...");
+ return false;
+ } catch(ClassCastException cce) {
+ System.out.println("Errors in Configuration, loading defaults...");
+ return false;
+ }
+ return true;
+ }
+
+/*
+ * get acutal srvConfig object
+ *
+ * @return ClientConfiguration: aktuelle Konfiguration
+ */
+ public ClientConfiguration getConfig(){
+ return this.settings;
+ }
+
+/*
+ * setzen und speichern eines ClientConfiguration Files
+ *
+ * @param set
+ * ClientConfiguration.xml
+ * @return boolean: true if succesful written Configuration
+ */
+ public boolean setConfig(ClientConfiguration set){
+ this.settings = set;
+ return this.writeConfig("ClientConfiguration.xml");
+ }
+
+/*
+ * Sends YalpUsername and passwd to Server and returns YalpUsergroup
+ *
+ * @param username
+ * @param passwd
+ * @return AccessRights
+ */
+ public AccessRights userVerify(String username,String passwd){
+ this.userName=username;
+ this.curPasswd = passwd;
+ YalpErrorHolder err = new YalpErrorHolder();
+ SessionHolder sess = new SessionHolder();
+ try{
+ // log on server
+ this.srvCon.clientLogon(this.userName,passwd,this.clientIP,sess,err);
+ this.session = sess.value;
+ this.userGroup = sess.value.me.level;
+ /*
+ } catch (RemoteException e) {
+ System.out.println("client.Model: Logon on Server failed 1"+ e);
+ e.printStackTrace();
+ System.out.println("client.Model: Logon on Server failed 1");
+ } catch (MalformedURLException e) {
+ System.out.println("client.Model: Logon on Server failed 2");
+ } catch (SQLException e) {
+ System.out.println("client.Model: Logon on Server failed 3");
+ } catch (NotBoundException e) {
+ System.out.println("client.Model: Logon on Server failed 4");
+ */
+ }catch(NullPointerException e){
+ System.out.println("YALP Server couldn't be reached");
+ this.userGroup = AccessRights.NO_YALP_SERVER;
+ }
+ return this.userGroup;
+ }
+
+/*
+ * Gets a list with all YalpUsers from the server
+ *
+ * @return ArrayList<YalpUser> all registered YalpUsers
+ */
+ public ArrayList<YalpUser> getUser(){
+ YalpErrorHolder err = new YalpErrorHolder();
+ try{
+ UsersHolder usr = new UsersHolder();
+ this.srvCon.getUser(usr, err);
+ this.userList = new ArrayList<YalpUser>(usr.value.length);
+ for(int i = 0; i < usr.value.length; i++)
+ this.userList.add(usr.value[i]);
+ }catch(Exception e){
+ System.out.println("Exceoption in Model userList "+ e);
+ }
+ return userList;
+ }
+
+/*
+ * Sends User change request to server
+ *
+ * @param user
+ * Configuration with changes on specific YalpUser
+ */
+ public void changeUser(YalpUser user, String passwd, Action action) {
+ YalpErrorHolder err = new YalpErrorHolder();
+ try{
+ this.srvCon.changeUser( user,
+ passwd,
+ action,
+ err );
+ System.out.println(err.value.descr);
+ }catch(Exception e){
+ System.out.println("Exceoption in Model changeUser "+ e);
+ }
+ }
+
+/*
+ * Sends Media change request to server and refreshes Model data
+ *
+ * @param media
+ * to change
+ * @return boolean: succesful changed media
+ */
+ public Boolean changeMedia(Media media, Action action){
+ YalpErrorHolder err = new YalpErrorHolder();
+ try{
+ this.srvCon.changeMedia(media, action, err);
+ if(err.value.code == YalpErrorCode.OK){
+ Media result;
+ for (int i=0;i<this.editMedia.size();i++){
+ result=this.editMedia.get(i);
+ /* t.b.d. alter to new db desgin
+ if (result.id==media.id){
+ result.type=media.type;
+ result.title=media.title;
+ result.author=media.author;
+ result.album=media.album;
+ result.category=media.category;
+ result.year=media.year;
+ result.duration=media.duration;
+ result.aBitrate=media.aBitrate;
+ result.vBitrate=media.vBitrate;
+ result.resolution=media.resolution;
+ result.ownerId=media.ownerId;
+ result.lastEdit=media.lastEdit;
+ result.path=media.path;
+ result.name=media.name;
+ return true;
+ }
+ */
+ }
+ }
+ } catch(Exception e) {
+ System.out.println("Exceoption in Model changeUser "+ e);
+ }
+ return false;
+ }
+
+/*
+ * adds Media with given id to Playlist
+ *
+ * @param id
+ */
+ public void add2PlayList(int id){
+ Boolean notfound=true;
+ for (int i=0;(i<this.findMedia.size())&& (notfound);i++){
+ Media result=this.findMedia.get(i);
+ if (result.id==id){
+ String name = result.name;
+ String path = result.path;
+ if(playback){
+ this.add2Stream(name, path);
+ }
+ this.playList.add(result);
+ this.toPlaylist.add(result);
+ notfound=false;
+ }
+ }
+ }
+
+/*
+ * Removes Media with given id from Playlist
+ *
+ * @param id
+ */
+ public void removeFromPlayList(int id){
+ /* t.b.d.
+ this.playList.remItem(id);
+ this.toPlaylist.remove(id);
+ */
+ }
+
+/*
+ * Returns List with items to play
+ *
+ * @return ArrayList<Media>: ArrayList to create Playlist from
+ */
+ public ArrayList<Media> getToPlaylist(){
+ return this.toPlaylist;
+ }
+
+/*
+ * Creates new Stream with actual playlist
+ *
+ * @return Streaminfo: about new created Stream, Client should use this,
+ * information to get the Information howto receive the stream
+ */
+ public Output createOutput(){
+ /* t.b.d. former createStream */
+ streamInfo.outputAction = Action.CREATE;
+ Media[] a = {};
+ streamInfo.playlist = this.playList.toArray(a);
+ return this.streamInfo;
+ }
+
+/*
+ * Sends search request to server and refreshes Model data
+ *
+ * @param request
+ * Search Request
+ * @param kind
+ * 1 - search in first Window; other ints: search in other window
+ * (admins edit view)
+ * @return int: number of results
+ */
+ public int search(String request, ArrayList<MediaType> types, int kind){
+ YalpErrorHolder err = new YalpErrorHolder();
+ MediasHolder result = new MediasHolder();
+ try{
+ MediaType[] a = {};
+ if (kind == 1){
+ srvCon.search(request, types.toArray(a), result, err);
+ for(int i = 0; i < result.value.length; i++)
+ findMedia.add(result.value[i]);
+ return findMedia.size();
+ } else {
+ srvCon.search(request, types.toArray(a), result, err);
+ for(int i = 0; i < result.value.length; i++)
+ editMedia.add(result.value[i]);
+ return editMedia.size();
+ }
+ } catch(Exception e){
+ e.printStackTrace();
+ System.out.println("Exceoption in Model search "+ e);
+ return 0;
+ }
+ }
+
+/*
+ * Returns the search result
+ *
+ * @param kind
+ * 1 - for searchMedia of mainwindow; 2 - for searchMedia of editView
+ * @return ArrayList<Media>: last found medias
+ */
+
+ public ArrayList<Media> getMedia(int kind){
+ if (kind==1) return this.findMedia;
+ else return this.editMedia;
+ }
+
+/*
+ * Retuns search result with given id
+ *
+ * @param id
+ * of the result
+ * @param kind
+ * 1 - for mainWindow, 2 for admins editView
+ * @return Media: searchMedia, with specified ID
+ */
+ public Media getMediaWithId(int id,int kind){
+ ArrayList<Media> resultList;
+ if (kind==1)resultList= this.findMedia;
+ else resultList=this.editMedia;
+ for (int i=0;(i<resultList.size());i++){
+ Media result=resultList.get(i);
+ if (result.id==id){
+ return result;
+ }
+ }
+ return null;
+ }
+
+/*
+ * Retuns id of YalpUser with given username
+ *
+ * @param username
+ * @return int: useriD
+ */
+ public int getOwnerid(String username){
+ ArrayList<YalpUser> ownerList =this.userList;
+ for (YalpUser owner:ownerList){
+ if (owner.name.equals(username)){
+ return owner.id;
+ }
+ }
+ return 0;
+ }
+
+/*
+ * Returns MediaType as string
+ *
+ * @param mediatype
+ * @return string
+ */
+ public String getTypeName(MediaType type)
+ {
+ switch(type.value())
+ {
+ case MediaType._IMAGE:
+ return "image";
+ case MediaType._SOUND:
+ return "sound";
+ case MediaType._VIDEO:
+ return "video";
+ default:
+ return "unknown";
+ }
+ }
+
+/*
+ * Returns AccessRights as string
+ *
+ * @param mediatype
+ * @return string
+ */
+ public String accessRightsName(AccessRights type)
+ {
+ switch(type.value())
+ {
+ case AccessRights._USER:
+ return "user";
+ case AccessRights._ADMIN:
+ return "admin";
+ case AccessRights._DENY:
+ return "no login";
+ default:
+ return "unknown";
+ }
+ }
+
+
+/*
+ * Sets class variable actualStream to given value
+ *
+ * @param aStream
+ * stream to srvControl via play, pause, etc
+ */
+ public void setActualStream(Output aStream){
+ actualStream = aStream;
+ }
+
+/*
+ * Starts Video Lan Player
+ *
+ * @return boolean: true if vlc can be started and a stream is actualStream
+ */
+ private boolean startVLC(){
+
+ String vlcCmd = "/usr/bin/vlc" +
+ " --ignore-config --no-qt-privacy-ask --video-on-top --qt-display-mode=2";
+ //settings.vlcCommand
+/*
+ switch (this.actualStream.getAccess()){
+ case UDP:
+ */
+ vlcCmd += " udp://@:";
+ /*
+ break;
+ case HTTP:
+ vlcCmd += "http://";
+ break;
+ default:
+ System.out.println(
+ "client.Model.startVLC: playback this type is not supported" );
+ }
+*/
+ vlcCmd += "9993"; // actualStream.info.params;
+ System.out.println(vlcCmd);
+
+ try {
+ this.vlcPlayer = Runtime.getRuntime().exec(vlcCmd);
+ } catch (IOException e) {
+ System.out.println("client.Model.startVLC: starting vlcPlayer failed");
+ return false;
+ }
+ return true;
+ }
+
+/*
+ * Stops Video Lan Player
+ *
+ */
+ private void stopVLC(){
+ playback = false;
+ if(vlcPlayer != null)
+ vlcPlayer.destroy();
+ }
+
+/*
+ * Starts playback of actual playlist
+ *
+ * @return void
+ */
+ public boolean play(){
+
+ playback = true;
+
+ actualStream.outputAction = Action.CREATE;
+ actualStream.info = new AccessInfo( "bam",
+ "bam",
+ "vlc",
+ "params",
+ AccessType.STREAM );
+
+ Media[] a = new Media[playList.size()];
+ actualStream.playlist = playList.toArray(a);
+ actualStream.destIp = clientIP;
+
+ YalpErrorHolder err = new YalpErrorHolder();
+
+ OutputHolder tmp = new OutputHolder();
+ tmp.value = actualStream;
+
+ srvCon.control(tmp, err);
+ actualStream = tmp.value;
+
+ actualStream.outputAction = Action.START;
+ OutputHolder tmp2 = new OutputHolder(actualStream);
+ srvCon.control(tmp2, err);
+ actualStream = tmp2.value;
+ startVLC();
+ return true;
+ }
+
+/*
+ * Adds a new Media to Playlist. Only during playback
+ *
+ * @param name
+ * @param path
+ * @return boolean: true if succesful added
+ */
+ public boolean add2Stream(String name, String path){
+
+ YalpErrorHolder err = new YalpErrorHolder();
+ Media[] empty = {};
+ this.actualStream.playlist = empty;
+
+ Media media = new Media();
+ media.path = path;
+ media.fileName = name;
+
+ this.actualStream.playlist[this.actualStream.playlist.length] = media;
+ this.actualStream.outputAction = Action.CREATE;
+
+ OutputHolder tmp = new OutputHolder(this.actualStream);
+ this.srvCon.control(tmp, err);
+ this.actualStream = tmp.value;
+ return true;
+ }
+
+/*
+ * Stops playback
+ *
+ * @return boolean: false - if srvConnection to streamer failed
+ */
+ public boolean stop(){
+ YalpErrorHolder err = new YalpErrorHolder();
+ this.actualStream.outputAction = Action.STOP;
+ OutputHolder tmp = new OutputHolder(this.actualStream);
+ this.srvCon.control(tmp,err);
+ this.actualStream = tmp.value;
+ this.stopVLC();
+ return true;
+ }
+
+/*
+ * jumps to next media in playlist
+ *
+ * @return boolean: false - if srvConnection to streamer failed
+ */
+ public boolean next(){
+ YalpErrorHolder err = new YalpErrorHolder();
+ this.actualStream.outputAction = Action.FORWARD;
+ OutputHolder tmp = new OutputHolder(this.actualStream);
+ this.srvCon.control(tmp,err);
+ this.actualStream = tmp.value;
+ return true;
+ }
+
+/*
+ * Pauses playback
+ *
+ * @return boolean: false - if srvConnection to streamer failed
+ */
+ public boolean pause(){
+ YalpErrorHolder err = new YalpErrorHolder();
+ this.actualStream.outputAction = Action.PAUSE;
+ OutputHolder tmp = new OutputHolder(this.actualStream);
+ this.srvCon.control(tmp,err);
+ this.actualStream = tmp.value;
+ return true;
+ }
+
+/*
+ * Causes the server to clean up and shutdown
+ *
+ */
+ public void serverShutdown(){
+ if (this.playback)
+ this.stop();
+ this.srvCon.serverShutdown();
+ }
+
+/*
+ * Checks if the server is still alive if not Client shutdown
+ *
+ */
+ public void serverStillAlive(){
+ // try{
+ // srvCon.ping();
+ /* }catch (RemoteException e){
+ if (this.playback)
+ this.stopVLC();
+ String errorStr="Server shutdown - Client is going down too";
+
+ MessageBox messageBox = new MessageBox(
+ new Shell(Display.getDefault(),SWT.MIN), SWT.OK);
+
+ System.out.println(errorStr);
+ messageBox.setMessage(errorStr);
+ messageBox.open();
+ System.exit(0);
+ } */
+ }
+
+/*
+ * Returns client IP address
+ *
+ * @return String: ipAddress
+ */
+ public String getClientIp(){
+ return this.clientIP;
+ }
+
+/*
+ * Returns username of logged in user
+ *
+ * @return String: username
+ */
+ public String getYalpUserName(){
+ return this.userName;
+ }
+
+/*
+ * Returns indication if playback is runing
+ *
+ * @return boolean: true - if is play'in
+ */
+ public Boolean getPlayback(){
+ return this.playback;
+ }
+
+/*
+ * Get Total amount of streams played
+ *
+ * @return int: number of Streams totally played
+ *
+ public int getAllStreamNum(){
+ try{
+ return this.srvCon.getStreamCounter().getAllStreams();
+ }catch (Exception e){
+ System.out.println("Exception in Model.getAllStreamNum"+e);
+ }
+ return -1;
+ }
+ */
+
+/*
+ * Gets amount of Streams actual playing
+ *
+ * @return int: number of Streams play'in at the moment
+ *
+ public int getActualStreamNum(){
+ try{
+ return this.srvCon.getStreamCounter().getActualStreams();
+ }catch (Exception e){
+ System.out.println("Exception in Model.getActualStreamNum"+e);
+ }
+ return -1;
+ }
+ */
+
+/*
+ * Sets class variable logoff to true and logs off from server
+ */
+ public void logoff(){
+ YalpErrorHolder err = new YalpErrorHolder();
+ try{
+ this.logoff=true;
+ this.srvCon.clientLogoff(this.session, err);
+ }catch(Exception e) {// DEBUG
+ System.out.println("Model Exeptions in logoff");
+ e.printStackTrace();
+ }
+ }
+
+/*
+ * Returns indication if client is logging of
+ *
+ * @return Boolean: true - if is logging of
+ */
+ public Boolean getLogoff(){
+ return this.logoff;
+ }
+}
diff --git a/src/YalpClients/SwtClient/SwtClient.java b/src/YalpClients/SwtClient/SwtClient.java index 1950eaa..513d4ff 100755 --- a/src/YalpClients/SwtClient/SwtClient.java +++ b/src/YalpClients/SwtClient/SwtClient.java @@ -1,61 +1,61 @@ -/* - * - * Copyright (c) 2006 Manuel Traut and Volker Dahnke - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: Manuel Traut and Volker Dahnke - * - */ -package YalpClients.SwtClient; - -import YalpClients.SwtClient.GUI.*; - -import org.eclipse.swt.*; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; - - -/* - * Class SwtClient - * - * <em>static main method</em> - * - * @author Volker Dahnke / Manuel Traut - * - * @version 0.1 20-11-2005<br> - */ -public class SwtClient{ - -/* - * Client initialization - * - * @param argv - * arguments which are not used - */ - public static void main (String[] argv) { - try{ - System.setProperty("java.security.policy","client.policy"); - } - catch (Exception e) {//DEBUG - System.out.println ("Server SecurityManagerExeptions not caught jet " + e); - System.exit(0); - } - - LoadDialog load = new LoadDialog( - new Shell(Display.getDefault(),SWT.NONE), SWT.NONE); - - load.show(); - final Model model = new Model(argv); - load.close(); - - StartDialog start = - new StartDialog(new Shell(Display.getDefault(),SWT.MIN),model, SWT.NONE); - - start.show(); - - return; - } -} +/*
+ *
+ * Copyright (c) 2006 Manuel Traut and Volker Dahnke
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors: Manuel Traut and Volker Dahnke
+ *
+ */
+package YalpClients.SwtClient;
+
+import YalpClients.SwtClient.GUI.*;
+
+import org.eclipse.swt.*;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+
+/*
+ * Class SwtClient
+ *
+ * <em>static main method</em>
+ *
+ * @author Volker Dahnke / Manuel Traut
+ *
+ * @version 0.1 20-11-2005<br>
+ */
+public class SwtClient{
+
+/*
+ * Client initialization
+ *
+ * @param argv
+ * arguments which are not used
+ */
+ public static void main (String[] argv) {
+ try{
+ System.setProperty("java.security.policy","client.policy");
+ }
+ catch (Exception e) {//DEBUG
+ System.out.println ("Server SecurityManagerExeptions not caught jet " + e);
+ System.exit(0);
+ }
+
+ LoadDialog load = new LoadDialog(
+ new Shell(Display.getDefault(),SWT.NONE), SWT.NONE);
+
+ load.show();
+ final Model model = new Model(argv);
+ load.close();
+
+ StartDialog start =
+ new StartDialog(new Shell(Display.getDefault(),SWT.MIN),model, SWT.NONE);
+
+ start.show();
+
+ return;
+ }
+}
diff --git a/src/YalpClients/WebClient/App.xaml b/src/YalpClients/WebClient/App.xaml index 48a0475..4919f98 100644 --- a/src/YalpClients/WebClient/App.xaml +++ b/src/YalpClients/WebClient/App.xaml @@ -1,8 +1,8 @@ -<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - x:Class="VideoPlayer.App" - > - <Application.Resources> - - </Application.Resources> -</Application> +<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ x:Class="VideoPlayer.App"
+ >
+ <Application.Resources>
+
+ </Application.Resources>
+</Application>
diff --git a/src/YalpClients/WebClient/App.xaml.cs b/src/YalpClients/WebClient/App.xaml.cs index 2a30f24..f377355 100644 --- a/src/YalpClients/WebClient/App.xaml.cs +++ b/src/YalpClients/WebClient/App.xaml.cs @@ -1,66 +1,66 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Animation; -using System.Windows.Shapes; - -namespace VideoPlayer -{ - public partial class App : Application - { - - public App() - { - this.Startup += this.Application_Startup; - this.Exit += this.Application_Exit; - this.UnhandledException += this.Application_UnhandledException; - - InitializeComponent(); - } - - private void Application_Startup(object sender, StartupEventArgs e) - { - this.RootVisual = new MainPage(); - } - - private void Application_Exit(object sender, EventArgs e) - { - - } - private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) - { - // If the app is running outside of the debugger then report the exception using - // the browser's exception mechanism. On IE this will display it a yellow alert - // icon in the status bar and Firefox will display a script error. - if (!System.Diagnostics.Debugger.IsAttached) - { - - // NOTE: This will allow the application to continue running after an exception has been thrown - // but not handled. - // For production applications this error handling should be replaced with something that will - // report the error to the website and stop the application. - e.Handled = true; - Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); }); - } - } - private void ReportErrorToDOM(ApplicationUnhandledExceptionEventArgs e) - { - try - { - string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace; - errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n"); - - System.Windows.Browser.HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight Application " + errorMsg + "\");"); - } - catch (Exception) - { - } - } - } -} +using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Animation;
+using System.Windows.Shapes;
+
+namespace VideoPlayer
+{
+ public partial class App : Application
+ {
+
+ public App()
+ {
+ this.Startup += this.Application_Startup;
+ this.Exit += this.Application_Exit;
+ this.UnhandledException += this.Application_UnhandledException;
+
+ InitializeComponent();
+ }
+
+ private void Application_Startup(object sender, StartupEventArgs e)
+ {
+ this.RootVisual = new MainPage();
+ }
+
+ private void Application_Exit(object sender, EventArgs e)
+ {
+
+ }
+ private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
+ {
+ // If the app is running outside of the debugger then report the exception using
+ // the browser's exception mechanism. On IE this will display it a yellow alert
+ // icon in the status bar and Firefox will display a script error.
+ if (!System.Diagnostics.Debugger.IsAttached)
+ {
+
+ // NOTE: This will allow the application to continue running after an exception has been thrown
+ // but not handled.
+ // For production applications this error handling should be replaced with something that will
+ // report the error to the website and stop the application.
+ e.Handled = true;
+ Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); });
+ }
+ }
+ private void ReportErrorToDOM(ApplicationUnhandledExceptionEventArgs e)
+ {
+ try
+ {
+ string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace;
+ errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n");
+
+ System.Windows.Browser.HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight Application " + errorMsg + "\");");
+ }
+ catch (Exception)
+ {
+ }
+ }
+ }
+}
diff --git a/src/YalpClients/WebClient/Default.aspx.cs b/src/YalpClients/WebClient/Default.aspx.cs index 0bd1d7d..dbb34a1 100644 --- a/src/YalpClients/WebClient/Default.aspx.cs +++ b/src/YalpClients/WebClient/Default.aspx.cs @@ -1,22 +1,22 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.UI; -using System.Web.UI.WebControls; - -namespace TwitterSearchApplication.Web -{ - public partial class _Default : System.Web.UI.Page - { - protected void Page_Load(object sender, EventArgs e) - { - - } - - protected void Button1_Click(object sender, EventArgs e) - { - - } - } -} +using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+
+namespace TwitterSearchApplication.Web
+{
+ public partial class _Default : System.Web.UI.Page
+ {
+ protected void Page_Load(object sender, EventArgs e)
+ {
+
+ }
+
+ protected void Button1_Click(object sender, EventArgs e)
+ {
+
+ }
+ }
+}
diff --git a/src/YalpClients/WebClient/Default.aspx.designer.cs b/src/YalpClients/WebClient/Default.aspx.designer.cs index 6b1c246..68788e8 100644 --- a/src/YalpClients/WebClient/Default.aspx.designer.cs +++ b/src/YalpClients/WebClient/Default.aspx.designer.cs @@ -1,70 +1,70 @@ -//------------------------------------------------------------------------------ -// <auto-generated> -// Dieser Code wurde von einem Tool generiert. -// Laufzeitversion:2.0.50727.4200 -// -// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn -// der Code erneut generiert wird. -// </auto-generated> -//------------------------------------------------------------------------------ - -namespace TwitterSearchApplication.Web { - - - public partial class _Default { - - /// <summary> - /// form1-Steuerelement - /// </summary> - /// <remarks> - /// Automatisch generiertes Feld - /// Um dies zu ändern, verschieben Sie die Felddeklaration aus der Designerdatei in eine Code-Behind-Datei. - /// </remarks> - protected global::System.Web.UI.HtmlControls.HtmlForm form1; - - /// <summary> - /// Checkbox1-Steuerelement - /// </summary> - /// <remarks> - /// Automatisch generiertes Feld - /// Um dies zu ändern, verschieben Sie die Felddeklaration aus der Designerdatei in eine Code-Behind-Datei. - /// </remarks> - protected global::System.Web.UI.WebControls.CheckBox Checkbox1; - - /// <summary> - /// Button1-Steuerelement - /// </summary> - /// <remarks> - /// Automatisch generiertes Feld - /// Um dies zu ändern, verschieben Sie die Felddeklaration aus der Designerdatei in eine Code-Behind-Datei. - /// </remarks> - protected global::System.Web.UI.WebControls.Button Button1; - - /// <summary> - /// TextBox1-Steuerelement - /// </summary> - /// <remarks> - /// Automatisch generiertes Feld - /// Um dies zu ändern, verschieben Sie die Felddeklaration aus der Designerdatei in eine Code-Behind-Datei. - /// </remarks> - protected global::System.Web.UI.WebControls.TextBox TextBox1; - - /// <summary> - /// TextBox2-Steuerelement - /// </summary> - /// <remarks> - /// Automatisch generiertes Feld - /// Um dies zu ändern, verschieben Sie die Felddeklaration aus der Designerdatei in eine Code-Behind-Datei. - /// </remarks> - protected global::System.Web.UI.WebControls.TextBox TextBox2; - - /// <summary> - /// RadioButton1-Steuerelement - /// </summary> - /// <remarks> - /// Automatisch generiertes Feld - /// Um dies zu ändern, verschieben Sie die Felddeklaration aus der Designerdatei in eine Code-Behind-Datei. - /// </remarks> - protected global::System.Web.UI.WebControls.RadioButton RadioButton1; - } -} +//------------------------------------------------------------------------------
+// <auto-generated>
+// Dieser Code wurde von einem Tool generiert.
+// Laufzeitversion:2.0.50727.4200
+//
+// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
+// der Code erneut generiert wird.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace TwitterSearchApplication.Web {
+
+
+ public partial class _Default {
+
+ /// <summary>
+ /// form1-Steuerelement
+ /// </summary>
+ /// <remarks>
+ /// Automatisch generiertes Feld
+ /// Um dies zu ändern, verschieben Sie die Felddeklaration aus der Designerdatei in eine Code-Behind-Datei.
+ /// </remarks>
+ protected global::System.Web.UI.HtmlControls.HtmlForm form1;
+
+ /// <summary>
+ /// Checkbox1-Steuerelement
+ /// </summary>
+ /// <remarks>
+ /// Automatisch generiertes Feld
+ /// Um dies zu ändern, verschieben Sie die Felddeklaration aus der Designerdatei in eine Code-Behind-Datei.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.CheckBox Checkbox1;
+
+ /// <summary>
+ /// Button1-Steuerelement
+ /// </summary>
+ /// <remarks>
+ /// Automatisch generiertes Feld
+ /// Um dies zu ändern, verschieben Sie die Felddeklaration aus der Designerdatei in eine Code-Behind-Datei.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.Button Button1;
+
+ /// <summary>
+ /// TextBox1-Steuerelement
+ /// </summary>
+ /// <remarks>
+ /// Automatisch generiertes Feld
+ /// Um dies zu ändern, verschieben Sie die Felddeklaration aus der Designerdatei in eine Code-Behind-Datei.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.TextBox TextBox1;
+
+ /// <summary>
+ /// TextBox2-Steuerelement
+ /// </summary>
+ /// <remarks>
+ /// Automatisch generiertes Feld
+ /// Um dies zu ändern, verschieben Sie die Felddeklaration aus der Designerdatei in eine Code-Behind-Datei.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.TextBox TextBox2;
+
+ /// <summary>
+ /// RadioButton1-Steuerelement
+ /// </summary>
+ /// <remarks>
+ /// Automatisch generiertes Feld
+ /// Um dies zu ändern, verschieben Sie die Felddeklaration aus der Designerdatei in eine Code-Behind-Datei.
+ /// </remarks>
+ protected global::System.Web.UI.WebControls.RadioButton RadioButton1;
+ }
+}
diff --git a/src/YalpClients/WebClient/MainPage.xaml b/src/YalpClients/WebClient/MainPage.xaml index 462b529..bbda7d3 100644 --- a/src/YalpClients/WebClient/MainPage.xaml +++ b/src/YalpClients/WebClient/MainPage.xaml @@ -1,284 +1,283 @@ -<UserControl xmlns:chartingToolkit="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit" x:Class="VideoPlayer.MainPage" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows" - mc:Ignorable="d" - Width="Auto" Height="Auto"> - - <UserControl.Resources> - <Style x:Key="roundThumbStyle" TargetType="Thumb"> - <Setter Property="Template"> - <Setter.Value> - <ControlTemplate TargetType="Thumb"> - <Ellipse Stroke="#FFFFFFFF" StrokeThickness="2" Fill="#FF484848"/> - </ControlTemplate> - </Setter.Value> - </Setter> - </Style> - <Grid x:Name="grid" Background="Transparent"> - - </Grid> - <Style x:Key="SliderStyle" TargetType="Slider"> - <Setter Property="Template"> - <Setter.Value> - <ControlTemplate TargetType="Slider"> - <Grid x:Name="Root" Background="Transparent"> - <Grid.Resources> - <ControlTemplate x:Key="RightRepeatButtonTemplate"> - <Rectangle Height="6" Margin="-5,0,0,0" Grid.Column="0" Grid.ColumnSpan="3" - StrokeThickness="0.5" RadiusY="3.5" RadiusX="3.5" Fill="#FF484848"/> - </ControlTemplate> - <ControlTemplate x:Key="LeftRepeatButtonTemplate"> - <Rectangle Height="6" Margin="0,0,-5,0" Grid.Column="0" Grid.ColumnSpan="3" - StrokeThickness="0.5" RadiusY="3.5" RadiusX="3.5" Fill="#FF7F7F7F"/> - </ControlTemplate> - </Grid.Resources> - <Grid x:Name="HorizontalTemplate"> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="Auto"/> - <ColumnDefinition Width="Auto"/> - <ColumnDefinition Width="*"/> - </Grid.ColumnDefinitions> - - <RepeatButton x:Name="HorizontalTrackLargeChangeDecreaseRepeatButton" Grid.Column="0" - IsTabStop="False" Template="{StaticResource LeftRepeatButtonTemplate}"/> - <Rectangle x:Name="LeftTrack" Grid.Row="1" Fill="#00FFFFFF" Cursor="Hand" MouseLeftButtonDown="LeftTrack_MouseLeftButtonDown"/> - <Thumb Background="#00FFFFFF" Height="10" x:Name="HorizontalThumb" Width="10" - Grid.Column="1" Style="{StaticResource roundThumbStyle}" HorizontalAlignment="Left" - DragStarted="HorizontalThumb_DragStarted" DragCompleted="HorizontalThumb_DragCompleted" - Canvas.ZIndex="1"/> - <RepeatButton x:Name="HorizontalTrackLargeChangeIncreaseRepeatButton" Grid.Column="2" - IsTabStop="False" Template="{StaticResource RightRepeatButtonTemplate}"/> - <Rectangle x:Name="RightTrack" Grid.Column="2" Grid.Row="1" Fill="#00FFFFFF" Cursor="Hand" MouseLeftButtonDown="LeftTrack_MouseLeftButtonDown"/> - </Grid> - </Grid> - </ControlTemplate> - </Setter.Value> - </Setter> - </Style> - - <ControlTemplate x:Key="PlayButtonTemplate" TargetType="ToggleButton"> - <Grid x:Name="grid" Background="Transparent"> - <vsm:VisualStateManager.VisualStateGroups> - <vsm:VisualStateGroup x:Name="FocusStates"> - <vsm:VisualState x:Name="Focused"> - <Storyboard> - </Storyboard> - </vsm:VisualState> - <vsm:VisualState x:Name="Unfocused"> - <Storyboard/> - </vsm:VisualState> - </vsm:VisualStateGroup> - <vsm:VisualStateGroup x:Name="CommonStates"> - <vsm:VisualState x:Name="Normal"> - <Storyboard/> - </vsm:VisualState> - <vsm:VisualState x:Name="MouseOver"> - <Storyboard> - </Storyboard> - </vsm:VisualState> - <vsm:VisualState x:Name="Pressed"> - <Storyboard/> - </vsm:VisualState> - </vsm:VisualStateGroup> - <vsm:VisualStateGroup x:Name="CheckStates"> - <vsm:VisualState x:Name="Checked"> - <Storyboard> - <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" - Storyboard.TargetName="playSymbol" - Storyboard.TargetProperty="(UIElement.Opacity)"> - <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/> - </DoubleAnimationUsingKeyFrames> - <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" - Storyboard.TargetName="pauseSymbol" - Storyboard.TargetProperty="(UIElement.Opacity)"> - <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/> - </DoubleAnimationUsingKeyFrames> - </Storyboard> - </vsm:VisualState> - <vsm:VisualState x:Name="Unchecked"> - <Storyboard> - <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="pauseSymbol" Storyboard.TargetProperty="(UIElement.Opacity)"> - <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/> - </DoubleAnimationUsingKeyFrames> - </Storyboard> - </vsm:VisualState> - </vsm:VisualStateGroup> - </vsm:VisualStateManager.VisualStateGroups> - <Grid Margin="11,3,0,0" HorizontalAlignment="Left" VerticalAlignment="Center" - Opacity="1" x:Name="playSymbol" Width="21" Height="22"> - <Path Width="14" Height="15" Stretch="Fill" Fill="#FF7F7F7F" - Data="F1 M 15.1997,22.542L 29.7776,14.89L 15.2707,6.99886L 15.1997,22.542 Z "/> - </Grid> - <Grid Margin="11,2,0,0" Opacity="0" x:Name="pauseSymbol" Width="31" Height="15"> - <Rectangle Stretch="Fill" Fill="#FF7F7F7F" HorizontalAlignment="Left" - Margin="0,0,0,0" Width="6"/> - <Rectangle Stretch="Fill" Fill="#FF7F7F7F" HorizontalAlignment="Stretch" - Margin="6,0,13,0" Width="6"/> - </Grid> - </Grid> - </ControlTemplate> - - <ControlTemplate x:Key="MuteButtonTemplate" TargetType="ToggleButton"> - <Grid Background="Transparent" Cursor="Hand"> - <vsm:VisualStateManager.VisualStateGroups> - <vsm:VisualStateGroup x:Name="FocusStates"> - <vsm:VisualState x:Name="Focused"> - <Storyboard> - </Storyboard> - </vsm:VisualState> - <vsm:VisualState x:Name="Unfocused"> - <Storyboard/> - </vsm:VisualState> - </vsm:VisualStateGroup> - <vsm:VisualStateGroup x:Name="CommonStates"> - <vsm:VisualState x:Name="Normal"> - <Storyboard/> - </vsm:VisualState> - <vsm:VisualState x:Name="MouseOver"> - <Storyboard> - </Storyboard> - </vsm:VisualState> - <vsm:VisualState x:Name="Pressed"> - <Storyboard/> - </vsm:VisualState> - </vsm:VisualStateGroup> - <vsm:VisualStateGroup x:Name="CheckStates"> - <vsm:VisualState x:Name="Checked"> - <Storyboard> - <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" - Storyboard.TargetName="volumeSymbol" - Storyboard.TargetProperty="(UIElement.Opacity)"> - <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/> - </DoubleAnimationUsingKeyFrames> - </Storyboard> - </vsm:VisualState> - <vsm:VisualState x:Name="Unchecked"> - <Storyboard> - <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" - Storyboard.TargetName="volumeSymbol" - Storyboard.TargetProperty="(UIElement.Opacity)"> - <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/> - </DoubleAnimationUsingKeyFrames> - </Storyboard> - </vsm:VisualState> - </vsm:VisualStateGroup> - </vsm:VisualStateManager.VisualStateGroups> - <Grid HorizontalAlignment="Left" VerticalAlignment="Top" - Width="17"> - <Path HorizontalAlignment="Left" Stretch="Fill" - Fill="#FF7F7F7F" Data="F1 M 23.1457,26.5056L 23.1457,33.8944L 25.7913,33.8944L 28.8235,37.4722L 30.5346,37.4722L 30.5665,23.0833L 28.8995,23.0833L 25.8679,26.5056L 23.1457,26.5056 Z " - Width="7.421" Height="14.389" UseLayoutRounding="False" - Margin="0,6.5,0,6.5"/> - - <Grid HorizontalAlignment="Right" Width="7.003" x:Name="volumeSymbol" - Height="27"> - <Path HorizontalAlignment="Right" VerticalAlignment="Stretch" - Width="2.398" - Data="M0.5,0.5 C0.5,0.5 2.5939558,2.7128265 2.5946648,7.0504856 C2.5953746,11.391507 0.50033337,13.889001 0.50033337,13.889001" - Stretch="Fill" Stroke="#FF7F7F7F" Margin="0,0,-0.398,0" UseLayoutRounding="False"/> - <Path HorizontalAlignment="Stretch" Margin="2.4,2.384,2.317,1.584" VerticalAlignment="Stretch" - Data="M0.5,0.50000006 C0.5,0.50000006 1.4786903,2.1275051 1.4781417,4.9569001 C1.4776551,7.4670725 0.35717732,9.892808 0.35717732,9.892808" Stretch="Fill" Stroke="#FF7F7F7F" UseLayoutRounding="False"/> - <Path HorizontalAlignment="Left" Margin="0,4.36,0,3.46" VerticalAlignment="Stretch" Width="1.542" - Data="M0.5,0.5 C0.5,0.5 1.0412779,1.4903735 1.042276,3.1459465 C1.0429831,4.3189368 0.66544437,6.0685911 0.66544437,6.0685911" Stretch="Fill" Stroke="#FF7F7F7F" d:LayoutOverrides="Width"/> - </Grid> - </Grid> - </Grid> - </ControlTemplate> - - <ControlTemplate x:Key="ButtonTemplate" TargetType="Button"> - <Grid Background="Transparent"> - <ContentPresenter Width="Auto"/> - </Grid> - </ControlTemplate> - </UserControl.Resources> - - <Border x:Name="layoutRoot" Background="#FF000000"> - <Grid HorizontalAlignment="Center" VerticalAlignment="Center"> - <Grid.RowDefinitions> - <RowDefinition Height="auto" x:Name="VideoRow"/> - <RowDefinition Height="auto"/> - </Grid.RowDefinitions> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="auto" x:Name="VideoColumn"/> - </Grid.ColumnDefinitions> - - <MediaElement x:Name="mediaElement" AutoPlay="False" Stretch="Uniform" - MediaOpened="MediaElement_MediaOpened" - CacheMode="BitmapCache" - Grid.Row="0" Height="auto" Width="auto"/> - - <Button x:Name="bigPlayButton" Template="{StaticResource ButtonTemplate}" - Click="BigPlayButton_Click" Grid.Row="0" > - <Canvas Width="100" Height="100"> - <Path Width="100" Height="100" Canvas.Left="0" Canvas.Top="0" Stretch="Fill" - Fill="#77000000" Data="F1 M 15,0L 85,0C 93.2843,0 100,6.71573 100,15L 100,85C 100,93.2843 93.2843,100 85,100L 15,100C 6.71573,100 0,93.2843 0,85L 0,15C 0,6.71573 6.71573,0 15,0 Z "/> - <Path Width="40.8182" Height="47.1328" Canvas.Left="34.6439" - Canvas.Top="27.6003" Stretch="Fill" Fill="#FFFFFFFF" - Data="F1 M 75.4621,51.1667L 34.6439,27.6003L 34.6439,74.7331L 75.4621,51.1667 Z "/> - </Canvas> - </Button> - - <Grid x:Name="transportControls" VerticalAlignment="Bottom" Height="40" Background="#FF000000" - Grid.Row="1" > - <Grid.ColumnDefinitions> - <ColumnDefinition Width="Auto" /> - <ColumnDefinition Width="*" /> - <ColumnDefinition Width="0" /> - <ColumnDefinition Width="Auto" /> - <ColumnDefinition Width="Auto" MinWidth="10" /> - <ColumnDefinition Width="Auto" MinWidth="10" /> - </Grid.ColumnDefinitions> - - <!-- play symbol showing is checked = false, Pause symbol showing is checked = true--> - <ToggleButton x:Name="playPauseButton" Template="{StaticResource PlayButtonTemplate}" - Click="PlayPauseButton_Click" IsChecked="false"/> - - <Grid x:Name="time" Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Center"> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="*" /> - <ColumnDefinition Width="40" /> - <ColumnDefinition Width="10" /> - <ColumnDefinition Width="40" /> - </Grid.ColumnDefinitions> - - <Slider x:Name="timelineSlider" Margin="0,1.5,0,0" HorizontalAlignment="Stretch" - Maximum="1" Style="{StaticResource SliderStyle}" Grid.Column="0" - ValueChanged="TimelineSlider_ValueChanged" - Value="0"/> - <TextBlock x:Name="currentTimeTextBlock" Margin="0,1.5,0,0" Height="12" - FontFamily="Verdana" FontSize="10" Text="00:00" TextWrapping="Wrap" - Foreground="#FFFFFFFF" FontStyle="Normal" HorizontalAlignment="Right" - TextAlignment="Right" Grid.Column="1"/> - <TextBlock Margin="0,1.5,0,0" Height="12" FontFamily="Verdana" FontSize="10" - Text="/" TextWrapping="Wrap" Foreground="#FFFFFFFF" - FontStyle="Normal" HorizontalAlignment="Center" TextAlignment="Right" - Grid.Column="2"/> - <TextBlock x:Name="totalTimeTextBlock" Margin="0,1.5,0,0" Height="12" - FontFamily="Verdana" FontSize="10" Text="00:00" TextWrapping="Wrap" - Foreground="#FFFFFFFF" FontStyle="Normal" HorizontalAlignment="Left" - TextAlignment="Right" Grid.Column="3"/> - </Grid> - - <ToggleButton IsChecked="false" Grid.Column="3" x:Name="muteButton" - Template="{StaticResource MuteButtonTemplate}" Click="MuteButton_Click" - VerticalAlignment="Center" Margin="0,0,6,0"/> - - <Slider Grid.Column="4" HorizontalAlignment="Stretch" Margin="3,0,0,0" - VerticalAlignment="Center" Maximum="1" x:Name="volumeSlider" - Background="#FF777777" Style="{StaticResource SliderStyle}" Width="50" - Value="{Binding ElementName=mediaElement, Mode=TwoWay, Path=Volume, UpdateSourceTrigger=Default}"/> - - <Button x:Name="fullScreenButton" Grid.Column="5" Margin="8,10,4,10" Click="FullScreenButton_Click" - Template="{StaticResource ButtonTemplate}" VerticalAlignment="Center"> - <Path Height="14.375" HorizontalAlignment="Stretch" - VerticalAlignment="Bottom" RenderTransformOrigin="0.212389379739761,0.208695650100708" - Data="M10.181361,8.375 L12.844413,11.008244 L14.125,9.7418737 L14.125,14.375 L9.675765,14.374833 L10.906104,13.158273 L8.125,10.408315 L10.181361,8.375 z M3.9666855,8.375 L6,10.431361 L3.3667567,13.094413 L4.6331258,14.375 L0,14.375 L0.00016707927,9.925765 L1.2167276,11.156104 L3.9666855,8.375 z M9.4918737,0 L14.125,0 L14.124833,4.449235 L12.908273,3.2188957 L10.158315,6 L8.125,3.943639 L10.758244,1.2805867 L9.4918737,0 z M0,0 L4.449235,0.00016686507 L3.2188957,1.2167276 L6,3.9666855 L3.943639,6 L1.280587,3.3667567 L0,4.6331258 L0,0 z" - Fill="#FF7F7F7F" Stretch="Fill" Stroke="#FF000000" StrokeThickness="0" /> - </Button> - </Grid> - </Grid> - </Border> +<UserControl xmlns:chartingToolkit="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit" x:Class="VideoPlayer.MainPage"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
+ mc:Ignorable="d"
+ Width="Auto" Height="Auto">
+ <UserControl.Resources>
+ <Style x:Key="roundThumbStyle" TargetType="Thumb">
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="Thumb">
+ <Ellipse Stroke="#FFFFFFFF" StrokeThickness="2" Fill="#FF484848"/>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+ <Style x:Key="SliderStyle" TargetType="Slider">
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="Slider">
+ <Grid x:Name="Root" Background="Transparent">
+ <Grid.Resources>
+ <ControlTemplate x:Key="RightRepeatButtonTemplate">
+ <Rectangle Height="6" Margin="-5,0,0,0" Grid.Column="0" Grid.ColumnSpan="3"
+ StrokeThickness="0.5" RadiusY="3.5" RadiusX="3.5" Fill="#FF484848"/>
+ </ControlTemplate>
+ <ControlTemplate x:Key="LeftRepeatButtonTemplate">
+ <Rectangle Height="6" Margin="0,0,-5,0" Grid.Column="0" Grid.ColumnSpan="3"
+ StrokeThickness="0.5" RadiusY="3.5" RadiusX="3.5" Fill="#FF7F7F7F"/>
+ </ControlTemplate>
+ </Grid.Resources>
+ <Grid x:Name="HorizontalTemplate">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto"/>
+ <ColumnDefinition Width="Auto"/>
+ <ColumnDefinition Width="*"/>
+ </Grid.ColumnDefinitions>
+
+ <RepeatButton x:Name="HorizontalTrackLargeChangeDecreaseRepeatButton" Grid.Column="0"
+ IsTabStop="False" Template="{StaticResource LeftRepeatButtonTemplate}"/>
+ <Rectangle x:Name="LeftTrack" Grid.Row="1" Fill="#00FFFFFF" Cursor="Hand" MouseLeftButtonDown="LeftTrack_MouseLeftButtonDown"/>
+ <Thumb Background="#00FFFFFF" Height="10" x:Name="HorizontalThumb" Width="10"
+ Grid.Column="1" Style="{StaticResource roundThumbStyle}" HorizontalAlignment="Left"
+ DragStarted="HorizontalThumb_DragStarted" DragCompleted="HorizontalThumb_DragCompleted"
+ Canvas.ZIndex="1"/>
+ <RepeatButton x:Name="HorizontalTrackLargeChangeIncreaseRepeatButton" Grid.Column="2"
+ IsTabStop="False" Template="{StaticResource RightRepeatButtonTemplate}"/>
+ <Rectangle x:Name="RightTrack" Grid.Column="2" Grid.Row="1" Fill="#00FFFFFF" Cursor="Hand" MouseLeftButtonDown="LeftTrack_MouseLeftButtonDown"/>
+ </Grid>
+ </Grid>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+ <ControlTemplate x:Key="PlayButtonTemplate" TargetType="ToggleButton">
+ <Grid x:Name="grid" Background="Transparent">
+ <vsm:VisualStateManager.VisualStateGroups>
+ <vsm:VisualStateGroup x:Name="FocusStates">
+ <vsm:VisualState x:Name="Focused">
+ <Storyboard>
+ </Storyboard>
+ </vsm:VisualState>
+ <vsm:VisualState x:Name="Unfocused">
+ <Storyboard/>
+ </vsm:VisualState>
+ </vsm:VisualStateGroup>
+ <vsm:VisualStateGroup x:Name="CommonStates">
+ <vsm:VisualState x:Name="Normal">
+ <Storyboard/>
+ </vsm:VisualState>
+ <vsm:VisualState x:Name="MouseOver">
+ <Storyboard>
+ </Storyboard>
+ </vsm:VisualState>
+ <vsm:VisualState x:Name="Pressed">
+ <Storyboard/>
+ </vsm:VisualState>
+ </vsm:VisualStateGroup>
+ <vsm:VisualStateGroup x:Name="CheckStates">
+ <vsm:VisualState x:Name="Checked">
+ <Storyboard>
+ <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000"
+ Storyboard.TargetName="playSymbol"
+ Storyboard.TargetProperty="(UIElement.Opacity)">
+ <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
+ </DoubleAnimationUsingKeyFrames>
+ <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000"
+ Storyboard.TargetName="pauseSymbol"
+ Storyboard.TargetProperty="(UIElement.Opacity)">
+ <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
+ </DoubleAnimationUsingKeyFrames>
+ </Storyboard>
+ </vsm:VisualState>
+ <vsm:VisualState x:Name="Unchecked">
+ <Storyboard>
+ <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="pauseSymbol" Storyboard.TargetProperty="(UIElement.Opacity)">
+ <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
+ </DoubleAnimationUsingKeyFrames>
+ </Storyboard>
+ </vsm:VisualState>
+ </vsm:VisualStateGroup>
+ </vsm:VisualStateManager.VisualStateGroups>
+ <Grid Margin="11,3,0,0" HorizontalAlignment="Left" VerticalAlignment="Center"
+ Opacity="1" x:Name="playSymbol" Width="21" Height="22">
+ <Path Width="14" Height="15" Stretch="Fill" Fill="#FF7F7F7F"
+ Data="F1 M 15.1997,22.542L 29.7776,14.89L 15.2707,6.99886L 15.1997,22.542 Z "/>
+ </Grid>
+ <Grid Margin="11,2,0,0" Opacity="0" x:Name="pauseSymbol" Width="31" Height="15">
+ <Rectangle Stretch="Fill" Fill="#FF7F7F7F" HorizontalAlignment="Left"
+ Margin="0,0,0,0" Width="6"/>
+ <Rectangle Stretch="Fill" Fill="#FF7F7F7F" HorizontalAlignment="Stretch"
+ Margin="6,0,13,0" Width="6"/>
+ </Grid>
+ </Grid>
+ </ControlTemplate>
+
+ <ControlTemplate x:Key="MuteButtonTemplate" TargetType="ToggleButton">
+ <Grid Background="Transparent" Cursor="Hand">
+ <vsm:VisualStateManager.VisualStateGroups>
+ <vsm:VisualStateGroup x:Name="FocusStates">
+ <vsm:VisualState x:Name="Focused">
+ <Storyboard>
+ </Storyboard>
+ </vsm:VisualState>
+ <vsm:VisualState x:Name="Unfocused">
+ <Storyboard/>
+ </vsm:VisualState>
+ </vsm:VisualStateGroup>
+ <vsm:VisualStateGroup x:Name="CommonStates">
+ <vsm:VisualState x:Name="Normal">
+ <Storyboard/>
+ </vsm:VisualState>
+ <vsm:VisualState x:Name="MouseOver">
+ <Storyboard>
+ </Storyboard>
+ </vsm:VisualState>
+ <vsm:VisualState x:Name="Pressed">
+ <Storyboard/>
+ </vsm:VisualState>
+ </vsm:VisualStateGroup>
+ <vsm:VisualStateGroup x:Name="CheckStates">
+ <vsm:VisualState x:Name="Checked">
+ <Storyboard>
+ <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000"
+ Storyboard.TargetName="volumeSymbol"
+ Storyboard.TargetProperty="(UIElement.Opacity)">
+ <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
+ </DoubleAnimationUsingKeyFrames>
+ </Storyboard>
+ </vsm:VisualState>
+ <vsm:VisualState x:Name="Unchecked">
+ <Storyboard>
+ <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000"
+ Storyboard.TargetName="volumeSymbol"
+ Storyboard.TargetProperty="(UIElement.Opacity)">
+ <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
+ </DoubleAnimationUsingKeyFrames>
+ </Storyboard>
+ </vsm:VisualState>
+ </vsm:VisualStateGroup>
+ </vsm:VisualStateManager.VisualStateGroups>
+ <Grid HorizontalAlignment="Left" VerticalAlignment="Top"
+ Width="17">
+ <Path HorizontalAlignment="Left" Stretch="Fill"
+ Fill="#FF7F7F7F" Data="F1 M 23.1457,26.5056L 23.1457,33.8944L 25.7913,33.8944L 28.8235,37.4722L 30.5346,37.4722L 30.5665,23.0833L 28.8995,23.0833L 25.8679,26.5056L 23.1457,26.5056 Z "
+ Width="7.421" Height="14.389" UseLayoutRounding="False"
+ Margin="0,6.5,0,6.5"/>
+
+ <Grid HorizontalAlignment="Right" Width="7.003" x:Name="volumeSymbol"
+ Height="27">
+ <Path HorizontalAlignment="Right" VerticalAlignment="Stretch"
+ Width="2.398"
+ Data="M0.5,0.5 C0.5,0.5 2.5939558,2.7128265 2.5946648,7.0504856 C2.5953746,11.391507 0.50033337,13.889001 0.50033337,13.889001"
+ Stretch="Fill" Stroke="#FF7F7F7F" Margin="0,0,-0.398,0" UseLayoutRounding="False"/>
+ <Path HorizontalAlignment="Stretch" Margin="2.4,2.384,2.317,1.584" VerticalAlignment="Stretch"
+ Data="M0.5,0.50000006 C0.5,0.50000006 1.4786903,2.1275051 1.4781417,4.9569001 C1.4776551,7.4670725 0.35717732,9.892808 0.35717732,9.892808" Stretch="Fill" Stroke="#FF7F7F7F" UseLayoutRounding="False"/>
+ <Path HorizontalAlignment="Left" Margin="0,4.36,0,3.46" VerticalAlignment="Stretch" Width="1.542"
+ Data="M0.5,0.5 C0.5,0.5 1.0412779,1.4903735 1.042276,3.1459465 C1.0429831,4.3189368 0.66544437,6.0685911 0.66544437,6.0685911" Stretch="Fill" Stroke="#FF7F7F7F" d:LayoutOverrides="Width"/>
+ </Grid>
+ </Grid>
+ </Grid>
+ </ControlTemplate>
+
+ <ControlTemplate x:Key="ButtonTemplate" TargetType="Button">
+ <Grid Background="Transparent">
+ <ContentPresenter Width="Auto"/>
+ </Grid>
+ </ControlTemplate>
+ </UserControl.Resources>
+
+ <Border x:Name="layoutRoot" Background="#FF000000">
+ <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="auto" x:Name="VideoRow"/>
+ <RowDefinition Height="auto"/>
+ </Grid.RowDefinitions>
+ <Grid.ColumnDefinitions>
+
+ <ColumnDefinition Width="auto" x:Name="VideoColumn"/>
+ <ColumnDefinition Width="Auto" x:Name="ListColumn"/>
+ </Grid.ColumnDefinitions>
+
+ <MediaElement x:Name="mediaElement" AutoPlay="False" Stretch="Uniform"
+ MediaOpened="MediaElement_MediaOpened"
+ CacheMode="BitmapCache"
+ Grid.Row="0" Grid.Column="0" Height="auto" Width="auto"/>
+
+ <Button x:Name="bigPlayButton" Template="{StaticResource ButtonTemplate}"
+ Click="BigPlayButton_Click" Grid.Row="0" Grid.Column="0" >
+ <Canvas Width="100" Height="100">
+ <Path Width="100" Height="100" Canvas.Left="0" Canvas.Top="0" Stretch="Fill"
+ Fill="#77000000" Data="F1 M 15,0L 85,0C 93.2843,0 100,6.71573 100,15L 100,85C 100,93.2843 93.2843,100 85,100L 15,100C 6.71573,100 0,93.2843 0,85L 0,15C 0,6.71573 6.71573,0 15,0 Z "/>
+ <Path Width="40.8182" Height="47.1328" Canvas.Left="34.6439"
+ Canvas.Top="27.6003" Stretch="Fill" Fill="#FFFFFFFF"
+ Data="F1 M 75.4621,51.1667L 34.6439,27.6003L 34.6439,74.7331L 75.4621,51.1667 Z "/>
+ </Canvas>
+ </Button>
+ <ListBox x:Name="PlayList" DisplayMemberPath ="Title" Grid.Row="0" Grid.Column="1" Width="200">
+
+ </ListBox>
+ <Grid x:Name="transportControls" VerticalAlignment="Bottom" Height="40" Background="#FF000000"
+ Grid.Row="1" >
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="0" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="Auto" MinWidth="10" />
+ <ColumnDefinition Width="Auto" MinWidth="10" />
+ </Grid.ColumnDefinitions>
+
+ <!-- play symbol showing is checked = false, Pause symbol showing is checked = true-->
+ <ToggleButton x:Name="playPauseButton" Template="{StaticResource PlayButtonTemplate}"
+ Click="PlayPauseButton_Click" IsChecked="false"/>
+
+ <Grid x:Name="time" Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Center">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="40" />
+ <ColumnDefinition Width="10" />
+ <ColumnDefinition Width="40" />
+ </Grid.ColumnDefinitions>
+
+ <Slider x:Name="timelineSlider" Margin="0,1.5,0,0" HorizontalAlignment="Stretch"
+ Maximum="1" Style="{StaticResource SliderStyle}" Grid.Column="0"
+ ValueChanged="TimelineSlider_ValueChanged"
+ Value="0"/>
+ <TextBlock x:Name="currentTimeTextBlock" Margin="0,1.5,0,0" Height="12"
+ FontFamily="Verdana" FontSize="10" Text="00:00" TextWrapping="Wrap"
+ Foreground="#FFFFFFFF" FontStyle="Normal" HorizontalAlignment="Right"
+ TextAlignment="Right" Grid.Column="1"/>
+ <TextBlock Margin="0,1.5,0,0" Height="12" FontFamily="Verdana" FontSize="10"
+ Text="/" TextWrapping="Wrap" Foreground="#FFFFFFFF"
+ FontStyle="Normal" HorizontalAlignment="Center" TextAlignment="Right"
+ Grid.Column="2"/>
+ <TextBlock x:Name="totalTimeTextBlock" Margin="0,1.5,0,0" Height="12"
+ FontFamily="Verdana" FontSize="10" Text="00:00" TextWrapping="Wrap"
+ Foreground="#FFFFFFFF" FontStyle="Normal" HorizontalAlignment="Left"
+ TextAlignment="Right" Grid.Column="3"/>
+ </Grid>
+
+ <ToggleButton IsChecked="false" Grid.Column="3" x:Name="muteButton"
+ Template="{StaticResource MuteButtonTemplate}" Click="MuteButton_Click"
+ VerticalAlignment="Center" Margin="0,0,6,0"/>
+
+ <Slider Grid.Column="4" HorizontalAlignment="Stretch" Margin="3,0,0,0"
+ VerticalAlignment="Center" Maximum="1" x:Name="volumeSlider"
+ Background="#FF777777" Style="{StaticResource SliderStyle}" Width="50"
+ Value="{Binding ElementName=mediaElement, Mode=TwoWay, Path=Volume, UpdateSourceTrigger=Default}"/>
+
+ <Button x:Name="fullScreenButton" Grid.Column="5" Margin="8,10,4,10" Click="FullScreenButton_Click"
+ Template="{StaticResource ButtonTemplate}" VerticalAlignment="Center">
+ <Path Height="14.375" HorizontalAlignment="Stretch"
+ VerticalAlignment="Bottom" RenderTransformOrigin="0.212389379739761,0.208695650100708"
+ Data="M10.181361,8.375 L12.844413,11.008244 L14.125,9.7418737 L14.125,14.375 L9.675765,14.374833 L10.906104,13.158273 L8.125,10.408315 L10.181361,8.375 z M3.9666855,8.375 L6,10.431361 L3.3667567,13.094413 L4.6331258,14.375 L0,14.375 L0.00016707927,9.925765 L1.2167276,11.156104 L3.9666855,8.375 z M9.4918737,0 L14.125,0 L14.124833,4.449235 L12.908273,3.2188957 L10.158315,6 L8.125,3.943639 L10.758244,1.2805867 L9.4918737,0 z M0,0 L4.449235,0.00016686507 L3.2188957,1.2167276 L6,3.9666855 L3.943639,6 L1.280587,3.3667567 L0,4.6331258 L0,0 z"
+ Fill="#FF7F7F7F" Stretch="Fill" Stroke="#FF000000" StrokeThickness="0" />
+ </Button>
+ </Grid>
+ </Grid>
+ </Border>
</UserControl>
\ No newline at end of file diff --git a/src/YalpClients/WebClient/MainPage.xaml.cs b/src/YalpClients/WebClient/MainPage.xaml.cs index aa392f2..37ccd83 100644 --- a/src/YalpClients/WebClient/MainPage.xaml.cs +++ b/src/YalpClients/WebClient/MainPage.xaml.cs @@ -1,198 +1,200 @@ -using System; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Animation; -using System.Windows.Shapes; - -namespace VideoPlayer -{ - // For best full-screen video performance, set EnableGPUAcceleration="true" on the plug-in. - // If hosting Silverlight from .aspx, add EnableGPUAcceleration="true" to the - // <asp:Silverlight> element. If hosting Silverlight from .html, add - // <param name="enableGPUAcceleration" value="true" /> under the <object> tag. - - public partial class MainPage : UserControl - { - // mediaElement.Position updates TimelineSlider.Value, and - // updating TimelineSlider.Value updates mediaElement.Position, - // this variable helps us break the infinite loop - private bool duringTickEvent = false; - - private bool playVideoWhenSliderDragIsOver = false; - - public MainPage() - { - InitializeComponent(); - - mediaElement.Source = new Uri("file:///D:/Test/countdown.wmv"); - //mit Datei: - //mediaElement.Source = new Uri("file:///D:/Test/countdown.wmv"); - //http://www.shoutcast.com/shoutcast_player?stationid=7806&Genre=Electronic&ContentFlag=1 - // - CompositionTarget.Rendering += new EventHandler(CompositionTarget_Rendering); - Application.Current.Host.Content.FullScreenChanged += new EventHandler(Content_FullScreenChanged); - } - - private void MediaElement_MediaOpened(object sender, RoutedEventArgs e) - { - TimeSpan duration = mediaElement.NaturalDuration.TimeSpan; - totalTimeTextBlock.Text = TimeSpanToString(duration); - UpdateVideoSize(); - } - - #region play button - - private void BigPlayButton_Click(object sender, RoutedEventArgs e) - { - playPauseButton.IsChecked = true; - PlayPauseButton_Click(sender, e); - } - - private void PlayPauseButton_Click(object sender, RoutedEventArgs e) - { - bigPlayButton.Visibility = Visibility.Collapsed; - - // this will be the toggle button state after the click has been processed - if (playPauseButton.IsChecked == true) - mediaElement.Play(); - else - mediaElement.Pause(); - } - - #endregion - - #region timelineSlider - - private void Seek(double percentComplete) - { - if (duringTickEvent) - throw new Exception("Can't call Seek() now, you'll get an infinite loop"); - - TimeSpan duration = mediaElement.NaturalDuration.TimeSpan; - int newPosition = (int)(duration.TotalSeconds * percentComplete); - mediaElement.Position = new TimeSpan(0, 0, newPosition); - - // let the next CompositionTarget.Rendering take care of updating the text blocks - } - - private Slider GetSliderParent(object sender) - { - FrameworkElement element = (FrameworkElement)sender; - do - { - element = (FrameworkElement)VisualTreeHelper.GetParent(element); - } while (!(element is Slider)); - return (Slider)element; - } - - private void LeftTrack_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) - { - e.Handled = true; - FrameworkElement lefttrack = (sender as FrameworkElement).FindName("LeftTrack") as FrameworkElement; - FrameworkElement righttrack = (sender as FrameworkElement).FindName("RightTrack") as FrameworkElement; - double position = e.GetPosition(lefttrack).X; - double width = righttrack.TransformToVisual(lefttrack).Transform(new Point(righttrack.ActualWidth, righttrack.ActualHeight)).X; - double percent = position / width; - Slider slider = GetSliderParent(sender); - slider.Value = percent; - } - - private void HorizontalThumb_DragStarted(object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e) - { - if (GetSliderParent(sender) != timelineSlider) return; - - bool notPlaying = (mediaElement.CurrentState == MediaElementState.Paused - || mediaElement.CurrentState == MediaElementState.Stopped); - - if (notPlaying) - { - playVideoWhenSliderDragIsOver = false; - } - else - { - playVideoWhenSliderDragIsOver = true; - mediaElement.Pause(); - } - } - - private void HorizontalThumb_DragCompleted(object sender, System.Windows.Controls.Primitives.DragCompletedEventArgs e) - { - if (playVideoWhenSliderDragIsOver) - mediaElement.Play(); - } - - private void TimelineSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) - { - if (duringTickEvent) - return; - - Seek(timelineSlider.Value); - } - - #endregion - - #region updating current time - - private void CompositionTarget_Rendering(object sender, EventArgs e) - { - duringTickEvent = true; - - TimeSpan duration = mediaElement.NaturalDuration.TimeSpan; - if (duration.TotalSeconds != 0) - { - double percentComplete = (mediaElement.Position.TotalSeconds / duration.TotalSeconds); - timelineSlider.Value = percentComplete; - string text = TimeSpanToString(mediaElement.Position); - if (this.currentTimeTextBlock.Text != text) - this.currentTimeTextBlock.Text = text; - } - - duringTickEvent = false; - } - - private static string TimeSpanToString(TimeSpan time) - { - return string.Format("{0:00}:{1:00}", (time.Hours * 60) + time.Minutes, time.Seconds); - } - #endregion - - private void MuteButton_Click(object sender, RoutedEventArgs e) - { - mediaElement.IsMuted = (bool)muteButton.IsChecked; - } - - #region fullscreen mode - - private void FullScreenButton_Click(object sender, RoutedEventArgs e) - { - var content = Application.Current.Host.Content; - content.IsFullScreen = !content.IsFullScreen; - } - - private void Content_FullScreenChanged(object sender, EventArgs e) - { - UpdateVideoSize(); - } - - private void UpdateVideoSize() - { - if (App.Current.Host.Content.IsFullScreen) - { - // mediaElement takes all available space - VideoRow.Height = new GridLength(1, GridUnitType.Star); - VideoColumn.Width = new GridLength(1, GridUnitType.Star); - } - else - { - // mediaElement is only as big as the source video - VideoRow.Height = new GridLength(1, GridUnitType.Auto); - VideoColumn.Width = new GridLength(1, GridUnitType.Auto); - } - } - - #endregion - } +using System;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Animation;
+using System.Windows.Shapes;
+
+namespace VideoPlayer
+{
+ // For best full-screen video performance, set EnableGPUAcceleration="true" on the plug-in.
+ // If hosting Silverlight from .aspx, add EnableGPUAcceleration="true" to the
+ // <asp:Silverlight> element. If hosting Silverlight from .html, add
+ // <param name="enableGPUAcceleration" value="true" /> under the <object> tag.
+
+ public partial class MainPage : UserControl
+ {
+ // mediaElement.Position updates TimelineSlider.Value, and
+ // updating TimelineSlider.Value updates mediaElement.Position,
+ // this variable helps us break the infinite loop
+ private bool duringTickEvent = false;
+
+ private bool playVideoWhenSliderDragIsOver = false;
+
+ public MainPage()
+ {
+ InitializeComponent();
+ //mediaElement.Source = new Uri("http://www.shoutcast.com/shoutcast_player?stationid=7806&Genre=Electronic&ContentFlag=1");
+ mediaElement.Source = new Uri("file:///D:/Test/countdown.wmv");
+ //mit Datei:
+ //mediaElement.Source = new Uri("file:///D:/Test/countdown.wmv");
+ //http://www.shoutcast.com/shoutcast_player?stationid=7806&Genre=Electronic&ContentFlag=1
+ //
+ CompositionTarget.Rendering += new EventHandler(CompositionTarget_Rendering);
+ Application.Current.Host.Content.FullScreenChanged += new EventHandler(Content_FullScreenChanged);
+
+ }
+
+ private void MediaElement_MediaOpened(object sender, RoutedEventArgs e)
+ {
+ TimeSpan duration = mediaElement.NaturalDuration.TimeSpan;
+ totalTimeTextBlock.Text = TimeSpanToString(duration);
+ UpdateVideoSize();
+ }
+
+ #region play button
+
+ private void BigPlayButton_Click(object sender, RoutedEventArgs e)
+ {
+ playPauseButton.IsChecked = true;
+ PlayPauseButton_Click(sender, e);
+ }
+
+
+ private void PlayPauseButton_Click(object sender, RoutedEventArgs e)
+ {
+ bigPlayButton.Visibility = Visibility.Collapsed;
+
+ // this will be the toggle button state after the click has been processed
+ if (playPauseButton.IsChecked == true)
+ mediaElement.Play();
+ else
+ mediaElement.Pause();
+ }
+
+ #endregion
+
+ #region timelineSlider
+
+ private void Seek(double percentComplete)
+ {
+ if (duringTickEvent)
+ throw new Exception("Can't call Seek() now, you'll get an infinite loop");
+
+ TimeSpan duration = mediaElement.NaturalDuration.TimeSpan;
+ int newPosition = (int)(duration.TotalSeconds * percentComplete);
+ mediaElement.Position = new TimeSpan(0, 0, newPosition);
+
+ // let the next CompositionTarget.Rendering take care of updating the text blocks
+ }
+
+ private Slider GetSliderParent(object sender)
+ {
+ FrameworkElement element = (FrameworkElement)sender;
+ do
+ {
+ element = (FrameworkElement)VisualTreeHelper.GetParent(element);
+ } while (!(element is Slider));
+ return (Slider)element;
+ }
+
+ private void LeftTrack_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+ {
+ e.Handled = true;
+ FrameworkElement lefttrack = (sender as FrameworkElement).FindName("LeftTrack") as FrameworkElement;
+ FrameworkElement righttrack = (sender as FrameworkElement).FindName("RightTrack") as FrameworkElement;
+ double position = e.GetPosition(lefttrack).X;
+ double width = righttrack.TransformToVisual(lefttrack).Transform(new Point(righttrack.ActualWidth, righttrack.ActualHeight)).X;
+ double percent = position / width;
+ Slider slider = GetSliderParent(sender);
+ slider.Value = percent;
+ }
+
+ private void HorizontalThumb_DragStarted(object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e)
+ {
+ if (GetSliderParent(sender) != timelineSlider) return;
+
+ bool notPlaying = (mediaElement.CurrentState == MediaElementState.Paused
+ || mediaElement.CurrentState == MediaElementState.Stopped);
+
+ if (notPlaying)
+ {
+ playVideoWhenSliderDragIsOver = false;
+ }
+ else
+ {
+ playVideoWhenSliderDragIsOver = true;
+ mediaElement.Pause();
+ }
+ }
+
+ private void HorizontalThumb_DragCompleted(object sender, System.Windows.Controls.Primitives.DragCompletedEventArgs e)
+ {
+ if (playVideoWhenSliderDragIsOver)
+ mediaElement.Play();
+ }
+
+ private void TimelineSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
+ {
+ if (duringTickEvent)
+ return;
+
+ Seek(timelineSlider.Value);
+ }
+
+ #endregion
+
+ #region updating current time
+
+ private void CompositionTarget_Rendering(object sender, EventArgs e)
+ {
+ duringTickEvent = true;
+
+ TimeSpan duration = mediaElement.NaturalDuration.TimeSpan;
+ if (duration.TotalSeconds != 0)
+ {
+ double percentComplete = (mediaElement.Position.TotalSeconds / duration.TotalSeconds);
+ timelineSlider.Value = percentComplete;
+ string text = TimeSpanToString(mediaElement.Position);
+ if (this.currentTimeTextBlock.Text != text)
+ this.currentTimeTextBlock.Text = text;
+ }
+
+ duringTickEvent = false;
+ }
+
+ private static string TimeSpanToString(TimeSpan time)
+ {
+ return string.Format("{0:00}:{1:00}", (time.Hours * 60) + time.Minutes, time.Seconds);
+ }
+ #endregion
+
+ private void MuteButton_Click(object sender, RoutedEventArgs e)
+ {
+ mediaElement.IsMuted = (bool)muteButton.IsChecked;
+ }
+
+ #region fullscreen mode
+
+ private void FullScreenButton_Click(object sender, RoutedEventArgs e)
+ {
+ var content = Application.Current.Host.Content;
+ content.IsFullScreen = !content.IsFullScreen;
+ }
+
+ private void Content_FullScreenChanged(object sender, EventArgs e)
+ {
+ UpdateVideoSize();
+ }
+
+ private void UpdateVideoSize()
+ {
+ if (App.Current.Host.Content.IsFullScreen)
+ {
+ // mediaElement takes all available space
+ VideoRow.Height = new GridLength(1, GridUnitType.Star);
+ VideoColumn.Width = new GridLength(1, GridUnitType.Star);
+ }
+ else
+ {
+ // mediaElement is only as big as the source video
+ VideoRow.Height = new GridLength(1, GridUnitType.Auto);
+ VideoColumn.Width = new GridLength(1, GridUnitType.Auto);
+ }
+ }
+
+ #endregion
+ }
}
\ No newline at end of file diff --git a/src/YalpClients/WebClient/Properties/AppManifest.xml b/src/YalpClients/WebClient/Properties/AppManifest.xml index 2e175fc..31a38be 100644 --- a/src/YalpClients/WebClient/Properties/AppManifest.xml +++ b/src/YalpClients/WebClient/Properties/AppManifest.xml @@ -1,16 +1,16 @@ -<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" -> - <Deployment.Parts> - </Deployment.Parts> - - <!-- Uncomment the markup and update the fields below to make your application offline enabled - <Deployment.ApplicationIdentity> - <ApplicationIdentity - ShortName="Out of Browser Silverlight Application" - Title="Window Title of Your Silverlight Application"> - <ApplicationIdentity.Blurb>Description of your Silverlight application</ApplicationIdentity.Blurb> - </ApplicationIdentity> - </Deployment.ApplicationIdentity> - --> -</Deployment> +<Deployment xmlns="http://schemas.microsoft.com/client/2007/deployment"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+>
+ <Deployment.Parts>
+ </Deployment.Parts>
+
+ <!-- Uncomment the markup and update the fields below to make your application offline enabled
+ <Deployment.ApplicationIdentity>
+ <ApplicationIdentity
+ ShortName="Out of Browser Silverlight Application"
+ Title="Window Title of Your Silverlight Application">
+ <ApplicationIdentity.Blurb>Description of your Silverlight application</ApplicationIdentity.Blurb>
+ </ApplicationIdentity>
+ </Deployment.ApplicationIdentity>
+ -->
+</Deployment>
diff --git a/src/YalpClients/WebClient/Properties/AssemblyInfo.cs b/src/YalpClients/WebClient/Properties/AssemblyInfo.cs index a7710f2..3e7c95d 100644 --- a/src/YalpClients/WebClient/Properties/AssemblyInfo.cs +++ b/src/YalpClients/WebClient/Properties/AssemblyInfo.cs @@ -1,35 +1,35 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("VideoPlayer")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("MSIT")] -[assembly: AssemblyProduct("VideoPlayer")] -[assembly: AssemblyCopyright("Copyright © MSIT 2009")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("35c726b0-7859-4c8e-a45c-81dc889f321e")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("VideoPlayer")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("MSIT")]
+[assembly: AssemblyProduct("VideoPlayer")]
+[assembly: AssemblyCopyright("Copyright © MSIT 2009")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("35c726b0-7859-4c8e-a45c-81dc889f321e")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/src/YalpClients/WebClient/VideoPlayer.csproj b/src/YalpClients/WebClient/VideoPlayer.csproj index 5e6c3f4..4cbfec1 100644 --- a/src/YalpClients/WebClient/VideoPlayer.csproj +++ b/src/YalpClients/WebClient/VideoPlayer.csproj @@ -1,103 +1,103 @@ -<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProductVersion>9.0.30729</ProductVersion> - <SchemaVersion>2.0</SchemaVersion> - <ProjectGuid>{9254F122-1734-4DEC-9859-49C16D114EBA}</ProjectGuid> - <ProjectTypeGuids>{A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids> - <OutputType>Library</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>VideoPlayer</RootNamespace> - <AssemblyName>VideoPlayer</AssemblyName> - <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> - <SilverlightApplication>true</SilverlightApplication> - <SupportedCultures> - </SupportedCultures> - <XapOutputs>true</XapOutputs> - <GenerateSilverlightManifest>true</GenerateSilverlightManifest> - <XapFilename>VideoPlayer.xap</XapFilename> - <SilverlightManifestTemplate>Properties\AppManifest.xml</SilverlightManifestTemplate> - <SilverlightAppEntry>VideoPlayer.App</SilverlightAppEntry> - <TestPageFileName>TestPage.html</TestPageFileName> - <CreateTestPage>true</CreateTestPage> - <ValidateXaml>true</ValidateXaml> - <UsePlatformExtensions>false</UsePlatformExtensions> - <ThrowErrorsInValidation>true</ThrowErrorsInValidation> - <LinkedServerProject> - </LinkedServerProject> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>Bin\Debug</OutputPath> - <DefineConstants>DEBUG;TRACE;SILVERLIGHT</DefineConstants> - <NoStdLib>true</NoStdLib> - <NoConfig>true</NoConfig> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <OutputPath>Bin\Release</OutputPath> - <DefineConstants>TRACE;SILVERLIGHT</DefineConstants> - <NoStdLib>true</NoStdLib> - <NoConfig>true</NoConfig> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - </PropertyGroup> - <ItemGroup> - <Reference Include="System.Windows" /> - <Reference Include="mscorlib" /> - <Reference Include="system" /> - <Reference Include="System.Core" /> - <Reference Include="System.Net" /> - <Reference Include="System.Windows.Controls.DataVisualization.Toolkit, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> - <Reference Include="System.Windows.Controls.Theming.ShinyRed, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> - <Reference Include="System.Windows.Controls.Theming.Toolkit, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> - <Reference Include="System.Xml" /> - <Reference Include="System.Windows.Browser" /> - </ItemGroup> - <ItemGroup> - <Compile Include="App.xaml.cs"> - <DependentUpon>App.xaml</DependentUpon> - </Compile> - <Compile Include="MainPage.xaml.cs"> - <DependentUpon>MainPage.xaml</DependentUpon> - </Compile> - <Compile Include="Properties\AssemblyInfo.cs" /> - </ItemGroup> - <ItemGroup> - <ApplicationDefinition Include="App.xaml"> - <SubType>Designer</SubType> - <Generator>MSBuild:MarkupCompilePass1</Generator> - </ApplicationDefinition> - <Page Include="MainPage.xaml"> - <SubType>Designer</SubType> - <Generator>MSBuild:MarkupCompilePass1</Generator> - </Page> - </ItemGroup> - <ItemGroup> - <None Include="Properties\AppManifest.xml" /> - </ItemGroup> - <ItemGroup> - <WCFMetadata Include="Service References\" /> - </ItemGroup> - <Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight\v3.0\Microsoft.Silverlight.CSharp.targets" /> - <!-- To modify your build process, add your task inside one of the targets below and uncomment it. - Other similar extension points exist, see Microsoft.Common.targets. - <Target Name="BeforeBuild"> - </Target> - <Target Name="AfterBuild"> - </Target> - --> - <ProjectExtensions> - <VisualStudio> - <FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}"> - <SilverlightProjectProperties /> - </FlavorProperties> - </VisualStudio> - </ProjectExtensions> +<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.30729</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{9254F122-1734-4DEC-9859-49C16D114EBA}</ProjectGuid>
+ <ProjectTypeGuids>{A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>VideoPlayer</RootNamespace>
+ <AssemblyName>VideoPlayer</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <SilverlightApplication>true</SilverlightApplication>
+ <SupportedCultures>
+ </SupportedCultures>
+ <XapOutputs>true</XapOutputs>
+ <GenerateSilverlightManifest>true</GenerateSilverlightManifest>
+ <XapFilename>VideoPlayer.xap</XapFilename>
+ <SilverlightManifestTemplate>Properties\AppManifest.xml</SilverlightManifestTemplate>
+ <SilverlightAppEntry>VideoPlayer.App</SilverlightAppEntry>
+ <TestPageFileName>TestPage.html</TestPageFileName>
+ <CreateTestPage>true</CreateTestPage>
+ <ValidateXaml>true</ValidateXaml>
+ <UsePlatformExtensions>false</UsePlatformExtensions>
+ <ThrowErrorsInValidation>true</ThrowErrorsInValidation>
+ <LinkedServerProject>
+ </LinkedServerProject>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>Bin\Debug</OutputPath>
+ <DefineConstants>DEBUG;TRACE;SILVERLIGHT</DefineConstants>
+ <NoStdLib>true</NoStdLib>
+ <NoConfig>true</NoConfig>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>Bin\Release</OutputPath>
+ <DefineConstants>TRACE;SILVERLIGHT</DefineConstants>
+ <NoStdLib>true</NoStdLib>
+ <NoConfig>true</NoConfig>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System.Windows" />
+ <Reference Include="mscorlib" />
+ <Reference Include="system" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Net" />
+ <Reference Include="System.Windows.Controls.DataVisualization.Toolkit, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
+ <Reference Include="System.Windows.Controls.Theming.ShinyRed, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
+ <Reference Include="System.Windows.Controls.Theming.Toolkit, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
+ <Reference Include="System.Xml" />
+ <Reference Include="System.Windows.Browser" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="App.xaml.cs">
+ <DependentUpon>App.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="MainPage.xaml.cs">
+ <DependentUpon>MainPage.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ApplicationDefinition Include="App.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:MarkupCompilePass1</Generator>
+ </ApplicationDefinition>
+ <Page Include="MainPage.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:MarkupCompilePass1</Generator>
+ </Page>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="Properties\AppManifest.xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <WCFMetadata Include="Service References\" />
+ </ItemGroup>
+ <Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight\v3.0\Microsoft.Silverlight.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+ <ProjectExtensions>
+ <VisualStudio>
+ <FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}">
+ <SilverlightProjectProperties />
+ </FlavorProperties>
+ </VisualStudio>
+ </ProjectExtensions>
</Project>
\ No newline at end of file diff --git a/src/YalpClients/WebClient/VideoPlayer.csproj.user b/src/YalpClients/WebClient/VideoPlayer.csproj.user index 47ceb7f..00b6274 100644 --- a/src/YalpClients/WebClient/VideoPlayer.csproj.user +++ b/src/YalpClients/WebClient/VideoPlayer.csproj.user @@ -1,28 +1,28 @@ -<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ProjectExtensions> - <VisualStudio> - <FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}"> - <SilverlightProjectProperties> - <StartPageUrl> - </StartPageUrl> - <StartAction>DynamicPage</StartAction> - <AspNetDebugging>True</AspNetDebugging> - <NativeDebugging>False</NativeDebugging> - <SQLDebugging>False</SQLDebugging> - <ExternalProgram> - </ExternalProgram> - <StartExternalURL> - </StartExternalURL> - <StartCmdLineArguments> - </StartCmdLineArguments> - <StartWorkingDirectory> - </StartWorkingDirectory> - <ShowWebRefOnDebugPrompt>True</ShowWebRefOnDebugPrompt> - <OutOfBrowserProjectToDebug> - </OutOfBrowserProjectToDebug> - <ShowRiaSvcsOnDebugPrompt>True</ShowRiaSvcsOnDebugPrompt> - </SilverlightProjectProperties> - </FlavorProperties> - </VisualStudio> - </ProjectExtensions> +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ProjectExtensions>
+ <VisualStudio>
+ <FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}">
+ <SilverlightProjectProperties>
+ <StartPageUrl>
+ </StartPageUrl>
+ <StartAction>DynamicPage</StartAction>
+ <AspNetDebugging>True</AspNetDebugging>
+ <NativeDebugging>False</NativeDebugging>
+ <SQLDebugging>False</SQLDebugging>
+ <ExternalProgram>
+ </ExternalProgram>
+ <StartExternalURL>
+ </StartExternalURL>
+ <StartCmdLineArguments>
+ </StartCmdLineArguments>
+ <StartWorkingDirectory>
+ </StartWorkingDirectory>
+ <ShowWebRefOnDebugPrompt>True</ShowWebRefOnDebugPrompt>
+ <OutOfBrowserProjectToDebug>
+ </OutOfBrowserProjectToDebug>
+ <ShowRiaSvcsOnDebugPrompt>True</ShowRiaSvcsOnDebugPrompt>
+ </SilverlightProjectProperties>
+ </FlavorProperties>
+ </VisualStudio>
+ </ProjectExtensions>
</Project>
\ No newline at end of file diff --git a/src/YalpClients/WebClient/VideoPlayer.sln b/src/YalpClients/WebClient/VideoPlayer.sln index 9ef3f22..2057756 100644 --- a/src/YalpClients/WebClient/VideoPlayer.sln +++ b/src/YalpClients/WebClient/VideoPlayer.sln @@ -1,20 +1,20 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Web Developer Express 2008 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VideoPlayer", "VideoPlayer.csproj", "{9254F122-1734-4DEC-9859-49C16D114EBA}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {9254F122-1734-4DEC-9859-49C16D114EBA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9254F122-1734-4DEC-9859-49C16D114EBA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9254F122-1734-4DEC-9859-49C16D114EBA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9254F122-1734-4DEC-9859-49C16D114EBA}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal +
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Web Developer Express 2008
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VideoPlayer", "VideoPlayer.csproj", "{9254F122-1734-4DEC-9859-49C16D114EBA}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {9254F122-1734-4DEC-9859-49C16D114EBA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9254F122-1734-4DEC-9859-49C16D114EBA}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9254F122-1734-4DEC-9859-49C16D114EBA}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9254F122-1734-4DEC-9859-49C16D114EBA}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/src/YalpInputs/YalpPGSqlInput/DatabaseDefines.java b/src/YalpInputs/YalpPGSqlInput/DatabaseDefines.java index 0300ad3..b6ee2ce 100644 --- a/src/YalpInputs/YalpPGSqlInput/DatabaseDefines.java +++ b/src/YalpInputs/YalpPGSqlInput/DatabaseDefines.java @@ -1,65 +1,65 @@ -/* - * Copyright (c) 2006 Manuel Traut and Volker Dahnke - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: Manuel Traut and Volker Dahnke - */ -package YalpInputs.YalpPGSqlInput; - -/* - * Class DatabaseDefines - * - * <em></em> - * - * @author Manuel Traut - * - * @version 0.1 28-08-2008<br> - * - */ - -public class DatabaseDefines { - - public String dbConnection="jdbc:postgresql://10.0.3.20:5432/yalp_media"; - public String dbUser="yalp"; - public String dbPasswd="huhu"; - -/* - * set string for dbConnection - * @param dbConnection - * "jdbc:postgresql://<serverIP>:<portOfDB>/<dataBaseName>"; - */ - public void setDBConnection(String dbConnection){ - this.dbConnection = dbConnection; - } - -/* - * set userName for db Edit - * @param dbUser - */ - public void setDBUser(String dbUser){ - this.dbUser = dbUser; - } - -/* - * set string for db Password - * @param DBPasswd - */ - public void setDBPasswd(String DBPasswd){ - this.dbPasswd = DBPasswd; - } - - public String getDBConnection(){ - return this.dbConnection; - } - - public String getDBUser(){ - return this.dbUser; - } - - public String getDBPasswd(){ - return this.dbPasswd; - } -} +/*
+ * Copyright (c) 2006 Manuel Traut and Volker Dahnke
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors: Manuel Traut and Volker Dahnke
+ */
+package YalpInputs.YalpPGSqlInput;
+
+/*
+ * Class DatabaseDefines
+ *
+ * <em></em>
+ *
+ * @author Manuel Traut
+ *
+ * @version 0.1 28-08-2008<br>
+ *
+ */
+
+public class DatabaseDefines {
+
+ public String dbConnection="jdbc:postgresql://10.0.3.20:5432/yalp_media";
+ public String dbUser="yalp";
+ public String dbPasswd="huhu";
+
+/*
+ * set string for dbConnection
+ * @param dbConnection
+ * "jdbc:postgresql://<serverIP>:<portOfDB>/<dataBaseName>";
+ */
+ public void setDBConnection(String dbConnection){
+ this.dbConnection = dbConnection;
+ }
+
+/*
+ * set userName for db Edit
+ * @param dbUser
+ */
+ public void setDBUser(String dbUser){
+ this.dbUser = dbUser;
+ }
+
+/*
+ * set string for db Password
+ * @param DBPasswd
+ */
+ public void setDBPasswd(String DBPasswd){
+ this.dbPasswd = DBPasswd;
+ }
+
+ public String getDBConnection(){
+ return this.dbConnection;
+ }
+
+ public String getDBUser(){
+ return this.dbUser;
+ }
+
+ public String getDBPasswd(){
+ return this.dbPasswd;
+ }
+}
diff --git a/src/YalpInputs/YalpPGSqlInput/db-design-sql.backup b/src/YalpInputs/YalpPGSqlInput/db-design-sql.backup Binary files differindex 8dc69e0..d6b273d 100644 --- a/src/YalpInputs/YalpPGSqlInput/db-design-sql.backup +++ b/src/YalpInputs/YalpPGSqlInput/db-design-sql.backup diff --git a/src/YalpServer/ServerControlImpl.java b/src/YalpServer/ServerControlImpl.java index 1064dd0..f8e4579 100755 --- a/src/YalpServer/ServerControlImpl.java +++ b/src/YalpServer/ServerControlImpl.java @@ -1,452 +1,452 @@ -/* - * Copyright (c) 2006 Manuel Traut and Volker Dahnke - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: Manuel Traut and Volker Dahnke - */ - -package YalpServer; - -import YalpInterfaces.*; - -import java.net.*; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.Properties; - -import org.omg.CosNaming.*; -import org.omg.CosNaming.NamingContextPackage.*; -import org.omg.CORBA.*; -import org.omg.PortableServer.*; -import org.omg.PortableServer.POA; - -import org.apache.log4j.Logger; -import org.apache.log4j.PropertyConfigurator; - -/* - * Class ServerControlImpl - * - * <em>Implements functionality of the ServerControl Interface</em> - * - * @author Volker Dahnke / Manuel Traut - * @version 0.6 14-12-2005<br> - * @see client - */ -public class ServerControlImpl extends ServerControlInterfacePOA -{ - private ORB orb; - - private InitServer srv; - private InputPluginHandler inputHandler; - private OutputPluginHandler outputHandler; - private AuthPluginHandler authHandler; - - private ArrayList<Session> sessions; - private ArrayList<PluginInfo> plugin_infos; - - private String log4jFile = "log4j_server.conf"; - - private static Logger logger = - Logger.getLogger("Yalp.Server.ServerControlImpl"); - -public ServerControlImpl() -{ - this.sessions = new ArrayList<Session> (); - this.plugin_infos = new ArrayList<PluginInfo> (); - - PropertyConfigurator.configureAndWatch(log4jFile); - logger.debug("ServerControlImpl()"); -} - - public void setORB(ORB _orb) - { - logger.debug("setOrb()"); - orb = _orb; - } - - public void init(InitServer _srv) - { - logger.debug("init()"); - srv = _srv; - inputHandler = srv.inputHandler; - outputHandler = srv.outputHandler; - authHandler = srv.authHandler; - } - -/* - * client logon - * - * @param userName - * @param password - * @param ipAdress - * @param session (out) - * @param error (out) - */ - public void clientLogon( String name, - String password, - String ipAddress, - SessionHolder session, - YalpErrorHolder err ) - { - logger.debug("clientLogon()"); - - YalpError error = new YalpError(); - error.code = YalpErrorCode.OK; - error.descr = "authentication successfull"; - error.msg = "nice isn't it"; - error.level = YalpErrorLevel.ERROR_LEVEL_INFO; - err.value = error; - - session.value = authHandler.logon(name, password, ipAddress, session, err); - - ArrayList<PluginInfo> all_plugins = new ArrayList<PluginInfo>(); - - PluginInfo[] t = {}; - session.value.availablePlugins = plugin_infos.toArray(t); - sessions.add(session.value); - } - -/* - * client logoff - * - * @param session - * @param error (out) - */ - public void clientLogoff( Session bye, YalpErrorHolder err) - { - logger.debug("clientLogoff"); - - YalpError error = new YalpError(); - error.code = YalpErrorCode.OK; - error.descr = "logged out"; - error.msg = "sad isn't it"; - error.level = YalpErrorLevel.ERROR_LEVEL_INFO; - err.value = error; - - sessions.remove(bye); - } - -/* - * get user list - * - * @param user list (out) - * @param error (out) - */ - public void getUser(UsersHolder list, YalpErrorHolder err) { - logger.debug("getUser()"); - YalpError error = new YalpError(); - error.code = YalpErrorCode.OK; - err = new YalpErrorHolder(error); - } - -/* - * change user details - * - * @param user - * @param password - * @param action (create, delete, alter) - * @param error (out) - */ - public void changeUser(YalpUser usr, String passwd, Action todo, - YalpErrorHolder err) { - logger.debug("changeUser()"); - YalpError error = new YalpError(); - error.code = YalpErrorCode.OK; - err = new YalpErrorHolder(error); - } - -/* - * alter media informations - * - * @param media to change - * @param action (update, delete, create) - * @param error (out) - */ - public void changeMedia( Media toChange, Action todo, YalpErrorHolder err ) { - logger.debug("changeMedia()"); - YalpError error = new YalpError(); - error.code = YalpErrorCode.OK; - err = new YalpErrorHolder(error); - } - -/* - * count yalp medias - * - * @param num (out) - * @param error (out) - */ - public void getNumOfMedias( IntHolder num, YalpErrorHolder err ) { - logger.debug("getNumOfMedias()"); - YalpError error = new YalpError(); - error.code = YalpErrorCode.OK; - err = new YalpErrorHolder(error); - } - -/* - * control yalp medias - * - * @param control description (inout) - * @param error (out) - */ - public void control( OutputHolder ctlOutput, YalpErrorHolder err ) { - logger.debug("control()"); - YalpError error = new YalpError(); - error.code = YalpErrorCode.OK; - error.descr = "streaming ;-)"; - error.msg = "nice isn't it"; - error.level = YalpErrorLevel.ERROR_LEVEL_INFO; - err.value = error; - - outputHandler.control(ctlOutput, err); - } - -/* - * search yalp media - * - * @param search string - * @param list of mediatypes - * @param result as list of medias (out) - */ - public void search( String str, MediaType[] types, MediasHolder result, - YalpErrorHolder err ) { - logger.debug("search()"); - YalpError error = new YalpError(); - inputHandler.search(str, types, result, err); - } - -/* - * register new output plugin - * - * @param plugin which should be registered - * @param error - */ - public void registerOutputPlugin( OutputPluginInterface itf, - PluginInfoHolder info, YalpErrorHolder err ) - { - logger.info("registering output plugin: " + info.value.name ); - - OutputPluginInterface outputItf; - - try { - outputItf = OutputPluginInterfaceHelper.narrow(itf); - } catch( Exception e ) { - e.printStackTrace(); - return; - } - - OutputPlugin newPlugin = new OutputPlugin(outputItf, info.value); - - PluginInfo inf = new PluginInfo(); - - if( newPlugin != null ) - inf = outputHandler.addPlugin( newPlugin ); - - info.value = inf; - plugin_infos.add( inf ); - - YalpError error = new YalpError(); - error.msg = "plugin registered"; - error.descr = ""; - error.code = YalpErrorCode.OK; - error.level = YalpErrorLevel.ERROR_LEVEL_INFO; - err.value = error; - } - -/* - * remove output plugin - * - * @param plugin which should be registered - * @param error - */ - public void removeOutputPlugin( PluginInfo itf, YalpErrorHolder err ) - { - logger.debug("removeOutputPlugin()"); - /* t.b.d. itf handling */ - YalpError error = new YalpError(); - error.code = YalpErrorCode.OK; - err = new YalpErrorHolder(error); - } - -/* - * get all registered output plugins - * - * @param plugin list - * @param error - */ - public void getOutputPlugins( PluginInfosHolder itfs, String name, - YalpErrorHolder err ) - { - logger.debug("getOutputPlugins()"); - /* t.b.d. itf handling */ - YalpError error = new YalpError(); - error.code = YalpErrorCode.OK; - err = new YalpErrorHolder(error); - } - -/* - * register new input plugin - * - * @param plugin which should be registered - * @param error - */ - public void registerInputPlugin( org.omg.CORBA.Object itf, - PluginInfoHolder info, YalpErrorHolder err ) - { - logger.info("registering input plugin: " + info.value.name ); - - InputPluginInterface inputItf; - - try { - inputItf = InputPluginInterfaceHelper.narrow(itf); - } catch( Exception e ) { - e.printStackTrace(); - return; - } - - InputPlugin newPlugin = new InputPlugin(inputItf, info.value); - - PluginInfo inf = new PluginInfo(); - - if( newPlugin != null ) - inf = inputHandler.addPlugin( newPlugin ); - - info.value = inf; - plugin_infos.add( inf ); - - YalpError error = new YalpError(); - error.msg = "plugin registered"; - error.descr = ""; - error.code = YalpErrorCode.OK; - error.level = YalpErrorLevel.ERROR_LEVEL_INFO; - err.value = error; - } - -/* - * remove input plugin - * - * @param plugin which should be registered - * @param error - */ - public void removeInputPlugin( PluginInfo itf, YalpErrorHolder err ) - { - logger.debug("removeInputPlugin()"); - /* t.b.d. itf handling */ - YalpError error = new YalpError(); - error.code = YalpErrorCode.OK; - err = new YalpErrorHolder(error); - } - -/* - * get all registered input plugins - * - * @param plugin list - * @param error - */ - public void getInputPlugins( PluginInfosHolder itfs, - String name, YalpErrorHolder err ) - { - logger.debug("getInputPlugins()"); - /* t.b.d. itf handling */ - YalpError error = new YalpError(); - error.code = YalpErrorCode.OK; - err = new YalpErrorHolder(error); - } - -/* - * register new auth plugin - * - * @param plugin which should be registered - * @param error - */ - public void registerAuthPlugin( org.omg.CORBA.Object itf, - PluginInfoHolder info, YalpErrorHolder err ) - { - logger.info("registering auth plugin: " + info.value.name ); - - AuthPluginInterface authItf; - - try { - authItf = AuthPluginInterfaceHelper.narrow(itf); - } catch( Exception e ) { - e.printStackTrace(); - return; - } - - AuthPlugin newPlugin = new AuthPlugin(authItf, info.value); - - PluginInfo inf = new PluginInfo(); - - if( newPlugin != null ) - inf = authHandler.addPlugin( newPlugin ); - - info.value = inf; - plugin_infos.add (inf); - - YalpError error = new YalpError(); - error.msg = "plugin registered"; - error.descr = ""; - error.code = YalpErrorCode.OK; - error.level = YalpErrorLevel.ERROR_LEVEL_INFO; - err.value = error; - } - -/* - * remove auth plugin - * - * @param plugin which should be registered - * @param error - */ - public void removeAuthPlugin( PluginInfo itf, - YalpErrorHolder err ) - { - logger.debug("removeAuthPlugin()"); - /* t.b.d. itf handling */ - YalpError error = new YalpError(); - error.code = YalpErrorCode.OK; - err = new YalpErrorHolder(error); - } - -/* - * get all registered auth plugins - * - * @param plugin list - * @param error - */ - public void getAuthPlugins( PluginInfosHolder itfs, - String name, YalpErrorHolder err ) - { - logger.debug("getAuthPlugins()"); - /* t.b.d. itf handling */ - YalpError error = new YalpError(); - error.code = YalpErrorCode.OK; - err = new YalpErrorHolder(error); - } - -/* - * to check if server is still ok - * - * @return Boolean true - if ok - */ - public void ping(YalpErrorHolder pong) { - logger.debug("ping()"); - YalpError err = new YalpError(); - err.descr = "PONG"; - err.msg = "huhu"; - err.level = YalpErrorLevel.ERROR_LEVEL_INFO; - err.code = YalpErrorCode.OK; - pong.value = err; - System.out.println("pong"); - } - -/* - * server shutdown - */ - public void serverShutdown() - { - logger.debug("server shutdown()"); - /* t.b.d. clear server shutdown */ - } -} +/*
+ * Copyright (c) 2006 Manuel Traut and Volker Dahnke
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors: Manuel Traut and Volker Dahnke
+ */
+
+package YalpServer;
+
+import YalpInterfaces.*;
+
+import java.net.*;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Properties;
+
+import org.omg.CosNaming.*;
+import org.omg.CosNaming.NamingContextPackage.*;
+import org.omg.CORBA.*;
+import org.omg.PortableServer.*;
+import org.omg.PortableServer.POA;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.PropertyConfigurator;
+
+/*
+ * Class ServerControlImpl
+ *
+ * <em>Implements functionality of the ServerControl Interface</em>
+ *
+ * @author Volker Dahnke / Manuel Traut
+ * @version 0.6 14-12-2005<br>
+ * @see client
+ */
+public class ServerControlImpl extends ServerControlInterfacePOA
+{
+ private ORB orb;
+
+ private InitServer srv;
+ private InputPluginHandler inputHandler;
+ private OutputPluginHandler outputHandler;
+ private AuthPluginHandler authHandler;
+
+ private ArrayList<Session> sessions;
+ private ArrayList<PluginInfo> plugin_infos;
+
+ private String log4jFile = "log4j_server.conf";
+
+ private static Logger logger =
+ Logger.getLogger("Yalp.Server.ServerControlImpl");
+
+public ServerControlImpl()
+{
+ this.sessions = new ArrayList<Session> ();
+ this.plugin_infos = new ArrayList<PluginInfo> ();
+
+ PropertyConfigurator.configureAndWatch(log4jFile);
+ logger.debug("ServerControlImpl()");
+}
+
+ public void setORB(ORB _orb)
+ {
+ logger.debug("setOrb()");
+ orb = _orb;
+ }
+
+ public void init(InitServer _srv)
+ {
+ logger.debug("init()");
+ srv = _srv;
+ inputHandler = srv.inputHandler;
+ outputHandler = srv.outputHandler;
+ authHandler = srv.authHandler;
+ }
+
+/*
+ * client logon
+ *
+ * @param userName
+ * @param password
+ * @param ipAdress
+ * @param session (out)
+ * @param error (out)
+ */
+ public void clientLogon( String name,
+ String password,
+ String ipAddress,
+ SessionHolder session,
+ YalpErrorHolder err )
+ {
+ logger.debug("clientLogon()");
+
+ YalpError error = new YalpError();
+ error.code = YalpErrorCode.OK;
+ error.descr = "authentication successfull";
+ error.msg = "nice isn't it";
+ error.level = YalpErrorLevel.ERROR_LEVEL_INFO;
+ err.value = error;
+
+ session.value = authHandler.logon(name, password, ipAddress, session, err);
+
+ ArrayList<PluginInfo> all_plugins = new ArrayList<PluginInfo>();
+
+ PluginInfo[] t = {};
+ session.value.availablePlugins = plugin_infos.toArray(t);
+ sessions.add(session.value);
+ }
+
+/*
+ * client logoff
+ *
+ * @param session
+ * @param error (out)
+ */
+ public void clientLogoff( Session bye, YalpErrorHolder err)
+ {
+ logger.debug("clientLogoff");
+
+ YalpError error = new YalpError();
+ error.code = YalpErrorCode.OK;
+ error.descr = "logged out";
+ error.msg = "sad isn't it";
+ error.level = YalpErrorLevel.ERROR_LEVEL_INFO;
+ err.value = error;
+
+ sessions.remove(bye);
+ }
+
+/*
+ * get user list
+ *
+ * @param user list (out)
+ * @param error (out)
+ */
+ public void getUser(UsersHolder list, YalpErrorHolder err) {
+ logger.debug("getUser()");
+ YalpError error = new YalpError();
+ error.code = YalpErrorCode.OK;
+ err = new YalpErrorHolder(error);
+ }
+
+/*
+ * change user details
+ *
+ * @param user
+ * @param password
+ * @param action (create, delete, alter)
+ * @param error (out)
+ */
+ public void changeUser(YalpUser usr, String passwd, Action todo,
+ YalpErrorHolder err) {
+ logger.debug("changeUser()");
+ YalpError error = new YalpError();
+ error.code = YalpErrorCode.OK;
+ err = new YalpErrorHolder(error);
+ }
+
+/*
+ * alter media informations
+ *
+ * @param media to change
+ * @param action (update, delete, create)
+ * @param error (out)
+ */
+ public void changeMedia( Media toChange, Action todo, YalpErrorHolder err ) {
+ logger.debug("changeMedia()");
+ YalpError error = new YalpError();
+ error.code = YalpErrorCode.OK;
+ err = new YalpErrorHolder(error);
+ }
+
+/*
+ * count yalp medias
+ *
+ * @param num (out)
+ * @param error (out)
+ */
+ public void getNumOfMedias( IntHolder num, YalpErrorHolder err ) {
+ logger.debug("getNumOfMedias()");
+ YalpError error = new YalpError();
+ error.code = YalpErrorCode.OK;
+ err = new YalpErrorHolder(error);
+ }
+
+/*
+ * control yalp medias
+ *
+ * @param control description (inout)
+ * @param error (out)
+ */
+ public void control( OutputHolder ctlOutput, YalpErrorHolder err ) {
+ logger.debug("control()");
+ YalpError error = new YalpError();
+ error.code = YalpErrorCode.OK;
+ error.descr = "streaming ;-)";
+ error.msg = "nice isn't it";
+ error.level = YalpErrorLevel.ERROR_LEVEL_INFO;
+ err.value = error;
+
+ outputHandler.control(ctlOutput, err);
+ }
+
+/*
+ * search yalp media
+ *
+ * @param search string
+ * @param list of mediatypes
+ * @param result as list of medias (out)
+ */
+ public void search( String str, MediaType[] types, MediasHolder result,
+ YalpErrorHolder err ) {
+ logger.debug("search()");
+ YalpError error = new YalpError();
+ inputHandler.search(str, types, result, err);
+ }
+
+/*
+ * register new output plugin
+ *
+ * @param plugin which should be registered
+ * @param error
+ */
+ public void registerOutputPlugin( OutputPluginInterface itf,
+ PluginInfoHolder info, YalpErrorHolder err )
+ {
+ logger.info("registering output plugin: " + info.value.name );
+
+ OutputPluginInterface outputItf;
+
+ try {
+ outputItf = OutputPluginInterfaceHelper.narrow(itf);
+ } catch( Exception e ) {
+ e.printStackTrace();
+ return;
+ }
+
+ OutputPlugin newPlugin = new OutputPlugin(outputItf, info.value);
+
+ PluginInfo inf = new PluginInfo();
+
+ if( newPlugin != null )
+ inf = outputHandler.addPlugin( newPlugin );
+
+ info.value = inf;
+ plugin_infos.add( inf );
+
+ YalpError error = new YalpError();
+ error.msg = "plugin registered";
+ error.descr = "";
+ error.code = YalpErrorCode.OK;
+ error.level = YalpErrorLevel.ERROR_LEVEL_INFO;
+ err.value = error;
+ }
+
+/*
+ * remove output plugin
+ *
+ * @param plugin which should be registered
+ * @param error
+ */
+ public void removeOutputPlugin( PluginInfo itf, YalpErrorHolder err )
+ {
+ logger.debug("removeOutputPlugin()");
+ /* t.b.d. itf handling */
+ YalpError error = new YalpError();
+ error.code = YalpErrorCode.OK;
+ err = new YalpErrorHolder(error);
+ }
+
+/*
+ * get all registered output plugins
+ *
+ * @param plugin list
+ * @param error
+ */
+ public void getOutputPlugins( PluginInfosHolder itfs, String name,
+ YalpErrorHolder err )
+ {
+ logger.debug("getOutputPlugins()");
+ /* t.b.d. itf handling */
+ YalpError error = new YalpError();
+ error.code = YalpErrorCode.OK;
+ err = new YalpErrorHolder(error);
+ }
+
+/*
+ * register new input plugin
+ *
+ * @param plugin which should be registered
+ * @param error
+ */
+ public void registerInputPlugin( org.omg.CORBA.Object itf,
+ PluginInfoHolder info, YalpErrorHolder err )
+ {
+ logger.info("registering input plugin: " + info.value.name );
+
+ InputPluginInterface inputItf;
+
+ try {
+ inputItf = InputPluginInterfaceHelper.narrow(itf);
+ } catch( Exception e ) {
+ e.printStackTrace();
+ return;
+ }
+
+ InputPlugin newPlugin = new InputPlugin(inputItf, info.value);
+
+ PluginInfo inf = new PluginInfo();
+
+ if( newPlugin != null )
+ inf = inputHandler.addPlugin( newPlugin );
+
+ info.value = inf;
+ plugin_infos.add( inf );
+
+ YalpError error = new YalpError();
+ error.msg = "plugin registered";
+ error.descr = "";
+ error.code = YalpErrorCode.OK;
+ error.level = YalpErrorLevel.ERROR_LEVEL_INFO;
+ err.value = error;
+ }
+
+/*
+ * remove input plugin
+ *
+ * @param plugin which should be registered
+ * @param error
+ */
+ public void removeInputPlugin( PluginInfo itf, YalpErrorHolder err )
+ {
+ logger.debug("removeInputPlugin()");
+ /* t.b.d. itf handling */
+ YalpError error = new YalpError();
+ error.code = YalpErrorCode.OK;
+ err = new YalpErrorHolder(error);
+ }
+
+/*
+ * get all registered input plugins
+ *
+ * @param plugin list
+ * @param error
+ */
+ public void getInputPlugins( PluginInfosHolder itfs,
+ String name, YalpErrorHolder err )
+ {
+ logger.debug("getInputPlugins()");
+ /* t.b.d. itf handling */
+ YalpError error = new YalpError();
+ error.code = YalpErrorCode.OK;
+ err = new YalpErrorHolder(error);
+ }
+
+/*
+ * register new auth plugin
+ *
+ * @param plugin which should be registered
+ * @param error
+ */
+ public void registerAuthPlugin( org.omg.CORBA.Object itf,
+ PluginInfoHolder info, YalpErrorHolder err )
+ {
+ logger.info("registering auth plugin: " + info.value.name );
+
+ AuthPluginInterface authItf;
+
+ try {
+ authItf = AuthPluginInterfaceHelper.narrow(itf);
+ } catch( Exception e ) {
+ e.printStackTrace();
+ return;
+ }
+
+ AuthPlugin newPlugin = new AuthPlugin(authItf, info.value);
+
+ PluginInfo inf = new PluginInfo();
+
+ if( newPlugin != null )
+ inf = authHandler.addPlugin( newPlugin );
+
+ info.value = inf;
+ plugin_infos.add (inf);
+
+ YalpError error = new YalpError();
+ error.msg = "plugin registered";
+ error.descr = "";
+ error.code = YalpErrorCode.OK;
+ error.level = YalpErrorLevel.ERROR_LEVEL_INFO;
+ err.value = error;
+ }
+
+/*
+ * remove auth plugin
+ *
+ * @param plugin which should be registered
+ * @param error
+ */
+ public void removeAuthPlugin( PluginInfo itf,
+ YalpErrorHolder err )
+ {
+ logger.debug("removeAuthPlugin()");
+ /* t.b.d. itf handling */
+ YalpError error = new YalpError();
+ error.code = YalpErrorCode.OK;
+ err = new YalpErrorHolder(error);
+ }
+
+/*
+ * get all registered auth plugins
+ *
+ * @param plugin list
+ * @param error
+ */
+ public void getAuthPlugins( PluginInfosHolder itfs,
+ String name, YalpErrorHolder err )
+ {
+ logger.debug("getAuthPlugins()");
+ /* t.b.d. itf handling */
+ YalpError error = new YalpError();
+ error.code = YalpErrorCode.OK;
+ err = new YalpErrorHolder(error);
+ }
+
+/*
+ * to check if server is still ok
+ *
+ * @return Boolean true - if ok
+ */
+ public void ping(YalpErrorHolder pong) {
+ logger.debug("ping()");
+ YalpError err = new YalpError();
+ err.descr = "PONG";
+ err.msg = "huhu";
+ err.level = YalpErrorLevel.ERROR_LEVEL_INFO;
+ err.code = YalpErrorCode.OK;
+ pong.value = err;
+ System.out.println("pong");
+ }
+
+/*
+ * server shutdown
+ */
+ public void serverShutdown()
+ {
+ logger.debug("server shutdown()");
+ /* t.b.d. clear server shutdown */
+ }
+}
diff --git a/src/YalpServer/ServerSettings.java b/src/YalpServer/ServerSettings.java index 3faaa37..313e875 100755 --- a/src/YalpServer/ServerSettings.java +++ b/src/YalpServer/ServerSettings.java @@ -1,68 +1,68 @@ -/* - * Copyright (c) 2006 Manuel Traut and Volker Dahnke - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: Manuel Traut and Volker Dahnke - */ - -package YalpServer; - -/* - * Class ServerSettings - * - * <em></em> - * - * @author Manuel Traut - * - * @version 0.1 27-03-2006<br> - * - * @see server.InitServer - */ - -public class ServerSettings{ - - static final long serialVersionUID = 0; - - public String imageDir = "/media/image"; - public String videoDir = "/media/video"; - public String soundDir = "/media/sound"; - - /** - * set Directories which contains media Files - * @param startDir - */ - public void setImageDir(String startDir){ - this.imageDir = startDir; - } - - /** - * set Directories which contains media Files - * @param startDir - */ - public void setVideoDir(String startDir){ - this.videoDir = startDir; - } - - /** - * set Directories which contains media Files - * @param startDir - */ - public void setSoundDir(String startDir){ - this.soundDir = startDir; - } - - public String getVideoDir(){ - return this.videoDir; - } - - public String getImageDir(){ - return this.imageDir; - } - - public String getSoundDir(){ - return this.soundDir; - } -} +/*
+ * Copyright (c) 2006 Manuel Traut and Volker Dahnke
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors: Manuel Traut and Volker Dahnke
+ */
+
+package YalpServer;
+
+/*
+ * Class ServerSettings
+ *
+ * <em></em>
+ *
+ * @author Manuel Traut
+ *
+ * @version 0.1 27-03-2006<br>
+ *
+ * @see server.InitServer
+ */
+
+public class ServerSettings{
+
+ static final long serialVersionUID = 0;
+
+ public String imageDir = "/media/image";
+ public String videoDir = "/media/video";
+ public String soundDir = "/media/sound";
+
+ /**
+ * set Directories which contains media Files
+ * @param startDir
+ */
+ public void setImageDir(String startDir){
+ this.imageDir = startDir;
+ }
+
+ /**
+ * set Directories which contains media Files
+ * @param startDir
+ */
+ public void setVideoDir(String startDir){
+ this.videoDir = startDir;
+ }
+
+ /**
+ * set Directories which contains media Files
+ * @param startDir
+ */
+ public void setSoundDir(String startDir){
+ this.soundDir = startDir;
+ }
+
+ public String getVideoDir(){
+ return this.videoDir;
+ }
+
+ public String getImageDir(){
+ return this.imageDir;
+ }
+
+ public String getSoundDir(){
+ return this.soundDir;
+ }
+}
diff --git a/src/YalpServer/YalpServer.java b/src/YalpServer/YalpServer.java index 8cf57d3..0ddbe00 100755 --- a/src/YalpServer/YalpServer.java +++ b/src/YalpServer/YalpServer.java @@ -1,40 +1,40 @@ -/* - * Copyright (c) 2006 Manuel Traut and Volker Dahnke - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Common Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html - * - * Contributors: Manuel Traut and Volker Dahnke - */ -package YalpServer; - -/* - * Class Server - * - * <em>static main method</em> - * - * @author Volker Dahnke / Manuel Traut - * - * @version 0.1 20-11-2005<br> - */ -public class YalpServer{ - -/* - * starts Server initialization - * - * @param argv - * arguments which are not used - */ - public static void main (String[] argv) { - try{ - System.setProperty("java.security.policy","server.policy"); - } catch (Exception e) {//DEBUG - System.out.println ("Server SecurityManagerExeptions not caught jet " + e); - System.exit(0); - } - InitServer yalpServer = new InitServer(argv); - return; - } - -} +/*
+ * Copyright (c) 2006 Manuel Traut and Volker Dahnke
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors: Manuel Traut and Volker Dahnke
+ */
+package YalpServer;
+
+/*
+ * Class Server
+ *
+ * <em>static main method</em>
+ *
+ * @author Volker Dahnke / Manuel Traut
+ *
+ * @version 0.1 20-11-2005<br>
+ */
+public class YalpServer{
+
+/*
+ * starts Server initialization
+ *
+ * @param argv
+ * arguments which are not used
+ */
+ public static void main (String[] argv) {
+ try{
+ System.setProperty("java.security.policy","server.policy");
+ } catch (Exception e) {//DEBUG
+ System.out.println ("Server SecurityManagerExeptions not caught jet " + e);
+ System.exit(0);
+ }
+ InitServer yalpServer = new InitServer(argv);
+ return;
+ }
+
+}
diff --git a/start.bat b/start.bat new file mode 100644 index 0000000..461ae5b --- /dev/null +++ b/start.bat @@ -0,0 +1 @@ +java -Djava.net.preferIPv4Stack=true -Dswt.library.path=d:\test\yalp\lib\win-swt.jar -Dorg.omg.CORBA.ORBInitialHost=127.0.0.1 -Djava.library.path=D:\test\yalp\lib -jar %1 -ORBInitialPort 1050 -ORBInitialHost 127.0.0.1 -ORBDottedDecimalAddresses 1 diff --git a/winidlj.bat b/winidlj.bat new file mode 100644 index 0000000..a8c92b4 --- /dev/null +++ b/winidlj.bat @@ -0,0 +1,3 @@ +echo %0 %1 %2 %3
+idlj -fall %1
+echo bi ba butzemann
\ No newline at end of file diff --git a/yalp.sql b/yalp.sql Binary files differnew file mode 100644 index 0000000..34ae666 --- /dev/null +++ b/yalp.sql |
